diff --git a/src/components/Panel.tsx b/src/components/Panel.tsx index 6bf5f7b..7e39434 100644 --- a/src/components/Panel.tsx +++ b/src/components/Panel.tsx @@ -11,6 +11,8 @@ import { ChartwerkGaugePod } from '@chartwerk/gauge-pod'; import { ChartwerkBarPod } from '@chartwerk/bar-pod'; import { PanelData, TimeRange, PanelProps } from '@grafana/data'; +import { VizLegend } from '@grafana/ui'; +import { LegendDisplayMode } from '@grafana/schema'; import React, { useRef } from 'react'; import { css } from 'emotion'; @@ -24,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: @@ -35,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: @@ -52,17 +52,29 @@ export function Panel({ options, data, width, height, timeRange, onChangeTimeRan } window.open(options.gauge.link, '_self'); }; - + const legendItems = _.map(grafanaSeriesList, (serie) => { + return { + label: serie.alias, + color: serie.color, + yAxis: 1, + }; + }); + const chartHeight = options.visualizationType !== Pod.GAUGE ? height - 20 : height; return ( -
+