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

html2canvas does not export red lines #340

Open
CSharpSeraph opened this issue Mar 1, 2021 · 5 comments
Open

html2canvas does not export red lines #340

CSharpSeraph opened this issue Mar 1, 2021 · 5 comments

Comments

@CSharpSeraph
Copy link

Hi everybody,

this is not exactly a jsgantt bug, but maybe someone had the same issue:

exporting the graph's div in html2canvas does not render the red arrows.

Any ideas / workarounds?

thanks!

@mariohmol
Copy link
Collaborator

The arrows are generated in a different div.. in the bottom after the chart.. have you seen this?

@CSharpSeraph
Copy link
Author

I found out. Actually the problem is that the div is set as Hidden:

if you comment the line after this:

f (this.vEvents.onLineContainerHover && typeof this.vEvents.onLineContainerHover === 'function') {
events_1.addListener('mouseover', this.vEvents.onLineContainerHover, vTmpDiv2);
events_1.addListener('mouseout', this.vEvents.onLineContainerHover, vTmpDiv2);
}
// vTmpDiv2.style.visibility = 'hidden'; /* THAT ONE */

Works like a charm. I did it only when I needed to export the b64, not during normal usage.

@mariohmol
Copy link
Collaborator

alright!!

and how are u using html2canvas? maybe we can incorporate this process in the docs on in code!

thanks

@CSharpSeraph
Copy link
Author

It is quite easy indeed,

you just call

html2canvas( [MAIN DIV CONTAINING THE CHART] ).then(function (canvas) {

then you call toDataURL:

imageData = canvas.toDataURL("image/png");

it gives you the base64 and you can embed it in an <img, send to an api to convert to jpg, and so on ...

@mariohmol
Copy link
Collaborator

@SeanBunch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants