Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ECharts - Change bar chart line height

Tags:

charts

echarts

I'm creating a chart using Echarts and it looks like this on my page:

enter image description here

This causes me two issues, the first is that it's really bad to see the data in the graph, so I need to make the bars bigger. The second issue is that the bar labels (on the left) are being cut.

My chart config is similar to this, it only has more data in it:

option = {
  xAxis: {
  },
  yAxis: {
    data: ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"]
  },
  series: [{
    name: "Sale",
    type: "bar",
    data: [5, 20, 36, 10, 10, 20, 4]
  }]
}
like image 581
Raphael Andres Avatar asked Nov 27 '25 07:11

Raphael Andres


1 Answers

the solution was simple.

After messing around with both the echarts docs and the Laravel Charts that I was using, i managed to get what I wanted by setting a height property at my chart config. Something like this:

option = {
  xAxis: {
  },
  yAxis: {
    data: ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"]
  },
  series: [{
    name: "Sale",
    type: "bar",
    data: [5, 20, 36, 10, 10, 20, 4]
  }],
  height: 2000px
}
like image 168
Raphael Andres Avatar answered Dec 01 '25 04:12

Raphael Andres