[C#/WINFORM/SCOTTPLOT] PopulationPlot 클래스 : 고급 모집단 스타일 사용하기
■ PopulationPlot 클래스에서 고급 모집단 스타일을 사용하는 방법을 보여준다. ▶ MainForm.cs
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 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
using System; using System.Drawing; using System.Windows.Forms; using ScottPlot; using ScottPlot.Plottable; using ScottPlot.Statistics; namespace TestProject { /// <summary> /// 메인 폼 /// </summary> public partial class MainForm : Form { //////////////////////////////////////////////////////////////////////////////////////////////////// Constructor ////////////////////////////////////////////////////////////////////////////////////////// Public #region 생성자 - MainForm() /// <summary> /// 생성자 /// </summary> public MainForm() { InitializeComponent(); Plot plot = new Plot(800, 600); Random random = new Random(0); double[] valueArray1 = DataGen.RandomNormal(random, 350, 72, 7 ); double[] valueArray2 = DataGen.RandomNormal(random, 420, 57, 10); double[] valueArray3 = DataGen.RandomNormal(random, 230, 79, 5 ); Population[] populationArray1 = new Population[] { new Population(valueArray1) }; Population[] populationArray2 = new Population[] { new Population(valueArray2) }; Population[] populationArray3 = new Population[] { new Population(valueArray3) }; PopulationSeries populationSeries1 = new PopulationSeries(populationArray1, "클래스 1"); PopulationSeries populationSeries2 = new PopulationSeries(populationArray2, "클래스 2"); PopulationSeries populationSeries3 = new PopulationSeries(populationArray3, "클래스 3"); PopulationSeries[] populationSeriesArray = new PopulationSeries[] { populationSeries1, populationSeries2, populationSeries3 }; PopulationMultiSeries populationMultiSeries = new PopulationMultiSeries(populationSeriesArray); PopulationPlot populationPlot = plot.AddPopulations(populationMultiSeries); populationPlot.DistributionCurve = true; populationPlot.DistributionCurveLineStyle = LineStyle.Dash; populationPlot.ScatterOutlineColor = Color.Transparent; populationPlot.DataFormat = PopulationPlot.DisplayItems.ScatterAndBox; populationPlot.DataBoxStyle = PopulationPlot.BoxStyle.BarMeanStDev; foreach(PopulationSeries populationSeries in populationPlot.MultiSeries.multiSeries) { populationSeries.color = Tools.GetRandomColor(random); } plot.Legend(location : Alignment.LowerLeft); plot.XAxis.Ticks(false); plot.XAxis.Grid(false); plot.YAxis.MajorGrid(lineStyle: LineStyle.Dot); plot.SetAxisLimits(yMin: 0); this.formsPlot.Reset(plot); this.formsPlot.Refresh(); } #endregion } } |
TestProject.zip