displaying value in bar chart as a percentage of tatal value

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
kapilkaps83
Posts: 9
Joined: Fri Jun 13, 2008 4:09 am
Location: Japan

displaying value in bar chart as a percentage of tatal value

Post by kapilkaps83 » Thu Jun 26, 2008 4:54 am

HI

i want to display range axis as a percentage of total value.
for example : if i have values as 20 ,40 ,80 ,200 ,60 then the bar chart display Y-axis as --
(20/200)*100 = 10
(40/200)*100 = 20
(80/200)*100 = 40
(200/200)*100 = 100
(60/200)*100 = 30

Also i want to display them as : total = 20+40+80+200+60 =400


y-axis as -- ( 20/400)*100 = 5
(40/400)*100 = 10
(80/400)*100 =20
(200/400)*100 = 50
(60/400)*100 = 15

How can i customize my bar chart.

RichardWest
Posts: 844
Joined: Fri Oct 13, 2006 9:29 pm
Location: Sunnyvale, CA

Post by RichardWest » Thu Jun 26, 2008 6:46 am

For the latter, try using a StackedBarRenderer. The former will most likely require you to create a custom dataset to return the values to plot. I am not sure why you would want to plot the values as a percentage of the maximum value and as a percentage of the total value, but it's your plot.
Richard West
Design Engineer II
Advanced Micro Devices
Sunnyvale, CA

kapilkaps83
Posts: 9
Joined: Fri Jun 13, 2008 4:09 am
Location: Japan

Post by kapilkaps83 » Fri Jun 27, 2008 7:15 am

hi all

i just want to plot bar chart whose y-axis is 0% - 100% how lager my values are but graph should have remain or calculated as a percentage of total.

Please suggest..

Locked