DataFrame: split DataFrameHelper into MutableDataFrame and FieldCache (#18795)

* add appending utility

* add appending utility

* update comment

* rename to mutable

* move mutable functions out of DataFrameHelper

* move mutable functions out of DataFrameHelper

* move mutable functions out of DataFrameHelper

* turn DataFrameHelper into FieldCache

* guess time from name

* graph the numbers

* return the timeField, not just the index

* just warn on duplicate field names

* only use a parser if the input is a string

* append init all fields to the same length

* typo

* only parse string if value is a string

* DataFrame: test fixes

* Switch to null for missing values

* Fixed tests
This commit is contained in:
Ryan McKinley
2019-09-01 05:44:22 -07:00
committed by Torkel Ödegaard
parent 13f55bc5e8
commit c777301535
30 changed files with 579 additions and 301 deletions

View File

@@ -7,7 +7,7 @@ import {
LoadingState,
LogLevel,
CSVReader,
DataFrameHelper,
MutableDataFrame,
CircularVector,
DataFrame,
} from '@grafana/data';
@@ -182,7 +182,7 @@ export class SignalWorker extends StreamWorker {
const vals = new CircularVector({ capacity: maxRows });
this.values = [times, vals];
const data = new DataFrameHelper({
const data = new MutableDataFrame({
fields: [
{ name: 'Time', type: FieldType.time, values: times }, // The time field
{ name: 'Value', type: FieldType.number, values: vals },
@@ -351,7 +351,7 @@ export class LogsWorker extends StreamWorker {
const lines = new CircularVector({ capacity: maxRows });
this.values = [times, lines];
this.data = new DataFrameHelper({
this.data = new MutableDataFrame({
fields: [
{ name: 'Time', type: FieldType.time, values: times },
{ name: 'Line', type: FieldType.string, values: lines },