dribnet / strokes

Let's pretend d3 was written in ClojureScript.
374 stars 28 forks source link

Documentation #6

Closed beandipper closed 9 years ago

beandipper commented 11 years ago

Finding this a great library, but I think it would be good if there was some documentation on how to use Eden with strokes

dribnet commented 11 years ago

Thanks for the feedback! Agree that documentation is lacking - perhaps an overview of features linked to existing examples would be best.

A good working example of using strokes/fetch-edn - which functions analogously as d3.json - is circle-pack which reads in this edn file. The demo can be seen online here.

mars0i commented 9 years ago

First, thanks very much for strokes! I'd much rather use d3.js in a convenient way from Clojurescript instead of a more limited library like c2.

An overview linked to examples might be too much (sounds like a lot of work) and too little (we already have the examples, but some of us have trouble understanding them).

What would help me would be a general description of the kinds of things that are provided. As it is, it's hard to know where to start with the examples, because to the uninitiated eye, strokes code looks a lot like regular d3.js code in Clojurescript. Without a lot of experience with d3.js in Clojurescript, it's difficult to figure out what strokes is adding--even though I'm pretty sure it's doing a lot. (I know Clojure, and I know d3 in Javascript, but I don't have a trained eye with the combination of d3 and Clojurescript.)

My sense, based on comparing the strokes and strokes-less code in the simple-bar example, is that helping new users to get beyond this stage wouldn't require a lot of work. (I might be wrong about that, since I don't know strokes well, obviously.)

Would it be possible to provide some very general documentation like this? "Strokes typically provides automatic conversion of Clojure vectors and maps to Javascript arrays, (a) so that you can avoid using cljs->js in such and such situations, and (b) so that you can avoid using the array function in such and such situations. The strokes versions of the following d3.js methods allow (a) ..., while the following allow (b) .... Here are two examples .... The general principle here is that whenever X, Y.

Obviously, thorough function documentation would be desirable, too, but that's a lot of work, and the right kind of overview--one that provides general principles of strokes code--might help a lot of people to figure out how to use strokes from the examples.

Thanks!

dribnet commented 9 years ago

Thanks @mars0i for the feedback. As you noted, the main thing provided is the ability to pass data to d3 without worrying about clj->js calls, and that functionality is provided by the upstream mrhyde library. However, these two libraries are no longer actively maintained by me and so I'd say this codebase now serves mostly as a proof of concept for others interested in experimenting with this approach.

If you are interested in trying this out, I'd suggest getting something very basic like the simple venn diagram (shown here) working and then building that out to something more complicated.

mars0i commented 9 years ago

OK, I understand. I had noticed that version numbers in the project.clj were not recent. Thanks very much, regardless. I've found the examples useful. I think it would be worthwhile for me to try working with d3 using pure Clojurescript at this point. It may be a little more verbose, but I may learn more about Clojurescript-Javascript interop.