Re: Segments
- From: "Ivar" <ivar.ekstromer000@xxxxxxxxxxxx>
- Date: Fri, 31 Mar 2006 12:12:02 GMT
Ah! you have spotted my problem with the 3D effect and the segment points on
the circumference. It's been a few weeks since I last looked at the drawing
sub for the pie charts so I forgot this. On the form there are two pie
charts, one on the left, one on the right. The aspect ratio between the
height and the width of the pies is the same as the form, so, unless it's a
square form then the pie charts width will be more than the height. (the
form is sizable and defaults to maximised, and the charts get redrawn if the
form is resized)
I'm going to rewrite it so that the pies have solid colours and change an
RGB pixel colour when the number of segments exceed the number of colours.
That's a good idea.
As far as finding those segment points goes, I'm clueless about where to
begin if the pie chart is not a perfect circle.
I would still like to apply the 3D effect to the charts, if you can come up
with the magic formula that calculates the end points of the segments in an
elliptical chart then I would be very interested to see it.
Thanks
Ivar
"Rick Rothstein" <rickNOSPAMnews@xxxxxxxxxxxxxxxxx> wrote in message
news:QaydncgiP7MqWLHZnZ2dnUVZ_vqdnZ2d@xxxxxxxxxxxxxx
It is not clear how your DrawSegment subroutine works
I'm using the Pie API with a few COS as SIN functions thrown in. I tried
the Circle method at first but go the same problem that shows up in the
code sample you posted - the segment is the right size but in the wrong
place. In the sample I would need the start of the segment to be 25%
clockwise around the circle and end at 58% of the circle.
That problem is correctable with a little math. Try this Circle statement
in place of the one I posted earlier...
Me.Circle (CenterX, CenterY), Radius, vbBlack, _
-(TwoPI * (1 + (Ray2 < 25) - ((Ray2 - 25)) / 100)), _
-(TwoPI * (1 + (Ray1 < 25) - ((Ray1 - 25)) / 100))
I wanted the end points of the segment so that I could draw a 3D looking
Pie chart, the idea being I could draw a little line down from the end
points (Provided they were between 25% and 75%), then draw an Arc and the
fill that little shape (what ever it's called) to make the pie chart have
a thickness look. trouble is the little lines dont start in the right
place, very nearly do, but not quite. All ways a few pixels out. The
function code is below.
I haven't studied your code in detail, so I'm not sure if you are taking
this into account or not, but for the "thickness" thing to work properly,
the entire pie should not be perfectly circular, rather it should be
elliptical (longer horizontally than vertically) so as to look like a
circle tilted away from the viewer. That way, the thickness you want to
add would create a tilted-away looking thick disk. Of course, this would
mean that you are no longer looking for calculated points on the
circumference of a circle, rather, you are looking for them on the
circumference of an ellipse (which I believe, without first researching
it, is a much harder problem).
One trouble I have it that the chart only uses 10 colours for it's
segments, when drawing the chart it loops through the colours to use and
when it gets to 10 it changes the drawStyle of the property so that two
segments that use the same colour look different. Using this method the
Point method does not do the job. I suppose I could change the colour
selection code to loop through 50 colours, then it would work.
Yes, to use the Point method I suggested would require a unique color for
each segment. You could create this by using the 10 colors you have now
and repeating them by changing one of the RGB colors by just 1. On the
screen, these colors would look identical, but that 1 difference in one of
the color channels would make it unique enough for the Point function to
discern.
Rick
.
- References:
- Segments
- From: Ivar
- Re: Segments
- From: Rick Rothstein
- Re: Segments
- From: Ivar
- Re: Segments
- From: Rick Rothstein
- Segments
- Prev by Date: Re: Segments
- Next by Date: Re: Segments
- Previous by thread: Re: Segments
- Next by thread: Re: Segments
- Index(es):
Relevant Pages
|