Remove Chart's gray border

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
gabbagabbahey
Posts: 10
Joined: Tue Oct 09, 2007 11:12 am

Remove Chart's gray border

Post by gabbagabbahey » Mon Oct 15, 2007 4:49 pm

How to remove the chart's gray border? To make the output more nicer.

dtopolsek
Posts: 8
Joined: Wed Oct 10, 2007 10:46 am
Contact:

Post by dtopolsek » Mon Oct 15, 2007 5:08 pm

.setOutlineVisible
or something like that?

david.gilbert
JFreeChart Project Leader
Posts: 11734
Joined: Fri Mar 14, 2003 10:29 am
antibot: No, of course not.
Contact:

Post by david.gilbert » Mon Oct 15, 2007 5:33 pm

Is the grey border just the chart's background paint? Try:

Code: Select all

chart.setBackgroundPaint(Color.white);
David Gilbert
JFreeChart Project Leader

:idea: Read my blog
:idea: Support JFree via the Github sponsorship program

gabbagabbahey
Posts: 10
Joined: Tue Oct 09, 2007 11:12 am

It works for Multiple Pie Chart.

Post by gabbagabbahey » Mon Oct 15, 2007 5:46 pm

var chart = plot.getPieChart();
chart.getPlot().setOutlinePaint(null);

The above works for Multiple Pie Chart. How about Line Chart?

gabbagabbahey
Posts: 10
Joined: Tue Oct 09, 2007 11:12 am

any solutions?

Post by gabbagabbahey » Tue Oct 16, 2007 12:21 pm

Any solutions for LineChart?

david.gilbert
JFreeChart Project Leader
Posts: 11734
Joined: Fri Mar 14, 2003 10:29 am
antibot: No, of course not.
Contact:

Post by david.gilbert » Tue Oct 16, 2007 1:44 pm

It depends what this "border" is? If it is the plot's outline, try:

Code: Select all

chart.getPlot().setOutlineVisible(false);
David Gilbert
JFreeChart Project Leader

:idea: Read my blog
:idea: Support JFree via the Github sponsorship program

gabbagabbahey
Posts: 10
Joined: Tue Oct 09, 2007 11:12 am

remove the x & y-axis gray line

Post by gabbagabbahey » Tue Oct 16, 2007 3:44 pm

Thanks, the above works.

How about removing the horizontal & vertical gray line for the x & y-axis.

rafidwahab
Posts: 5
Joined: Fri Oct 26, 2007 8:02 pm

Removing Axis Lines...

Post by rafidwahab » Mon Oct 29, 2007 8:46 pm

Try this for the axis:

chart.getXYPlot().getDomainAxis().setAxisLinePaint(Color.WHITE);
chart.getXYPlot().getRangeAxis().setAxisLinePaint(Color.WHITE);
ValueAxis y2 = jFreeChart.getXYPlot().getRangeAxis(1);
if(y2 != null){
y2.setAxisLinePaint(Color.WHITE);
}

It does not really remove them as much as set them to white.. so if you have a different plot background paint.. you might want to match...
Thanks,
Rafid

Locked