You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
652 B
26 lines
652 B
2 years ago
|
import * as _ from 'lodash';
|
||
|
|
||
|
// Convert Grafana series into Chartwerk series
|
||
|
export class BarSeries {
|
||
|
private _seriesList;
|
||
|
|
||
|
constructor(grafanaSeriesList: any) {
|
||
|
this._seriesList = this._updateSeriesListWithChartwerkParams(grafanaSeriesList);
|
||
|
}
|
||
|
|
||
|
getChartwerkSeries(): any[] {
|
||
|
return this._seriesList;
|
||
|
}
|
||
|
|
||
|
private _updateSeriesListWithChartwerkParams(series: any[]): any[] {
|
||
|
return _.map(series, (serie: any, idx: number) => {
|
||
|
return {
|
||
|
target: serie.alias,
|
||
|
color: serie.color,
|
||
|
datapoints: _.map(serie.datapoints, (row) => _.reverse(_.clone(row))),
|
||
|
alias: serie.label,
|
||
|
};
|
||
|
});
|
||
|
}
|
||
|
}
|