How to highlight the item label

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
khanhtran
Posts: 5
Joined: Mon Jul 17, 2006 3:34 am

How to highlight the item label

Post by khanhtran » Fri Sep 15, 2006 10:53 am

Dear experts,
Please show me how to highlight the item label in bar chart so it easier to read.

Thanks.

the_schmitz
Posts: 13
Joined: Thu May 18, 2006 6:01 pm
Location: Washington DC

Post by the_schmitz » Fri Sep 15, 2006 11:17 am

Highlight a label? I think the best way to do that would be to change the Font and/or Color associated with the label. You should be able to do something like this:

Code: Select all

            XYPlot plot = (XYPlot) chart.getPlot();

            plot.getDomainAxis().setTickLabelPaint(Color.white);
            plot.getDomainAxis().setTickLabelFont(new Font("TimesRoman", Font.BOLD, 12));
            plot.getDomainAxis().setLabelPaint(Color.white);
            plot.getDomainAxis().setLabelFont(new Font("TimesRoman", Font.BOLD, 12));

chart is the JFreeChart object.

Good Luck,
Chris

the_schmitz
Posts: 13
Joined: Thu May 18, 2006 6:01 pm
Location: Washington DC

Post by the_schmitz » Fri Sep 15, 2006 11:18 am

I forgot to mention you can also pull the range info with

Code: Select all

plot.getRangeAxis()

Locked