A
AndiAA
Guest
Hi there,
I hope somebody can help me.
I'm trying to create a chart in c#.
My Data is provided in timestamps in seconds and other data.
My Problem is to create the x axis with hour 0 - 23h.
My Code so far:
double[] timestamps = { 0, 337, 675, 1012, 1350, 1687, 2025, 2362, 2700, 3037, 3375, 3712, 4050, 4387, 4725, 5062, 5400, 5737, 6075, 6412, 6750, 7087, 7425, 7762, 8100, 8437, 8775, 9112, 9450, 9787, 10125, 10462, 10800, 11137, 11475, 11812, 12150, 12487, 12825, 13162, 13500, 13837, 14175, 14512, 14850, 15187, 15525, 15862, 16200, 16537, 16875, 17212, 17550, 17887, 18225, 18562, 18900, 19237, 19575, 19912, 20250, 20587, 20925, 21262, 21600, 21937, 22275, 22612, 22950, 23287, 23625, 23962, 24300, 24637, 24975, 25312, 25650, 25987, 26325, 26662, 27000, 27337, 27675, 28012, 28350, 28687, 29025, 29362, 29700, 30037, 30375, 30712, 31050, 31387, 31725, 32062, 32400, 32737, 33075, 33412, 33750, 34087, 34425, 34762, 35100, 35437, 35775, 36112, 36450, 36787, 37125, 37462, 37800, 38137, 38475, 38812, 39150, 39487, 39825, 40162, 40500, 40837, 41175, 41512, 41850, 42187, 42525, 42862};
double[] peaks = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 666, 2443, 3998, 6072, 8293, 10663, 12662, 15254, 17920, 20067, 22807, 25621, 27917, 30805, 33619, 36433, 38728, 41468, 44134, 46281, 48799, 51243, 53094, 55241, 57315, 58796, 60499, 62054, 63461, 64424, 65460, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65312, 64868, 64350, 63831, 63387, 62795, 62202, 61684, 61091, 60425, 59833, 59166, 58426, 57611, 57019, 56130, 55241, 54501, 53538, 52576, 51687, 50576, 49465, 48207, 47244, 45911, 44504, 43319, 41838, 40283, 39024, 37321, 35618, 34211, 32434, 30582, 28731, 27250, 25251, 23326, 21696, 19697, 17624, 15994, 13921, 11848, 9700, 7997, 5850, 3702, 1999 };
Series peak_white = new Series("White");
for (int i = 0; i < timestamps.Length; i++)
{
peak_white.Points.AddXY(timestamps/3600, peaks);
}
peak_white.Name = "White";
peak_white.Color = Color.Yellow;
peak_white.ChartType = SeriesChartType.Spline;
peak_white.ToolTip = "#SERIESNAME : X=#VALX, Y=#VALY";
peak_white.MarkerSize = 5;
peak_white.MarkerStyle = MarkerStyle.Square;
chart1.ChartAreas[0].AxisY.Minimum = 0;
chart1.ChartAreas[0].AxisY.Maximum = 65535;
chart1.ChartAreas[0].AxisX.IntervalType = DateTimeIntervalType.Hours;
chart1.ChartAreas[0].AxisX.Minimum = 0;
chart1.ChartAreas[0].AxisX.Maximum = 23;
chart1.ChartAreas[0].AxisX.Interval = 1;
chart1.ChartAreas[0].AxisX.LabelStyle.Format = "HH:mm";
chart1.Series.Add(peak_white);
}
}
}
Kind regards,
Andreas
Continue reading...
I hope somebody can help me.
I'm trying to create a chart in c#.
My Data is provided in timestamps in seconds and other data.
My Problem is to create the x axis with hour 0 - 23h.
My Code so far:
double[] timestamps = { 0, 337, 675, 1012, 1350, 1687, 2025, 2362, 2700, 3037, 3375, 3712, 4050, 4387, 4725, 5062, 5400, 5737, 6075, 6412, 6750, 7087, 7425, 7762, 8100, 8437, 8775, 9112, 9450, 9787, 10125, 10462, 10800, 11137, 11475, 11812, 12150, 12487, 12825, 13162, 13500, 13837, 14175, 14512, 14850, 15187, 15525, 15862, 16200, 16537, 16875, 17212, 17550, 17887, 18225, 18562, 18900, 19237, 19575, 19912, 20250, 20587, 20925, 21262, 21600, 21937, 22275, 22612, 22950, 23287, 23625, 23962, 24300, 24637, 24975, 25312, 25650, 25987, 26325, 26662, 27000, 27337, 27675, 28012, 28350, 28687, 29025, 29362, 29700, 30037, 30375, 30712, 31050, 31387, 31725, 32062, 32400, 32737, 33075, 33412, 33750, 34087, 34425, 34762, 35100, 35437, 35775, 36112, 36450, 36787, 37125, 37462, 37800, 38137, 38475, 38812, 39150, 39487, 39825, 40162, 40500, 40837, 41175, 41512, 41850, 42187, 42525, 42862};
double[] peaks = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 666, 2443, 3998, 6072, 8293, 10663, 12662, 15254, 17920, 20067, 22807, 25621, 27917, 30805, 33619, 36433, 38728, 41468, 44134, 46281, 48799, 51243, 53094, 55241, 57315, 58796, 60499, 62054, 63461, 64424, 65460, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65312, 64868, 64350, 63831, 63387, 62795, 62202, 61684, 61091, 60425, 59833, 59166, 58426, 57611, 57019, 56130, 55241, 54501, 53538, 52576, 51687, 50576, 49465, 48207, 47244, 45911, 44504, 43319, 41838, 40283, 39024, 37321, 35618, 34211, 32434, 30582, 28731, 27250, 25251, 23326, 21696, 19697, 17624, 15994, 13921, 11848, 9700, 7997, 5850, 3702, 1999 };
Series peak_white = new Series("White");
for (int i = 0; i < timestamps.Length; i++)
{
peak_white.Points.AddXY(timestamps/3600, peaks);
}
peak_white.Name = "White";
peak_white.Color = Color.Yellow;
peak_white.ChartType = SeriesChartType.Spline;
peak_white.ToolTip = "#SERIESNAME : X=#VALX, Y=#VALY";
peak_white.MarkerSize = 5;
peak_white.MarkerStyle = MarkerStyle.Square;
chart1.ChartAreas[0].AxisY.Minimum = 0;
chart1.ChartAreas[0].AxisY.Maximum = 65535;
chart1.ChartAreas[0].AxisX.IntervalType = DateTimeIntervalType.Hours;
chart1.ChartAreas[0].AxisX.Minimum = 0;
chart1.ChartAreas[0].AxisX.Maximum = 23;
chart1.ChartAreas[0].AxisX.Interval = 1;
chart1.ChartAreas[0].AxisX.LabelStyle.Format = "HH:mm";
chart1.Series.Add(peak_white);
}
}
}
Kind regards,
Andreas
Continue reading...