amcharts / amcharts5

The newest, fastest, and most advanced amCharts charting library for JavaScript and TypeScript apps.
324 stars 90 forks source link

How to Identify what is plotted on chart? (Company, Indicator, Compare Company) #578

Closed mukeshbadgujar closed 1 year ago

mukeshbadgujar commented 1 year ago

I am using StockChart,

I want to identify what is plotted on chart? means i have List of Indicators Control, Comparison Control, Drawing Tools etc. after they plotted on chart or panel, i can see them with am5.array.

am5.array.each(dateAxis.series, function(series) {
  console.log(series)
  console.log(series._settings)
  console.log(series._settings.name)
  console.log(series.className)                                           
})

Output:

For Company:

t {uid: 2364, _settings: {…}, _privateSettings: {…}, _settingEvents: {…}, _privateSettingEvents: {…}, …}
{name: 'Tata Consumer Products Ltd | NSE', clustered: false, valueXField: 'DATE', valueYField: 'CLOSE', highValueYField: 'HIGH', …}
Tata Consumer Products Ltd | NSE
CandlestickSeries

Note: If Series Type is Line then it gives LineSeries (which is also seen in Indicator)
------------------------------------------------------------------
For Indicator:

t {uid: 5882, _settings: {…}, _privateSettings: {…}, _settingEvents: {…}, _privateSettingEvents: {…}, …}
{valueXField: 'valueX', valueYField: 'ma', groupDataDisabled: true, calculateAggregates: true, xAxis: t, …}
MA
LineSeries
-------------------------------------------------------------------
For Drawing Tools:

t {uid: 1856, _settings: {…}, _privateSettings: {…}, _settingEvents: {…}, _privateSettingEvents: {…}, …}
{xAxis: t, yAxis: t, themeTags: Array(2), valueYField: 'valueY', valueXField: 'valueX', …}
undefined
DoodleSeries

with above array i got all the LineSeries, Candlesticks, and Drawing Tools etc. but i need to identify which array element is belongs to which control.

means in array- which element is company ? which element is indicator? etc.

or if there is any other way to identify, please let me know.

Thanks...

martynasma commented 1 year ago

You can identify drawing series by checking for "drawing" theme tag:

if (series.hasTag("drawing")) {
  // it's a drawing series
}

We will add the same for indicator series in the next version. Will let you know when it's released.

martynasma commented 1 year ago

Implemented in 5.2.20.

[5.2.20] - 2022-09-05

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.