diff --git a/src/components/Panel.tsx b/src/components/Panel.tsx index 8508b51..7e39434 100644 --- a/src/components/Panel.tsx +++ b/src/components/Panel.tsx @@ -26,7 +26,6 @@ export function Panel({ options, data, width, height, timeRange, onChangeTimeRan // we request animation frame here because we need an existing DOM-element at the moment we render the pod window.requestAnimationFrame(() => { - console.log('pod', options.visualizationType); let pod; switch (options.visualizationType) { case Pod.GAUGE: @@ -37,7 +36,6 @@ export function Panel({ options, data, width, height, timeRange, onChangeTimeRan case Pod.BAR: const barSeries = new BarSeries(grafanaSeriesList).getChartwerkSeries(); const chartwerkBarOptions = new BarOptions(grafanaSeriesList, onChangeTimeRange).getChartwerkOptions(); - console.log('data', barSeries, chartwerkBarOptions); pod = new ChartwerkBarPod((chartContainer as any).current, barSeries, chartwerkBarOptions); break; default: @@ -54,26 +52,28 @@ export function Panel({ options, data, width, height, timeRange, onChangeTimeRan } window.open(options.gauge.link, '_self'); }; - const legendItems = [ - { label: 'metric1', yAxis: 100, color: 'red' }, - { label: 'metric2', yAxis: 200, color: 'green' }, - ]; + const legendItems = _.map(grafanaSeriesList, (serie) => { + return { + label: serie.alias, + color: serie.color, + yAxis: 1, + }; + }); + const chartHeight = options.visualizationType !== Pod.GAUGE ? height - 20 : height; return (
- + {options.visualizationType !== Pod.GAUGE && ( + + )}
); }