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

How do you use canvas to render figures? #65

Open
slowkow opened this issue Apr 12, 2018 · 4 comments
Open

How do you use canvas to render figures? #65

slowkow opened this issue Apr 12, 2018 · 4 comments
Labels
documentation API Documentation good first issue Good for newcomers help wanted Extra attention is needed

Comments

@slowkow
Copy link

slowkow commented Apr 12, 2018

This tutorial suggests that picasso.js can render to a canvas, an svg element, or the dom:

https://beta.observablehq.com/@cbt1/picasso-js-creating-your-own-tooltip-component

Is that true?

I don't see any documentation about specifying canvas instead of svg to render figures.

Could I please ask for a minimal example?

It would be nice if I could search for "canvas" or "render" and find instructions on the documentation page: https://picassojs.com/docs/chart.html#render-a-chart

@mindspank
Copy link

mindspank commented Apr 17, 2018

Each component will have a rendering target where canvas is the prefered one.
You can also specify a priority order on the picasso instance picasso.renderer.prio(['canvas'])

@slowkow
Copy link
Author

slowkow commented Apr 18, 2018

Thanks, Alexander!

Here is a minimal example showing how to switch from SVG to canvas.

Note that SVG is the default renderer, not canvas.

https://jsfiddle.net/slowkow/5ry08e77/

This uses canvas to render the figure:

// this works
picasso.renderer.prio(['canvas'])

// this also works
picasso.renderer.default('canvas')

var mychart = picasso.chart({})

This uses SVG to render the figure:

var mychart = picasso.chart({})

Could I please ask you to add this to the documentation?

The page exists: https://picassojs.com/docs/picasso.html

But there is no link to this page in the documentation, as far as I can tell.

I only found that page because I saw it in the GitHub repo here: docs/dist/picasso.md

@mindspank
Copy link

mindspank commented Apr 18, 2018

@miralemd ^^
Assuming picasso.renderer.prio() is stable enough to document? If so I can take a stab at it.

@miralemd
Copy link
Contributor

We do indeed support canvas rendering but have apparently completely missed to document that :D.

The way to enable it is to specify the defaultrenderer you want to use on the picasso instance

picasso.renderer.default('canvas')`

@mindspank Stab it :P

@miralemd miralemd added the documentation API Documentation label Apr 19, 2018
@miralemd miralemd added the good first issue Good for newcomers label May 16, 2018
@JohanBjerning JohanBjerning added the help wanted Extra attention is needed label Oct 3, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation API Documentation good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

4 participants