Fix the color of the serie in the comparison

master
jsers 5 years ago
parent ecb87505bc
commit 4d08dd4e8c

@ -60,7 +60,7 @@ export default class Graph extends Component<Props, State> {
chartOptions = config.chart; chartOptions = config.chart;
headerHeight = 35; headerHeight = 35;
counterList = []; counterList = [];
series = []; series = [] as any[];
state = { state = {
spinning: false, spinning: false,
errorText: '', errorText: '',

@ -1,12 +1,14 @@
import _ from 'lodash'; import _ from 'lodash';
import { hexPalette } from '../config'; import { hexPalette } from '../config';
import { SerieInterface } from '../interface'; import { SerieInterface, GraphDataInterface } from '../interface';
export default function normalizeSeries(data: any[]) { export default function normalizeSeries(data: any[], graphConfig: GraphDataInterface): SerieInterface[] {
const { comparison } = graphConfig;
const isComparison = !!_.get(comparison, 'length', 0);
const series = [] as SerieInterface[]; const series = [] as SerieInterface[];
_.each(_.sortBy(data, ['counter', 'endpoint']), (o, i) => { _.each(_.sortBy(data, ['counter', 'endpoint']), (o, i) => {
const { endpoint, comparison } = o; const { endpoint, comparison } = o;
const color = getSerieColor(o, i); const color = getSerieColor(o, i, isComparison);
const separatorIdx = o.counter.indexOf('/'); const separatorIdx = o.counter.indexOf('/');
let counter = endpoint ? '' : o.counter; let counter = endpoint ? '' : o.counter;

Loading…
Cancel
Save