shahinrostami / plotapi

Engaging visualisations, made easy.
https://plotapi.com
MIT License
267 stars 17 forks source link

`Allow_download` does not download -- js error #40

Closed csaund closed 3 years ago

csaund commented 3 years ago

Hello,

As stated, the allow_download functionality does not work. Functionally, the allow_download parameter works and the Download button appears next to the chart, but it fails to download. A screenshot of the error in the js console of chrome is posted below: I think the offenders are probably:

Access to script at 'https://datacrayon.com/assets/chord/download/d3-save-svg.js' from origin 'null' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

And

Uncaught ReferenceError: to_svg is not defined

As I did successfully set my username for the package, and have not hit the request limit, I suspect my credentials on the library are set successfully.

The plot successfully builds and displays so I am able to take a screenshot, so this error is not the end of the world.

This is on: Chord v3 (I think) Windows 10

image

shahinrostami commented 3 years ago

Hello @csaund

Thanks for sending this through. It's an experimental and quite temperamental feature because each browser handles it differently, and with the (justifiable) increase in browser security over time, I may have to remove it.

In anticipation of this I created the new output methods available here https://datacrayon.com/posts/statistics/data-is-beautiful/chord-pro-features-for-chord-diagrams/#Outputs-Methods

As well as

Chord(matrix, names).show()

and

Chord(matrix, names).to_html('out.html')

we now have

Chord(matrix, names).show_png()

and

Chord(matrix, names).to_png('out.png')

I'll let you know the outcome of my time on this - perhaps I can fix it again, or I retire it!

shahinrostami commented 3 years ago

Hello @csaund!

I've had some time to work on this. Can you test it and see if it works?

shahinrostami commented 3 years ago

Please let me know if you encounter it again! Closing for now.