echarts icon indicating copy to clipboard operation
echarts copied to clipboard

Column of whitespace on right side of chart, how to get rid of it?

Open cosmicscr opened this issue 10 years ago • 1 comments

问题简述 (One-line summary)

There is a column of whitespace on the right side of the chart.

screen shot 2016-10-14 at 1 01 31 pm #### 版本及环境 (Version & Environment) - ECharts 版本 (ECharts version): 3.2.3 - 浏览器类型和版本 (Browser version): Chrome 53 - 操作系统类型和版本 (OS Version): OSX Yosemite #### 重现步骤 (Steps to reproduce) 1. Render chart with the options 2. See unexplainable column of whitespace on right side of chart.

I've searched through all the axis options but cannot figure out how to get rid of that white space.

Thanks!

期望结果 (Expected behaviour)

可能哪里有问题 (What went wrong)

ECharts配置项 (ECharts option)

option = {
  "color": [
    "green",
    "red"
  ],
  "tooltip": {
    "trigger": "axis",
    "showDelay": 0
  },
  "xAxis": [
    {
      "type": "value",
      "scale": true,
      "boundaryGap": false,
      "splitNumber": 20,
      "axisLabel": {
        "show": false
      }
    }
  ],
  "yAxis": [
    {
      "type": "value",
      "scale": false,
      "boundaryGap": false
    }
  ],
  "series": [
    {
      "name": "Bids",
      "type": "line",
      "stack": "bids",
      "itemStyle": {
        "normal": {
          "areaStyle": {}
        }
      },
      "data": [
        [
          0.01805,
          50
        ],
        [
          0.0181,
          40
        ],
        [
          0.018150000000000003,
          30
        ],
        [
          0.018200000000000004,
          20
        ],
        [
          0.018250000000000006,
          10
        ],
        [
          0.018250000000100006,
          0
        ]
      ]
    },
    {
      "name": "Offers",
      "type": "line",
      "stack": "offers",
      "itemStyle": {
        "normal": {
          "areaStyle": {}
        }
      },
      "data": [
        [
          0.0190499999999,
          0
        ],
        [
          0.01905,
          10
        ],
        [
          0.019100000000000002,
          20
        ],
        [
          0.019150000000000004,
          30
        ],
        [
          0.019200000000000005,
          40
        ],
        [
          0.019250000000000007,
          50
        ]
      ]
    }
  ]
}

其他信息 (Other comments)

cosmicscr avatar Oct 14 '16 19:10 cosmicscr

Try xAxis.max please.

  "xAxis": [
    {
      "type": "value",
      "scale": true,
      "boundaryGap": false,
      "splitNumber": 20,
      "max": 0.01925,
      "axisLabel": {
        "show": false
      }
    }
  ],

Or, in your case, you can format your data using +value.toFixed(5), then the max value 0.019250000000000007 on xAxis will be formatted to 0.01925, and the whitespace on the right side will disappear.

100pah avatar Oct 15 '16 14:10 100pah