Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Graph
- {
- public Panel panel;
- public Label name;
- public Label value;
- private Chart chart;
- public Graph()
- {
- panel = forms.CHelper.mkC<Panel>("", 540, 30, 302, 225);
- panel.BackColor = Color.FromArgb(150, 200, 255);
- panel.BorderStyle = BorderStyle.FixedSingle;
- name = forms.CHelper.mkC<Label>("", 3, 3, 80, 20);
- name.Text = "Volt";
- panel.Controls.Add(name);
- value = forms.CHelper.mkC<Label>("", 103, 3, 150, 20);
- value.Text = "421321.432 ( OK)";
- panel.Controls.Add(value);
- Label l = forms.CHelper.mkC<Label>("", 250, 3, 80, 20);
- l.Text = "OPT";
- panel.Controls.Add(l);
- double[] yValues = { 1, 0, 0, 1, 2, 3, 0 };
- string[] xValues = { "", "", "", "", "", "", "" };
- double[] yValues2 = { -2, -2, -2, -2, -2, -2, -2 };
- string[] xValues2 = { "", "", "", "", "", "", "" };
- chart = new Chart();
- Series series = new Series();
- series.ChartType = SeriesChartType.StackedArea;
- series.Color = Color.FromArgb(140, 255, 0, 0);
- series.BorderWidth = 1;
- chart.Series.Add(series);
- series = new Series();
- series.ChartType = SeriesChartType.StepLine;
- series.Color = Color.FromArgb(0, 0, 0);
- chart.Series.Add(series);
- chart.Series[1].Points.DataBindXY(xValues, yValues);
- chart.Series[0].Points.DataBindXY(xValues2, yValues2);
- ChartArea chartArea = new ChartArea();
- Axis yAxis = new Axis(chartArea, AxisName.Y);
- Axis xAxis = new Axis(chartArea, AxisName.X);
- chart.ChartAreas.Add(chartArea);
- chart.ChartAreas[0].BackColor = Color.FromArgb(180, 255, 255, 255);
- chart.ChartAreas[0].AxisY.Maximum = 8;
- chart.ChartAreas[0].AxisY.Minimum = -2;
- chart.ChartAreas[0].AxisY.Interval = 2;
- chart.ChartAreas[0].AxisX.Minimum = 1;
- chart.ChartAreas[0].AxisY.MajorGrid.LineDashStyle = ChartDashStyle.Solid;
- chart.ChartAreas[0].AxisX.MajorGrid.LineDashStyle = ChartDashStyle.Solid;
- chart.ChartAreas[0].AxisY.MajorGrid.LineColor = Color.FromArgb(100, 0, 0, 0);
- chart.ChartAreas[0].AxisX.MajorGrid.LineColor = Color.FromArgb(100, 0, 0, 0);
- chart.ChartAreas[0].AxisY.LineColor = Color.FromArgb(100, 0, 0, 0);
- chart.ChartAreas[0].AxisX.LineColor = Color.FromArgb(100, 0, 0, 0);
- chart.Size = new Size(310, 200);
- chart.Location = new Point(-5, 24);
- chart.BackColor = Color.Transparent;
- panel.Controls.Add(chart);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement