Author |
Topic  |
|
marco
18 Posts |
Posted - 25 Nov 2003 : 09:02:48
|
FWI, I found a way to "hide" channels at run-time on a six channel multiline graph (chart2d). Since I'm not using the "autoscale" method for my YAxis, I'm using set values which start at zero, I simply set the values to YScaleMinValue - 100 and voila! the trace disapears. Since the graph is showing data in real time, you actualy see the value drop, but its something I can live with.
Marco |
|
quinncurtis
1164 Posts |
Posted - 25 Nov 2003 : 10:12:05
|
I think that you should also be able to assign a transparent color to a particular trace, leaving its data unchanged, but making it invisible. Use the plot object method
SetSegmentLineColor( int nsegment, Color rgbcolor) method
where the nsegment value is the trace number. Use the Color.FromArgb method to produce a tranparent color (alpha value = 0).
Color transparentColor = Color.FromArgb (0,128, 128,128); groupplotobj.SetSegmentLineColor( 3, transparentColor);
|
 |
|
marco
18 Posts |
Posted - 25 Nov 2003 : 17:15:47
|
Thank you. When refering to "groupplotobj", you are refering to the actual plot object,right? (in my case c_plot) I tried this the other day. My chart attributes dont get updated.
I added this to the top of my addNewPoints() method:
if(nCount > 1000) { Color transparentColor = Color.FromArgb (0,128, 128,128); c_Plot.SetSegmentLineColor( 2, transparentColor); nCount ++; }
just to be able to test and all colors stay the same.
In initializeGraph() i add each channel this way:
ChartAttribute attrib1 = new ChartAttribute(Color.Gray, 2,DashStyle.Solid, Color.Gray); ChartAttribute attrib2 = new ChartAttribute(Color.Yellow, 2,DashStyle.Solid, Color.Yellow); ChartAttribute attrib3 = new ChartAttribute(Color.Blue, 2,DashStyle.Solid, Color.Blue); ChartAttribute attrib4 = new ChartAttribute(Color.Green, 2,DashStyle.Solid, Color.Green); ChartAttribute attrib5 = new ChartAttribute(Color.Red, 2,DashStyle.Solid, Color.Red); ChartAttribute attrib6 = new ChartAttribute(Color.Brown, 2,DashStyle.Solid, Color.Brown);
Should I be creating the segments a different way?
Marco |
 |
|
quinncurtis
1164 Posts |
Posted - 25 Nov 2003 : 17:22:16
|
It is not clear if you are calling the ChartView.UpdateDraw method.
As after any changes to a plot object, you must call the ChartView.UpdateDraw method to force the object to redraw with the new attributes. |
 |
|
marco
18 Posts |
Posted - 25 Nov 2003 : 17:59:17
|
The way my program works is like this. Main class receives data. Main class manipulates data and "AddNewPoint()" to graph. After all points are added(about 10 calls to AddNewPoints()) Main class calls UpdateDraw(). I'm trying to reduce the amount of calls I do to the graph because it holds 300 points and my CPU usage goes through the roof otherwise.
Which brings me to something else (while I'm at it :))I've tried calling xAxis.CalculateAutoAxis() just before my updateDraw() call from MainClass, (meaning I just call it once even though I've added 20 new points each to six channels), but I still get HUGE cpu usage(99% on P4 2Gig). I realize the multiline plot has alot of calculating to do to update in real-time. Is there something else I could do to help reduce this. our clients probably wont be running P4's.
Marco |
 |
|
quinncurtis
1164 Posts |
Posted - 25 Nov 2003 : 18:26:30
|
I don't understand if the first part of your post means that you do call the UpdateDraw method after you change the color, or not. If you want the color to change, you must call it. You can accumulate changes and call UpdateDraw once, after which all changes will go into affect.
Are you saying that you have 6 traces of 300 points when you call the xAxisCalcAutoAxis ? Or are there more points. The CPU usage might go up for a fraction of a second, but it wouldn't stay there.
If, because you understand the way the data is collected, you can calculate the new x-axis minimum and maximum values without having to look at every x-value of every data point, don't use the CalculateAutoAxis method. Just set the minimum and maximum values explicitly, using the axis methods that do that. |
 |
|
|
Topic  |
|
|
|