amcharts5 icon indicating copy to clipboard operation
amcharts5 copied to clipboard

how to access bullets property of a series?

Open franz-86 opened this issue 1 year ago • 3 comments

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

franz-86 avatar Jul 29 '22 13:07 franz-86

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?

martynasma avatar Jul 29 '22 13:07 martynasma

you're right, but how can I know what bullet is being created when I execute series.bullets.push ?

franz-86 avatar Jul 29 '22 14:07 franz-86

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

martynasma avatar Jul 29 '22 14:07 martynasma

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.

github-actions[bot] avatar Aug 29 '22 00:08 github-actions[bot]