chart.xkcd icon indicating copy to clipboard operation
chart.xkcd copied to clipboard

consider interfacing with vega.js

Open g3o2 opened this issue 6 years ago • 4 comments

Interesting project! The syntax of your library strongly reminds me of vega-lite, which itself is based on vega and the latter being itself based on d3.

I can see at least three advantages for your library, in particular the rendering part, if you built a renderer for vega:

  • vega is extensible, even on the rendering part, and thus you would benefit from an already available interactive grammar of graphics syntax - no burden of inventing a new one;
  • better focus on the rendering itself instead of users asking for implementing this and that type of chart;
  • your renderer would be accessible to js (via vega and vega-lite), R (via vega widget) and python (via altair) communities.

g3o2 avatar Aug 19 '19 09:08 g3o2

Thanks for the suggestion, I will look into it to see if it easy to do so when I have time

timqian avatar Aug 19 '19 23:08 timqian

To save you even more time, please check this link ;)

g3o2 avatar Aug 20 '19 14:08 g3o2

BTW I am not even sure that you need to write your own renderer, there is already a svg, canvas and webgl renderer. Maybe some CSS or other middle solution is already sufficient...

Edit: According to feedback from one of the vega core developers, implementing xkcd kind of style while preserving the benefits from the vega ecosystem would probably require to:

  • write a post-processor on the vega-scenegraph to implement the sketchy effect on the marks (e.g. lines, axes, gridlines, bars, etc.). For completeness, here is an article on how vega works internally;

  • create a customised tooltip. For this purpose, one can tap into the vega-tooltip API for inserting a custom tooltip handler. There is also the possibility of theming the already existing tooltip via CSS;

  • the rest (e.g. font, font-size, etc.) can be implemented by a vega config specification, which sets the visualization’s theme. The guide to vega guides may be useful for experimenting.

g3o2 avatar Aug 20 '19 14:08 g3o2

Long-term matplotlib user here. Used mpl's xkcd style quite a bit, too. I'm digging into https://github.com/altair-viz/altair right now which is based on Vega. Would love to be able to use an xkcd style in that eco system, too!

Thanks for expressing all these thoughts @g3o2.

jgehrcke avatar Dec 30 '20 11:12 jgehrcke