728x90
반응형
728x170
▶ MainForm.cs
using System;
using System.Collections.Generic;
using System.Drawing;
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);
List<List<(double x, double y)>> polygonList = new List<List<(double x, double y)>>();
int polygonCount = 5000;
int pointCountPerPolygon = 100;
Random random = new Random(0);
for(int i = 0; i < polygonCount; i++)
{
double polygonX = random.NextDouble() * 100;
double polygonY = random.NextDouble() * 100;
double polygonRadius = random.NextDouble();
double[] xValueArray = Enumerable.Range(0, pointCountPerPolygon)
.Select(x => polygonRadius * Math.Cos(2.0 * Math.PI * x / pointCountPerPolygon) + polygonX)
.ToArray();
double[] yValueArray = Enumerable.Range(0, pointCountPerPolygon)
.Select(x => polygonRadius * Math.Sin(2.0 * Math.PI * x / pointCountPerPolygon) + polygonY)
.ToArray();
List<(double x, double y)> pointList = xValueArray.Zip(yValueArray, (px, py) => (px, py)).ToList();
polygonList.Add(pointList);
}
plot.AddPolygons(polygonList, fillColor : Color.Green);
plot.AxisScaleLock(true);
this.formsPlot.Reset(plot);
this.formsPlot.Refresh();
}
#endregion
}
}
728x90
반응형
그리드형(광고전용)
'ScottPlot > WinForm' 카테고리의 다른 글
[SCOTTPLOT/WINFORM] PopulationPlot 클래스 : DataFormat/DataBoxStyle 속성을 사용해 막대 위에서 데이터 포인트 그리기 (0) | 2022.02.20 |
---|---|
[SCOTTPLOT/WINFORM] Plot 클래스 : AddPopulations 메소드를 사용해 복수 모집단 차트 그리기 (0) | 2022.02.20 |
[SCOTTPLOT/WINFORM] Plot 클래스 : AddPopulation 메소드를 사용해 모집단 차트 그리기 (0) | 2022.02.20 |
[SCOTTPLOT/WINFORM] 2개의 차트 축을 동기화시키기 (0) | 2022.02.20 |
[SCOTTPLOT/WINFORM] IPlottable 인터페이스 : GetAxisLimits 메소드를 사용해 축 값 구하기 (0) | 2022.02.19 |
[SCOTTPLOT/WINFORM] Polygon 클래스 : 누적 채워진 선 그림 그리기 (0) | 2022.02.17 |
[SCOTTPLOT/WINFORM] Tools 클래스 : Pad 정적 메소드를 사용해 양쪽을 0으로 채워진 배열 구하기 (0) | 2022.02.17 |
[SCOTTPLOT/WINFORM] Tools 클래스 : Pad 정적 메소드를 사용해 소스 배열의 값으로 2개씩 채워진 배열 구하기 (0) | 2022.02.17 |
[SCOTTPLOT/WINFORM] Palette 클래스 : GetColor 메소드를 사용해 팔레트 색상 구하기 (0) | 2022.02.17 |
[SCOTTPLOT/WINFORM] Plot 클래스 : AddFill 메소드를 사용해 곡선들 사이 채우기 (0) | 2022.02.17 |
댓글을 달아 주세요