* `minor` unit using the given scale time `options`.
* Important: this method can return ticks outside the min and max range, it's the
* responsibility of the calling code to clamp values if needed.
- * @private
+ * @protected
*/
_generate() {
const adapter = this._adapter;
}
// @ts-ignore
- return Object.keys(ticks).sort((a, b) => a - b).map(x => +x);
+ return Object.keys(ticks).sort(sorter).map(x => +x);
}
/**
return table;
}
+ /**
+ * Generates all timestamps defined in the data.
+ * Important: this method can return ticks outside the min and max range, it's the
+ * responsibility of the calling code to clamp values if needed.
+ * @protected
+ */
+ _generate() {
+ const min = this.min;
+ const max = this.max;
+ let timestamps = super.getDataTimestamps();
+ if (!timestamps.includes(min) || !timestamps.length) {
+ timestamps.splice(0, 0, min);
+ }
+ if (!timestamps.includes(max) || timestamps.length === 1) {
+ timestamps.push(max);
+ }
+ return timestamps.sort((a, b) => a - b);
+ }
+
/**
* Returns all timestamps
* @return {number[]}
--- /dev/null
+module.exports = {
+ threshold: 0.01,
+ tolerance: 0.0015,
+ config: {
+ type: 'line',
+ data: {
+ datasets: [{data: [
+ {x: 1687849697000, y: 904},
+ {x: 1687817063000, y: 905},
+ {x: 1687694268000, y: 913},
+ {x: 1687609438000, y: 914},
+ {x: 1687561387000, y: 916},
+ {x: 1686875127000, y: 918},
+ {x: 1686873138000, y: 920},
+ {x: 1686872777000, y: 928},
+ {x: 1686081641000, y: 915}
+ ], fill: false}, {data: [
+ {x: 1687816803000, y: 1105},
+ {x: 1686869490000, y: 1114},
+ {x: 1686869397000, y: 1103},
+ {x: 1686869225000, y: 1091},
+ {x: 1686556516000, y: 1078}
+ ]}]
+ },
+ options: {
+ scales: {
+ x: {
+ type: 'timeseries',
+ bounds: 'data',
+ time: {
+ unit: 'day'
+ },
+ ticks: {
+ source: 'auto'
+ }
+ },
+ y: {
+ display: false
+ }
+ }
+ }
+ },
+ options: {
+ spriteText: true
+ }
+};
autoSkip: true,
autoSkipPadding: 75,
maxRotation: 0,
- sampleSize: 100
+ sampleSize: 100,
+ maxTicksLimit: 3
},
// manually set major ticks so that test passes in all time zones with moment adapter
afterBuildTicks: function(scale) {
- const major = [0, 12, 24];
const ticks = scale.ticks;
+ const major = [0, 264, 522];
for (let i = 0; i < ticks.length; i++) {
ticks[i].major = major.indexOf(i) >= 0;
}