Verweise geändert
This commit is contained in:
@@ -17,18 +17,24 @@ namespace SanSystem
|
||||
public FrmLinerChart()
|
||||
{
|
||||
InitializeComponent();
|
||||
ChartAxis axis = chartControl1.PrimaryYAxis;
|
||||
|
||||
}
|
||||
|
||||
public void SaveChart()
|
||||
{
|
||||
Size size = new Size(800, 400);
|
||||
ChartControl chartControl = new ChartControl();
|
||||
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();
|
||||
|
||||
chartControl1.Axes.Add(axis0);
|
||||
chartControl1.Axes.Add(axis1);
|
||||
|
||||
|
||||
|
||||
chartControl.Axes.Add(axis0);
|
||||
chartControl.Axes.Add(axis1);
|
||||
|
||||
layout1.Spacing = 12;
|
||||
layout2.Spacing = 12;
|
||||
@@ -36,8 +42,8 @@ namespace SanSystem
|
||||
layout2.Axes.Add(axis0);
|
||||
layout2.Axes.Add(axis1);
|
||||
|
||||
chartControl1.ChartArea.YLayouts.Add(layout1);
|
||||
chartControl1.ChartArea.YLayouts.Add(layout2);
|
||||
chartControl.ChartArea.YLayouts.Add(layout1);
|
||||
chartControl.ChartArea.YLayouts.Add(layout2);
|
||||
|
||||
ChartSeries temperaturChart = new ChartSeries("Temperatur", ChartSeriesType.Line);
|
||||
ChartSeries druckChart = new ChartSeries("Druck", ChartSeriesType.Line);
|
||||
@@ -48,13 +54,13 @@ namespace SanSystem
|
||||
{
|
||||
string[] parts = pars.Split(',');
|
||||
if (parts[0].Equals("Group1") || parts[1].Equals("(END)")) continue;
|
||||
double temperatur = double.Parse(parts[1].Replace('.',','));
|
||||
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;
|
||||
@@ -65,22 +71,22 @@ namespace SanSystem
|
||||
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;
|
||||
|
||||
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;
|
||||
chartControl1.Axes.Add(chartAxis);
|
||||
|
||||
chartControl1.Series.Add(temperaturChart);
|
||||
chartControl1.Series.Add(druckChart);
|
||||
chartControl1.Skins = Skins.Metro;
|
||||
chartControl.Axes.Add(chartAxis);
|
||||
|
||||
chartControl.Series.Add(temperaturChart);
|
||||
chartControl.Series.Add(druckChart);
|
||||
chartControl.Skins = Skins.Metro;
|
||||
|
||||
|
||||
axis1.OpposedPosition = true;
|
||||
@@ -88,7 +94,12 @@ namespace SanSystem
|
||||
axis0.EdgeLabelsDrawingMode = ChartAxisEdgeLabelsDrawingMode.Shift;
|
||||
axis1.EdgeLabelsDrawingMode = ChartAxisEdgeLabelsDrawingMode.Shift;
|
||||
|
||||
chartControl1.SaveImage("./temp.jpg");
|
||||
chartControl.SaveImage("./temp.jpg");
|
||||
}
|
||||
|
||||
private void button1_Click(object sender, EventArgs e)
|
||||
{
|
||||
SaveChart();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user