Page 1 of 1

Drawing triangles

Posted: Fri Jun 04, 2004 1:45 pm
by 8576535
Hi,

I've been using the shape series for displaying information, in a 3x3 grid. Thus I'd position 9 squares in the appropriate slot, and use colour and the text to indicate the value for that part of the grid. I use the 3D display, so it looks nice. That is simplified, but it shows the current state.

Now, I really need to split each square in the grid into two, and would really like to use triangles, where the current square is sliced diagonally. The shape (in version 6 - I see no change mentioned in v7) doesn't do such triangles. Is there a way to make it do so? I could (I think) do some custom drawing, but then I'd lose the 3D effect unless that can be added automatically.

If there was something in v7 that made this easy I'd buy the upgrade, but I can't see anything.

All thoughts welcome!

Thanks, Matthew

Posted: Tue Jun 08, 2004 10:51 am
by 8576535
Well, given no formal response, I'll describe how I've got on so far. I'm now using the TeeCanvas3D Triangle3D function, and the RectangleZ in addition to draw my own triangles. It does at least work, even if I must to it myself in the OnBeforeSeriesDraw.

My only problem now is with the axis, which I can't seem to control explicitly in any way. I can only add labels if I have a series so I've got a hidden series. But they don't get updated properly for some reason until the second time around. I wish for a function to "recalc axis info" so if anyone knows of anything (is there any support around here?) then I'd love to know.

Matthew

Posted: Tue Jun 08, 2004 4:08 pm
by Pep
Hi Matthew,
now using the TeeCanvas3D Triangle3D function, and the RectangleZ in addition to draw my own triangles. It does at least work, even if I must to it myself in the OnBeforeSeriesDraw.
You've choosed the correct way ..
But they don't get updated properly for some reason until the second time around. I wish for a function to "recalc axis info" so if anyone knows of
Could you please post the code that you're using and getting this problem ?

Posted: Tue Jun 08, 2004 7:11 pm
by 8576535
Thanks for the response. I've now sort of solved it. The funny thing was that the second time round it would work, but not the first time the form was loaded. Fortunately Codesite allowed me to see what was happening.

My code was basically as follows:
var
rBlockRect : TRect;

rBlockRect := ChartRisk.ChartRect;
nSegWidthY := (rBlockRect.Right - rBlockRect.Left) div (ItemCount);

What happened was that the ChartRect was 0,0,0,0 when the chart was just being created, and my index series was being set using multiples of the width (and height). Since that was all zero, it didn't have a useful effect. So it wasn't the axis getting it wrong, but the graph info being wrong. The solution I found was to call ChartRisk.ReCalcWidthHeight before this call, which then gives a proper response to ChartRect and all works fine.

It does though raise an interesting error, but I'll post another test for that shortly.

Thanks,

Matthew