Quinn-Curtis Forums
Quinn-Curtis Forums
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Tools for Microsoft .Net & .Net Compact Framework
 QCChart2D and QCChart2D CF (VB and C#)
 removing channels from multiline graph at runtime
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

marco

18 Posts

Posted - 25 Nov 2003 :  09:02:48  Show Profile  Reply with Quote
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  Show Profile  Reply with Quote
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);

Go to Top of Page

marco

18 Posts

Posted - 25 Nov 2003 :  17:15:47  Show Profile  Reply with Quote
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
Go to Top of Page

quinncurtis

1164 Posts

Posted - 25 Nov 2003 :  17:22:16  Show Profile  Reply with Quote
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.
Go to Top of Page

marco

18 Posts

Posted - 25 Nov 2003 :  17:59:17  Show Profile  Reply with Quote
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
Go to Top of Page

quinncurtis

1164 Posts

Posted - 25 Nov 2003 :  18:26:30  Show Profile  Reply with Quote
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.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
Quinn-Curtis Forums © 2000-07 Quinn-Curtis, Inc. Go To Top Of Page
Powered By: Snitz Forums 2000 Version 3.4.07