echarts Allow margins for grid additional to position

g9icjywg  于 6个月前  发布在  Echarts
关注(0)|答案(4)|浏览(68)

What problem does this feature solve?

I am trying to auto calculate margins in a grid depending if a title, legend, dataZoom is added on top/bottom/left/right. The result is an amount of pixels I want to inset the grid from the position.
Currently this is only possible by positioning the grid with left/top. But this is not working if the grid is positioned relative, e.g. 50% from left. You cannot add an additional offset, e.g. "30px" when a dataZoom is added to the left yAxis.

The "containLabel" option is of no help here, as it doesn't cover dataZooms, titles, legends etc.

What does the proposed API look like?

Add following options to Grid option:

// Set margin to be 5 (px)
margin: 5
// Set the top and bottom margins to be 5 (px), and left and right margins to be 10 (px)
margin: [5, 10]
// Set each of the four margins seperately
margin: [
5, // up
10, // right
5, // down
10, // left
]

jyztefdp

jyztefdp1#

Hi! We've received your issue and please be patient to get responded. 🎉
The average response time is expected to be within one day for weekdays.

In the meanwhile, please make sure that you have posted enough image to demo your request. You may also check out the API and chart option to get the answer.

If you don't get helped for a long time (over a week) or have an urgent question to ask, you may also send an email to dev@echarts.apache.org . Please attach the issue link if it's a technical question.

If you are interested in the project, you may also subscribe our mailing list .

Have a nice day! 🍵

bbuxkriu

bbuxkriu2#

An even more powerful approach throughout the library would be to allow calculations widthin %/px attributes (e.g. left,right,top,bottom,width,height) similiar to calc() in CSS3.

E.g.
left: calc(50% + 18px)

x759pob2

x759pob23#

This issue has been automatically marked as stale because it did not have recent activity. It will be closed in 7 days if no further activity occurs. If you wish not to mark it as stale, please leave a comment in this issue.

jhdbpxl9

jhdbpxl94#

This would be very useful

相关问题