several questions about barchart

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
cee_time
Posts: 8
Joined: Thu Oct 06, 2016 10:23 pm
antibot: No, of course not.

several questions about barchart

Post by cee_time » Thu Oct 06, 2016 10:54 pm

Hi everyone:

i´m trying to create a specific barchart, so far i did some customizations to aproach to final design, but still miss a lot of them, so i nedd help. hope u could help me with you´re experience.

this is the idea of the final design

Image

Some of the specifications:
- bar width 0.4cm,
- space between bars 0.2cm
- some bars are filled with dots, other with lines other wit other color
- font used, arial narrow 8pt.
- Range Marker dotted and always visible.

My average graph and color highlited.

Image

- Light Green: that space could be 0.2cm but aparently is larger than that, it´s possible to customise it?.
- yellow: how can i hide perpendicular line to de x axis to label? and it´s posible to modify the space between label and axis (X and Y axes)?.
- red: i have to put 13 months(images are in spanish), so when i put january to december and repeat january, the chart render only one January(Ene in my case), so i have to change it for Act, it´s posible to repeat a label?, if its posible how to?.
- Blue: Name of axis in goal graph positions it´s posible?.
- light blue: Range marker is set to 340, and as you can see, didn´t display, and i need to display it anyways, how can i do this?.
- Green: its posible to change color or pattern to a specific bar?

thanks in advance to everyone culd help me.

PD: i searched about one week in forums...

paradoxoff
Posts: 1634
Joined: Sat Feb 17, 2007 1:51 pm

Re: several questions about barchart

Post by paradoxoff » Fri Oct 07, 2016 11:59 am

cee_time wrote: - Light Green: that space could be 0.2cm but aparently is larger than that, it´s possible to customise it?.
Have a look at either categoryAxis.setUpper/LowerMargin.
cee_time wrote: - yellow: how can i hide perpendicular line to de x axis to label? and it´s posible to modify the space between label and axis (X and Y axes)?.
categoryAxis.setTickLabelsVisible(false);
cee_time wrote: - red: i have to put 13 months(images are in spanish), so when i put january to december and repeat january, the chart render only one January(Ene in my case), so i have to change it for Act, it´s posible to repeat a label?, if its posible how to?.
You have two choiced: either make the tick labes unique by adding the year (that should also be more informative for the viewer of the chart), or make sure that equal Strings that you use as keys are not considered to be "equal". See this thread for an example.
cee_time wrote: - Blue: Name of axis in goal graph positions it´s posible?.
categoryAxis.setLabelLocation(AxisLabelLocation.HIGH_END) should work. I haven´t used it so far.
cee_time wrote: - light blue: Range marker is set to 340, and as you can see, didn´t display, and i need to display it anyways, how can i do this?.
Two options:
- Extend the displayed range of the ValueAxis to 15 % more than what wpuld be required (valueAxis.setUpperMargin(0.15))
- Set the range of the ValueAxis manually.
cee_time wrote: - Green: its posible to change color or pattern to a specific bar?
You will have to implement a suitable BarPainter.

cee_time
Posts: 8
Joined: Thu Oct 06, 2016 10:23 pm
antibot: No, of course not.

Re: several questions about barchart

Post by cee_time » Tue Oct 11, 2016 3:27 pm

thanks paradoxoff for the advices.

after test you´re advices the results are:
Have a look at either categoryAxis.setUpper/LowerMargin.
this works like a charm...
categoryAxis.setTickLabelsVisible(false);
this hide labels complete, for example domainaxes setTickLabelsVisible to false, hide ,months name, not what i´m looking for. i just need to hide perpendicular tick, and modify space between axe and label.

that´s only two things that i need right now.

paradoxoff
Posts: 1634
Joined: Sat Feb 17, 2007 1:51 pm

Re: several questions about barchart

Post by paradoxoff » Tue Oct 11, 2016 4:34 pm

Sorry, I confused categoryAxis.setTickLabelsVisible(false) with categoryAxis.setTickMarksVisible(false) :oops:

cee_time
Posts: 8
Joined: Thu Oct 06, 2016 10:23 pm
antibot: No, of course not.

Re: several questions about barchart

Post by cee_time » Fri Oct 14, 2016 4:20 pm

paradoxoff wrote:isible(false) with categoryAxis.setTickMarksVisible(false)
Thanks a lot paradoxoff, finally i got the same graph that i nedd.

Locked