Jump to content
Software FX Community

Q: How ValueToPixel() for 3D clustered chart?

User (Legacy)

Recommended Posts


When custom painting into the chart from C++ application

(Cfx4032.dll), I am faced with the problem of how to get

the pixel related to given value at given coordinates.

The attached sample shows probalby the problem better than

the following description.

The ValueToPixel() method returns only the coordination

related to the front wall of the chart. Moreover, it seems

that it produces very strange results when the chart is

switched to 3D clustered mode and then rotated.

The ValueToPixel() method returns pixel coordinates only for

given X and the value. The PaintInfo(CPI_MARKERTOPIXEL, ...)

method returns pixel coordinates of the marker (i.e. for

point (x) and serie (z) coordinates) -- but only for the

value related to the marker. Can these be somehow combined?

Also, the PaintInfo(CPI_MARKERTOPIXEL, ...) returns the

pixel in the middle of the front wall of the bar even in 3D

mode. How can I move the coordinations to the middle of the

ceiling of the 3D bar?

Thanks for you help,



Petr Prikryl (prikrylp at skil dot cz)

Link to comment
Share on other sites

"SoftwareFX Support" wrote...

> You can not use ValueToPixel in a 3D hart, you only similar

> function you can use is CPI_MARKERTOPIXEL as a an X,Y value

> is not enough to determine the position of a point (you need

> Z as well). -- FP Software FX, Inc.

Well I guessed that it could be so. What I need is to get

pixel coordinations for a different value than the point

has. I tried (successfully) to set temporarily the serie point

to a different value to obtain the pixel coordinations of

that value (and then the value of the point was set back).

The working example that demonstrates the problem

is attached.

The bug


When you try the sample, and switch the mode to 2D not

clustered, you may observe the bug in

PaintInfo(CPI_MARKERTOPIXEL, ...). Because the gallery type

for the second serie (index 1) is set to SCATTER and the

marker is set to MK_NONE to make the serie invisible, the

MARKERTOPIXEL returns the x coordination in the middle of

the area for painting the points of different series --

which is fine. The third serie (index 2) which is displayed

as a bar is moved slighly left in comparison with situation

when all series are bars. However, the

PaintInfo(CPI_MARKERTOPIXEL, ...) still returns the pixel

coordinations as if the second serie were the bar (i.e.

slightly moved to the right than expected). In the attached sample,

you can try to change the gallery type of the second serie to bar

through the toolbar to see the difference.

Am I doing something wrong or is it really a bug?

Another problem/bug?


When you try to switch the mode to 2D non clustered (in the

sample, let the second serie gallery type set to SCATTER),

the bars for the first, third, and forth series are painted

correctly. However, when you switch to 3D (through

toolbar), only the first serie bar is painted. The other two


The final problem


The ValueToPixel() is able to return the pixel coordinations

even for points (values) that are placed outside the painted

area of the chart (e.g. y value greater than y-max). When

drawing a line between the point that is inside the area and

the calculated point outside the are, the line is clipped,

but it has the correct angle.

When I try to use the PaintInfo(CPI_MARKERTOPIXEL, ...)

with the value of the point temporarily set to higher value than

y-max, then the returned coordinations belong to the point

where the bar (for example) is cut, not to the point where

the bar-end would be displayed if it was not cut.

Is there any workaround?

Thanks for your help,



Petr Prikryl (prikrylp at skil dot cz)

Link to comment
Share on other sites


This topic is now archived and is closed to further replies.

  • Create New...