Seth
Seth

Reputation: 63

Completely hiding the y-axis in echart bar chart

Using echarts 3.8.5, I am trying to create a bar chart with no y-axis labels.

Here is a snippet of my options object:

const options = {
  yAxis: [
    {
      show: false,
      type: "log",
    }
  ],

  // additional config...
};

The result looks something like this:

chart image

There is an empty white space to the left of the chart. It appears the space for the y-axis labels is being reserved, even though I set show to false. How can I get the chart to extend all the way to the left, without having this empty space?

Upvotes: 6

Views: 15896

Answers (1)

esion
esion

Reputation: 238

"y-axis: show" is actually for the y-axis line itself. I don't think it has to do with the labels themselves. I think echarts is trying to keep those labels in there, but they are just not showing.

Note: Just got home from work and my original answer did not work. Are you using a grid? I just tested it and use something like this:

myChart.setOptions({
    grid: {
       left: '15px',
       right: '15px'
    },
.........(add more options as needed here)
}

Upvotes: 9

Related Questions