简体   繁体   English

在java / gwt中创建图表或图表?

[英]Create Graph or chart in java/ gwt?

I have to create a graph or a chart in GWT which look like 我必须在GWT中创建一个图形或图表,看起来像 图表

P,Y,T,A,R are the organisations and the 10 is the Max limit . P,Y,T,A,R是组织,10是Max限制。 For P the value is 5 , For Y value is 7.. 对于P,值为5,对于Y值为7 ..

Is there any library availabe for this chart .? 这个图表是否有可用的库? If not can any tell me the approach to achieve this.?? 如果没有,可以告诉我实现这一目标的方法。

Thanks 谢谢

You can always use d3.js . 您始终可以使用d3.js。 There are hundreds of example charts. 有数百个示例图表。

It's a JavaScript library, so you will need to use JSNI to use it. 它是一个JavaScript库,因此您需要使用JSNI来使用它。 There is also a GWT wrapper for it called gwt-d3 . 还有一个名为gwt-d3的GWT包装器。

Here is an example of a spider/radar plot. 是一个蜘蛛/雷达图的例子。 The advantage of d3 is that it's very customizable, interactive and (in my opinion) the prettiest chart library for javascript. d3的优势在于它是非常可定制的,交互式的(在我看来)是javascript最漂亮的图表库。

在此输入图像描述

We use JFreeChart ( http://www.jfree.org/jfreechart ) library on server side successfuly in GWT application. 我们在GWT应用程序中成功地在服务器端使用JFreeChart( http://www.jfree.org/jfreechart )库。 JFreeChart brings us great flexibility to what could be rendered. JFreeChart为我们提供了很大的灵活性。 The only major drawback is that it runs only on server side (JVM). 唯一的主要缺点是它只在服务器端(JVM)运行。 You need special servlet for handling graph generations. 您需要特殊的servlet来处理图形生成。 On client side you should create eg img html element with special url passing either chart parameters or special token (for chart identification) returned in previous RPC (Ajax) call, invoked for chart processing. 在客户端,你应该使用特殊的url创建例如img html元素,传递图表参数或在之前的RPC(Ajax)调用中返回的特殊标记(用于图表标识),为图表处理调用。

This approach requires more work than using client-side charting library, but brings you possibility to tune up charts in future in the way you need. 这种方法比使用客户端图表库需要更多的工作,但是您可以根据需要调整图表。 Please check JFreeChart Web Start Demo with sources - http://www.jfree.org/jfreechart/samples.html . 请使用来源检查JFreeChart Web Start演示 - http://www.jfree.org/jfreechart/samples.html For your use case there is one nice example - Spider Web Chart Demo - which is certainly possible to adopt for your requirements. 对于您的用例,有一个很好的例子 - 蜘蛛网图表演示 - 当然可以根据您的要求采用。

蜘蛛网图表演示1

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM