I have a .net program that lets the user select a chart from a dropdown and a data range then queries sql for the data to display the chart, everything is fine unless they pick a date range that would only return 1 value for that particular chart.
When this happens since there is only 1 point on the graph it does not display anything for line or area charts (it does work on bar and column).
i have thought about forcing the graph type to column if there is only 1 data point but was wondering if there was a setting i am missing that would allow a straight line on a line graph if there was only 1 datapoint.
well based on the idea of faking a 2nd point i came up with this that technically does what i want it to do.
this is called when there is only 1 point
foreach (Series ser in mainChart.Series)
{
ser.Points.AddY(ser.Points[0].YValues[0]);
}
I thought i might should add in case anyone else needs this that the code above needs to be after the chart has been DataBound (had .DataBind() called).