public void UpdateGraph()
{
GraphPane pane = zedGraphControl.GraphPane;
pane.CurveList.Clear();
if (Cumulative)
{
// Set the titles and axis labels
pane.Title.Text = "Distribution";
pane.XAxis.Title.IsVisible = true;
pane.YAxis.Title.IsVisible = true;
// Add points for distribution
var list = new PointPairList();
foreach (var component in source)
list.Add(component.Index, component.CumulativeProportion);
// Add a single curve
LineItem curve = pane.AddCurve("label", list, Color.Red, SymbolType.Circle);
curve.Line.Width = 2.0F;
curve.Line.IsAntiAlias = true;
curve.Symbol.Fill = new Fill(Color.White);
curve.Symbol.Size = 7;
}
else
{
// Set the titles and axis labels
pane.Title.Text = "Component proportion";
pane.XAxis.Title.IsVisible = false;
pane.YAxis.Title.IsVisible = false;
// Add pie slices for shares
foreach (var component in source)
{
int index = component.Index;
Color color = colors[index % colors.Count];
pane.AddPieSlice(component.Proportion, color, 0.1, index.ToString());
}
}
// Calculate the Axis Scale
zedGraphControl.AxisChange();
zedGraphControl.Invalidate();
}