首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > 编程 >

JFreechart参数配备

2012-12-20 
JFreechart参数配置 ChartFactory.createBarChart3D(???? 热点讨论投票结果, // 图表标题???? , //

JFreechart参数配置

= ChartFactory.createBarChart3D(
???? "热点讨论投票结果", // 图表标题
???? "", // 目录轴的显示标签
???? "", // 数值轴的显示标签
???? getDataSet(), // 数据集
???? //PlotOrientation.HORIZONTAL , // 图表方向:水平
???? PlotOrientation.VERTICAL , // 图表方向:垂直
???? false, // 是否显示图例(对于简单的?? //分类标签以45度角倾斜
?? //categoryAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_45);
?? categoryAxis.setTickLabelFont(new Font("宋体" , Font.BOLD , 18));
?? //取得纵轴
?? NumberAxis numberAxis = (NumberAxis)plot.getRangeAxis();
?? //设置纵轴显示标签的字体
?? numberAxis.setLabelFont(new Font("宋体" , Font.BOLD , 18));
?? //设置最高的一个柱与图片顶端的距离
?? numberAxis.setUpperMargin(0.1);
?? //numberAxis.setFixedAutoRange(100);
?? //设置整数显示
?? //numberAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
?? //numberAxis.setNegativeArrowVisible(true);
??
?? //取最大数Math.max(supportCount, blackballCount)
?? numberAxis.setUpperBound(1);
?? numberAxis.setLowerBound(0.01);
?? //设置百分比显示
?? numberAxis.setNumberFormatOverride(new DecimalFormat("0%"));
?? //numberAxis.setNumberFormatOverride(new DecimalFormat("0.00%"));
?? //设置最小显示数,小于的话会显示在中间(正负)
?? //numberAxis.setAutoRangeMinimumSize(1);
??
?? plot.setNoDataMessage("没有可供使用的数据!");
?? plot.setNoDataMessagePaint(Color.blue);
??
??
?? BarRenderer3D renderer = new BarRenderer3D();
?? //设置柱子宽度
?? renderer.setMaximumBarWidth(0.1);
?? //设置柱子高度
?? renderer.setMinimumBarLength(0.2);
?? //设置柱子的颜色
??????? renderer.setSeriesPaint(0, new Color(0, 0, 255));
???????
??????? //设置柱子边框可见
??????? //renderer.setDrawBarOutline(true);
??????? //设置柱子默认的边框颜色,必须设置边框可见才起效
?? //renderer.setBaseOutlinePaint(Color.gray);
??????? //设置分类柱子的边框色,覆盖默认的边框颜色,必须设置边框可见才起效
??????? //renderer.setSeriesOutlinePaint(0,Color.red);
??????? //设置柱子的纵横背景色
??????? //renderer.setWallPaint(Color.gray);
??????? //设置平行柱的之间距离
??????? renderer.setItemMargin(0.5);
??????? //显示每个柱的数值,并修改该数值的字体属性
??????? renderer.setIncludeBaseInRange(true);
??????? //将修改后的属性值保存到图中,这一步很重要,否则上面对颜色的设置都无效
??????? plot.setRenderer(renderer);
????????
??????? //设置柱子的透明度,0.8相当于80%的透明度
??????? plot.setForegroundAlpha(0.8f);

热点排行