almende / vis

⚠️ This project is not maintained anymore! Please go to https://github.com/visjs
7.85k stars 1.48k forks source link

Can unit for event can be seconds or ms instead of date? #4283

Closed christophepersoz closed 5 years ago

christophepersoz commented 5 years ago

I like the way your library is working, but I’m looking for a much smaller timerange event than days, months years. Do you think that can be easily done or implement? - maybe I can help on this.

Thanks!

christophepersoz commented 5 years ago

Found by using the timeline in milliseconds unit and using minorLabels and majorLabels options to generate frame en TC values on axis.

                /* in options {} */
                format: {
            minorLabels: function(date, scale, step) {
                return get_frame_from_ms( new Date(date).getTime() );
            },
            majorLabels: function(date, scale, step) {
                return get_TC_from_ms( new Date(date).getTime() );
            }
        },
                /* others options here below */

Perfect lib! Thanks