【问题标题】:Display column keys of stacked bar chart vertically in jFreeCharts在jFreeCharts中垂直显示堆叠条形图的列键
【发布时间】:2013-05-01 11:34:56
【问题描述】:

我正在使用 jfreecharts 开发一个 javaEE 应用程序。我使用stackedBarChart 成功显示了我的数据,但列键(Y 轴标签)没有完全显示,因为它们太大了。如何垂直显示它们?谢谢你的建议

【问题讨论】:

    标签: jfreechart


    【解决方案1】:

    你可以使用setCategoryLabelPositions(),就像他们显示here一样。

    CategoryPlot plot = (CategoryPlot) chart.getPlot();
    CategoryAxis domainAxis = plot.getDomainAxis();
    domainAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_90));
    

    【讨论】:

    • 非常感谢您的回复。我收到一个错误,说方法 createUpRotationLabelPositions 需要一个 double 作为参数,并且 CategoryLabelPositions 不能转换为一个 double。但是我找到了类似的解决方案Here。唯一的区别是 createUpRotationLabelPositions 方法没有被调用。所以它只是 CategoryPlot plot = (CategoryPlot) chart.getPlot(); CategoryAxis domainAxis = plot.getDomainAxis(); domainAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_90);
    猜你喜欢
    • 2013-12-07
    • 1970-01-01
    • 2021-11-20
    • 1970-01-01
    • 2023-02-04
    • 1970-01-01
    • 1970-01-01
    • 2011-03-14
    • 1970-01-01
    相关资源
    最近更新 更多