I've looked around but don't manage to understand how to use the Raphael module. I expected it to load the javascript file after enabling the module but that doesn't seem to be the behaviour.
I don't need to use theme functions of gRaphael, only include the raphaeljs libraries.
For the time being I'll just add the javascript to the theme, but would like to know the basics about the module.
Thanks in advance.

Comments

phaer’s picture

A README.markdown is included in the modules source: http://drupalcode.org/project/raphael.git/blob/refs/heads/7.x-2.x:/READM...

To use this library, first call `drupal_add_library('raphael', 'raphael', TRUE);`
somewhere in your PHP code to let Drupal know that you want to load
Rapha�l on this page. After this, Rapha�l will be available for use in
your JavaScript code.

lEaDbEllY’s picture

Version: 6.x-1.0-rc1 » 7.x-2.x-dev

Ok, so I added 'drupal_add_library('raphael', 'raphael', TRUE);' (without the quotes) to the bottom of my themes template.php file, and I'm looking at the gRaphael example graphs, and it shows the titles and no graphs. Is that normal? Do I have to manually install the graphs (I am assuming that the modules included are just templates that I have to add more stuff to for the examples to be functional). Is that correct? I can get raphael graphs to show up outside of drupal, but not from within drupal, so I assume that I have to add more. Please confirm.

googletorp’s picture

The example module is just examples of how the module can be used.

This is an API module, which means you should create the grafs etc in a custom module and this module helps you along the way. The module can also simply be used to load JavaScript files, if you want to handle the JavaSript yourself, in that case handling all of it in the theme would be just fine.

dddbbb’s picture

I have followed the instructions but when trying to create a new Raphael object I get the following console error:

Raphael is not defined

  • I've downloaded the Raphael JS library and placed it at libraries/raphael/raphael.js
  • I've installed and enabled the Raphael module.
  • I'm calling drupal_add_library('raphael', 'raphael', TRUE); from within a custom module that is already confirmed working.
  • I'm trying to create a new Raphael object in my JS code using var paper = new Raphael(document.getElementById('zone-content'), 500, 500);
  • I've cleared caches - still no change.

Searching my markup reveals no mention of the raphael.js library being included - this doesn't look right to me.

Any ideas what's going on here?

Zorkoff’s picture

Did you install Entity API and Libraries API? And the path to the library should be sites/all/libraries/raphael/raphael.js.