Raphael Eckert
Raphael Eckert

Reputation: 118

chartjs-plugin-error-bars display error-bars without displaying label on a horizontalBar chart

i am trying to add error bars to a horizontal bar chart in chartjs using the chartjs-plugin-error-bars. It seems that the error bar is tied to a label rather than the actual data, but i dont want do display the label. is there a way to either not declare a label an still have error bars, or just hide the label.

var barChartData = {
  labels: ["shouldNotBeDisplayed"],
  datasets: [{
    data: [
      56,
    ],
    errorBars: {
      shouldNotBeDisplayed: {plus: 1, minus: 1},
    }
  }]
};

you can try it out here and see the chart: https://codepen.io/reckert/pen/rNWmdeK

Thank you in advance

Upvotes: 1

Views: 800

Answers (1)

uminder
uminder

Reputation: 26150

You can filter out tick labels by defining a yAxes.ticks.callback function as follows.

options: {
  ...
  scales: {
    yAxes: [{
      ticks: {
        callback: () => undefined
     }
   }]
},

For further details, please consult chapter Creating Custom Tick Formats from the Chart.js documentation.

Upvotes: 1

Related Questions