Click anywhere on chart, not just data items
See original GitHub issueI’m trying to implement a feature where the user can click anywhere on the chart to add kind of annotations, however C3 only recognises click events on data points. Setting data.selection.grouped = true
as suggested elsewhere makes it partly work, however the onclick
event callback is then called once per data item, and still only works for the data items themselves.
What i’m after is a way of recognising a click anywhere, so I am then able to calculate what the X value should be based on the x-axis’ scale and use it elsewhere. Is there any way I can do this?
Issue Analytics
- State:
- Created 9 years ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
Click event of stacked line chart not working
On click of chart, the chart method getElementsAtEvent() is returning empty array. On the click event function, I need the x-axis data points....
Read more >Change the data series in a chart - Microsoft Support
Right-click your chart, and then choose Select Data. Select Data Source dialog box. In the Legend Entries (Series) box, click the series you...
Read more >Interactions - Chart.js
For example, to have the chart only respond to click events, you could do: ... data: data, options: { // This chart will...
Read more >Charts as the source of actions—ArcGIS Dashboards
Clicking anywhere that does not represent a data point on a chart clears the selection. When a chart is showing continuous categories, such...
Read more >Event handlers in JavaScript - Plotly
Unlike plotly_click , a plotly_doubleclick is registered upon clicking anywhere on the graph (not just data points), therefore, plotly_doubleclick does not ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Ah so it does! Initially this wasn’t working as I expected, calling
chart.internal.x(xCoord)
returned-2031062
but callingchart.internal.x.invert(xCoord)
instead works as expected 😃 Thanks for all the helpI’m using this method on a Stacked Area Graph, and I got it working. I can tell which X-axis value is being clicked on, but I don’t know how to tell which vertical area of the graph is being clicked on.