diff --git a/lib/timeline/Core.js b/lib/timeline/Core.js index 49cbde5532..422e01a549 100644 --- a/lib/timeline/Core.js +++ b/lib/timeline/Core.js @@ -411,7 +411,7 @@ class Core { 'width', 'height', 'minHeight', 'maxHeight', 'autoResize', 'start', 'end', 'clickToUse', 'dataAttributes', 'hiddenDates', 'locale', 'locales', 'moment', 'preferZoom', 'rtl', 'zoomKey', - 'horizontalScroll', 'verticalScroll', 'longSelectPressTime' + 'horizontalScroll', 'verticalScroll', 'longSelectPressTime', 'snap' ]; util.selectiveExtend(fields, this.options, options); this.dom.rollingModeBtn.style.visibility = 'hidden'; @@ -668,9 +668,9 @@ class Core { } const customTime = new CustomTime(this.body, util.extend({}, this.options, { - time : timestamp, + time: timestamp, id, - snap: this.itemSet.options.snap + snap: this.itemSet ? this.itemSet.options.snap : this.options.snap })); this.customTimes.push(customTime); diff --git a/lib/timeline/Graph2d.js b/lib/timeline/Graph2d.js index 7e69f4c192..9663040eb0 100644 --- a/lib/timeline/Graph2d.js +++ b/lib/timeline/Graph2d.js @@ -76,6 +76,13 @@ function Graph2d (container, items, groups, options) { }, hiddenDates: [], util: { + getScale() { + return me.timeAxis.step.scale; + }, + getStep() { + return me.timeAxis.step.step; + }, + toScreen: me._toScreen.bind(me), toGlobalScreen: me._toGlobalScreen.bind(me), // this refers to the root.width toTime: me._toTime.bind(me), diff --git a/lib/timeline/optionsGraph2d.js b/lib/timeline/optionsGraph2d.js index 7ffab7e1ca..cde26916fc 100644 --- a/lib/timeline/optionsGraph2d.js +++ b/lib/timeline/optionsGraph2d.js @@ -159,6 +159,7 @@ let allOptions = { showMajorLabels: {'boolean': bool}, showMinorLabels: {'boolean': bool}, showWeekScale: {'boolean': bool}, + snap: {'function': 'function', 'null': 'null'}, start: {date, number, string, moment}, timeAxis: { scale: {string,'undefined': 'undefined'},