TimeScale

extends:
Jump To: Members

A time scale behaves exactly like a linear scale with the exception that it can scale a date as an input to a number output. This is typically used when scaling dates with the GridLayout which sets a range of input dates and the output range is the size of the grid. However, it can be used for other cases as well.

Examples:

Create a scaling function that scales Date inputs from 1980 to 1990 between 0 and a 1000. var startDate = new Date(1980,1,1); var endDate = new Date(1989,12,31); var scale = thinkmap.scale.time().inputs(startDate,endDate).outputs(0,1000); scale(new Date(1980,1,1)); // returns 0 scale(new Date(1985,1,1)); // returns approximately 500 scale(new Date(1989,12,31)); // return 1000

Instance Methods