Skip to content

Commit

Permalink
fix[chjs]: slap optional chaining in case no peaks are passed
Browse files Browse the repository at this point in the history
  • Loading branch information
puglet5 committed Nov 11, 2023
1 parent 35d7fda commit 8a1a38f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions app/javascript/controllers/chart_controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,11 @@ export default class extends Controller {
transmissionPlot = false
showLabels = true
cubicInterpolationMode: string | undefined = undefined
displayLabelValues: number[][] = this.labelsValue.map(e => e.map(o => o.position).map(Number))
displayLabelValues: number[][] = this.labelsValue?.map(e => e?.map(o => o.position).map(Number)) ?? []
reverseXAxis: boolean = this.axesSpecValue["reverse"]

connect() {
console.log(this.labelsValue)
if (this.compareValue) {
this.disableControls()
this.visualize()
Expand Down Expand Up @@ -192,7 +193,7 @@ export default class extends Controller {
},
display: (context) => {
if (this.showLabels)
return (this.displayLabelValues[i].includes(context.dataIndex) ? "auto" : false)
return (this.displayLabelValues[i]?.includes(context.dataIndex) ? "auto" : false)
else
return false
},
Expand Down

0 comments on commit 8a1a38f

Please sign in to comment.