When comparing D3.js vs ZIM, the Slant community recommends D3.js for most people. In the question“What are the best JavaScript drawing libraries?” D3.js is ranked 1st while ZIM is ranked 29th. The most important reason people chose D3.js is:
D3.js is a very popular tool with an active community, resulting in plenty of learning resources and fast responses to questions.
Ranked in these QuestionsQuestion Ranking
Pros
Pro Large community
D3.js is a very popular tool with an active community, resulting in plenty of learning resources and fast responses to questions.
Pro Huge number of examples online
Most of the examples provided are by the author, but there's also a great community writing plugins and more examples.
Pro Doesn't require a proprietary framework
D3's emphasis on web standards gives you the full capabilities of modern browsers without tying yourself to a proprietary framework.
Pro Versatile library for manipulating data on the DOM
Pro Very flexible join paradigm
Can be tricky at first, but once learned, data manipulation and binding can easily generate complex visualizations for massive amounts of data.
Pro Great for highly interactive scenes
D3.js offers incredible levels of interactivity.
Pro Backwards compatible
D3.js is intended for modern browsers, so supports IE9 and above (IE8 with an additional library) as well as all the other modern browsers.
Pro ZIM lets you write less code
Here is a chart of examples showing ZIM at 37% less code the developer writes when compared to other frameworks such as PixiJS, Flutter, CreateJS, PaperJS, P5js, Phaser and the DOM.
Pro ZIM supports chaining
It is quite common in ZIM to not even store an object in a variable as chaining is available for almost all methods and there are short chainable methods for most properties.
new Circle().center().drag();
new Rectangle()
.loc(100,100)
.alp(0) // alpha
.animate({x:200, alpha:1}, .5);
Pro ZIM has dynamic parameters
new Tile(new Circle(20, series(red, blue, green), 10, 10).center();
// tiles 10x10 circles with colors is series of red, blue or green
new Emitter([new Circle(), new Rectangle()]).center();
// emits random circles and rectangles
interval({min:1, max:3}, ()=>{});
// each interval is between 1 and 3 seconds
So passing in a series lets you pick in order, passing in an array lets you pick randomly, passing in a min/max range picks from the range, passing in a function picks the result of the function. These can be applied to all styles too.
Pro ZIM has Style on the Canvas
Style = {
color:red,
Button:{
color:blue;
}
}
new Circle().center(); // red
new Button().center(); // blue
Pro The ZIM DUO technique of providing regular parameters or a configuration object literal is very handy.
For instance:
new Rectangle(100,100,undefined,undefined,undefined,20).center();
or
new Rectangle({width:100, height:100, corner:20}).center();
Cons
Con Steep learning curve
The complexity and flexibility of D3.js results in it being a time-consuming tool to learn for many users.
D3 is incredibly flexible; probably more so than any other JavaScript visualization library at the time of this posting. With that flexibility comes increased complexity. If you just want to create some quick charts you will get results faster with something else.
Con "Selections" are elegant, but somewhat hard to grok
Selections are core to working with D3 beyond the basics. They're powerful and useful, but require new developers to get up to speed (e.g. set aside 30m to read and digest: https://github.com/mbostock/d3/wiki/Selections) and if used in the context of a larger application will result in a portion of the code using different patterns than the rest, requiring a translation layer in between.