Jump to content
Software FX Community

Intelligent (?) chart redraw


User (Legacy)
 Share

Recommended Posts

I need to send smaples to a chart in discrete clusters.

Everytime i send a cluster to Chartfx, it redraws ALL chart even if

AutoScale is set to false for both X and Y axes.

It gets slow when I send many clusters composed of few samples.

Is it by design, or I've made some mistake?

Isn't implemented some kind of double buffering technique?

Thank you in advance.

Lorenzo Saladini

Link to comment
Share on other sites

"SoftwareFX Support" <noreply@softwarefx.com> ha scritto nel messaggio

news:aqoqpAXTEHA.3080@webserver3.softwarefx.com...

> What do you mean by a "cluster".

I mean a set of values.

I have to draw a scatter (XY) chart, and don't know in advance how many

points will be drawn at all.

I store samples in a buffer as they are provided by another process (let's

say 100 at time) and then send these samples (XY values) to chartfx.

>

> Unless you use the Real-Time features in Chart FX (see programmer's guide

on

> Real Time Charts), the whole chart will be redrawn every time you add a

> value or change one.

OK i see the point, but the first step of creating real timne charts is

"Set the CT_EVENSPACING to the chart type using the TypeMask property

(either at design or running time)."

and I have to draw a scatter plot (X values are not evenly spaced!).

So I guess Real-Time charts are not compatible with XY scatter charts.

Isn't it right?

Thank you again for your attention.

>

> --

> FP

> Software FX

>

>

Link to comment
Share on other sites

Are you adding points or replacing existing points ?

If you are adding points, and re-allocating the data everytime, the

performance hit may be caused here as old data is copied into the new memory

block instead of in the drawing itself.

If he scale isn't changing, you could prevent a full re-paint but I don't

think you will be gaining much as far as performance unless you are painting

100's of 1000's of points. Are you ?

The want to do this is by calling CloseData with COD_NOINVALIDATE you will

prevent Chart FX from re-drawing, however, you will need to use

MarkerToPixel to find out the position of each of the changed points and

invalidate those using standard Windows API (InvalidateRect).

--

FP

Software FX

Link to comment
Share on other sites

I'm adding points.

I need:

* to add points in small sets

* to view newly added points

* to add a total amount of (about) 100.000

Adding points in sets composed of 100 points makes 1.000 sets to add.

Thus if component redraws entire chart 1.000 times, one for each added set,

with an average of 50K points we have ..... a total amount of 50 M points

drawn!

I understand that either resizing or rescaling the chart would cause

component to re-draw the entire chart anyway, but

with a fixed size and a fixed scale, I would need a redraw policy which only

draws new (added) points over the existing ones.

Lorenzo Saladini

"SoftwareFX Support" <noreply@softwarefx.com> ha scritto nel messaggio

news:s87blBaTEHA.3152@webserver3.softwarefx.com...

> Are you adding points or replacing existing points ?

>

> If you are adding points, and re-allocating the data everytime, the

> performance hit may be caused here as old data is copied into the new

memory

> block instead of in the drawing itself.

>

> If he scale isn't changing, you could prevent a full re-paint but I don't

> think you will be gaining much as far as performance unless you are

painting

> 100's of 1000's of points. Are you ?

>

> The want to do this is by calling CloseData with COD_NOINVALIDATE you will

> prevent Chart FX from re-drawing, however, you will need to use

> MarkerToPixel to find out the position of each of the changed points and

> invalidate those using standard Windows API (InvalidateRect).

>

> --

> FP

> Software FX

>

>

Link to comment
Share on other sites

Since points can be added anywhere (end, middle, scattered across the chart)

we can not optimized this re-draw.

Since you know how your data is, maybe you are always updating a cluster of

points at the end or you can determine the range in which those points are

you can do this in your program using COD_NOINVALIDATE, MarkerToPixel and/or

ValueToPixel (if you have a range).

Also, as I mentioned in my previous posting, you need to measure the time

that is taking to pass your data vs. the time it is taking to draw it.

If a lot of time is spent passing the data you may want to pre-allocate

bigger chunks and initialize them with CHART_HIDDEN, then one a new set of

data comes, you simply make them visible.

--

FP

Software FX

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...