Commit 0ba07720 by Ryan McKinley Committed by Torkel Ödegaard

TimeSeries: assume values are all numbers (#18540)

* assume number for TimeSeries types

* use const
parent 91a911b6
...@@ -29,6 +29,15 @@ describe('toDataFrame', () => { ...@@ -29,6 +29,15 @@ describe('toDataFrame', () => {
expect(series.fields[0].name).toEqual('Value'); expect(series.fields[0].name).toEqual('Value');
}); });
it('assumes TimeSeries values are numbers', () => {
const input1 = {
target: 'time',
datapoints: [[100, 1], [200, 2]],
};
const data = toDataFrame(input1);
expect(data.fields[0].type).toBe(FieldType.number);
});
it('keeps dataFrame unchanged', () => { it('keeps dataFrame unchanged', () => {
const input = { const input = {
fields: [{ text: 'A' }, { text: 'B' }, { text: 'C' }], fields: [{ text: 'A' }, { text: 'B' }, { text: 'C' }],
......
...@@ -29,6 +29,7 @@ function convertTimeSeriesToDataFrame(timeSeries: TimeSeries): DataFrame { ...@@ -29,6 +29,7 @@ function convertTimeSeriesToDataFrame(timeSeries: TimeSeries): DataFrame {
fields: [ fields: [
{ {
name: timeSeries.target || 'Value', name: timeSeries.target || 'Value',
type: FieldType.number,
unit: timeSeries.unit, unit: timeSeries.unit,
}, },
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment