I'm using JFreechart 0.5.5 on Sun Solaris and when I create the chart, I have the following error :
Can't connect to X11 window server using ':0.0' as the value of the DISPLAY variable.
The code I am using to create the chart is :
JFreeChart myChart = JFreeChart.createVerticalBarChart(myDataSource);
//Put a white background
myChart.setChartBackgroundPaint(new GradientPaint(0, 0, new Color(235, 235, 235), 1000, 0, new Color(235, 235, 235)));
//Set the color is the series
myChart.setSeriesPaint(SERIESPAINT);
//Set the title
String title="";
myChart.setTitle(title);
Plot myPlot=myChart.getPlot();
Axis myHorizontalAxis=myPlot.getAxis(Plot.HORIZONTAL_AXIS);
myHorizontalAxis.setLabel("");
/**
* Add the possibility to view labels verticaly
* This is a protected attribute (verticalCategoryLabels) of the
* HorizontalCategoryAxis object.
* I have to modify the code of JFreechart or to wait for the next release
* Current release 0.5.5
* 16/10/2000 : I have modify the code of JFreechart
*/
//Set the label of the horizontal axis to be view verticaly
HorizontalCategoryAxis HorizontalCategoryAxis = (HorizontalCategoryAxis) myPlot.getHorizontalAxis();
HorizontalCategoryAxis.setVerticalCategoryLabels(true);
Axis myVerticalAxis=myPlot.getAxis(Plot.VERTICAL_AXIS);
myVerticalAxis.setLabel("CHF");
The value of the variable SERIEPAINT is :
new Paint[] {new Color(206, 45, 69),new Color(102, 153, 0),new Color(102, 102, 204),new Color(255, 102, 0),Color.red,Color.blue,Color.green,Color.yellow,Color.cyan};
I have modify the code of the HorizontalCategoryAxis class to add the method setVerticalCategoryLabels.
Thanks for your help.
Fabien
X11 error using JFreechart on Sun Solaris
RE: X11 error using JFreechart on Sun Solaris
Hello Fabien,
the error you encountered has nothing to do with JFreeChart.
There are two possibilities for the error:
1. You have not set the DISPLAY variable correctly for your X-Display
Enter the following to check:
# env
you should now see the setting of your DISPLAY variable.
The correct setting is hostname:display (e.g. myhost:0.0)
2. You have not allowed remote access to your X-Server
You can do this by entering xhost +Hostname
Regards,
Alexander
the error you encountered has nothing to do with JFreeChart.
There are two possibilities for the error:
1. You have not set the DISPLAY variable correctly for your X-Display
Enter the following to check:
# env
you should now see the setting of your DISPLAY variable.
The correct setting is hostname:display (e.g. myhost:0.0)
2. You have not allowed remote access to your X-Server
You can do this by entering xhost +Hostname
Regards,
Alexander