Skip to content

Commit

Permalink
fix(chart): prevent custom ticks when index axis is y
Browse files Browse the repository at this point in the history
  • Loading branch information
MatsJohansen87 committed Oct 26, 2023
1 parent 6341f1f commit 9f94858
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions packages/lib/src/components/results/ChartComponent.wc.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@
title: {
display: true,
text: yAxisTitle
}
},
},
x: {
display: viewScales,
Expand All @@ -133,12 +133,12 @@
},
ticks: (chartType === "bar") ? {
callback: (val: any) => {
if (typeof val === 'string') return val.toString()
const key: unknown = (initialChartData.data.labels[val])
if(indexAxis === 'y') return val.toString()
if (typeof val === 'string') return val
const key: unknown = (initialChartData.data.labels[val]) !== undefined
? initialChartData.data.labels[val] : val.toString();
if (typeof key !== 'string') return val.toString()
let result = (headers.get(key))
? headers.get(key) : key;
let result = (headers.get(key)) ? headers.get(key) : key;
return result
}
} : []
Expand Down

0 comments on commit 9f94858

Please sign in to comment.