jfreechart:甘特图任务标签字体大小 [英] jfreechart: Gantt Chart Task Label Font Size

查看:596
本文介绍了jfreechart:甘特图任务标签字体大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将甘特图(ChartPanel)放到JScrollPane中,并创建一个名为[放大]的按钮。
按钮[放大]的功能是:

当我点击[放大]按钮,图表面板的宽度将会加倍。

  newSize = originalChartWidth * 2; 
chartPanel.setPreferredSize(new java.awt.Dimension(newSize,1000));

单击[放大]按钮后,将出现JScrollPane的滚动条。 b $ b然后,用户可以滚动,以放大后观看整个图表。



但有一个问题,当我加倍图表面板宽度时,任务标签字体也会放大。



在放大



放大后(字体会变形,难以阅读)


是否有任何方法在双倍图表后保留原始字体面板的宽度?

解决方案

我得到了解决我的问题的答案。



调用具有较小值的ChartPanel.setMinimumDrawWidth / Height和具有较大值的ChartPanel.setMaximumDrawWidth / Height,超过显示器的屏幕大小。然后,ChartPanel将被缩放而不失真。

请参阅:
如何避免轴标签和图例缩放


I put my Gantt Chart (ChartPanel) in a JScrollPane,and create a button named [zoom in].
The function for the button [zoom in] is:
When I click [zoom in] button, the width of chart panel will be doubled.

newSize = originalChartWidth * 2;
chartPanel.setPreferredSize(new java.awt.Dimension(newSize, 1000)); 

After click [zoom in] button, the scroll bar of JScrollPane will be appeared.
Then the user can scroll to watch the whole chart after zoom in.

But there is a problem, When I double the chart panel width, The Task Label Font will be enlarged too.

Before zoom in

After zoom in (The font will be deformed and hard to read)

Is there any way to keep the original font after I double the chart panel width?

解决方案

I got the answer to solve my problem.

Call ChartPanel.setMinimumDrawWidth/Height with small value and ChartPanel.setMaximumDrawWidth/Height with large values than exceed the screen size of your monitor. Then, the ChartPanel will be scaled without being distorted.

Please refer to: How to aviod axis label and legend scaling

这篇关于jfreechart:甘特图任务标签字体大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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