How to render a blank bar and average line in React Column Charts?
Description
This article shows how to render a blank bar and average line in React Column Charts.
Solution
To render blank bars in React Column charts, you can set the color property to transparent in the dataSource of the chart. Then, map that property to the pointColorMapping property in the series of the chart.
To render an average vertical line, you can set the stripline for the y-axis by specifying the start and end properties in the stripLines of the axis.
Code Snippet
primaryYAxis={{
labelFormat: '{value}%',
edgeLabelPlacement: 'Shift',
majorTickLines: { width: 0 },
lineStyle: { width: 0 },
stripLines: [
{
start: 1,
size: 3, sizeType: 'Pixel', dashArray: "10,5", visible: true,
color: '#69924e',
},
],
}}
<SeriesCollectionDirective>
<SeriesDirective pointColorMapping= 'color'>
</SeriesDirective>
</SeriesCollectionDirective>
The following image illustrates the output of the above code.
Conclusion
I hope you enjoyed learning how to render a blank bar and average line in React Column Charts.
You can refer to our React Charts feature tour page to learn about its other features and documentation, and how to quickly get started for configuration specifications. You can also explore our React Charts example to understand how to create and visualize 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 comment section below. You can also contact us through our support forums, support portal, or feedback portal. We are always happy to assist you!