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

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

问题描述

我正在尝试合并百度的echart(看起来非常好)。但是,如果没有设置标题或使用其工具栏,则实际图形周围会有很多空白。有没有办法让图表/图表使用更多的画布?

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中,网格属性的名称已更改为顶部和底部

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天全站免登陆