amcharts / amcharts5

The newest, fastest, and most advanced amCharts charting library for JavaScript and TypeScript apps.
Other
353 stars 95 forks source link

How to change the legend and setting modal of custom indicator #1738

Closed p3777dev closed 1 month ago

p3777dev commented 1 month ago

I am using the custom indicator feature to create my custom indicators. But I got an issue that I am not able to change the legend and setting modal name of the custom indicator .

Note : I am creating the custom indicator by extending the class of the pre-Existing indicators.

I am able to change the legend and setting modal name if I create the indicator using the am5stock.Indicator . By adding in the _afterNew() method.

https://codepen.io/prince-work/pen/JjgjBMZ

martynasma commented 1 month ago

I am able to change the legend and setting modal name if I create the indicator using the am5stock.Indicator . By adding in the _afterNew() method.

I don't see any issues with this approach, if it works for you.

p3777dev commented 1 month ago

@martynasma As you can see in the image the modal color changed but the legend didn't changed . image

You can check the codepen too.

martynasma commented 1 month ago

Do you mean that there is no colored marker in the legend?

workingbuddy10 commented 1 month ago

No @martynasma , You can see in the custom indicator legend is showing MA ( ideally it should have shown My Indicator) .

workingbuddy10 commented 1 month ago

the custom indicator modal is showing correct info as My Indicator Whereas the custom indicator legend was showing the inherited class name only.

martynasma commented 1 month ago

@workingbuddy10 are you working with @p3777dev?

Can I assume this is @p3777dev reply?

martynasma commented 1 month ago

No @martynasma , You can see in the custom indicator legend is showing MA ( ideally it should have shown My Indicator) .

Legend uses indicator's shortName by default. You can specify it just like name:

this._setDefault("name", "My Indicator");
this._setDefault("shortName", "My Indicator");
workingbuddy10 commented 1 month ago

This worked!

workingbuddy10 commented 1 month ago

But this doesn't works in the case of Volume profile indicator. @martynasma https://codepen.io/Ansh-m-the-reactor/pen/xxvGXNO?editors=0010

martynasma commented 1 month ago

We'll fix that in the next version. Thanks.

martynasma commented 1 month ago

Fixed in 5.10.6.

[5.10.6] - 2024-10-11

Added

Changed

Fixed

Full change log.

Download options.

Make sure you clear your browser cache after upgrading. And feel free to contact us again if you are still experiencing this issue.