(timeline_config, options)
| 26 | export class TimeScale { |
| 27 | |
| 28 | constructor(timeline_config, options) { |
| 29 | |
| 30 | var slides = timeline_config.events; |
| 31 | this._scale = timeline_config.scale; |
| 32 | |
| 33 | options = mergeData({ // establish defaults |
| 34 | display_width: 500, |
| 35 | screen_multiplier: 3, |
| 36 | max_rows: null |
| 37 | }, options); |
| 38 | |
| 39 | this._display_width = options.display_width; |
| 40 | this._screen_multiplier = options.screen_multiplier; |
| 41 | this._pixel_width = this._screen_multiplier * this._display_width; |
| 42 | |
| 43 | this._group_labels = undefined; |
| 44 | this._positions = []; |
| 45 | this._pixels_per_milli = 0; |
| 46 | |
| 47 | this._earliest = timeline_config.getEarliestDate().getTime(); |
| 48 | this._latest = timeline_config.getLatestDate().getTime(); |
| 49 | this._span_in_millis = this._latest - this._earliest; |
| 50 | if (this._span_in_millis <= 0) { |
| 51 | this._span_in_millis = this._computeDefaultSpan(timeline_config); |
| 52 | } |
| 53 | this._average = (this._span_in_millis) / slides.length; |
| 54 | |
| 55 | this._pixels_per_milli = this.getPixelWidth() / this._span_in_millis; |
| 56 | |
| 57 | this._axis_helper = getBestHelper(this); |
| 58 | |
| 59 | this._scaled_padding = (1 / this.getPixelsPerTick()) * (this._display_width / 2) |
| 60 | this._computePositionInfo(slides, options.max_rows); |
| 61 | } |
| 62 | |
| 63 | _computeDefaultSpan(timeline_config) { |
| 64 | // this gets called when all events are at the same instant, |
nothing calls this directly
no test coverage detected