Bar Chart: Crash when no number field exist (#102265)

* fix bar chart crash

* format

* use optional chaining
pull/102673/head
jackyin 9 months ago committed by GitHub
parent bb8392c9a1
commit c661077651
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 2
      public/app/plugins/panel/barchart/utils.ts

@ -247,7 +247,7 @@ export const prepConfig = ({ series, totalSeries, color, orientation, options, t
// use opacity from first numeric field
let opacityField = frame.fields.find((f) => f.type === FieldType.number)!;
fillOpacity = (opacityField.config.custom.fillOpacity ?? 100) / 100;
fillOpacity = (opacityField?.config?.custom?.fillOpacity ?? 100) / 100;
getColor = (seriesIdx: number, valueIdx: number) => {
let field = frame.fields[seriesIdx];

Loading…
Cancel
Save