I'm not sure but comparing with thejit implementation is is probably best to create a module for each render type.

This gives users more control over what displays are allowed and probably makes easier field configurations and ie mappings to graphapi.

The d3.module can provide for all overall functions and templates.

Comments

asherry’s picture

Sorry again for not responding. I've implemented a number of different render types with d3 on the site I'm working on that I will commit soon. I'm not so sure though that we would need a separate module for each render type. Maybe in some cases but I would imagine that would lead to dozens and dozens of extra modules to basically do the same functionality.

Is there any reason why you don't want to go with a template-link structure? Or perhaps adding the ability to use libraries?

clemens.tolboom’s picture

You are building a class structure for template injection iirc. That is weird as that deviates from the drupal way (TM) ... think about themers and the Drupal 8 twig template engine.

You should abstract all actions D3 provide (click, hover, ...) into nice *.tpl.php template files to allow people to override those behaviors. (That is one of the powers of Drupal)

You do not have to provide zillion modules as the only need is to group all data structure types (trees, graphs, simple-x-y) into a separate module. That leads to 4-6 modules.

d3.module (contains all shared code, provides for classes, js, templates like d3-click.tpl.php)
d3_tree.module (overrides d3-click-tree.tpl.php, graph data code)
d3_graph.module (similar)
d3_simple.module (similar)
d3_x ?

japanitrat’s picture

I also have to admit that the current structure is kind of weird in terms of themability and encapsulation. I'd rather go for additional modules and have the d3-module only handle the very basic (library checking / loading) and shared stuff.

If I'd want to use d3 for only my own visualizations, I'd have to add it to the d3-module (with my css and js changes) which is a pain to update.

asherry’s picture

I agree - I don't intend to keep the current class structure. The idea of each visualization though, or each type of visualization having another module that you have to enable is already limiting in its nature.

Let me use this for example:
http://trends.truliablog.com/vis/tru247/

Here is "one" visualization, but which module would you install that under? Would you have to enable 4 modules just to use this one visualization in your code? I'm looking to evolve the template system that I have, and definitely keeping twig with drupal 8 in mind. I envision the d3 module to ship with a good number of visualizations, but addons and extra visualizations should be expandable by adding in to sites/all/libraries or adding .tpl or .twig files.

Each site can track their own visualizations with git, and then contrib back their visualizations by posting a .tpl file, and/or a library file.

There's quite a bit of work to do though - that's why it's really still in the sandbox phase. Do you agree?

Let me know your thoughts.

clemens.tolboom’s picture

I'm quite disappointed in @asherry claiming this sandbox works as I failed getting it to work.

My #1818870: Big patch trying to get Graph API running was a good hint.

I asked for git access to help move this project further without response :-(

I hope I find resources to add d3 support for http://drupal.org/project/graphapi as a sub module :-/

asherry’s picture

Status: Active » Fixed

I believe with the last update using libraries, that the need for modules is very limited. I've added the possibility of custom .tpl.php files inside each library and they will be called simply by using
template = template_name (minus the .tpl.php)

I'd like to also add in the future the ability to call custom data functions that can be stored in the library as well.

The idea of a module and a visualization I think are two different things. A module can depend on, or use a visualization, or several different visualizations, but I don't see the point of having a module for one visualization.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

asherry’s picture

Project: » d3.js
Version: » 7.x-1.x-dev
Issue summary: View changes