How to format the trackball labels in React Chart Component?
This article explains how to format the trackball labels in the React Chart.
Customize the format of the trackball label
You can easily customize the format of the trackball label by using format property.
By default, the tooltip shows information about the x and y values in points.
Index.js
import { createRoot } from 'react-dom/client';
import * as React from 'react';
import { ChartComponent, SeriesCollectionDirective, SeriesDirective, Inject, LineSeries, DateTime, Tooltip,
Crosshair, Legend, Highlight } from '@syncfusion/ej2-react-charts';
const TrackballChart = () => {
return (
<ChartComponent
id="charts"
tooltip={{ enable: true, shared: true, format: '${point.y}.00' }}
crosshair={{ enable: true, lineType: 'Vertical' }}
>
<Inject
services={[ LineSeries, DateTime, Tooltip, Crosshair, Legend, Highlight ]}
/>
<SeriesCollectionDirective>
<SeriesDirective
dataSource={john}
xName="x"
yName="y"
type="Line"
/>
<SeriesDirective
dataSource={andrew}
xName="x"
yName="y"
type="Line"
/>
<SeriesDirective
dataSource={thomas}
xName="x"
yName="y"
type="Line"
/>
</SeriesCollectionDirective>
</ChartComponent>
);
};
export default TrackballChart;
const root = createRoot(document.getElementById('sample'));
root.render(<TrackballChart />);
The following screenshot illustrate the output of the above code snippet.
Screenshot:
Conclusion
We hope you enjoyed learning about how to format the trackball labels in the React Chart Component.
You can refer to our React Chart feature tour page to learn about its other groundbreaking feature representations and documentation for configuration specifications and how to quickly get started. You can also explore our React Chart example to understand how to create and manipulate data.
For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.
If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forums, BoldDesk Support, or feedback portal. We are always happy to assist you!