JFreeChartWrapper : Refreshing charts

How do i refresh the chart when i click on the a button in the application?
In Jfreechart i can update the dataset & the UI reflects the updated change. So on a refresh button click i update the dataset.
BUt it seems the chart is an image file, so how do i update the chart back in the UI.
Also the component that i’m using is an CustomComponent.

Let me rephrase my problem.
I want to show a dynamically rendered dial meter for CPU.
We are evaluating using Vaadin for our system management console.
Plese help me out in promoting Vaadin.Right now Flash is winning :frowning:

  1. Use Vaadin for most parts of your console.

For this part use GWT and HTML5 canvas.

JFreeChart itself isn’t for speed.

  1. If JFreeChart speed is enough.
    Use
    vaadin.com/book/-/page/components.progressindicator.html
    for “pull” refresh.

Hi,

As Andrew said JFreeChart isn’t that well suitable for highly dynamic graphics when used this way with Batik or bit map rendering. Instead of canvas, I’d use a custom tailored widget that wraps an SVG graphic. Then the server could just communicate the value and the client side widget would rotate the pointer. To make it work without refresh button (aka server push) I’d use DontPush OzoneLayer.

If you don’t need your chart to update itself several times in second (or you have moderate amount of users and good network) I think you could still use JFreeChart. I guess this is your case as you have a separate “refresh button”.

The problem is that the wrapper component has no refresh method that would inform the client side that it should reload the graph. To achieve this you should probably remove the chart from your layout (or custom component) and then re-attach it. It that don’t work you could also just replace the old jfreechart with a new instance. If you recycle you dataset etc. that shouldn’t be too expensive operation.

cheers,
matti

Is it possible to handle click event on JFreeChart Wrapper?.