Skip to content
Snippets Groups Projects
Commit 7d037c47 authored by Dennis Eisold's avatar Dennis Eisold
Browse files

changed graph

parent 72e6c315
No related branches found
No related tags found
No related merge requests found
...@@ -36,10 +36,6 @@ namespace Wetterstation ...@@ -36,10 +36,6 @@ namespace Wetterstation
/// </summary> /// </summary>
private void InitializeComponent() private void InitializeComponent()
{ {
System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea3 = new System.Windows.Forms.DataVisualization.Charting.ChartArea();
System.Windows.Forms.DataVisualization.Charting.Legend legend3 = new System.Windows.Forms.DataVisualization.Charting.Legend();
System.Windows.Forms.DataVisualization.Charting.Series series3 = new System.Windows.Forms.DataVisualization.Charting.Series();
System.Windows.Forms.DataVisualization.Charting.Title title3 = new System.Windows.Forms.DataVisualization.Charting.Title();
this.lbTextInnentemp = new System.Windows.Forms.Label(); this.lbTextInnentemp = new System.Windows.Forms.Label();
this.lbTextAussentemp = new System.Windows.Forms.Label(); this.lbTextAussentemp = new System.Windows.Forms.Label();
this.lbTextWindSpeed = new System.Windows.Forms.Label(); this.lbTextWindSpeed = new System.Windows.Forms.Label();
...@@ -67,7 +63,6 @@ namespace Wetterstation ...@@ -67,7 +63,6 @@ namespace Wetterstation
this.lbTextLuftfeuchtAussen = new System.Windows.Forms.Label(); this.lbTextLuftfeuchtAussen = new System.Windows.Forms.Label();
this.lbTextLuftdruck = new System.Windows.Forms.Label(); this.lbTextLuftdruck = new System.Windows.Forms.Label();
this.lbLuftdruck = new System.Windows.Forms.Label(); this.lbLuftdruck = new System.Windows.Forms.Label();
this.chart1 = new System.Windows.Forms.DataVisualization.Charting.Chart();
this.lbHintergrund = new System.Windows.Forms.Label(); this.lbHintergrund = new System.Windows.Forms.Label();
this.lbCity = new System.Windows.Forms.Label(); this.lbCity = new System.Windows.Forms.Label();
this.lbForecastImage1 = new System.Windows.Forms.PictureBox(); this.lbForecastImage1 = new System.Windows.Forms.PictureBox();
...@@ -85,12 +80,12 @@ namespace Wetterstation ...@@ -85,12 +80,12 @@ namespace Wetterstation
this.lbForecastTemp3 = new System.Windows.Forms.Label(); this.lbForecastTemp3 = new System.Windows.Forms.Label();
this.lbForecastTemp4 = new System.Windows.Forms.Label(); this.lbForecastTemp4 = new System.Windows.Forms.Label();
this.lbForecastTemp5 = new System.Windows.Forms.Label(); this.lbForecastTemp5 = new System.Windows.Forms.Label();
this.cartesianChart1 = new LiveCharts.WinForms.CartesianChart();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.lbForecastImage2)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.lbForecastImage2)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.lbForecastImage3)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.lbForecastImage3)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.lbForecastImage4)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.lbForecastImage4)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.lbForecastImage5)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.lbForecastImage5)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.chart1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.lbForecastImage1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.lbForecastImage1)).BeginInit();
this.SuspendLayout(); this.SuspendLayout();
// //
...@@ -443,27 +438,6 @@ namespace Wetterstation ...@@ -443,27 +438,6 @@ namespace Wetterstation
this.lbLuftdruck.TabIndex = 40; this.lbLuftdruck.TabIndex = 40;
this.lbLuftdruck.Text = "NA hPa"; this.lbLuftdruck.Text = "NA hPa";
// //
// chart1
//
this.chart1.Anchor = System.Windows.Forms.AnchorStyles.None;
chartArea3.Name = "ChartArea1";
this.chart1.ChartAreas.Add(chartArea3);
legend3.Name = "Legend1";
this.chart1.Legends.Add(legend3);
this.chart1.Location = new System.Drawing.Point(37, 672);
this.chart1.Margin = new System.Windows.Forms.Padding(4);
this.chart1.Name = "chart1";
this.chart1.Palette = System.Windows.Forms.DataVisualization.Charting.ChartColorPalette.Excel;
series3.ChartArea = "ChartArea1";
series3.Legend = "Legend1";
series3.Name = "Series1";
this.chart1.Series.Add(series3);
this.chart1.Size = new System.Drawing.Size(991, 132);
this.chart1.TabIndex = 41;
this.chart1.Text = "chTendenz";
title3.Name = "Title1";
this.chart1.Titles.Add(title3);
//
// lbHintergrund // lbHintergrund
// //
this.lbHintergrund.Anchor = System.Windows.Forms.AnchorStyles.None; this.lbHintergrund.Anchor = System.Windows.Forms.AnchorStyles.None;
...@@ -677,6 +651,14 @@ namespace Wetterstation ...@@ -677,6 +651,14 @@ namespace Wetterstation
this.lbForecastTemp5.TabIndex = 59; this.lbForecastTemp5.TabIndex = 59;
this.lbForecastTemp5.Text = "NA °C"; this.lbForecastTemp5.Text = "NA °C";
// //
// cartesianChart1
//
this.cartesianChart1.Location = new System.Drawing.Point(19, 480);
this.cartesianChart1.Name = "cartesianChart1";
this.cartesianChart1.Size = new System.Drawing.Size(1309, 310);
this.cartesianChart1.TabIndex = 60;
this.cartesianChart1.Text = "cartesianChart1";
//
// Hintergrund // Hintergrund
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
...@@ -684,6 +666,7 @@ namespace Wetterstation ...@@ -684,6 +666,7 @@ namespace Wetterstation
this.BackgroundImage = global::Wetterstation.Properties.Resources.Bild_Dennis_Formatiert; this.BackgroundImage = global::Wetterstation.Properties.Resources.Bild_Dennis_Formatiert;
this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
this.ClientSize = new System.Drawing.Size(1344, 897); this.ClientSize = new System.Drawing.Size(1344, 897);
this.Controls.Add(this.cartesianChart1);
this.Controls.Add(this.lbForecastTemp5); this.Controls.Add(this.lbForecastTemp5);
this.Controls.Add(this.lbForecastTemp4); this.Controls.Add(this.lbForecastTemp4);
this.Controls.Add(this.lbForecastTemp3); this.Controls.Add(this.lbForecastTemp3);
...@@ -705,7 +688,6 @@ namespace Wetterstation ...@@ -705,7 +688,6 @@ namespace Wetterstation
this.Controls.Add(this.lbForecastDay4); this.Controls.Add(this.lbForecastDay4);
this.Controls.Add(this.lbForecastDay5); this.Controls.Add(this.lbForecastDay5);
this.Controls.Add(this.lbAussenTemp); this.Controls.Add(this.lbAussenTemp);
this.Controls.Add(this.chart1);
this.Controls.Add(this.lbLuftdruck); this.Controls.Add(this.lbLuftdruck);
this.Controls.Add(this.lbTextLuftdruck); this.Controls.Add(this.lbTextLuftdruck);
this.Controls.Add(this.lbTextLuftfeuchtAussen); this.Controls.Add(this.lbTextLuftfeuchtAussen);
...@@ -740,7 +722,6 @@ namespace Wetterstation ...@@ -740,7 +722,6 @@ namespace Wetterstation
((System.ComponentModel.ISupportInitialize)(this.lbForecastImage3)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.lbForecastImage3)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.lbForecastImage4)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.lbForecastImage4)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.lbForecastImage5)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.lbForecastImage5)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.chart1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.lbForecastImage1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.lbForecastImage1)).EndInit();
this.ResumeLayout(false); this.ResumeLayout(false);
this.PerformLayout(); this.PerformLayout();
...@@ -776,7 +757,6 @@ namespace Wetterstation ...@@ -776,7 +757,6 @@ namespace Wetterstation
private Label lbTextLuftfeuchtAussen; private Label lbTextLuftfeuchtAussen;
private Label lbTextLuftdruck; private Label lbTextLuftdruck;
private Label lbLuftdruck; private Label lbLuftdruck;
private System.Windows.Forms.DataVisualization.Charting.Chart chart1;
private Label lbHintergrund; private Label lbHintergrund;
private Label lbCity; private Label lbCity;
private PictureBox lbForecastImage1; private PictureBox lbForecastImage1;
...@@ -794,6 +774,7 @@ namespace Wetterstation ...@@ -794,6 +774,7 @@ namespace Wetterstation
private Label lbForecastTemp3; private Label lbForecastTemp3;
private Label lbForecastTemp4; private Label lbForecastTemp4;
private Label lbForecastTemp5; private Label lbForecastTemp5;
private LiveCharts.WinForms.CartesianChart cartesianChart1;
} }
} }
...@@ -6,6 +6,9 @@ using uPLibrary.Networking.M2Mqtt; ...@@ -6,6 +6,9 @@ using uPLibrary.Networking.M2Mqtt;
using uPLibrary.Networking.M2Mqtt.Messages; using uPLibrary.Networking.M2Mqtt.Messages;
using Newtonsoft.Json; using Newtonsoft.Json;
using System.Globalization; using System.Globalization;
using LiveCharts;
using LiveCharts.WinForms;
using LiveCharts.Wpf;
namespace Wetterstation namespace Wetterstation
{ {
...@@ -27,7 +30,46 @@ namespace Wetterstation ...@@ -27,7 +30,46 @@ namespace Wetterstation
t.Start(); t.Start();
mqttStart(); mqttStart();
updateChart();
} }
private void updateChart()
{
cartesianChart1.Series = new SeriesCollection
{
new LineSeries
{
Title = "Temperature",
Values = new ChartValues<double> {4, 6, 5, 2, 7},
PointGeometry = null
},
new LineSeries
{
Title = "Humidity",
Values = new ChartValues<double> {6, 7, 3, 4, 6},
PointGeometry = null
},
new LineSeries
{
Title = "Pressure",
Values = new ChartValues<double> {5, 2, 8, 3},
PointGeometry = null
}
};
cartesianChart1.LegendLocation = LegendLocation.Right;
//modifying the series collection will animate and update the chart
//cartesianChart1.Series.Add(new LineSeries
//{
// Values = new ChartValues<double> { 5, 3, 2, 4, 5 },
// LineSmoothness = 0, //straight lines, 1 really smooth lines
//});
//modifying any series values will also animate and update the chart
cartesianChart1.Series[2].Values.Add(5d);
}
private void t_DateTime(object sender, EventArgs e) private void t_DateTime(object sender, EventArgs e)
{ {
lbUhr.Text = DateTime.Now.ToLongTimeString(); lbUhr.Text = DateTime.Now.ToLongTimeString();
......
...@@ -41,12 +41,20 @@ ...@@ -41,12 +41,20 @@
<Reference Include="LiveCharts, Version=0.9.7.0, Culture=neutral, PublicKeyToken=0bc1f845d1ebb8df, processorArchitecture=MSIL"> <Reference Include="LiveCharts, Version=0.9.7.0, Culture=neutral, PublicKeyToken=0bc1f845d1ebb8df, processorArchitecture=MSIL">
<HintPath>..\packages\LiveCharts.0.9.7\lib\net45\LiveCharts.dll</HintPath> <HintPath>..\packages\LiveCharts.0.9.7\lib\net45\LiveCharts.dll</HintPath>
</Reference> </Reference>
<Reference Include="LiveCharts.WinForms, Version=0.9.7.1, Culture=neutral, PublicKeyToken=0bc1f845d1ebb8df, processorArchitecture=MSIL">
<HintPath>..\packages\LiveCharts.WinForms.0.9.7.1\lib\net45\LiveCharts.WinForms.dll</HintPath>
</Reference>
<Reference Include="LiveCharts.Wpf, Version=0.9.7.0, Culture=neutral, PublicKeyToken=0bc1f845d1ebb8df, processorArchitecture=MSIL">
<HintPath>..\packages\LiveCharts.Wpf.0.9.7\lib\net45\LiveCharts.Wpf.dll</HintPath>
</Reference>
<Reference Include="M2Mqtt.Net, Version=4.3.0.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="M2Mqtt.Net, Version=4.3.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\M2Mqtt.4.3.0.0\lib\net45\M2Mqtt.Net.dll</HintPath> <HintPath>..\packages\M2Mqtt.4.3.0.0\lib\net45\M2Mqtt.Net.dll</HintPath>
</Reference> </Reference>
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL"> <Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll</HintPath> <HintPath>..\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference> </Reference>
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Configuration" /> <Reference Include="System.Configuration" />
<Reference Include="System.Core" /> <Reference Include="System.Core" />
...@@ -55,6 +63,7 @@ ...@@ -55,6 +63,7 @@
</Reference> </Reference>
<Reference Include="System.Management" /> <Reference Include="System.Management" />
<Reference Include="System.Windows.Forms.DataVisualization" /> <Reference Include="System.Windows.Forms.DataVisualization" />
<Reference Include="System.Xaml" />
<Reference Include="System.Xml.Linq" /> <Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" /> <Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" /> <Reference Include="Microsoft.CSharp" />
...@@ -64,6 +73,8 @@ ...@@ -64,6 +73,8 @@
<Reference Include="System.Net.Http" /> <Reference Include="System.Net.Http" />
<Reference Include="System.Windows.Forms" /> <Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" /> <Reference Include="System.Xml" />
<Reference Include="WindowsBase" />
<Reference Include="WindowsFormsIntegration" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="SqliteDataAccess.cs" /> <Compile Include="SqliteDataAccess.cs" />
......
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
<packages> <packages>
<package id="Dapper" version="2.0.30" targetFramework="net472" /> <package id="Dapper" version="2.0.30" targetFramework="net472" />
<package id="LiveCharts" version="0.9.7" targetFramework="net472" /> <package id="LiveCharts" version="0.9.7" targetFramework="net472" />
<package id="LiveCharts.WinForms" version="0.9.7.1" targetFramework="net472" />
<package id="LiveCharts.Wpf" version="0.9.7" targetFramework="net472" />
<package id="M2Mqtt" version="4.3.0.0" targetFramework="net472" /> <package id="M2Mqtt" version="4.3.0.0" targetFramework="net472" />
<package id="Newtonsoft.Json" version="12.0.3" targetFramework="net472" /> <package id="Newtonsoft.Json" version="12.0.3" targetFramework="net472" />
<package id="System.Data.SQLite.Core" version="1.0.112.0" targetFramework="net472" /> <package id="System.Data.SQLite.Core" version="1.0.112.0" targetFramework="net472" />
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment