JFreechart标签太小了

时间:2012-06-12 13:00:13

标签: java eclipse-plugin swt eclipse-rcp jfreechart

我正在为eclipse rcp插件创建一个新视图。在这个视图中,我想使用一个JFreeChart水平(!)StackedBar,修复高度为20.问题是,项目标签显示得太小,尽管有更大的空间可以显示更大(见图片)设置更大“setSeriesItemLabelFont()”的大小不会增加标签的高位而只会增加宽度

照片:

image http://s14.directupload.net/images/120612/n2zm8rkh.png

这是我的代码: ViewPart:

@Override
public void createPartControl(Composite parent) {

    GridLayout gridLayout = new GridLayout(1, false);
    parent.setLayout(gridLayout);

    totalRenderingContent = new TotalRenderingContent(parent);
}

和TotalRenderingContent.java

public TotalRenderingContent(Composite parent) {

    chartComposite = new Composite(parent, SWT.EMBEDDED);
    GridData gridDataChart = new GridData(GridData.FILL, GridData.FILL, true, false);
    gridDataChart.heightHint = 20;
    chartComposite.setLayoutData(gridDataChart);
    chartFrame = SWT_AWT.new_Frame(chartComposite);
    createTotalRenderingContent();
}

private void createTotalRenderingContent() {
    Chart renderingChart = new TotalRenderingChart();
    JFreeChart chart = renderingChart.getChart();
    ChartPanel chartPanel = new ChartPanel(chart);
    chartFrame.add(chartPanel);
}

1 个答案:

答案 0 :(得分:0)

您正在使用SWT_AWT,也许这就是问题所在。有org.jfree.experimental.chart.swt.ChartComposite,它有助于在SWT中显示图表。请看示例:http://codeandme.blogspot.ru/2012/12/using-jfreechart-in-your-rcp.html