Bugfix: Updating storybook example to pass theme property to BarGuage (#98804)

* Updating storybook example and making sure BarGauage has theme setup.

* removed unneccessary theme.

* Reverted change updated example.
pull/98868/head
Marcus Andersson 6 months ago committed by GitHub
parent 01aeb56646
commit 5282b7ca8c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 29
      packages/grafana-ui/src/components/BarGauge/BarGauge.mdx

@ -14,34 +14,35 @@ import { VizOrientation, ThresholdsMode, Field, FieldType, getDisplayProcessor }
const field: Partial<Field> = { const field: Partial<Field> = {
type: FieldType.number, type: FieldType.number,
config: { config: {
min: minValue, min: 0,
max: maxValue, max: 100,
thresholds: { thresholds: {
mode: ThresholdsMode.Absolute, mode: ThresholdsMode.Absolute,
steps: [ steps: [
{ value: -Infinity, color: 'green' }, { value: -Infinity, color: 'green' },
{ value: threshold1Value, color: threshold1Color }, { value: 20, color: 'blue' },
{ value: threshold2Value, color: threshold2Color }, { value: 90, color: 'red' },
], ],
}, },
}, },
}; };
field.display = getDisplayProcessor({ field });
const value = { field.display = getDisplayProcessor({ theme, field });
text: value.toString(),
title: title,
numeric: value,
};
<BarGauge return (
value={70} <BarGauge
theme={theme}
field={field.config} field={field.config}
display={field.display} display={field.display}
value={value} value={{
text: '70',
title: 'Title of data point',
numeric: 70,
}}
orientation={VizOrientation.Vertical} orientation={VizOrientation.Vertical}
displayMode={BarGaugeDisplayMode.Basic} displayMode={BarGaugeDisplayMode.Basic}
/>; />
);
``` ```
<ArgTypes of={BarGauge} /> <ArgTypes of={BarGauge} />

Loading…
Cancel
Save