});
```
+When the scale is in `series` mode, the data indices are expected to be unique, sorted, and consistent across datasets.
+
### Scale Bounds
The `bounds` property controls the scale boundary strategy (bypassed by `min`/`max` time options).
}
function getDataTimestamps(scale) {
- var timestamps = scale._cache.data || [];
- var i, ilen, metas;
+ const isSeries = scale.options.distribution === 'series';
+ let timestamps = scale._cache.data || [];
+ let i, ilen, metas;
if (timestamps.length) {
return timestamps;
}
metas = scale._getMatchingVisibleMetas();
+
+ if (isSeries && metas.length) {
+ return metas[0].controller._getAllParsedValues(scale);
+ }
+
for (i = 0, ilen = metas.length; i < ilen; ++i) {
timestamps = timestamps.concat(metas[i].controller._getAllParsedValues(scale));
}
}
function getLabelTimestamps(scale) {
- var timestamps = scale._cache.labels || [];
- var i, ilen, labels;
+ const isSeries = scale.options.distribution === 'series';
+ const timestamps = scale._cache.labels || [];
+ let i, ilen, labels;
if (timestamps.length) {
return timestamps;
}
// We could assume labels are in order and unique - but let's not
- return (scale._cache.labels = arrayUnique(timestamps.sort(sorter)));
+ return (scale._cache.labels = isSeries ? timestamps : arrayUnique(timestamps.sort(sorter)));
}
function getAllTimestamps(scale) {
- var timestamps = scale._cache.all || [];
- var label, data;
+ let timestamps = scale._cache.all || [];
+ let label, data;
if (timestamps.length) {
return timestamps;