95 lines
3.4 KiB
C#
95 lines
3.4 KiB
C#
using Syncfusion.Windows.Forms.Chart;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Windows.Forms;
|
|
|
|
namespace SanSystem
|
|
{
|
|
public partial class FrmLinerChart : Form
|
|
{
|
|
public FrmLinerChart()
|
|
{
|
|
InitializeComponent();
|
|
ChartAxis axis = chartControl1.PrimaryYAxis;
|
|
ChartAxis axis0 = new ChartAxis(ChartOrientation.Vertical);
|
|
ChartAxis axis1 = new ChartAxis(ChartOrientation.Vertical);
|
|
|
|
ChartAxisLayout layout1 = new ChartAxisLayout();
|
|
ChartAxisLayout layout2 = new ChartAxisLayout();
|
|
|
|
chartControl1.Axes.Add(axis0);
|
|
chartControl1.Axes.Add(axis1);
|
|
|
|
|
|
|
|
|
|
layout1.Spacing = 12;
|
|
layout2.Spacing = 12;
|
|
layout1.Axes.Add(axis);
|
|
layout2.Axes.Add(axis0);
|
|
layout2.Axes.Add(axis1);
|
|
|
|
chartControl1.ChartArea.YLayouts.Add(layout1);
|
|
chartControl1.ChartArea.YLayouts.Add(layout2);
|
|
|
|
ChartSeries temperaturChart = new ChartSeries("Temperatur", ChartSeriesType.Line);
|
|
ChartSeries druckChart = new ChartSeries("Druck", ChartSeriesType.Line);
|
|
|
|
string[] input = File.ReadAllLines(@"C:\Users\Damian\Desktop\SanVerwaltung\SanSystem\bin\Debug\projekte\18-850\SW01-SW02\UVAnlage\Trend\Trend022.csv");
|
|
int counter = 0;
|
|
foreach (string pars in input)
|
|
{
|
|
string[] parts = pars.Split(',');
|
|
if (parts[0].Equals("Group1") || parts[1].Equals("(END)")) continue;
|
|
double temperatur = double.Parse(parts[1].Replace('.',','));
|
|
double druck = double.Parse(parts[2].Replace('.', ','));
|
|
|
|
temperaturChart.Points.Add(counter, temperatur);
|
|
druckChart.Points.Add(counter, druck);
|
|
counter++;
|
|
|
|
}
|
|
temperaturChart.YAxis = axis;
|
|
druckChart.YAxis = axis0;
|
|
|
|
axis.Title = "°C";
|
|
axis.TitleFont = new Font("Segeo UI", 14F);
|
|
|
|
axis0.Title = "[bar]";
|
|
axis0.TitleFont = new Font("Segeo UI", 14F);
|
|
|
|
chartControl1.LegendsPlacement = ChartPlacement.Outside;
|
|
chartControl1.LegendPosition = ChartDock.Bottom;
|
|
chartControl1.LegendAlignment = ChartAlignment.Center;
|
|
chartControl1.Title.Visible = false;
|
|
|
|
ChartAxis chartAxis = new ChartAxis();
|
|
chartAxis.Orientation = ChartOrientation.Horizontal;
|
|
chartAxis.Range = new MinMaxInfo(0, 6, 1);
|
|
chartAxis.DrawGrid = false;
|
|
chartAxis.LineType.Width = 1F;
|
|
chartAxis.LineType.ForeColor = Color.Black;
|
|
chartControl1.Axes.Add(chartAxis);
|
|
|
|
chartControl1.Series.Add(temperaturChart);
|
|
chartControl1.Series.Add(druckChart);
|
|
chartControl1.Skins = Skins.Metro;
|
|
|
|
|
|
axis1.OpposedPosition = true;
|
|
axis.EdgeLabelsDrawingMode = ChartAxisEdgeLabelsDrawingMode.Shift;
|
|
axis0.EdgeLabelsDrawingMode = ChartAxisEdgeLabelsDrawingMode.Shift;
|
|
axis1.EdgeLabelsDrawingMode = ChartAxisEdgeLabelsDrawingMode.Shift;
|
|
|
|
chartControl1.SaveImage("./temp.jpg");
|
|
}
|
|
}
|
|
}
|