Chart wird generiert aus CSV Datei

This commit is contained in:
Husky
2018-07-08 18:46:53 +02:00
parent 95353ff2a4
commit b49b7f1654
6 changed files with 331 additions and 9 deletions

76
SanSystem/FrmLinerChart.Designer.cs generated Normal file
View File

@@ -0,0 +1,76 @@
namespace SanSystem
{
partial class FrmLinerChart
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.chartControl1 = new Syncfusion.Windows.Forms.Chart.ChartControl();
this.SuspendLayout();
//
// chartControl1
//
this.chartControl1.ChartArea.CursorLocation = new System.Drawing.Point(0, 0);
this.chartControl1.ChartArea.CursorReDraw = false;
this.chartControl1.EnableYZooming = true;
this.chartControl1.IsWindowLess = false;
//
//
//
this.chartControl1.Legend.Location = new System.Drawing.Point(485, 75);
this.chartControl1.Localize = null;
this.chartControl1.Location = new System.Drawing.Point(12, 12);
this.chartControl1.MinZoomFactorX = 0.5D;
this.chartControl1.MinZoomFactorY = 0.5D;
this.chartControl1.Name = "chartControl1";
this.chartControl1.PrimaryXAxis.LogLabelsDisplayMode = Syncfusion.Windows.Forms.Chart.LogLabelsDisplayMode.Default;
this.chartControl1.PrimaryXAxis.Margin = true;
this.chartControl1.PrimaryYAxis.LogLabelsDisplayMode = Syncfusion.Windows.Forms.Chart.LogLabelsDisplayMode.Default;
this.chartControl1.PrimaryYAxis.Margin = true;
this.chartControl1.Size = new System.Drawing.Size(776, 357);
this.chartControl1.TabIndex = 0;
//
//
//
this.chartControl1.Title.Name = "Default";
//
// FrmLinerChart
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(800, 450);
this.Controls.Add(this.chartControl1);
this.Name = "FrmLinerChart";
this.Text = "FrmLinerChart";
this.ResumeLayout(false);
}
#endregion
private Syncfusion.Windows.Forms.Chart.ChartControl chartControl1;
}
}

View File

@@ -0,0 +1,94 @@
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");
}
}
}

View File

@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@@ -38,8 +38,12 @@
<Reference Include="Ionic.Zip, Version=1.9.1.8, Culture=neutral, PublicKeyToken=edbe51ad942a3f5c, processorArchitecture=MSIL">
<HintPath>..\packages\Ionic.Zip.1.9.1.8\lib\Ionic.Zip.dll</HintPath>
</Reference>
<Reference Include="Syncfusion.Chart.Base, Version=16.1460.0.37, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89" />
<Reference Include="Syncfusion.Chart.Windows, Version=16.1460.0.37, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89, processorArchitecture=MSIL" />
<Reference Include="Syncfusion.Shared.Base, Version=16.1460.0.37, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89" />
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Design" />
<Reference Include="System.Web" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
@@ -52,6 +56,12 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="FrmLinerChart.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="FrmLinerChart.Designer.cs">
<DependentUpon>FrmLinerChart.cs</DependentUpon>
</Compile>
<Compile Include="frmObjektEdit.cs">
<SubType>Form</SubType>
</Compile>
@@ -97,6 +107,9 @@
<Compile Include="UCSchachtanbindung.Designer.cs">
<DependentUpon>UCSchachtanbindung.cs</DependentUpon>
</Compile>
<EmbeddedResource Include="FrmLinerChart.resx">
<DependentUpon>FrmLinerChart.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="frmObjektEdit.resx">
<DependentUpon>frmObjektEdit.cs</DependentUpon>
</EmbeddedResource>

View File

@@ -30,6 +30,7 @@
{
this.tabControl1 = new System.Windows.Forms.TabControl();
this.tabPage2 = new System.Windows.Forms.TabPage();
this.button1 = new System.Windows.Forms.Button();
this.ftpProgress = new System.Windows.Forms.ProgressBar();
this.btn_transfer_ftp = new System.Windows.Forms.Button();
this.label1 = new System.Windows.Forms.Label();
@@ -69,7 +70,7 @@
this.label11 = new System.Windows.Forms.Label();
this.label10 = new System.Windows.Forms.Label();
this.label9 = new System.Windows.Forms.Label();
this.button1 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.tabControl1.SuspendLayout();
this.tabPage2.SuspendLayout();
this.groupBox3.SuspendLayout();
@@ -91,6 +92,7 @@
//
// tabPage2
//
this.tabPage2.Controls.Add(this.button2);
this.tabPage2.Controls.Add(this.button1);
this.tabPage2.Controls.Add(this.ftpProgress);
this.tabPage2.Controls.Add(this.btn_transfer_ftp);
@@ -115,6 +117,16 @@
this.tabPage2.Text = "Vorraussetzungen";
this.tabPage2.UseVisualStyleBackColor = true;
//
// button1
//
this.button1.Location = new System.Drawing.Point(829, 197);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(199, 66);
this.button1.TabIndex = 30;
this.button1.Text = "button1";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// ftpProgress
//
this.ftpProgress.Location = new System.Drawing.Point(782, 487);
@@ -534,15 +546,15 @@
this.label9.TabIndex = 0;
this.label9.Text = "Harz";
//
// button1
// button2
//
this.button1.Location = new System.Drawing.Point(829, 197);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(199, 66);
this.button1.TabIndex = 30;
this.button1.Text = "button1";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
this.button2.Location = new System.Drawing.Point(595, 426);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(95, 61);
this.button2.TabIndex = 31;
this.button2.Text = "button2";
this.button2.UseVisualStyleBackColor = true;
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// UCInliner
//
@@ -611,5 +623,6 @@
private System.Windows.Forms.Button btn_transfer_ftp;
private System.Windows.Forms.ProgressBar ftpProgress;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Button button2;
}
}

View File

@@ -199,5 +199,11 @@ namespace SanSystem
BerichtGen.Options options = new BerichtGen.Options("", "", "", grunddaten,bilderO);
options.ShowDialog();
}
private void button2_Click(object sender, EventArgs e)
{
FrmLinerChart frmLinerChart = new FrmLinerChart();
frmLinerChart.ShowDialog();
}
}
}