Skip to content
Snippets Groups Projects
Unverified Commit 3fddc4cd authored by Paul Rosenzweig's avatar Paul Rosenzweig Committed by GitHub
Browse files

add special case for timeseries with one x value (#10200)

parent c34cb507
No related branches found
No related tags found
No related merge requests found
......@@ -196,6 +196,10 @@ function computeTimeseriesDataInvervalIndex(xValues, unit) {
if (unit && INTERVAL_INDEX_BY_UNIT[unit] != undefined) {
return INTERVAL_INDEX_BY_UNIT[unit];
}
// Always use 'day' when there's just one value.
if (xValues.length === 1) {
return TIMESERIES_INTERVALS.findIndex(ti => ti.interval === "day");
}
// Keep track of the value seen for each level of granularity,
// if any don't match then we know the data is *at least* that granular.
const values = [];
......
......@@ -132,6 +132,7 @@ describe("visualization.lib.timeseries", () => {
10,
[["2015-01-01T00:00:00.000Z"], ["2025-01-01T00:00:00.000Z"]],
],
["day", 1, [["2019-01-01T00:00:00.000Z"]]],
];
TEST_CASES.map(([expectedInterval, expectedCount, data]) => {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment