Dear Master,
I trying make a zedgraph plotter system in C# in the temperature measurement system, and successfully to graph serial data. But the direction is not linear, it's mean the lower temperature not placed in the first time but in the end of time. This is my code:
can I change the plot graph direction to be linear? how I can do that?
Thanks for your help
regards
Nanang
What I have tried:
<pre lang="C#">
GraphPane myPane = ZedGraphControl1.GraphPane;
myPane.Title.Text = "Temperature vs. Time";
myPane.Title.FontSpec.FontColor = Color.Black;
myPane.XAxis.Title.Text = "Time (Sec)";
myPane.XAxis.Title.FontSpec.FontColor = Color.Black;
myPane.YAxis.Title.Text = "Temperature (Celcius)";
myPane.YAxis.Title.FontSpec.FontColor = Color.Black;
myPane.Fill = new Fill(Color.FromArgb(255, 255, 245), Color.FromArgb(255, 255, 190), 90F);
myPane.Chart.Fill = new Fill(Color.FromArgb(255, 255, 245), Color.FromArgb(255, 255, 190), 90F);
myPane.XAxis.Scale.FontSpec.IsAntiAlias = true;
myPane.YAxis.Scale.FontSpec.IsAntiAlias = true;
myPane.XAxis.MajorGrid.IsVisible = true;
myPane.XAxis.MajorGrid.Color = Color.LightGray;
myPane.YAxis.MajorGrid.IsVisible = true;
myPane.YAxis.MajorGrid.Color = Color.LightGray;
ZedGraphControl1.IsShowPointValues = true;
ZedGraphControl1.PointValueEvent += new ZedGraphControl.PointValueHandler(PointValueHandler);
ZedGraphControl1.IsShowHScrollBar = true;
ZedGraphControl1.IsAutoScrollRange = true;
ZedGraphControl1.ScrollGrace = 0.1;
ZedGraphControl1.IsEnableHPan = true;
ZedGraphControl1.IsEnableHZoom = true;
ZedGraphControl1.IsEnableVPan = false;
ZedGraphControl1.IsEnableVZoom = false;
ZedGraphControl1.GraphPane.IsBoundedRanges = true;
myPane.Margin.All = 10;
myPane.XAxis.Scale.BaseTic = 0;
myPane.YAxis.Scale.BaseTic = 0;
myPane.XAxis.Scale.Min = 0.0;
myPane.XAxis.Scale.MinorStep = 5;
myPane.XAxis.Scale.MajorStep = 10;
myPane.YAxis.Scale.Min = 0;
myPane.YAxis.Scale.Max = 400;
myPane.YAxis.Scale.MinorStep = 5;
myPane.YAxis.Scale.MajorStep = 10;
RollingPointPairList list = new RollingPointPairList(7400);
myPane.AxisChange();
private void initCurves()
{
PointPairList list1 = new PointPairList();
PointPairList list2 = new PointPairList();
PointPairList list3 = new PointPairList();
Samples = 10000;
NoOfCurves = 3;
for (int j = 0; j < NoOfCurves; j++)
{
PointPairList tempppl = new PointPairList();
for (double x = 0; x < Samples; x++)
{
tempppl.Add(x, -1);
}
list1.Add(tempppl);
list2.Add(tempppl);
list3.Add(tempppl);
}
ZedGraphControl1.GraphPane.AddCurve("Thermocouple #1",list1, Color.Red, SymbolType.None);
ZedGraphControl1.GraphPane.AddCurve("Thermocouple #2", list2, Color.Blue, SymbolType.None);
ZedGraphControl1.GraphPane.AddCurve("Thermocouple #3", list3, Color.Brown, SymbolType.None);
ZedGraphControl1.AxisChange();
}</pre>