-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathChartBuilder.cs
More file actions
36 lines (34 loc) · 1.27 KB
/
Copy pathChartBuilder.cs
File metadata and controls
36 lines (34 loc) · 1.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
using System.Drawing;
using System.Linq;
using System.Windows.Forms;
using ZedGraph;
namespace StructBenchmarking
{
public class ChartBuilder
{
public Control CreateTimeOfObjectSizeChart(ChartData chartData)
{
var chart = new ZedGraphControl();
chart.GraphPane.YAxis.Title.Text = "Time";
chart.GraphPane.XAxis.Title.Text = "Size";
chart.GraphPane.Title.Text = chartData.Title;
chart.GraphPane.AddCurve(
"Classes",
chartData.ClassPoints.Select(z => (double) z.FieldsCount).ToArray(),
chartData.ClassPoints.Select(z => z.AverageTime).ToArray(),
Color.Red);
chart.GraphPane.AddCurve(
"Structures",
chartData.StructPoints.Select(z => (double) z.FieldsCount).ToArray(),
chartData.StructPoints.Select(z => z.AverageTime).ToArray(),
Color.Blue);
chart.GraphPane.XAxis.Scale.MinAuto = true;
chart.GraphPane.XAxis.Scale.MaxAuto = true;
chart.GraphPane.YAxis.Scale.MinAuto = true;
chart.GraphPane.YAxis.Scale.MaxAuto = true;
chart.AxisChange();
chart.Invalidate();
return chart;
}
}
}