How to show or hide zooming toolbar items in React Chart?
This article explains how to show or hide zooming toolbar items in the React Chart.
Customize to show or hide zooming toolbar items
You can easily customize the toolbar items to show at the initial load by setting the showToolbar property to true. By default, it is set to false, hiding the toolbar items.
In the following code example, the toolbar items are set to show at the initial load.
Index.js
import { createRoot } from 'react-dom/client';
import * as React from 'react';
import { ChartComponent, SeriesCollectionDirective, SeriesDirective, Inject, AreaSeries, DateTime, Zoom, Selection
} from '@syncfusion/ej2-react-charts';
const Performance = () => {
return (
<ChartComponent
id="charts"
primaryXAxis={{
intervalType: 'Years',
valueType: 'DateTime'
}}
primaryYAxis={{
interval: 2000,
minimum: 0,
maximum: 12000
}}
zoomSettings={{
enableSelectionZooming: true,
toolbarItems: ['Zoom', 'Pan', 'Reset'],
showToolbar: true
}}
>
<Inject services={[AreaSeries, DateTime, Zoom, Selection]} />
<SeriesCollectionDirective>
<SeriesDirective type="Area" />
</SeriesCollectionDirective>
</ChartComponent>
);
};
export default Performance;
const root = createRoot(document.getElementById('sample'));
root.render(<Performance />);
The following screenshot portrays the results of the code snippet mentioned above.
Screenshot:
Conclusion
I hope you enjoyed learning how to show or hide zooming toolbar items in the React Chart Component.
You can refer to our React Chart feature tour page to know about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications. 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, support portal, or feedback portal. We are always happy to assist you!