Druckverlaufgrafik getrennt.

Wird kein Exception geworfen, wenn bild nicht vorhanden ist in Schachtanbindung
This commit is contained in:
Husky
2019-03-11 21:19:46 +01:00
parent fd96f439a8
commit 3b45cc592a
6 changed files with 43 additions and 42 deletions

View File

@@ -149,7 +149,8 @@ namespace BerichtGen
private void MailMerge_MergeImageField(object sender, MergeImageFieldEventArgs args) private void MailMerge_MergeImageField(object sender, MergeImageFieldEventArgs args)
{ {
if(args.FieldName == "UVImage")
if(args.FieldName == "UVImageTemp" || args.FieldName == "UVImageDruck")
{ {
string source = args.FieldValue.ToString(); string source = args.FieldValue.ToString();
if (!File.Exists(source)) return; if (!File.Exists(source)) return;

View File

@@ -101,7 +101,8 @@ namespace KlassenBIB
{"vakuum","" }, {"vakuum","" },
{"time_start","" }, {"time_start","" },
{"time_ende","" }, {"time_ende","" },
{"UVImage","" }, {"UVImageTemp","" },
{"UVImageDruck","" },
{"liner_type","" }, {"liner_type","" },
{"rueckhol_speed","" }, {"rueckhol_speed","" },
{"harz_type","" } {"harz_type","" }
@@ -145,7 +146,8 @@ namespace KlassenBIB
grunddaten["vakuum"] = this.KalibrierUnterdruck; grunddaten["vakuum"] = this.KalibrierUnterdruck;
grunddaten["time_start"] = this.AnfangAushaertung; grunddaten["time_start"] = this.AnfangAushaertung;
grunddaten["time_ende"] = this.EndeAushaertung; grunddaten["time_ende"] = this.EndeAushaertung;
grunddaten["UVImage"] = Path.Combine(destinationPath, "linerGraph.jpg"); grunddaten["UVImageTemp"] = Path.Combine(destinationPath, "linerGraph_temp.jpg");
grunddaten["UVImageDruck"] = Path.Combine(destinationPath, "linerGraph_druck.jpg");
grunddaten["rueckhol_speed"] = rueckholgeschwindigkeit; grunddaten["rueckhol_speed"] = rueckholgeschwindigkeit;
grunddaten["liner_type"] = LinerTyp; grunddaten["liner_type"] = LinerTyp;
grunddaten["harz_type"] = HarzTyp; grunddaten["harz_type"] = HarzTyp;

View File

@@ -18,7 +18,7 @@
<DebugType>full</DebugType> <DebugType>full</DebugType>
<Optimize>false</Optimize> <Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath> <OutputPath>bin\Debug\</OutputPath>
<DefineConstants>TRACE;DEBUG;LAPTOP</DefineConstants> <DefineConstants>TRACE;DEBUG</DefineConstants>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
<DocumentationFile>bin\Debug\SanSystem.xml</DocumentationFile> <DocumentationFile>bin\Debug\SanSystem.xml</DocumentationFile>

View File

@@ -210,7 +210,7 @@ namespace SanSystem
} }
private static ChartControl getGraph(List<UVcsvStrukture> input) private static ChartControl getGraph(List<UVcsvStrukture> input,string type)
{ {
Size size = new Size(600, 400); Size size = new Size(600, 400);
@@ -218,67 +218,60 @@ namespace SanSystem
chartControl.Size = size; chartControl.Size = size;
ChartAxis axis = chartControl.PrimaryYAxis; ChartAxis axis = chartControl.PrimaryYAxis;
ChartAxis axis0 = new ChartAxis(ChartOrientation.Vertical);
ChartAxis axis1 = new ChartAxis(ChartOrientation.Vertical);
ChartAxisLayout layout1 = new ChartAxisLayout(); ChartAxisLayout layout1 = new ChartAxisLayout();
ChartAxisLayout layout2 = new ChartAxisLayout();
chartControl.Axes.Add(axis0);
//chartControl.Axes.Add(axis1);
layout1.Spacing = 12; layout1.Spacing = 12;
layout2.Spacing = 12;
layout1.Axes.Add(axis); layout1.Axes.Add(axis);
layout2.Axes.Add(axis0);
//layout2.Axes.Add(axis1);
chartControl.ChartArea.YLayouts.Add(layout1); chartControl.ChartArea.YLayouts.Add(layout1);
chartControl.ChartArea.YLayouts.Add(layout2);
ChartSeries temperaturChart = new ChartSeries("Temperatur", ChartSeriesType.Line); ChartSeries mychart = new ChartSeries(type, ChartSeriesType.Line);
ChartSeries druckChart = new ChartSeries("Druck", ChartSeriesType.Line);
int counter = 0; int counter = 0;
foreach (UVcsvStrukture pars in input) foreach (UVcsvStrukture pars in input)
{ {
temperaturChart.Points.Add(counter, pars.Temperatur); if (type.Equals("Temperatur"))
druckChart.Points.Add(counter, pars.Druck); mychart.Points.Add(counter, pars.Temperatur);
else if (type.Equals("Druck"))
mychart.Points.Add(counter, pars.Druck);
else
throw new Exception("Kein gültiger Aufruf");
counter++; counter++;
} }
temperaturChart.YAxis = axis; mychart.YAxis = axis;
druckChart.YAxis = axis0;
switch(type)
{
case "Temperatur":
axis.Title = "°C"; axis.Title = "°C";
break;
case "Druck":
axis.Title = "[bar]";
break;
}
axis.TitleFont = new Font("Segeo UI", 14F); axis.TitleFont = new Font("Segeo UI", 14F);
axis0.Title = "[bar]";
axis0.TitleFont = new Font("Segeo UI", 14F);
chartControl.LegendsPlacement = ChartPlacement.Outside; chartControl.LegendsPlacement = ChartPlacement.Outside;
chartControl.LegendPosition = ChartDock.Bottom; chartControl.LegendPosition = ChartDock.Bottom;
chartControl.LegendAlignment = ChartAlignment.Center; chartControl.LegendAlignment = ChartAlignment.Center;
chartControl.Title.Visible = false; chartControl.Title.Visible = false;
/*ChartAxis chartAxis = new ChartAxis(); chartControl.Series.Add(mychart);
chartAxis.Orientation = ChartOrientation.Horizontal;
chartAxis.Range = new MinMaxInfo(0, 6, 1);
chartAxis.DrawGrid = false;
chartAxis.LineType.Width = 1F;
chartAxis.LineType.ForeColor = Color.Black;
chartControl.Axes.Add(chartAxis);
*/
chartControl.Series.Add(temperaturChart);
chartControl.Series.Add(druckChart);
chartControl.Skins = Skins.Metro; chartControl.Skins = Skins.Metro;
//axis1.OpposedPosition = true;
axis.EdgeLabelsDrawingMode = ChartAxisEdgeLabelsDrawingMode.Shift; axis.EdgeLabelsDrawingMode = ChartAxisEdgeLabelsDrawingMode.Shift;
axis0.EdgeLabelsDrawingMode = ChartAxisEdgeLabelsDrawingMode.Shift;
//axis1.EdgeLabelsDrawingMode = ChartAxisEdgeLabelsDrawingMode.Shift;
return chartControl; return chartControl;
} }
@@ -296,10 +289,14 @@ namespace SanSystem
inliner.AnfangAushaertung = struktures.Select(x => x.Zeitstempel).Min(); inliner.AnfangAushaertung = struktures.Select(x => x.Zeitstempel).Min();
inliner.EndeAushaertung = struktures.Select(x => x.Zeitstempel).Max(); inliner.EndeAushaertung = struktures.Select(x => x.Zeitstempel).Max();
ChartControl chart = getGraph(struktures); ChartControl tempChart = getGraph(struktures,"Temperatur");
if (chart == null) return false; if (tempChart == null) return false;
else else
chart.SaveImage(Path.Combine(destinationPath, "linerGraph.jpg")); tempChart.SaveImage(Path.Combine(destinationPath, "linerGraph_temp.jpg"));
ChartControl druckChart = getGraph(struktures, "Druck");
if (druckChart == null) return false;
else
druckChart.SaveImage(Path.Combine(destinationPath, "linerGraph_druck.jpg"));
return true; return true;
} }

View File

@@ -124,6 +124,7 @@ namespace SanSystem
if (!File.Exists(pfad)) if (!File.Exists(pfad))
{ {
MessageBox.Show("Bilddatei mit den Pfad " + pfad + " nicht gefunden"); MessageBox.Show("Bilddatei mit den Pfad " + pfad + " nicht gefunden");
return;
} }
pt_box.Load(pfad); pt_box.Load(pfad);
pt_box.SizeMode = PictureBoxSizeMode.StretchImage; pt_box.SizeMode = PictureBoxSizeMode.StretchImage;