Articles in this section
Category / Section

How to change the color of axis elements in React Chart?

2 mins read

This article explains how to change the color of axis elements in the React Chart.

Customize the color of axis elements

You can easily customize width, color, size and dashArray of major grid lines, minor grid lines, major tick lines, minor tick lines, axis line and axis label,

In the following code example, the axis elements appearance changed.

Index.js

import { createRoot } from 'react-dom/client';
import * as React from 'react';
import { ChartComponent, SeriesCollectionDirective, SeriesDirective, Inject, BubbleSeries, Category
   } from '@syncfusion/ej2-react-charts';

const Spline = () => {
 return (
       <chartcomponent id="charts" primaryxaxis="{{" valuetype:="" 'category',="" edgelabelplacement:="" 'shift',="" minorticksperinterval:="" 3,="" majorgridlines:="" {="" color:="" 'blue',="" width:="" 2="" },="" minorgridlines:="" 0="" minorticklines:="" majorticklines:="" linestyle:="" labelstyle:="" 'blue'="" }="" }}="" primaryyaxis="{{" title:="" 'million="" metric="" tons',="" rangepadding:="" 'none',="" minimum:="" 20,="" maximum:="" 80,="" interval:="" 5,="" title="Crude Steel Production Annual Growth">
         <inject services="{[BubbleSeries," category]}="">
         <seriescollectiondirective>
           <seriesdirective datasource="{data1}" xname="x" yname="y" width="{4}" type="Bubble" size="size" minradius="{3}" maxradius="{10}" pointcolormapping="color"></seriesdirective>
         </seriescollectiondirective>
       </inject></chartcomponent>
 );
};
export default Spline;

const root = createRoot(document.getElementById('sample'));
root.render(<spline>);

The following screenshot illustrate the output of the above code snippet.

Screenshot:

React chart axis elements customization

View Sample in Stackblitz

Conclusion

I hope you enjoyed learning how to change the color of axis elements 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,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!

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please  to leave a comment
Access denied
Access denied