11

I will draw a line chart by echart library. When I draw a chart, it shows grid too. I do not need grid, but I cannot remove it. I have checked out Echart options and I know that grid:{show=false} is an option of echart but it is not effective. My snippet code is below.

function lineGraph(xAxisLabels){    
var echartLine = echarts.init(document.getElementById('myElineChart')); 
  echartLine.setOption({
    grid: {show: false},
    xAxis: [{
      type: 'category',
      showGrid: false,
      data: xAxisLabels
    }],
    yAxis: [{
      type: 'value',    
    }],
    series: [{
      name: 'Actual',
      type: 'line',
      data: [820, 932, 901, 934, 1290, 1330, 1320]
    }],
  });}

The result is below: enter image description here

I appreciate it if you help me.

RiTeSh
  • 513
  • 3
  • 12

2 Answers2

28

I'm late to the party, but answering this question if anyone in the future needs help.

It's a good guess to think that this is because of the grid attribute, but the grid is actually set to false by default. The lines are generated by an attribute on your X and Y axis, called splitLine, which makes it look like a grid. You can remove it by changing the attribute like shown below:

function lineGraph(xAxisLabels){    
var echartLine = echarts.init(document.getElementById('myElineChart')); 
  echartLine.setOption({
    grid: {show: false},
    xAxis: [{
      type: 'category',
      showGrid: false,
      data: xAxisLabels,
      splitLine: {
         show: false
      },
    }],
    yAxis: [{
      type: 'value',   
      splitLine: {
         show: false
      },
    }],
    series: [{
      name: 'Actual',
      type: 'line',
      data: [820, 932, 901, 934, 1290, 1330, 1320]
    }],
  });}
Andreas Engedal
  • 751
  • 7
  • 16
1
xAxis: {
    axisLine: {
        show: false, // Hide full Line
    },
    xisTick: {
        show: false, // Hide Ticks,
    },
}

Full result

enter image description here

RiTeSh
  • 513
  • 3
  • 12