The Problem: You’re creating a line or area chart using the Microsoft Charting components (the ones in System.Web.UI.DataVisualization.Charting, not System.Web.Helpers) and for whatever reason the first entry is actually in the second quadrant, like so:
The Cause: The charting components assume you want to show some sort of contrast for the first value, but it just doesn’t look right in this case.
The Solution: Set your minimum value to 1 instead of zero (zero is the default), like so
myChart.ChartAreas.AxisX.Minimum = 1;
The chart will now be pushed flush left, for a much better appearance. You will see something like the chart below.
This post originally appeared on the Stronico blog – with the absorption of Stronico into Digital Tool Factory this post has been moved to the Digital Tool Factory blog
||Written By Steve French|
Leave a Reply