getting coordinants for a bar graph
ritu mahajan
Greenhorn
Posts: 5
posted 13 years ago
 0
Hi,
I need to generate 2 applets to display bar graphs. One an aligned bar graph and the other a stacked bar graph comparing three values in each. I am able to get the drawing coordinants for one value, but then I'm stuck.
I'm confused as to how to display the graph showing all the three values.
thanks,
Ritu
I need to generate 2 applets to display bar graphs. One an aligned bar graph and the other a stacked bar graph comparing three values in each. I am able to get the drawing coordinants for one value, but then I'm stuck.
I'm confused as to how to display the graph showing all the three values.
thanks,
Ritu
Dirk Schreckmann
Sheriff
Posts: 7023
ritu mahajan
Greenhorn
Posts: 5
posted 13 years ago
Dirk,
Thanks for the response.
I am trying to develop a multiseries bar graph applet.

y 
 h
 h v
 l h v l
 hl vh vhl
 vhl vh vhl
 vhl vhl vhl
 vhl vhl vhl
 vhl vhl vhl

x
One bar for each item.
I appreciate your help.
Thanks,
Ritu
 0
Originally posted by Dirk Schreckmann:
Sounds like something someone here could help you out with. If I may make a suggestion/request...
Just to clarify what you are trying to do, maybe you could provide a little "text picture" of what you are trying to do and the code that you have so far. For example:
Good Luck.
Dirk,
Thanks for the response.
I am trying to develop a multiseries bar graph applet.

y 
 h
 h v
 l h v l
 hl vh vhl
 vhl vh vhl
 vhl vhl vhl
 vhl vhl vhl
 vhl vhl vhl

x
One bar for each item.
I appreciate your help.
Thanks,
Ritu
Manfred Leonhardt
Ranch Hand
Posts: 1492
posted 13 years ago
 0
Hi Ritu,
Not exactly sure what your problem is. But I can try and explain how to get stacked bars.
1. Assume: same number of points in each series
2. Figure out how many pixels we have for the height > maxPixels
3. For each point:
Add up all series values at that point to get maximum value (100%) > maxValue[i]
4. For each series at point i:
Number of pixels to draw it will be (maxPixels * seriesValue[i]) / maxValue[i]
5. Start at lowest point and use answer to 4 and keep adding to ylocation until all series have been drawn.
6. Return to 3 and keep going until all series and points are complete.
For horizontal size just figure out how many pixels you are dealing with in the horizontal direction. Divide by the number of points and draw your bars with some small gap between them.
Below is some code that kindof shows what I mean.
Regards,
Manfred.
[ April 15, 2002: Message edited by: Manfred Leonhardt ]
[ April 15, 2002: Message edited by: Manfred Leonhardt ]
Not exactly sure what your problem is. But I can try and explain how to get stacked bars.
1. Assume: same number of points in each series
2. Figure out how many pixels we have for the height > maxPixels
3. For each point:
Add up all series values at that point to get maximum value (100%) > maxValue[i]
4. For each series at point i:
Number of pixels to draw it will be (maxPixels * seriesValue[i]) / maxValue[i]
5. Start at lowest point and use answer to 4 and keep adding to ylocation until all series have been drawn.
6. Return to 3 and keep going until all series and points are complete.
For horizontal size just figure out how many pixels you are dealing with in the horizontal direction. Divide by the number of points and draw your bars with some small gap between them.
Below is some code that kindof shows what I mean.
Regards,
Manfred.
[ April 15, 2002: Message edited by: Manfred Leonhardt ]
[ April 15, 2002: Message edited by: Manfred Leonhardt ]
I agree. Here's the link: http://aspose.com/filetools 