【问题标题】:BIRT: Getting started with the Chart APIBIRT:图表 API 入门
【发布时间】:2011-09-09 18:06:56
【问题描述】:

所以我需要一些简单的 BIRT 图表 API 指针。

我正在尝试绘制一个简单的数值随时间变化的折线图。我有一个 (Date,Double) 对的向量作为输入。我已经阅读了 org.eclipse.birt.chart.examples 中的示例,但还没有获得足够的 API 牵引力来开始使用它。仅仅编写一个 org.eclipse.birt.chart.model.impl.ChartWithAxesImpl 就让我难住了。

最终的目标是一个 Eclipse 编辑器,我可以做到。是否有任何人可以推荐的教程或书籍可以让我了解 BIRT 图表方面?

非常感谢

M.

【问题讨论】:

    标签: eclipse-rcp birt


    【解决方案1】:

    嗯。有这个例子:http://www.eclipse.org/articles/article.php?file=Article-BIRTChartEngine/index.html

    但我在实际让它自己工作时遇到了一些问题。我最终得到的只是一个这样的例外:

    java.lang.NullPointerException
    at org.eclipse.birt.chart.device.swt.SwtTextMetrics.getHeight(SwtTextMetrics.java:178)
    at org.eclipse.birt.chart.computation.Methods.computeFontHeight(Methods.java:1272)
    at org.eclipse.birt.chart.computation.BIRTChartComputation.computeFontHeight(BIRTChartComputation.java:30)
    at org.eclipse.birt.chart.computation.EllipsisHelper$SimpleTester.<init>(EllipsisHelper.java:213)
    at org.eclipse.birt.chart.computation.EllipsisHelper.createSimpleTester(EllipsisHelper.java:176)
    at org.eclipse.birt.chart.computation.EllipsisHelper.simpleInstance(EllipsisHelper.java:183)
    at org.eclipse.birt.chart.computation.LabelLimiter.limitLabelSize(LabelLimiter.java:256)
    at org.eclipse.birt.chart.computation.LabelLimiter.limitLabelSize(LabelLimiter.java:211)
    at org.eclipse.birt.chart.model.layout.impl.TitleBlockImpl.computeBox(TitleBlockImpl.java:288)
    at org.eclipse.birt.chart.model.layout.impl.LabelBlockImpl.getPreferredSize(LabelBlockImpl.java:266)
    at org.eclipse.birt.chart.internal.layout.LayoutManager$ChartLayout.<init>(LayoutManager.java:111)
    at org.eclipse.birt.chart.internal.layout.LayoutManager.doLayout_tmp(LayoutManager.java:1145)
    at org.eclipse.birt.chart.internal.layout.LayoutManager.doLayout(LayoutManager.java:1310)
    at org.eclipse.birt.chart.factory.Generator.build(Generator.java:1092)
    

    【讨论】:

    • 啊。我终于弄清楚了为什么链接的示例不起作用。它没有足够早地将 GC 设置为渲染。 render.setProperty(IDeviceRenderer.GRAPHICS_CONTEXT, gc) 需要在 Generator#build 调用之前调用
    【解决方案2】:

    org.eclipse.birt.chart.examples 中的示例遇到了同样的问题。有一些很好的java代码sn-ps,但是你看不到它们对应的是什么。这就是为什么我决定生成所有示例并将它们放在一个网站上:BIRT Charts Gallery

    【讨论】:

      猜你喜欢
      • 2014-03-09
      • 2013-12-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-07-29
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多