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

bundled examples generate only svg header line, no drawing #8

Closed
nd3i opened this issue Apr 10, 2016 · 9 comments
Closed

bundled examples generate only svg header line, no drawing #8

nd3i opened this issue Apr 10, 2016 · 9 comments

Comments

@nd3i
Copy link
Contributor

nd3i commented Apr 10, 2016

The two examples bundled with SVG::Plot, run under current Rakudo (2016.03-113-g37857b2) generate only the svg header element and no drawing elements.

$ perl6 circle.pl
<svg xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="400" height="250" />

I asked for help on reddit;
https://www.reddit.com/r/perl6/comments/4e133o/problem_using_svgplot/?sort=old
There are links to more details in this thread:
https://www.reddit.com/r/perl6/comments/4e133o/problem_using_svgplot/d1wrz35

It seems that SVG::Plot is generating a couple of bare lists in the output data structure, which leads to XML::Writer ignoring everything but the top svg => [ ] pair. /u/raiph suggested this may have happened with the GLR.

@nd3i
Copy link
Contributor Author

nd3i commented Apr 12, 2016

Here's a patch showing the changes that work for me.

I've no idea if this is right; I only got here through trial-and-error. But the examples seem to be working.

flatten_diff.txt

@niner
Copy link
Collaborator

niner commented Apr 12, 2016

Your changes look entirely reasonable to me. Can you create a pull request please?

@MasterDuke17
Copy link

If I specify :full I get no body, but the height and width are set, if I specify :!full I get a body, but the height and width aren't set. I also had to make a change to SVG (moritz/svg#1), I don't know if they're related.

@MasterDuke17
Copy link

MasterDuke17 commented Aug 15, 2016

For example, using the same example/circle.pl.

unmodified:

perl6 circle.pl 
# <svg xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="400" height="250" />

adding :!full to the plot() call:

perl6 circle.pl
# Method 'key' not found for invocant of class 'Array'
  in method serialize at /usr/share/perl6/vendor/sources/A82811D3E34196F12B956F15901F062744206B18 (SVG) line 12
  in block <unit> at circle.pl line 12
perl6 --version
# This is Rakudo version 2016.07.1 built on MoarVM version 2016.07
implementing Perl 6.c.

@Xliff
Copy link
Collaborator

Xliff commented Aug 21, 2016

This patch should allow the payload XML properly display. This also looks to eliminate the error regarding "method 'key' not found...", however I'm not sure if the output is valid.

Cheers!

plot_patch.txt

@Xliff
Copy link
Collaborator

Xliff commented Aug 21, 2016

Looks like nd3i beat me to the punch a while ago, however I did not notice his changes in a recently cloned version of the code.

If you need me to update things and submit a PR, please let me know.

@moritz
Copy link
Owner

moritz commented Aug 21, 2016

@Xliff as on issue #10, please make a PR or push directly. Thanks!

@MasterDuke17
Copy link

@Xliff++ Thanks, that patch worked. I plan to release a version of Benchable soon that uses all Perl 6 modules and SVG::Plot was the last thing I was waiting for.

@Xliff
Copy link
Collaborator

Xliff commented Aug 24, 2016

Excellent! Glad I could help. Looking forward to seeing what you have in Benchable.

@Xliff Xliff closed this as completed Aug 28, 2016
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

5 participants