[SCOTTPLOT/WINFORM] Plot 클래스 : AddSignalXYConst 메소드를 사용해 데이터 타입이 다른 X/Y 데이터 사용하기
ScottPlot/WinForm 2022. 2. 26. 22:17728x90
반응형
728x170
▶ MainForm.cs
using System;
using System.Linq;
using System.Windows.Forms;
using ScottPlot;
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);
int pointCount = 1000000;
double[] sineValueArray = DataGen.Sin(pointCount, 3);
double[] noiseValueArray = DataGen.RandomNormal(random, pointCount, 0, 0.5);
float[] yValueArray = sineValueArray.Zip(noiseValueArray, (s, n) => s + n).Select(x => (float)x).ToArray();
int[] xValueArray = Enumerable.Range(0, pointCount)
.Select(x => (int)x)
.Select(x => x > 500000 ? x + 1_000000 : x)
.Select(x => x > 200000 ? x + 100000 : x)
.ToArray();
plot.AddSignalXYConst(xValueArray, yValueArray);
this.formsPlot.Reset(plot);
this.formsPlot.Refresh();
}
#endregion
}
}
728x90
반응형
그리드형(광고전용)
댓글을 달아 주세요