Remove canvas dependency for core Vega
See original GitHub issueRequiring canvas dependency (or any other lib that uses native node bindings and requires C++ compilation) is always a challenge. I think it would greatly simplify Vega integration into large existing projects if it didn’t require canvas, but offered it as either a separate package, e.g. vega-server, or used some other npm install magic. Or we could create vega-no-canvas?
The moment I add vega lib as a dependency every user who wants to contribute to my project is required to install several native libraries/packages. And the instruction is complex and different for each OS / version. The issue also shows up for build integration (my project now has to specify complex travis configuration, or alter Jenkins, …).
Issue Analytics
- State:
- Created 6 years ago
- Reactions:7
- Comments:13 (10 by maintainers)
Top Results From Across the Web
Usage - Vega & Vega-Lite
The vega package does not require node-canvas by default, so you must include it as an explicit dependency in your own project if...
Read more >Vega | Kibana Guide [master] - Elastic
Queries that use custom time filters; Complex calculations; Extracted data from _source instead of aggregations; Scatter charts, sankey charts, and custom maps ...
Read more >Solved: Workflow Dependencies - Designer - Alteryx Community
When I select OK to get back to the canvas and then access dependencies again I am back where I stared with the...
Read more >Introduction to Vega-Lite / UW Interactive Data Lab | Observable
This notebook walks through the basic process of creating visualizations with Vega-Lite. At its core, Vega-Lite uses JavaScript Object Notation (JSON) as a ......
Read more >Reactive Vega: A Streaming Dataflow Architecture for ...
The Reactive Vega dataflow graph created from a declarative ... Dependent signals are evaluated in a ... Reactive Vega (Canvas).
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

I’ve added a new vega-canvas module that centralizes instantiation of canvas instances. It does not include explicit dependencies / optional dependencies on node-canvas libraries, deferring to parent projects to include node-canvas when desired.
The vega-scenegraph and vega-wordcloud modules now depend on vega-canvas, and so do not directly import node-canvas (other than as a dev dependency for testing).
Vega 3.0.10 has been released and now includes explicit optionalDependencies on
canvasandcanvas-prebuilt. This is done to maintain compatibility, such that node.js use and command line utilities continue to work as expected. To create a Vega variant that does not attempt to import node-canvas, you can basically copy the main Vega repo and remove the optionalDependencies from package.json.I’m considering adding a new vega-client module to the Vega org that does exactly this, which would then replace Yuri’s vega-nocanvas. Feel free to share any additional thoughts here.
I’ll redirect that question to @kanitw and @domoritz. I believe Vega-Lite only depends on Vega for testing purposes, so canvas should only be an issue there if you are loading the devDependencies to run test cases.
Another question is vega-embed. That project should probably just import vega-lib instead of vega proper, but I’ll leave that question to the devs on that project.
Feel free to file issues directly on the relevant repos!