amcharts5
amcharts5 copied to clipboard
how to access bullets property of a series?
I'm trying to access the bullets property of a series, in order to change the style of a single bullet on my plot.
At the moment I attempted, unsuccessfully, like this:
series.events.once("datavalidated", function(ev) { console.log(series.dataItems[0].bullets) });
This logs undefined even if, when inspecting series.dataItems[0]
, bullets property is there.
Any suggestion? thanks
Bullets are created at a later stage than data is validated.
If you need to modify a bullet when it is created, why not do that in bullet creation function itself?
you're right, but how can I know what bullet is being created when I execute series.bullets.push
?
You push a function, which is executed whenever a bullet is created. It receives a target data item as third parameter, which you can use for whatever customization you need to do. E.g.:
https://www.amcharts.com/docs/v5/concepts/common-elements/bullets/#selectively-displaying-bullets
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.