Profile Picture

Active Real Time Graph

Posted By Daniel Csimszi 11 Years Ago
Author
Message
Daniel Csimszi
Posted 11 Years Ago
View Quick Profile
Forum Guru

Forum Guru (50 reputation)Forum Guru (50 reputation)Forum Guru (50 reputation)Forum Guru (50 reputation)Forum Guru (50 reputation)Forum Guru (50 reputation)Forum Guru (50 reputation)Forum Guru (50 reputation)Forum Guru (50 reputation)

Group: Forum Members
Last Active: 8 Years Ago
Posts: 61, Visits: 35
Hi,

I am trying to create a real time graph with multiple lines in it.
The number of lines are always different and it is possible that this number changes while the graph already running.

All of the lines need to have separate Y axis but I always just want to display one of those, but I still will display the max and min values of the axis on the top and bottom.

I wrote a method which should add the lines to the graph, but it does not seems to be working.

this is my method:

private void addNormalLine(int i)
{
// add line
NLineSeries line = new NLineSeries();
line = (NLineSeries)m_Chart.Series.Add(SeriesType.Line);
line.MultiLineMode = MultiLineMode.Series;
line.DataLabelStyle.Visible = false;
line.Values.ValueFormatter = new NNumericValueFormatter("0.0");
line.BorderStyle.Color = colors[i % 16];
line.BorderStyle.Width = new NLength(1, NGraphicsUnit.Pixel);
line.MarkerStyle.BorderStyle.Color = colors[i % 16];
line.MarkerStyle.FillStyle = new NColorFillStyle(colors[i % 16]);
line.DataLabelStyle.TextStyle.BackplaneStyle.Visible = false;
line.DataLabelStyle.ArrowStrokeStyle.Width = new NLength(0, NGraphicsUnit.Pixel);
line.DataLabelStyle.ArrowLength = new NLength(2.5f, NRelativeUnit.ParentPercentage);
line.DataLabelStyle.TextStyle.FontStyle = new NFontStyle("Arial", 8);

//set the axis of the line
NAxis axis = ((NCartesianAxisCollection)m_Chart.Axes).AddCustomAxis(AxisOrientation.Vertical, AxisDockZone.FrontLeft);
axisList.Add(axis);

NLinearScaleConfigurator linearScale;

linearScale = new NLinearScaleConfigurator();
axis.ScaleConfigurator = linearScale;

linearScale.RulerStyle.FillStyle = new NColorFillStyle(colors[i % 16]);
linearScale.RulerStyle.BorderStyle.Color = colors[i % 16];
linearScale.InnerMajorTickStyle.LineStyle.Color = colors[i % 16];
linearScale.OuterMajorTickStyle.LineStyle.Color = colors[i % 16];
linearScale.MajorGridStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Back, ChartWallType.Left };
linearScale.LabelStyle.TextStyle.FillStyle = new NColorFillStyle(colors[i % 16]);

//set the axis of the line
m_Chart.Axis(axis.AxisId).View = new NRangeAxisView(new NRange1DD(50, 100));
line.DisplayOnAxis(StandardAxis.PrimaryY, false);
line.DisplayOnAxis(axisList[i].AxisId, true);


//axisList[i].Anchor = new NDockAxisAnchor(AxisDockZone.FrontLeft, true);

lineList.Add(line);

nChartControl1.Refresh();
}

If anyone could point out any mistake of mine it would be great.

When the code divided to parts then it works. I mean When I have set number of lines then first I create all of the lines then all of the axis then set the linear scale for all of the axis and for last I attach the lines to the axis.

I do not really get why it works when I build up everything separate then building up the whole stuff line by line.

Edit:

I manage to make it kind of work, there is just one thing now, it is missing the second axis, its always the second one, and I can not find the reason why.

Regards
Daniel

Daniel Csimszi
Posted 11 Years Ago
View Quick Profile
Forum Guru

Forum Guru (50 reputation)Forum Guru (50 reputation)Forum Guru (50 reputation)Forum Guru (50 reputation)Forum Guru (50 reputation)Forum Guru (50 reputation)Forum Guru (50 reputation)Forum Guru (50 reputation)Forum Guru (50 reputation)

Group: Forum Members
Last Active: 8 Years Ago
Posts: 61, Visits: 35
Hi,

It's sorted. My problem was with my auto scaling method. I forgot that it sets the value of the 2nd axis(code from previous try). It is working now.

One more questions, is nevron have a built in function for auto scaling?

Daniel

Nevron Support
Posted 11 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)

Group: Forum Members
Last Active: Last Week
Posts: 3,054, Visits: 4,009
Hi Daniel,

What do you mean by auto scaling?

Best Regards,
Nevron Support Team



Daniel Csimszi
Posted 11 Years Ago
View Quick Profile
Forum Guru

Forum Guru (50 reputation)Forum Guru (50 reputation)Forum Guru (50 reputation)Forum Guru (50 reputation)Forum Guru (50 reputation)Forum Guru (50 reputation)Forum Guru (50 reputation)Forum Guru (50 reputation)Forum Guru (50 reputation)

Group: Forum Members
Last Active: 8 Years Ago
Posts: 61, Visits: 35
I mean, as I have a real time graph the the values keep changing on it. Say my scale is between 0 and 100 then I insert a value 150, I would like from the scale to change to 0 - 150.

Daniel

Daniel Csimszi
Posted 11 Years Ago
View Quick Profile
Forum Guru

Forum Guru (50 reputation)Forum Guru (50 reputation)Forum Guru (50 reputation)Forum Guru (50 reputation)Forum Guru (50 reputation)Forum Guru (50 reputation)Forum Guru (50 reputation)Forum Guru (50 reputation)Forum Guru (50 reputation)

Group: Forum Members
Last Active: 8 Years Ago
Posts: 61, Visits: 35
I have another question regarding my first one. As I changed to multiple Y axis without my primary Y my whole X axis got messed up, I use a date time X axis, it was perfect but now it start in 30-dec-99.
My X axis is set as primary X axis.

Do I need to set a primary Y? If i do that, than my Y axis move around.
Do I need to set the X axis of each line? If yes how?
Do I need to add other X axis? I would like to keep just one primary, all of the lines has 1 X axis but their own Y axis.


Daniel

Nevron Support
Posted 11 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)

Group: Forum Members
Last Active: Last Week
Posts: 3,054, Visits: 4,009
Hi Daniel,

By default all axes will scale to accommodate the range of values displayed on them. This is usually overridden when you specify a fixed axis view:

someAxis(StandardAxis.PrimaryY).View = new NRangeAxisView(new NRange1DD(0, 150), true, true);

To revert back to automatic axis scale you need to use content view:

someAxis(StandardAxis.PrimaryY).View = new NContentAxisView();

You probably have a line series which does not use x values (UseXValues is set to false) or those x values contain zero - which maps to the end 1899.

Hope this helps - let us know if you meet any problems.


Best Regards,
Nevron Support Team



Daniel Csimszi
Posted 11 Years Ago
View Quick Profile
Forum Guru

Forum Guru (50 reputation)Forum Guru (50 reputation)Forum Guru (50 reputation)Forum Guru (50 reputation)Forum Guru (50 reputation)Forum Guru (50 reputation)Forum Guru (50 reputation)Forum Guru (50 reputation)Forum Guru (50 reputation)

Group: Forum Members
Last Active: 8 Years Ago
Posts: 61, Visits: 35
Hi,

You was right, it was the use X values variable.

Would it be possible to set the minimum value of the graph but leave the max value blank(so it changes automatic)?

So instead of "someAxis(StandardAxis.PrimaryY).View = new NContentAxisView();"
use: someAxis(StandardAxis.PrimaryY).View = new NContentAxisView(minAxisValue);

Thank you
Daniel



Similar Topics


Reading This Topic