Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Save as image background for connected charts #10099

Closed
MINDoSOFT opened this issue Mar 13, 2019 · 12 comments · Fixed by #10205, OpenTMI/opentmi-default-gui#32 or DeviaVir/zenbot#2011 · May be fixed by dyna-dot/iClient-JavaScript-s#1
Closed
Assignees
Labels
en This issue is in English enhancement

Comments

@MINDoSOFT
Copy link

Version

4.2.1-rc.2

Reproduction link

https://jsfiddle.net/z9hj8xqd/3/

Steps to reproduce

Notice that the 2 charts are connected.

Click the save as image toolbox button.

See the transparent background between the charts in the exported png image.

What is expected?

When "save as image" is clicked for connected charts, the exported image should contain the background color for every part of the image.

What is actually happening?

Where there are no charts (e.g. other DOM elements), the background of the image is transparent.


I ran into this bug, because I have connected charts on my page and they have DOM elements in between them.

@echarts-bot
Copy link

echarts-bot bot commented Mar 13, 2019

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.

Have a nice day! 🍵

@echarts-bot echarts-bot bot added bug en This issue is in English pending We are not sure about whether this is a bug/new feature. waiting-for-help labels Mar 13, 2019
@deqingli deqingli removed the bug label Mar 15, 2019
@Ovilia
Copy link
Contributor

Ovilia commented Mar 18, 2019

@MINDoSOFT Sorry I could not get it. The transparent between the two charts is expected since there's no chart and thus no background there.

@Ovilia Ovilia added missing-demo The author should provide a demo. waiting-for-author and removed waiting-for-help labels Mar 18, 2019
@Meldanen
Copy link

Meldanen commented Mar 21, 2019

I have the same issue.

@Ovilia Even though it's expected it doesn't make much sense from a user's perspective.
Shouldn't the space between the charts be filled in the the same background colour as the chart's? (e.g. white)

@Ovilia
Copy link
Contributor

Ovilia commented Mar 22, 2019

@Meldanen In this case, you can set the background of the container using CSS.

@MINDoSOFT
Copy link
Author

Hello there,

@Ovilia I have tried your suggested approach by setting the background color of the parent div but still when saving the image the background for the space between the charts is transparent. You can see the jsfiddle here.

Here is how it looks in the browser
Screenshot from 2019-03-22 09-00-49

And here is how it looks after save as image (the black background is the transparent part)
echarts (32)

Thank you for your time.

@Ovilia
Copy link
Contributor

Ovilia commented Mar 22, 2019

I see. So what do you think if we use CSS background color to render first, and then the chart background?

@Ovilia Ovilia added enhancement and removed missing-demo The author should provide a demo. pending We are not sure about whether this is a bug/new feature. waiting-for-author labels Mar 22, 2019
@Ovilia Ovilia self-assigned this Mar 22, 2019
@MINDoSOFT
Copy link
Author

For my use case, I believe only the chart background should be used. There is no need to use the css background color.

Best regards,

Sergios.

@Meldanen
Copy link

Chart background makes sense for me as well

@Ovilia
Copy link
Contributor

Ovilia commented Mar 25, 2019

But there are two chart instances, and thus two possible backgroundColor options.
What is expected if they are set to be different values?

@MINDoSOFT
Copy link
Author

MINDoSOFT commented Mar 26, 2019

Hi @Ovilia ,

only in the case where the charts have different background colors, I think the container css background color should be used.

@Ovilia
Copy link
Contributor

Ovilia commented Mar 27, 2019

I think this breaks the consistency of expectation. For example, if the user has set CSS background, he may confuse why in some cases it is used and some not.

Ovilia added a commit that referenced this issue Apr 3, 2019
toolbox.feature.saveAsImage.connectedBackgroundColor can be used to set
the background color.
Fix #10099
@Ovilia
Copy link
Contributor

Ovilia commented Apr 3, 2019

I had a second thought and found CSS background may not be accurate, because the container may have a transparent background while the ancestors may have a background color.
So, in this commit, I added an option toolbox.feature.saveAsImage.connectedBackgroundColor to configure the background color between the connected charts, and the default value is '#fff'.

Ovilia added a commit that referenced this issue Apr 15, 2019
toolbox.feature.saveAsImage.connectedBackgroundColor can be used to set
the background color.
Fix #10099
100pah added a commit that referenced this issue Apr 21, 2019
* 'master' of https://github.com/apache/incubator-echarts:
  fix: last axis label duplicated, fix #10304
  feat: support backgroundColor for connected charts in toolbox toolbox.feature.saveAsImage.connectedBackgroundColor can be used to set the background color. Fix #10099
  fix: set default position to be bottom
  test: add test case for b3a2548 #10202
  feat: support tooltip for toolbox #10202
  test: update test example
  feat: add toolbox text style support
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment