如何使用开源 Java API - JOFC 设置带有 Open Flash Chart 2 图形的图例?

发布于 2024-10-02 07:54:24 字数 1444 浏览 7 评论 0原文

我有一个在 JBoss5 下运行的 Seam 2.2 应用程序。 1.在此应用程序中,我使用 Java Open Flash Chart(一种 Java API)成功开发了一些图形对于 打开 Flash 图表。

现在我想添加 X 和 Y 图例就像这个。

嗯,我有一张图形,它是正确渲染,然后我尝试使用以下方法设置 X Label:

... Chart.setXLegend(new Text("图例 X"));

但它不是显示图例,而是破坏了一些东西,导致图形呈现完全空白。

这是图形正确渲染时生成的 JSon。

{"y_axis":{"min":388,"max":866,"steps":20},"title":{"text":"Gráfico de gasto mensal com Combustível"},"bg_colour":"#FFFFFF","is_decimal_separator_comma":0,"elements":[{"values":[{"tip":"R$:610.0\n05/2010","top":610},{"tip":"R$:488.0\n06/2010","top":488},{"tip":"R$:634.57\n07/2010","top":634.57},{"tip":"R$:766.0\n08/2010","top":766},{"tip":"R$:396.0\n09/2010","top":396},{"tip":"R$:610.0\n10/2010","top":610}],"type":"bar"}],"num_decimals":2,"is_fixed_num_decimals_forced":0,"x_axis":{"labels":{"labels":["05/2010","06/2010","07/2010","08/2010","09/2010","10/2010"]}},"is_thousand_separator_disabled":0}

我深入研究了它,结果发现每当我尝试添加 x 图例以及上面显示的代码片段时,JSon 实际上不是由 JOFC 生成的。

我在网上找不到太多关于 JOFC 的有用文档,而且 API 本身也没有很好的文档记录,所以我完全迷失在尝试添加这个简单的 x 标签上,这应该是最简单的部分:( 。对此有任何想法。

更新:

现在我刚刚下载了 JOFC 源代码,并将看一下。

I have a Seam 2.2 app running under JBoss5.1. In this application I have successfully developed some Graphics using Java Open Flash Chart, which is a Java API for Open Flash Chart.

Now I would like to add a X and Y legend like this one.

Well I have a graphic which is rendering properly and than I try to set X Label using:

...
chart.setXLegend(new Text("Legenda X"));

But than instead of showing the legend it corrupts something which causes the graphic to renders completely blank.

This is the generated JSon when the graphics renders correctly.

{"y_axis":{"min":388,"max":866,"steps":20},"title":{"text":"Gráfico de gasto mensal com Combustível"},"bg_colour":"#FFFFFF","is_decimal_separator_comma":0,"elements":[{"values":[{"tip":"R$:610.0\n05/2010","top":610},{"tip":"R$:488.0\n06/2010","top":488},{"tip":"R$:634.57\n07/2010","top":634.57},{"tip":"R$:766.0\n08/2010","top":766},{"tip":"R$:396.0\n09/2010","top":396},{"tip":"R$:610.0\n10/2010","top":610}],"type":"bar"}],"num_decimals":2,"is_fixed_num_decimals_forced":0,"x_axis":{"labels":{"labels":["05/2010","06/2010","07/2010","08/2010","09/2010","10/2010"]}},"is_thousand_separator_disabled":0}

I took a deeply look at it and turns out that whenever I try to add the x legend with the code fragment showed above the JSon is actually NOT generated by JOFC.

I could not find much useful documentation on JOFC on the web and the API itself is not very well documented, so I am completely lost on trying to add this simple x label, which should be the easiest part :( . Any Ideas on that.

An update:

Now I just have downloaded JOFC source code and will take a look at this.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

濫情▎り 2024-10-09 07:54:24

JOFC 页面上似乎有一个未解决的问题:http://code .google.com/p/jofc2/issues/detail?id=29

它建议了一种调用该函数的解决方法,例如:

chart.setXLegend(new Text("Legenda X", Text.TEXT_ALIGN_CENTER))

It looks like there's an open issue on the JOFC page: http://code.google.com/p/jofc2/issues/detail?id=29

It suggests a workaround of calling the function like:

chart.setXLegend(new Text("Legenda X", Text.TEXT_ALIGN_CENTER))
烟燃烟灭 2024-10-09 07:54:24

我会尝试使用Open Flash Grapix,它更容易使用,并且只需在FlashVars上设置参数即可。

打开 Flash Grapix

I would try with Open Flash Grapix, it is easier to use, and just sets parameters on FlashVars.

Open Flash Grapix

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文