JFreeChart chart = ChartFactory.createStackedBarChart3D("","","",dataset_bar,PlotOrientation.VERTICAL,true,true,false);
CategoryPlot plot = (CategoryPlot) chart.getPlot();
plot.setBackgroundPaint(Color.white);
CategoryAxis categoryaxis = plot.getDomainAxis();
categoryaxis.setCategoryLabelPositions(CategoryLabelPositions.UP_45); categoryaxis.setMaximumCategoryLabelWidthRatio(5.0f);
categoryaxis.setMaximumCategoryLabelLines(1);
categoryaxis.setTickLabelsVisible(false);
chart.setBackgroundImageAlpha(0.01F);
categoryaxis.setTickMarksVisible(true);
categoryaxis.setCategoryLabelPositionOffset(20);
return chart;
[img]http://dl.iteye.com/upload/attachment/384493/fac87842-a6df-3c6a-b486-e6a954c480f9.jpg[/img]
很急很急。。若能给出其他解决方案也好!
[quote]有没有其他的办法,不修改数据源。。。jfreechart难道不能设置x轴上的坐标么?[/quote]
他就是以数据源的方式来设置x/y坐标的啊。 你不想修改原来那个,可以复制一份来改,就当作是构造jfreechart的参数。
看不到图片啊
[quote]若能给出其他解决方案也好![/quote]
把宽度设长! 用html和js实现可以左右拉动的,如把这个图放在一个有左右滚动条的iframe中。
[quote]我现在想要做到的是,,在x轴左侧,中间,右侧加一个时间坐标。[/quote]
修改一下数据源,把不是"左侧,中间,右侧"的时间设为""。
[quote]这样会有问题的,我已经试过。时间为空的数据在时间轴上无法显示。[/quote]
那就设置为一个空格,全角的,如" "。
[quote]这样不行,试过了,另外也不数据逻辑。 x坐标 都为“ ” ,那么数据都显示在一起了啊。[/quote]
中间的只显示小时?