java 客户端图表开发,混合服务器端java和客户端JavaScript图表库?

Is there a library to generate same charts for the same data, both in Java and Javascript?

My task is both:

display some flashy dynamic chart in a browser, better with dynamic tooltips, zooming and so on (I'm thinking Javascript here)

and generate the same (or similar enough) charts on server side, in Java, for automatically sending them in emails (no browser at all in this scenario).

I'd like to avoid Flash for iPhone interoperability.

There are some static server-side charts like Eastwood/JFreeChart, but I'd like to make it more alive in browser.

Yes I can reload static images via Ajax. Are there other options?

解决方案

How come this question is more than a year old but got no answers?! I suggest a rather questionable and somewhat hardcore approach.

Use JavaScript, it's awesome!

Here's your success formula: d3.js+jsdom+Rhino+Batik

Specifically:

Generate your graphs using some slick JavaScript library like d3.js.

Use jsdom to run d3 server-side. Jsdom is pure JS library and d3 is known to be working on top of it.

Run jsdom and d3 inside Rhino - a JavaScript engine baked into your beloved JVM since 1.6 (yay, JSR-223!). Although, I suggest you updating it to latest release (It's on Maven Central, neat!). I guess Node.JS can do a better job but I assume that you're stuck with Java.

Also note that there's an older, more mature and Rhino-specific server-side DOM implementation - EnvJs

Use Batik to rasterize an SVG generated by d3. Batik even supports scripting inside SVG via Rhino. That means you can generate interactive charts server-side if you want to. I also used it in practice and had great experience with it.

BTW, If you'll make it all running let me know.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值