echarts-for-react icon indicating copy to clipboard operation
echarts-for-react copied to clipboard

Allow setting `id` and `data-testid`

Open joshkel opened this issue 2 years ago • 1 comments

To facilitate testing and better integrate into the DOM, it would be helpful to be able to pass standard HTML div attributes such as id, as well as HTML5 data attributes such as the data-testid attribute used by React Testing Library, to the ReactECharts component and have them appear on the <div>.

joshkel avatar May 27 '23 22:05 joshkel

I just found a walkaround. You can refer to it before the official resolution of this.

<ReactEChartsCore
  //  ....
  onChartReady={(chart): void => {
    chart._dom.dataset.testid = 'test';
  }}
/>

ronny1020 avatar Nov 23 '23 07:11 ronny1020