Converting line chart with value to percent chart

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
phoenix_stealer
Posts: 1
Joined: Tue Jan 27, 2015 9:59 pm
antibot: No, of course not.

Converting line chart with value to percent chart

Post by phoenix_stealer » Tue Jan 27, 2015 11:32 pm

Hi,

i am doing an servlet who generates charts with JFreeChart. I succeeded to obtain my line chart with value.
Now, i want to use the same dataset, with percentage written instead of values.

Example :

i have 3 series :
serie 1: [(1 may, 12), (1 june, 23), (1 july, 6)]
serie 2: [(1 may, 3), (1 june, 7), (1 july, 4)]
serie 3: [(1 may, 6), (1 june, 20), (1 july, 5)]

My first chart is quite simple : first field is X and second field is Y.
But i want to display a second chart with, for each serie : first field is X, and Y is (2nd field / total of series 2nd field) * 100.

One way to do this is to create a second dataset equals to :
serie 1: [(1 may, 57), (1 june, 46), (1 july, 40)] => where 57 = (12 / (12 +3 + 6))*100 ; 46 = (23 /(23 + 7 + 20))*100, etc.
serie 2: [(1 may, 14.7), (1 june, 14), (1 july, 27)]
serie 3: [(1 may, 28.5), (1 june, 40), (1 july, 33)]

Is it possible to generate the same chart with some specials Renderer or method and the first dataset ?

I checked a lot of thing around the internet, and i saw that is it possible to convert chart label , but i don't see how to do a conversion depending of dataset values.

I can't give some extra screenshot to display what i want to do, i'm newbie on this forum, but i think what i want to do is quite clear.
Thank you for your advices, and sorry for my poor English, it's not my native language.

Locked