52 lines
1.4 KiB
C#
52 lines
1.4 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Windows.Forms;
|
|
|
|
namespace chart_new
|
|
{
|
|
public partial class Form1 : Form
|
|
{
|
|
public Form1()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
private void button1_Click(object sender, EventArgs e)
|
|
{
|
|
LoadTestData();
|
|
chart.AdjustScaleX();
|
|
chart.AdjustScaleY();
|
|
this.chart.Refresh();
|
|
}
|
|
|
|
private void LoadTestData()
|
|
{
|
|
int dataCount = 100000;
|
|
DateTime[] timeData = new DateTime[dataCount];
|
|
float[] voltageData = new float[dataCount];
|
|
|
|
DateTime startTime = DateTime.Now;
|
|
Random random = new Random();
|
|
|
|
for (int i = 0; i < dataCount; i++)
|
|
{
|
|
timeData[i] = startTime.AddSeconds(i+i*2); // 1초 간격으로 시간 데이터 생성
|
|
//if(i > 500)
|
|
//voltageData[i] = (float)(random.NextDouble() * 100); // 0부터 10 사이의 임의 전압 데이터 생성
|
|
//else
|
|
voltageData[i] = (float)(random.NextDouble() * 10); // 0부터 10 사이의 임의 전압 데이터 생성
|
|
}
|
|
|
|
chart.TimeData = timeData;
|
|
chart.VoltageData = voltageData;
|
|
|
|
}
|
|
}
|
|
}
|