You are here

README.txt in d3.js 7

Welcome to the Drupal D3 module!

USING THE API
=============
- Download d3 library and install it into your libraries module.
  Latest version can be found at https://github.com/mbostock/d3/wiki
  To download the library using the provided example makefile and drush, use:
  drush make --no-core d3.make.example
  If you're creating a distribution, simply copy the example makefile
  into your own makefile.
- Enable d3 module and dependencies
- If you're not familiar with the API, see the d3_examples module
  for various code examples of the d3 API.

CUSTOM LIBRARY
==============
Instructions on how to create a new custom d3 library:
- In your sites libraries folder (e.g. sites/all/libraries) create a new
  directory for your library with the prefix d3. (e.g. d3.mylibrary).
- Create your .info file.
  @see libraries.api.php for information on parameters.
- Use javascript enclosure around your js code, and extend the global Drupal.d3
  variable using your unique library name. E.g. 
  

    (function($) {

      Drupal.d3.mylibraryname = function (select, settings) {
        // javascript code
      }
    })(jQuery);
  
- In your d3_draw API call, set 'type' => 'libraryname'. - Any variable you include in the d3_draw() arguments, will be included in the settings variable. For example:
$args = array(
  'type' => 'myviz',
  'id' => 'testvis',
  'foo' => 'bar',
);
return d3_draw($args);
Inside your js function, 'foo' will be available as settings.foo. GRAPHAPI ======== The d3 module comes with support for the graphapi module. http://drupal.org/project/graphapi Instructions on how to use d3 with graphapi: - Enable graphapi, and set d3 as the engine in the api call. - An example of a graphapi call, using d3, is also available in the d3_examples module. VIEWS ===== All support for views is handled in the d3_views module. Instructions on how to use d3 in views: - Enable the d3_views module. - Create the view you'd like to render with d3. The view must have fields. - Under "Format", choose "D3 Visualization". - Click "Settings". - Choose which library you'd like to use for this particular view. If you are creating your own custom D3 library, and you'd like to integrate it with views, make sure in the info file you include views = [version #]. - Select which fields you want to use for display, (i.e. on an axis), and which fields you'd like to use for values, (i.e. a bar or line value).

File

README.txt
View source
  1. Welcome to the Drupal D3 module!
  2. USING THE API
  3. =============
  4. - Download d3 library and install it into your libraries module.
  5. Latest version can be found at https://github.com/mbostock/d3/wiki
  6. To download the library using the provided example makefile and drush, use:
  7. drush make --no-core d3.make.example
  8. If you're creating a distribution, simply copy the example makefile
  9. into your own makefile.
  10. - Enable d3 module and dependencies
  11. - If you're not familiar with the API, see the d3_examples module
  12. for various code examples of the d3 API.
  13. CUSTOM LIBRARY
  14. ==============
  15. Instructions on how to create a new custom d3 library:
  16. - In your sites libraries folder (e.g. sites/all/libraries) create a new
  17. directory for your library with the prefix d3. (e.g. d3.mylibrary).
  18. - Create your .info file.
  19. @see libraries.api.php for information on parameters.
  20. - Use javascript enclosure around your js code, and extend the global Drupal.d3
  21. variable using your unique library name. E.g.
  22. @code
  23. (function($) {
  24. Drupal.d3.mylibraryname = function (select, settings) {
  25. // javascript code
  26. }
  27. })(jQuery);
  28. @endcode
  29. - In your d3_draw API call, set 'type' => 'libraryname'.
  30. - Any variable you include in the d3_draw() arguments, will be included in
  31. the settings variable. For example:
  32. @code
  33. $args = array(
  34. 'type' => 'myviz',
  35. 'id' => 'testvis',
  36. 'foo' => 'bar',
  37. );
  38. return d3_draw($args);
  39. @endcode
  40. Inside your js function, 'foo' will be available as settings.foo.
  41. GRAPHAPI
  42. ========
  43. The d3 module comes with support for the graphapi module.
  44. http://drupal.org/project/graphapi
  45. Instructions on how to use d3 with graphapi:
  46. - Enable graphapi, and set d3 as the engine in the api call.
  47. - An example of a graphapi call, using d3, is also available in
  48. the d3_examples module.
  49. VIEWS
  50. =====
  51. All support for views is handled in the d3_views module.
  52. Instructions on how to use d3 in views:
  53. - Enable the d3_views module.
  54. - Create the view you'd like to render with d3.
  55. The view must have fields.
  56. - Under "Format", choose "D3 Visualization".
  57. - Click "Settings".
  58. - Choose which library you'd like to use for this particular view. If
  59. you are creating your own custom D3 library, and you'd like to integrate
  60. it with views, make sure in the info file you include views = [version #].
  61. - Select which fields you want to use for display, (i.e. on an axis),
  62. and which fields you'd like to use for values, (i.e. a bar or line value).