datavisyn/chartjs-plugin-error-bars

Multi-lined labels string[][]

Closed this issue · 1 comments

ChartJS allows multi-lined labels of type string[][], but you can't have an array as a key. How to add error deviations to a data with multi-lined label as string[] array label?

  data: {
    labels: [['January', 'January line 2'], ['February', 'February line 2'], ['March', 'March line 2']],
    datasets: [{
      ...
      errorBars: {
        'February': {plus: 15, minus: -34}, // the label is not 'February' but ['February', 'February line 2'] ???
        'March': {plus: 5, minus: -24}
      },
...

How to add the {plus, minus} error object to the labels[0] which is of type string[] - [string, string] while you can't have a string[] key?

You can join the string array to a string and pass it as a key. Working:
[['January', 'January line 2'].toString()]: {plus: 15, minus: -34}