How to increase or decrease the width of the Column series?
This article explains how to increase or decrease the width of the column series in React Chart.
Customize the width of the column series
You can use the columnWidth property to adjust the width of a specific column series, and it accepts values ranging from 0 to 1.
In the following code example, the column width is set to 0.4.
Index.js
import { createRoot } from 'react-dom/client';
import * as React from 'react';
import { ChartComponent, SeriesCollectionDirective, SeriesDirective, Inject, ColumnSeries, Category, Legend
} from '@syncfusion/ej2-react-charts';
const Column = () => {
return (
<ChartComponent
id="charts"
primaryXAxis={{
valueType: 'Category'
}}
primaryYAxis={{
labelFormat: '{value}%',
title: 'GDP (In Percentage)'
}}
title="GDP by Country in 2017"
>
<Inject services={[ColumnSeries, Category, Legend]} />
<SeriesCollectionDirective>
<SeriesDirective
dataSource={data1}
xName="x"
yName="y"
type="Column"
name="Country"
/>
<SeriesDirective
dataSource={data2}
xName="x"
yName="y"
type="Column"
columnWidth={0.4}
name="GDP"
/>
</SeriesCollectionDirective>
</ChartComponent>
);
};
export default Column;
const root = createRoot(document.getElementById('sample'));
root.render(<Column />);
The following screenshots illustrate the output of the above code snippet.
Screenshot:
Conclusion
I hope you enjoyed learning how to increase or decrease in the width of the column series in 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!