Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chart specific possible accessibilities #1667

Closed
SanjayStratforge opened this issue Aug 12, 2024 · 8 comments
Closed

Chart specific possible accessibilities #1667

SanjayStratforge opened this issue Aug 12, 2024 · 8 comments
Labels

Comments

@SanjayStratforge
Copy link

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
Copy link
Collaborator

Area & Line - No right click event. How do I get the value from that data point? even I couldn't get the tooltip content.

LineSerries does not have individual elements to add click events on.

You might need to consider adding bullets. They can be transparent if you don't want them displayed.

https://www.amcharts.com/docs/v5/concepts/common-elements/bullets/

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.

Please make sure you add events on a series item, e.g.:

columnSeries.columns.template.events.on("click", function(ev) {
  console.log(ev.target.dataItem);
});

pieSeries.slices.template.events.on("click", function(ev) {
  console.log(ev.target.dataItem);
});

@SanjayStratforge
Copy link
Author

I tried this approach already for pieSeries but the event isn't captured by the listener.
columnSeries.events.on("rightclick", function (event: any) {
console.log("Column event ->", event;
});

Only this is capturing my event. That too doesn't hold it's parent.

@martynasma
Copy link
Collaborator

As per my previous reply, you need to add those events column templates, rather than series directly:

columnSeries.columns.template.events.on("rightclick", function (event: any) {
  console.log("Column event ->", event);
});

@SanjayStratforge
Copy link
Author

SanjayStratforge commented Aug 13, 2024

It doesn't work. Following is the code:

columnSeries.columns.template.events.on("rightclick", function (event: any) {
        console.log("Event =>", event);
});

Also not able to get the parent slice data.

PieSeries:

pieSeries.slices.template.events.on("rightclick", function (event: any) {
console.log("Event =>", event);
});

The event listener is not getting it.

@martynasma
Copy link
Collaborator

The code is good. Make sure the events are created before data is set on series.

@SanjayStratforge
Copy link
Author

Checked. Not resolved yet.

@martynasma
Copy link
Collaborator

Can you post your chart on CodePen?

@SanjayStratforge
Copy link
Author

Thank you @martynasma,

#1667 (comment)

I was able to find an alternate for the above mentioned.

Few things I couldn't get was for the line series which is using bullets for getting events, for sunburst and radar chart, we'll have a separate discussion since this gets more chart specific and cluttered over here.

I'll try proceeding with bullets for line series. We might close this issue for now.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants