Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add method priceLines in ISeriesAPI #1729

Closed
wants to merge 1 commit into from

Conversation

signatenkov
Copy link
Contributor

Type of PR: enchantment
PR checklist:

Overview of change:

Adds new method priceLines() to ISeriesApi interface

@signatenkov signatenkov self-assigned this Nov 18, 2024
@signatenkov signatenkov marked this pull request as ready for review November 18, 2024 10:49
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we rather create a new test case?

You can use this test-case as a starting point, and then instead of removing the price lines rather use the returned IPriceLine to modify the existing price lines so there is a visual difference on the chart.

return new Promise(resolve => {
	setTimeout(() => {
		const [line1, line2] = series.priceLines();
		series.removePriceLine(line1); // still check it can be removed
		line2.applyOptions({
			price: 15,
			color: 'red',
		});
		resolve();
	}, 1000);
});

Additionally, it might be good to check that the array is a copy and if modified then it won't break anything:

// create 3 price lines...
return new Promise(resolve => {
	setTimeout(() => {
		const priceLines = series.priceLines();
		const [line1, line2, line3] = priceLines;

		priceLines.splice(2,1); // remove line 3 from array, however line3 should still be visible on the chart

		series.removePriceLine(); // still check it can be removed
		line2.applyOptions({
			price: 15,
			color: 'red',
		});
		resolve();
	}, 1000);
});

@signatenkov
Copy link
Contributor Author

#1739

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature: Get priceLines from ISeriesAPI
2 participants