Skip to content

[charts] LinePlot onItemClick should provide dataIndex property #12840

Description

@dmytro-shchurov

Summary

When the composition is used, then LinePlot onItemClick callback does not have dataIndex property provided. At the same time ChartContainer does not receive any events, so it's impossible to handle onAxisClick event as well.

Examples

<ResponsiveChartContainer 
  ...
  onAreaClick // is never triggered
  onLineClick // is never triggered
  onMarkClick // is never triggered
  onAxisClick // is never triggered

>
  <LinePlot onItemClick={(_, { seriesId, dataIndex <- is always undefined })} .. />
  ...
</ResponsiveChartContainer>

Motivation

For relatively small number of points, to have MarkPlot child component is to have some disadvantages like a significant drop in a performance (for already 150 marks which is not a really huge number), and mark circles everywhere which are not configurable.

Together with missing a click event handler for ChartsXAxis component, and a silent onAxisClick and onItemClick in a container, a silent LineHighlightPlot, ChartsAxisHighlight and ChartsTooltip which could theoretically give a chance to keep a highlighted data point in a state, that causes big problems in determine a data point under a cursor when is clicked.

Consider pls a possibility to return the dataIndex property from LinePlot onItemClick event in case user clicks not on a line itself but on a data point (with some tolerance). I understand that LinePlot responsibility is only about a connecting line, but what can I do if there are NO other ways to get a data point index?..

As an option pls consider firing onItemClick event in ChartContainer even when a composition is used.

Search keywords: charts, onItemClick, ChartContainer, LinePlot

Metadata

Metadata

Assignees

Labels

scope: chartsChanges related to the charts.type: bugIt doesn't behave as expected.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions