Commit ade8aa5b by Torkel Ödegaard

feat(graph): refactorings

parent 34f15d92
......@@ -56,8 +56,8 @@ type QueryResult struct {
}
type TimeSeries struct {
Name string `json:"name"`
Points [][2]*float64 `json:"points"`
Name string `json:"target"`
Points [][2]*float64 `json:"datapoints"`
}
type TimeSeriesSlice []*TimeSeries
......
......@@ -22,12 +22,6 @@ class TestDataDatasource {
scenario: options.targets[0].scenario,
interval: options.intervalMs,
maxDataPoints: options.maxDataPoints,
}).then(res => {
res.data = res.data.map(item => {
return {target: item.name, datapoints: item.points};
});
return res;
});
}
......
......@@ -9,6 +9,8 @@ class GrafanaDatasource {
return this.backendSrv.get('/api/metrics/test', {
from: options.range.from.valueOf(),
to: options.range.to.valueOf(),
scenario: 'random_walk',
interval: options.intervalMs,
maxDataPoints: options.maxDataPoints
});
}
......
......@@ -98,65 +98,13 @@ export class DataProcessor {
}
customHandler(dataItem) {
console.log('custom', dataItem);
let nameField = this.panel.xaxis.name;
if (!nameField) {
throw {message: 'No field name specified to use for x-axis, check your axes settings'};
}
// let valueField = this.panel.xaxis.esValueField;
// let datapoints = _.map(seriesData.datapoints, (doc) => {
// return [
// pluckDeep(doc, valueField), // Y value
// pluckDeep(doc, xField) // X value
// ];
// });
//
// // Remove empty points
// datapoints = _.filter(datapoints, (point) => {
// return point[0] !== undefined;
// });
//
// var alias = valueField;
// re
return [];
}
// tableHandler(seriesData, index) {
// var xColumnIndex = Number(this.panel.xaxis.columnIndex);
// var valueColumnIndex = Number(this.panel.xaxis.valueColumnIndex);
// var datapoints = _.map(seriesData.rows, (row) => {
// var value = valueColumnIndex ? row[valueColumnIndex] : _.last(row);
// return [
// value, // Y value
// row[xColumnIndex] // X value
// ];
// });
//
// var alias = seriesData.columns[valueColumnIndex].text;
//
// return this.seriesHandler(seriesData, index, datapoints, alias);
// }
// esRawDocHandler(seriesData, index) {
// let xField = this.panel.xaxis.esField;
// let valueField = this.panel.xaxis.esValueField;
// let datapoints = _.map(seriesData.datapoints, (doc) => {
// return [
// pluckDeep(doc, valueField), // Y value
// pluckDeep(doc, xField) // X value
// ];
// });
//
// // Remove empty points
// datapoints = _.filter(datapoints, (point) => {
// return point[0] !== undefined;
// });
//
// var alias = valueField;
// return this.seriesHandler(seriesData, index, datapoints, alias);
// }
validateXAxisSeriesValue() {
switch (this.panel.xaxis.mode) {
case 'series': {
......
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