• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

getting coordinants for a bar graph

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
ritu mahajan
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
 
Ranch Hand
Posts: 1492
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 kind-of shows what I mean.

Regards,
Manfred.
[ April 15, 2002: Message edited by: Manfred Leonhardt ]
[ April 15, 2002: Message edited by: Manfred Leonhardt ]
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic