amcharts / amcharts5

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

Data point possible accessibilities #1661

Closed SanjayStratforge closed 1 month ago

SanjayStratforge commented 1 month ago

How to find whether I have clicked on the data point or the out space other than data point or on the free area?

martynasma commented 1 month ago

What type of chart/series is it?

workingbuddy10 commented 1 month ago

Maybe @SanjayStratforge this can help you : https://www.amcharts.com/docs/v5/reference/sprite/#Events

SanjayStratforge commented 1 month ago

What type of chart/series is it?

I tried with Column chart

martynasma commented 1 month ago

You can add click events to both columns and charts plot container, then check whether column click did not occur before invoking outside click code:

var skipNextOutsideClick = false;

series.columns.template.events.on("click", function(ev) {
  console.log("clicked inside");
  skipNextOutsideClick = true;
});

chart.plotContainer.events.on("click", function(ev) {
  if (skipNextOutsideClick) {
    skipNextOutsideClick = false;
    return;
  }
  console.log("clicked outside");
})

Example: https://codepen.io/team/amcharts/pen/abgyQVQ/d8ef0da17b608a617fe323b937286ca1?editors=0010

SanjayStratforge commented 1 month ago

For the below listed charts, I am facing some difficulties also I don't know whether it is possible or not. I need to know whether these charts have possibilities that I expect.

Charts Area & Line - No right click event. How do I get the value from that data point? even I couldn't get the tooltip content. Combo - I could get the data of column but I couldn't get value of line from a data point. Stacked - I am able to get only the whole column value and not the split value. Sunburst & Radar - I was not able to get the desired data. Pie of pie & Pie of bar - I was not able to get the parent series of the sub series.

So, help me out folks!

martynasma commented 1 month ago

Let's keep this place clutter-free, both for our own sake and the other's. If you have other questions, not directly related to original topic, please post a separate issue.