Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- using System.Windows.Forms.DataVisualization;
- using System.Windows.Forms.DataVisualization.Charting;
- namespace Profiling
- {
- public class Type
- {
- public static readonly string Struct = "Struct";
- public static readonly string Class = "Class";
- }
- class ChartBuilder : IChartBuilder
- {
- public Series CreateSetPoints(string type)
- {
- Series result = new Series(type);
- result.LegendText = type;
- result.BorderWidth = 2;
- result.ChartType = SeriesChartType.Line;
- result.ChartArea = "Experiment Result";
- return result;
- }
- public Control Build(List<ExperimentResult> result)
- {
- Chart myChart = new Chart();
- myChart.Dock = DockStyle.Fill;
- myChart.ChartAreas.Add(new ChartArea("Experiment Result"));
- var pointStruct = CreateSetPoints(Type.Struct);
- var pointClass = CreateSetPoints(Type.Class);
- foreach (var res in result)
- {
- pointStruct.Points.AddXY(res.Size, res.StructResult);
- pointClass.Points.AddXY(res.Size, res.ClassResult);
- }
- myChart.Series.Add(pointStruct);
- myChart.Series.Add(pointClass);
- Legend legend = new Legend();
- myChart.Legends.Add(legend);
- return myChart;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement