Margin Convention II with ReactiveModel
This example demonstrates the margin convention for data visualization, animating the margins of a gray rectangle within an SVG as they shift in sinusoidal patterns. It shows how reusable code modules—ReactiveSVG, ReactiveMargin, and GrayRectangle—are composed into a MarginVis component using the ReactiveModel library and its `call` method. The visualization uses D3 v4 to append SVG elements and drive the animation via `d3.timer`, while window resizing updates the chart dimensions through the `Resize` function.
AI-generated descriptionThis example shows a variation of <a href='http://bl.ocks.org/curran/b8e76dd7003538975b3e81e86ac6dd1e'>Margin Convention with ReactiveModel</a> that encapsulates functionality using "reactive mixins" and reactiveModel.call. This demonstrates how property definitions and pieces of reactive behavior can be organized and potentially split off into separate modules. The purpose of this is to allow common patterns used by many data visualizations to be encapsulated as reusable modules, allowing the complexity of visualizations to grow while still being manageable and well organized. The model.call(fn) method was added in release v0.7.0, inspired by call() in d3-selection.
See also
<!-- Start of SimpleHitCounter Code --> <div align="center"><a href="http://www.simplehitcounter.com" target="_blank"><img src="http://simplehitcounter.com/hit.php?uid=2073662&f=16777215&b=0" border="0" height="18" width="83" alt="web counter"></a></div> <!-- End of SimpleHitCounter Code -->