如何减少百度echarts周围的空白 [英] How to minimize whitespace around Baidu's echarts

查看:39
本文介绍了如何减少百度echarts周围的空白的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试合并百度的 echarts(看起来非常好).然而,当一个人既没有设置标题也没有使用他们的工具栏时,实际图形周围会有很多空白.有没有办法让图形/图表使用更多的画布?

I'm trying to incorporate Baidu's echarts (which look really good). However, there is a lot of whitespace around the actual graph when one doesn't set a title nor uses their toolbar. Is there a way to have the graph/chart use more of the canvas?

我目前的解决方案是在容器内添加一个额外的东西,然后通过将top"和left"设置为负值来将其宽度和高度设置为更大的边距我想要删除各自的边距.不优雅,更重要的是,不健壮,但它暂时有效.

My current solution to add an extra inside the container one and then set it's width and height to be be bigger by the margins I want to remove and the offset it by setting 'top' and 'left' to negative values of the respective margins. Not elegant and more importantly, not robust, but it works for the moment.

推荐答案

在 ECharts 4.X 中

正如其他一些海报所提到的,摆脱空白的正确方法是更改​​ options.grid.

https://ecomfe.github.io/echarts-doc/public/en/option.html#grid

grid: {
  left: 0,
  top: 0,
  right: 0,
  bottom: 0
}

在 ECharts 4 中,网格属性的名称已更改为 leftrighttopbottom.

In ECharts 4, the names of the grid properties have been changed to left, right, top, and bottom.

感谢上面的答案为我指明了正确的方向!

Thanks to the answers above for pointing me in the right direction!

此外,如上所述,更改 option.legend 对我的图表没有影响.

Further, changing the option.legend, as suggested above, had no effect on my chart.

这篇关于如何减少百度echarts周围的空白的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆