You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the current version of Kirby, if a chart is created where an empty array is passed to the labels input property, we will auto generate blank labels to apply to the x-axis. Otherwise the chart will not render:
In #2082 it was however discovered that there exist cases where we want to be able to pass an empty array of labels to the chart. For example when utilizingtimeScale via customOptions. Here we want the default behaviour of chart.js - generating blank labels will result in them being appended to the x-axis, causing the chart to render incorrectly.
Logic was introduced in #2082 to make it possible to use a timeScale with the stock chart type. But to simplify this logic, i think we should simply always pass labels directly to chart.js if anything is given to the labels input property.
Only if nothing is passed in here should we have some default behaviour.
Pseudo-code:
if labels are given: return labels
else if chart type is stock: return defaultStockChartLabels
else: return blank labels
This would be a breaking change as a chart now works with an empty array; it wouldn't after this change.
The text was updated successfully, but these errors were encountered:
In the current version of Kirby, if a chart is created where an empty array is passed to the
labels
input property, we will auto generate blank labels to apply to the x-axis. Otherwise the chart will not render:In #2082 it was however discovered that there exist cases where we want to be able to pass an empty array of labels to the chart. For example when utilizing
timeScale
viacustomOptions
. Here we want the default behaviour of chart.js - generating blank labels will result in them being appended to the x-axis, causing the chart to render incorrectly.Logic was introduced in #2082 to make it possible to use a
timeScale
with the stock chart type. But to simplify this logic, i think we should simply always pass labels directly to chart.js if anything is given to thelabels
input property.Only if nothing is passed in here should we have some default behaviour.
Pseudo-code:
This would be a breaking change as a chart now works with an empty array; it wouldn't after this change.
The text was updated successfully, but these errors were encountered: