我用jfreechart只能做出一个 系列 的柱状图,有没有人会做两个系列的

ASPCOMjsp 2003-08-18 09:09:11
我用jfreechart只能做出一个 系列 的柱状图,有没有人会做两个系列的
...全文
59 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
ASPCOMjsp 2003-08-28
  • 打赏
  • 举报
回复
我是在linux上,没有"宋体"
所以font=new Font("Sans",Font.CENTER_BASELINE,20);
可是不行


mini 2003-08-28
  • 打赏
  • 举报
回复
用owc
mingjob 2003-08-26
  • 打赏
  • 举报
回复
下面这样可以正常显示中文:

//设置整个图表的背景颜色和标题的字体
chart.setBackgroundPaint(new GradientPaint(0.0F, 0.0F, Color.white, 1000F, 0.0F, Color.red));
chart.setTitle(new TextTitle(titles, new Font("隶书", Font.ITALIC, 15)));

font=new Font("黑体",Font.TRUETYPE_FONT, 12);

//
StandardLegend legend = (StandardLegend) chart.getLegend();
legend.setItemFont(font);

//设置柱状图的前景色
CategoryPlot plot = (CategoryPlot)chart.getPlot();
plot.setForegroundAlpha(0.9F);

//获取plot的render对象(控制每个柱的外观和柱的label等属性)
BarRenderer render = (BarRenderer)plot.getRenderer();
render.setItemLabelsVisible(new Boolean(true)); //在每个柱上显示统计数据
render.setItemMargin(-2.5); //设置柱间距,数值越大表示间隔越大

//设置统计坐标轴的字体
CategoryAxis domain_axis = plot.getDomainAxis();
domain_axis.setTickLabelFont(font);

//设置数值坐标轴的说明文字的字体和显示的角度
ValueAxis value_axis=plot.getRangeAxis();
value_axis.setLabelFont(font);
value_axis.setLabelAngle(1.570795); //以弧度为单位:角度×圆周率÷180
value_axis.setUpperMargin(0.25); //设置坐标轴顶部距柱状图距离占整个坐标轴程度的百分比
coollzh 2003-08-26
  • 打赏
  • 举报
回复
用中文字体就行了
ASPCOMjsp 2003-08-20
  • 打赏
  • 举报
回复
String[] seriesNames = new String[] {"1", "2"};
String[] categoryNames = new String[] {"First Quater","Second Quater"};
Number[][] categoryData = new Integer[][] {{new Integer(20),new Integer(35)},{new Integer(40),new Integer(60)}};
CategoryDataset categoryDataset = new DefaultIntervalCategoryDataset
(seriesNames,
categoryNames,
categoryData,
categoryData);

CategoryAxis categoryAxis = new CategoryAxis("");
ValueAxis valueAxis = new NumberAxis("");
BarRenderer renderer = new BarRenderer();
Plot plot = new CategoryPlot(categoryDataset,categoryAxis, valueAxis, renderer);
font=new Font("Sans",Font.CENTER_BASELINE,20);//这个地方是设置统计图标题的字体和大小
JFreeChart chart = new JFreeChart("", font, plot, false);

还是我自己解决了,有没有人知道怎样可以显示中文
boat2002w 2003-08-19
  • 打赏
  • 举报
回复
什么样的是一个系列的?什么是两个系列的?说清楚点
transist 2003-08-19
  • 打赏
  • 举报
回复
DefaultCategoryDataset dataset = new DefaultCategoryDataset();
addValue(double double0, Comparable comparable, Comparable comparable2)
ASPCOMjsp 2003-08-19
  • 打赏
  • 举报
回复
DefaultCategoryDataset dataset = new DefaultCategoryDataset();
addValue(double double0, Comparable comparable, Comparable comparable2)

是画单系列的吧
ASPCOMjsp 2003-08-19
  • 打赏
  • 举报
回复
系列(series )

__ __
| | | |
| | | |
| | | |
__|__|___|__|________ 这样的是单系列
__
__ __| |
| | | | |
| |__ | | |
| | | | | |
__|__|__|___|__|__|______ 这样的是两个系列

computersim 2003-08-19
  • 打赏
  • 举报
回复
up,me too

81,091

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧