첨부 실행 코드는 나눔고딕코딩 폰트를 사용합니다.
728x90
반응형
728x170

TestProject.zip
0.01MB

▶ MainForm.cs

using System;
using System.Windows.Forms;

using ScottPlot;
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[] valueArray1A = DataGen.RandomNormal(random, 350, 85, 5);
            double[] valueArray1B = DataGen.RandomNormal(random, 350, 84, 3);
            double[] valueArray1C = DataGen.RandomNormal(random, 350, 80, 5);
            double[] valueArray1D = DataGen.RandomNormal(random, 350, 91, 2);

            double[] valueArray2A = DataGen.RandomNormal(random, 420, 87, 5);
            double[] valueArray2B = DataGen.RandomNormal(random, 420, 88, 3);
            double[] valueArray2C = DataGen.RandomNormal(random, 420, 90, 5);
            double[] valueArray2D = DataGen.RandomNormal(random, 420, 93, 2);

            double[] valueArray3A = DataGen.RandomNormal(random, 230, 82, 5);
            double[] valueArray3B = DataGen.RandomNormal(random, 230, 84, 3);
            double[] valueArray3C = DataGen.RandomNormal(random, 230, 85, 5);
            double[] valueArray3D = DataGen.RandomNormal(random, 230, 90, 2);

            Population[] populationArray1 = new Population[]
            {
                new Population(valueArray1A),
                new Population(valueArray1B),
                new Population(valueArray1C),
                new Population(valueArray1D)
            };

            Population[] populationArray2 = new Population[]
            {
                new Population(valueArray2A),
                new Population(valueArray2B),
                new Population(valueArray2C),
                new Population(valueArray2D)
            };

            Population[] populationArray3 = new Population[]
            {
                new Population(valueArray3A),
                new Population(valueArray3B),
                new Population(valueArray3C),
                new Population(valueArray3D)
            };

            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);

            plot.AddPopulations(populationMultiSeries);

            string[] groupNames = new string[] { "1월", "2월", "3월", "4월" };

            plot.XTicks(groupNames);

            plot.XAxis.Grid(false);

            plot.Legend();

            this.formsPlot.Reset(plot);

            this.formsPlot.Refresh();
        }

        #endregion
    }
}
728x90
반응형
그리드형(광고전용)
Posted by icodebroker

댓글을 달아 주세요