Druckverlaufgrafik getrennt.
Wird kein Exception geworfen, wenn bild nicht vorhanden ist in Schachtanbindung
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -218,67 +218,60 @@ namespace SanSystem
|
||||
chartControl.Size = size;
|
||||
|
||||
ChartAxis axis = chartControl.PrimaryYAxis;
|
||||
ChartAxis axis0 = new ChartAxis(ChartOrientation.Vertical);
|
||||
ChartAxis axis1 = new ChartAxis(ChartOrientation.Vertical);
|
||||
|
||||
|
||||
ChartAxisLayout layout1 = new ChartAxisLayout();
|
||||
ChartAxisLayout layout2 = new ChartAxisLayout();
|
||||
|
||||
chartControl.Axes.Add(axis0);
|
||||
//chartControl.Axes.Add(axis1);
|
||||
|
||||
|
||||
layout1.Spacing = 12;
|
||||
layout2.Spacing = 12;
|
||||
|
||||
layout1.Axes.Add(axis);
|
||||
layout2.Axes.Add(axis0);
|
||||
//layout2.Axes.Add(axis1);
|
||||
|
||||
|
||||
chartControl.ChartArea.YLayouts.Add(layout1);
|
||||
chartControl.ChartArea.YLayouts.Add(layout2);
|
||||
|
||||
ChartSeries temperaturChart = new ChartSeries("Temperatur", ChartSeriesType.Line);
|
||||
ChartSeries druckChart = new ChartSeries("Druck", ChartSeriesType.Line);
|
||||
ChartSeries mychart = new ChartSeries(type, ChartSeriesType.Line);
|
||||
|
||||
|
||||
int counter = 0;
|
||||
|
||||
foreach (UVcsvStrukture pars in input)
|
||||
{
|
||||
temperaturChart.Points.Add(counter, pars.Temperatur);
|
||||
druckChart.Points.Add(counter, pars.Druck);
|
||||
if (type.Equals("Temperatur"))
|
||||
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++;
|
||||
}
|
||||
|
||||
temperaturChart.YAxis = axis;
|
||||
druckChart.YAxis = axis0;
|
||||
mychart.YAxis = axis;
|
||||
|
||||
axis.Title = "°C";
|
||||
switch(type)
|
||||
{
|
||||
case "Temperatur":
|
||||
axis.Title = "°C";
|
||||
break;
|
||||
|
||||
case "Druck":
|
||||
axis.Title = "[bar]";
|
||||
break;
|
||||
}
|
||||
|
||||
axis.TitleFont = new Font("Segeo UI", 14F);
|
||||
|
||||
axis0.Title = "[bar]";
|
||||
axis0.TitleFont = new Font("Segeo UI", 14F);
|
||||
|
||||
|
||||
chartControl.LegendsPlacement = ChartPlacement.Outside;
|
||||
chartControl.LegendPosition = ChartDock.Bottom;
|
||||
chartControl.LegendAlignment = ChartAlignment.Center;
|
||||
chartControl.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;
|
||||
chartControl.Axes.Add(chartAxis);
|
||||
*/
|
||||
chartControl.Series.Add(temperaturChart);
|
||||
chartControl.Series.Add(druckChart);
|
||||
chartControl.Series.Add(mychart);
|
||||
chartControl.Skins = Skins.Metro;
|
||||
|
||||
|
||||
//axis1.OpposedPosition = true;
|
||||
axis.EdgeLabelsDrawingMode = ChartAxisEdgeLabelsDrawingMode.Shift;
|
||||
axis0.EdgeLabelsDrawingMode = ChartAxisEdgeLabelsDrawingMode.Shift;
|
||||
//axis1.EdgeLabelsDrawingMode = ChartAxisEdgeLabelsDrawingMode.Shift;
|
||||
|
||||
|
||||
return chartControl;
|
||||
}
|
||||
@@ -296,10 +289,14 @@ namespace SanSystem
|
||||
|
||||
inliner.AnfangAushaertung = struktures.Select(x => x.Zeitstempel).Min();
|
||||
inliner.EndeAushaertung = struktures.Select(x => x.Zeitstempel).Max();
|
||||
ChartControl chart = getGraph(struktures);
|
||||
if (chart == null) return false;
|
||||
ChartControl tempChart = getGraph(struktures,"Temperatur");
|
||||
if (tempChart == null) return false;
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user