almende / chap-links-library

a web based visualization library for displaying graphs, networks, and timelines
http://almende.github.com/chap-links-library
Apache License 2.0
599 stars 167 forks source link

Zoom level #274

Open mustafa2808 opened 10 years ago

mustafa2808 commented 10 years ago

I have used your Timeline plugin and created a history timeline. Which contains data from stone age, bronze age to current age. My questions are:

  1. How would i set the zoom level upto year only not to the months, week....hour etc...
  2. How would make the it zoom when a click or touch event appears on a particular section(era) and not on mouseWheel Scroll.

Zoom level: timeline

zoom

josdejong commented 10 years ago

That looks nice :)

You can specify a maximum and minimum zoom level with the options zoomMin and zoomMax (see documentation).

There is no generic click handler in the Timeline. Maybe you could add click handlers to your background objects (they can contain HTML), and use that to trigger a function to adjust the visible range. You can adjust the visible range with the function setVisibleChartRange(start, end).

mustafa2808 commented 10 years ago

I have set the zoomMax setting here but all stops when i change anything here. Could you suggest what changes i have to make to set zoom (scaling) amount.

////////// 'zoomMax': 1000 * 60 * 60 * 24 * 365 * 10000, // milliseconds ///////// var options = this.options; var year = 1000 * 60 * 60 * 24 * 365; var zoomMin = Number(options.zoomMin) || 10; if (zoomMin < 10) { zoomMin = 10; } var zoomMax = Number(options.zoomMax) || 10000 * year; if (zoomMax > 10000 * year) { zoomMax = 10000 * year; } if (zoomMax < zoomMin) { zoomMax = zoomMin; }

Thanks for your appreciation and support

josdejong commented 10 years ago

I have set the zoomMax setting here but all stops when i change anything here.

I'm not sure what you mean. Don't you need to set zoomMin instead of zoomMax?

mustafa2808 commented 10 years ago

I mean when i zoom the timeline it should only zoom upto the year not more then that.

when i edit the code of zoomMin or zoomMax it does'nt work. So could help me out here as i am not a developer but a ui-ux designer m not into hard coding :).

josdejong commented 10 years ago

I don't understand why you want to adjust the code of the Timeline for this, unless you're convinced there is a bug there.

I mean when i zoom the timeline it should only zoom upto the year not more then that.

Don't you need to use zoomMin instead of zoomMax? zoomMin limits how much you can zoom in.

Maybe the following example helps: http://almende.github.io/chap-links-library/js/timeline/examples/example18_limit_range.html

mustafa2808 commented 10 years ago

Hello, If I want to bind click event into timeline.js and if I click with mouse its give me same effect as on mouse scroll. Can you please provide us some solutions ? Thanks.

josdejong commented 10 years ago

Is your zoomMin issue solved?

See my earlier comment for the click issue. You will have to be creative yourself adding some jquery event listeners or something like that.