JfreeChart:显示日期的堆积条形图和 CategoryAxis [英] JfreeChart: Stacked Bar Chart and CategoryAxis showing dates

查看:30
本文介绍了JfreeChart:显示日期的堆积条形图和 CategoryAxis的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个堆积条形图,其中在 y 轴上显示计数,在 x 轴上显示日期.问题是当我在 x 轴上有很多日期时,它会变得非常混乱并且无法阅读.我只想显示一些日期,例如每周一个日期.那可能吗?我正在使用 ChartFactory.createStackedBarChart() 创建图表,并且我在 DefaultCategoryDataSet 中有数据.

I have created a stacked bar chart in which I show a count on the y axis and dates on the x axis. The problem is that when I have many dates on the x axis it gets very cluttered and impossible to read. I would like to show only some of the dates, e.g one date per week. Is that possible? I am using ChartFactory.createStackedBarChart() to create the chart, and I have the data in a DefaultCategoryDataSet.

感谢任何输入!

推荐答案

对于 CategoryAxis,用于StackedBarChart<中的域轴/code>,您对 setCategoryLabelPositions().BarChartDemo1<中说明了典型用法/code> 来源,显示 此处.

For a CategoryAxis, which is used the for the domain axis in a StackedBarChart, you have considerable flexility with the method setCategoryLabelPositions(). Typical usage is illustrated in the BarChartDemo1 source, shown here.

CategoryAxis domainAxis = plot.getDomainAxis();
domainAxis.setCategoryLabelPositions(
    CategoryLabelPositions.createUpRotationLabelPositions(Math.PI / 6.0));

这篇关于JfreeChart:显示日期的堆积条形图和 CategoryAxis的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆