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

How can I change the bullet position when the user zooms or drags the stock chart? #1612

Closed
shishima123 opened this issue Jul 12, 2024 · 4 comments

Comments

@shishima123
Copy link

Hello

I want to add a feature that signals the highest and lowest prices.
It worked when I manually added it using the addBullet function.

However, I want the chart to automatically change the position and text on the bullet based on the candlesticks displayed on the chart when the user zooms or drags.

I tried the following method, but it didn't work.

valueSeries.columns.template.on('userData', function() {
  console.log('userData trigger')
  addBullet()
})

Can you give me some advice?

My JSFiddle

@martynasma
Copy link
Collaborator

If you need to change something on chart zoom, you may need to use events on your X axis:

dateAxis.onPrivate("selectionMinFinal", function(min) {
  console.log(new Date(min));
});

dateAxis.onPrivate("selectionMaxFinal", function(max) {
  console.log(new Date(max));
});

@shishima123
Copy link
Author

Thanks @martynasma

Your sample code worked in the case of zoom
However, it doesn't work when I drag the candlestick chart to the left or right
For example, I want to drag to the left to see past data

Do you have any advice for this?

@martynasma
Copy link
Collaborator

Try using selectionMin and selectionMax instead.

Copy link

This issue is stale because it has been open 30 days with no activity. It will be closed in 5 days unless a new comment is added.

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

No branches or pull requests

2 participants