Hello,
I'm trying to draw ErrorBars for a standard deviation function I was given on a Chart of type Line which displays averages.
I have the following model bound to the chart control
public class ChartDataModel
{
public string GroupValuesName {get;set;}
public List<double> Values {get;set;}
public double Average {get;set;}
public double StandardDeviation {get;set;}
}
I'm calculating the standard deviation which is a double in the following manner:
var model = new ChartDataModel();
model.GroupValuesName = "GroupName";
model.Values = GetValues();
model.Average = model.Values.Average();
var count = model.Values.Count();
var sum = model.Values.Sum(value => (value - model.Average) * (value - model.Average));
model.StandardDeviation = Math.Sqrt(sum/count);
I want to show the standard deviation double value as the VerticalNegativeErrorValue and VerticalPositiveErrorValue of the ErrorBar in my chart line series.
I'm passing the data to the chart on the c# server side.
All the examples in the documentation show how to bind the server side model to the Chart control and set the series XName and YName values, where the YName in my situation would be the Average property of my data model.
What type should my series be and how would I draw my double model.StandardDeviation properties as the Positive and Negative Error value of the ErrorBar?