DateTime axis tick with InvientCharts add-on.


A few months ago I posted my question to another thread, but this category seems to be correct for that question. I hope it will be answered here.

I’m trying to create dynamic tick on DateTime axis, but tick interval is changed only in case of page reload using browser reload.

There is a Button object in report form with ClickListener, which calls for reloadReportInternal() method. In this method I set tick interval value according given input

        Tick tick = xAxis.getTick();
        if (tick ==  null){
            tick = new Tick();
        long periodInMillis = dateEnd.getTime() - dateBegin.getTime();
        tick.setInterval(periodInMillis < 14*24*60*60*1000 ? new Double(24*60*60*1000) : null);

but response is displayed with old tick. Adding


to method didn’t help. X-Axis with correct tick is displayed after page is reloaded using browser reload. Behaviour is tested in Chrome, Firefox and IE.

I’m using Vaadin 6.7.1 + invient-charts 0.8.6 (patched).

I have noticed the same strange behaviour, where browser page reload is needed for some changes to be displayed, in some other cases, too (eg changing chart label). Am I doing something wrong or is this a bug?

Can anyone help me?

Thanks in advance,
Priit Naruskberg

Hi mate,

it’s frustrating when people get no answer on their question, isn’t it? :slight_smile:

I’m no expert in programming, but I know what should be causing your problems: Just imagine your problem like this: In general a server can’t send an update to the client, if the client hasn’t requested one. This is why we can make changes shown on a client request (like a button click), but have problems doing this automatically. This is no vaadin bug but just the way the internet works.

There are two solutions for your problem:

  1. Implement a Refresher for your application (vaadin plugin download page here: ). A refresher will refresh the window it’s attached to in a given specific interval. Just try out the examples and you will understand it. I am using the refresher for an “animation” example, too, where I want to show the movement of points over the time in a scatterchart.

  2. (this is only a thought) MAYBE you could use the chart.refresh() method that exists for every chart. I’m not sure if it does the right thing, but from the method description it seems to send a little request from the client to the server, so the server can update the page for the client. It might be worth a try!

Both options don’t take that much time, if you need closer help on option 1), just post here again and I will post you some code how to implement it.



(PS - if you know something about my question, it’d be great if you share your knowledge with me as well - because IT IS frustrating :smiley: )

I don’t know the chart add-ons but more on Refresher and server push solutions