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

[unexpected behavior] using canvas.svg() in loop #9

Open
MaGrMo opened this issue Mar 20, 2020 · 2 comments
Open

[unexpected behavior] using canvas.svg() in loop #9

MaGrMo opened this issue Mar 20, 2020 · 2 comments

Comments

@MaGrMo
Copy link

MaGrMo commented Mar 20, 2020

hello have a problem with unexpected behavior using svg() method in loop
here is code sample:

There duplicated SVG outputs files. or some of them is empty or both conditions
managers = ['man1','man2','man3']
canvas = vegascope.LocalCanvas()
for man in managers:
canvas.svg(get_vega_data(man), man)

if init of the object LocalCanvas in loop there works ok, but there lot of browser tabs is opened.
managers = ['man1','man2','man3']
for man in managers:
canvas = vegascope.LocalCanvas()
canvas.svg(get_vega_data(man), man)

thanks a Lot!
(Editor wraps formatting Sorry( ) )

@jpivarski
Copy link
Member

I have to think hard to remember how this worked, but I think that vegascope.LocalCanvas() is supposed to create a new browser tab. To reuse an existing tab, you should call canvas.svg repeatedly on the same canvas. (My apologies if I have the interface wrong—it's all documented on the GitHub readme—take this as a hint that there is one command to make new tabs and other to refill the same tab.)

@MaGrMo
Copy link
Author

MaGrMo commented Mar 21, 2020

Thanks but i 1st case of code I'm reusing of the instance
canvas = vegascope.LocalCanvas()
but there is problem That saved svg - data browser is showing ok, but saving is not predictable behavior.

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