From b8025c7702a8ff00df8cff650a147bbae0a9ecd4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Tue, 15 Dec 2020 09:56:09 +0100 Subject: [PATCH] Sparkline: Fixes issue with sparkline that sent in custom fillColor instead of fillOpacity (#29825) * Sparkline: Fixes issue with sparkline that sent in custom fillColor instead of fillOpacity * Updated --- .../components/uPlot/config/UPlotSeriesBuilder.ts | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/packages/grafana-ui/src/components/uPlot/config/UPlotSeriesBuilder.ts b/packages/grafana-ui/src/components/uPlot/config/UPlotSeriesBuilder.ts index f3c69260dd2..a014754fe37 100755 --- a/packages/grafana-ui/src/components/uPlot/config/UPlotSeriesBuilder.ts +++ b/packages/grafana-ui/src/components/uPlot/config/UPlotSeriesBuilder.ts @@ -73,14 +73,19 @@ export class UPlotSeriesBuilder extends PlotConfigBuilder { let fillConfig: any | undefined; let fillOpacityNumber = fillOpacity ?? 0; - if (fillColor && fillOpacityNumber !== 0) { + + if (fillColor) { fillConfig = { - fill: tinycolor(fillColor) - .setAlpha(fillOpacityNumber / 100) - .toRgbString(), + fill: fillColor, }; } + if (fillOpacityNumber !== 0) { + fillConfig.fill = tinycolor(fillColor ?? lineColor) + .setAlpha(fillOpacityNumber / 100) + .toRgbString(); + } + return { scale: scaleKey, spanGaps: spanNulls,