timeglider / jquery_widget

Timeglider's JS Widget component. See README for details.
193 stars 41 forks source link

Some values of max and min zoom not allowing to initialize Timeglider correctly #51

Open psanchez-zRed opened 12 years ago

psanchez-zRed commented 12 years ago

Hi! First of all, thank you for building this awesome plugin! :)

Well, let's go to the point. The plugin is working well with the default zoom levels included in the demos. But I want to set a "three days" zoom in my timeline by default, allowing user to zoom until a week view, so I have been testing the plugin with different zoom levels.

To achieve this, I made some tests in the table.html demo page changing the zoom values to:

        var tg1 = $("#placement").timeline({
                "min_zoom":10, 
                "max_zoom":30, 
                // data source is the id of the table!
                "data_source":"#mylife"
        });

or

        var tg1 = $("#placement").timeline({
                "min_zoom":10, 
                "max_zoom":11, 
                // data source is the id of the table!
                "data_source":"#mylife"
        });

But when I go to the browser the timeline is empty. There are no ticks or timeslots at all. These are some screenshots on Firefox and Chrome:

![Firefox](http://ompldr.org/vZTVhdA/Timeglider jQuery Widget: Basic Demo - Mozilla Firefox_026.png)

![Chrome](http://ompldr.org/vZTVhdg/Timeglider jQuery Widget: Basic Demo - Google Chrome_027.png)

However, after changing the zoom manually (clicking on the zoom bar), the timeline redraws itself and now it displays correctly. Maybe a workaround for me could be call the goTo() function at start. I have to test this solution.

I experimented this issue in the previous version, but it also appears in the last version (0.1.4).

Thank you very much and sorry for my bad english. Greetings from Spain.

Pedro S.

psanchez-zRed commented 12 years ago

Well, my workaround is working well. Doing this call after Timeglider creation solves the problem and draws the timeline correctly at start:

    $('#placement').data('timeline').goTo('today',10);

This could be included as option, something like _initialzoom and _initialday :)

Pedro S.