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

Boost module - Data labels formatter #4829

Closed
hkostia opened this issue Dec 11, 2015 · 10 comments
Closed

Boost module - Data labels formatter #4829

hkostia opened this issue Dec 11, 2015 · 10 comments
Labels
Status: Stale This issue hasn't had any activity for a while, and will be auto-closed if no further updates occur.

Comments

@hkostia
Copy link

hkostia commented Dec 11, 2015

Would it be possible to use dataLabels formatter with boost module? At the moment dataLabels formatter isn't called when boost module kicks in.

http://jsfiddle.net/2hw9t3Lo/

My real world use case would be to add/show few dataLabels per serie.

@pawelfus
Copy link
Contributor

How about using a bit different approach? I mean using two series: one with all points except points with dataLabels, and second series with points which should have labels. Second series can be connected to the first one using linkedTo option.

Something like this: http://jsfiddle.net/2hw9t3Lo/1/

@hkostia
Copy link
Author

hkostia commented Dec 14, 2015

That might do. There's also extra requirements that

  1. When the chart is zoomed the dataLabels most likely change
  2. Labels are using custom HTML

@pawelfus
Copy link
Contributor

Sure, then:

  1. How do you determine which dataLabel will show up? Some data comes from backend? In that case, I would try to use setData()
  2. I don't think that is a problem - simply use formatter, as right now

@hkostia
Copy link
Author

hkostia commented Dec 14, 2015

Currently, it's the first visible data point that should have the dataLabel shown. The logic for that was used inside formatter (it works without the boost module). I'll experiment with the additional serie + setData on zoom workaround.

Thanks!

@hkostia
Copy link
Author

hkostia commented Dec 16, 2015

Is it possible to get calculated axis min and max values after setExtremes before redraw has happened as afterSetExtremes happens after redraw?
eg.
setExtremes
=> do something after new min and max are in place but before redraw
redraw

@pawelfus
Copy link
Contributor

Hmm.. why not using afterSetExtremes? I mean something like this: http://jsfiddle.net/2hw9t3Lo/1/

@hkostia
Copy link
Author

hkostia commented Dec 17, 2015

I tried using it but it seems to happen after redraw which would mean that there will be second redraw to get stuff visible done in afterSetExtremes and that's not acceptable.

Is that the wrong fiddle, couldn't find afterSetExtremes there? The specs for my need are now more clear: the point where the dataLabel should be shown isn't always the same point it was in line series. It should be always be at the edge of the chart (left, top or bottom) where line serie is visible the first time.

@pawelfus
Copy link
Contributor

I'm sorry, jsFiddle is buggy after the update and sometimes (?) doesn't save changes. Here is the example I wanted to show: http://jsfiddle.net/4wafgLm4/

I understand that second redraw may be unacceptable, but since you will be using the same points, it won't change extremes on x/yAxis, so it will only redraw second series (Highcharts core is smart enough to redraw only these parts which changed) - which is exactly what needs to be done. In my opinion it would be faster to update a couple of points, then loop over all existing points and find which one should be displaying the label?

And to answer: you can use setExtremes which is called before redraw event. Unfortunately, there is no event beforeRedraw which would be useful in this case.

Just to be on the same page: I'm trying to find some workaround for your case, because I'm not convinced if dataLabels should be possible in the series on the canvas.

And the best solution for your case would be to use renderer and render that labels using text() method - it won't affect performance in any way and won't be the workaround like setData(). Something like this: http://jsfiddle.net/34yLzx32/

@hkostia
Copy link
Author

hkostia commented Dec 17, 2015

Using renderer.label with useHTML as true was absolutely the way to go. It works nicely now. Thanks a lot!

@stale
Copy link

stale bot commented Jun 16, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions!

@stale stale bot added the Status: Stale This issue hasn't had any activity for a while, and will be auto-closed if no further updates occur. label Jun 16, 2019
@stale stale bot closed this as completed Jun 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Stale This issue hasn't had any activity for a while, and will be auto-closed if no further updates occur.
Projects
None yet
Development

No branches or pull requests

2 participants