Jump to content
Software FX Community

How to Optimize Graph Rendering Speeds


User (Legacy)
 Share

Recommended Posts

To anyone who can answer this,

I'm using VB6 with the Chart FX OCX, version 5.0.9.0 on Windows 2000

machines, one a 800MHz P4 workstation and another 600MHz P3 Celeron laptop.

My question has to do with graph rendering speed. I'm getting some

performance results which don't seem to make much sense.

I have a device streaming data values at 20 updates per second. These are

displayed on an X/Y graph in real time. The graph has one series with a

maximum of 30,000 data points. The user can select variable X axis modes so

that either all 30,000 points are shown at once, or a moving window with 600

points at one time is shown. I'm using the SetScrollView() method to scroll

the graph in real time for the 600 point mode, and using the COD_SMOOTH

modifier when I add data to prevent annoying flicker. Everything works fine

but the odd thing is that CPU utilization goes close to 100% when I set the

graph in the 30,000 point (full view) mode. In this mode, the axis is fixed

and ChartFX simply has to "draw in" the data for the series. This should be

the fastest mode. In the other mode, ChartFX has to draw in the series

data, update the X axis labels, scroll the X axis, and scroll the data, yet

CPU useage is less than 50% for this mode on my workstation. Why would this

be, and is there a setting I could use to optimize the full view mode to

increase rendering speed? I'm using the .MaxValues property to set the

number of data points and I use the COD_UNCHANGE modifier when I add data

via OpenDataEx. I have data point markers turned off as well.

thanks,

Gary Kercheck

Advanced Energy, Inc.

Link to comment
Share on other sites

"Gary Kercheck" <gary.kercheck@aei.com> wrote in message

news:7idr4lq3CHA.3068@webserver1.softwarefx.com...

> I'm using the .MaxValues property to set the

> number of data points and I use the COD_UNCHANGE modifier when I add data

> via OpenDataEx. I have data point markers turned off as well.

One other quick detail: I'm using the CHART_HIDDEN property on all the

elements of the data series prior to filling the chart. This lets me

effectively "erase" the design time data points and overwrite them as "real"

data is streamed from my device.

Link to comment
Share on other sites

So, let me see if I understand, you want to refresh a 30,000 points chart 20

times a second ?

Even though this may seem the "simple" case, the most time is consume

drawing not calculating or scrolling, so in fact having a 600 point view and

scrolling into position every time you get a new point is much faster as the

actual drawing (the heaviest process) is only done for 600 points.

How long is the chart taking to draw ? What type of chart is it (Line, Bar ?

2D, 3D ?) ?

--

FP

Software FX, Inc.

Link to comment
Share on other sites

"SoftwareFX Support" <support@softwarefx.com> wrote in message

news:PK2ttnz3CHA.3068@webserver1.softwarefx.com...

> So, let me see if I understand, you want to refresh a 30,000 points chart

20

> times a second ?

I'm only refreshing 20 points a second out of that chart. the other 29,980

points are not changing.

> Even though this may seem the "simple" case, the most time is consume

> drawing not calculating or scrolling, so in fact having a 600 point view

and

> scrolling into position every time you get a new point is much faster as

the

> actual drawing (the heaviest process) is only done for 600 points.

That makes sense. Again, what I'm trying to get ChartFx to do is just to

draw twenty new points per second on the 30,000 point view, not redraw all

30,000 points every time data comes in. Is there a way to do this using

OpenDataEx()? When I call this method, I'm using the 'COD_VALUES,

COD_UNCHANGE, COD_UNCHANGE' modifiers in

the OpenDataEx() call and the "COD_VALUES Or COD_SMOOTH" modifiers on the

CloseData() call. I am not looping through all 30,000 YValues() on the

series, either.

> How long is the chart taking to draw ? What type of chart is it (Line, Bar

?

> 2D, 3D ?) ?

I'ts a 2D line chart.

I appreciate your help trying to work through this!

Gary

Link to comment
Share on other sites

> I'm only refreshing 20 points a second out of that chart.  the other

29,980

> points are not changing.

You are only changing 20 points but all 30,000 points are redrawn. So

whether you change 1 or 30,000 the painting time will be the same .The time

it takes to change the points will vary, but after they are changed the time

it takes to draw the chart is the same.

> Is there a way to do this using

> OpenDataEx()? When I call this method, I'm using the 'COD_VALUES,

> COD_UNCHANGE, COD_UNCHANGE' modifiers in

> the OpenDataEx() call and the "COD_VALUES Or COD_SMOOTH" modifiers on the

> CloseData() call.

I'm afraid not, there is no way to redraw only a few points as the drawing

algorithm sweeps all the points. So in conclusion I don't think you can get

a better performance if what you are getting right now as long as you

display this many points (30,000) at the same time.

However, even with this chart I can get over 100 draws per second in a

simple line chart on a 1 GHZ Pentium. That's 3,000,000 points drawn every

second. I don't think you can get better than that using a generic charting

tool like ours.

One thing you could do to improve this is to reduce the number of points, if

you reduce the number of points from 30,000 to say 10,000 I don't think the

user is going to see the difference (the screen is less than 2000 pixels

wide) so if you can somehow reduce this number by means of averaging values

or a similar function you could improve the performance significantly.

--

FP

Software FX, Inc.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...