cogJavascript Extension and Wiki macro to load the d3 javascript framework
TypeXAR
Developed by

Flavius Olaru

Active Installs14
Rating
Rate!
1 Votes
LicenseGNU Lesser General Public License 2.1
Installable with the Extension Manager

Description

This extension is a helper for loading d3 javascript framework.

See also the D3 Example

Usage

There are 2 ways to load d3js.

Using the wiki macro:

{{d3js minify="<true|false>"/}}

Or using directly the JavascriptExtension:

{{velocity}}
$!xwiki.jsx.use("Macros.d3js", {"minify":false})
{{/velocity}}

After loading d3js there is an event triggered in javascript that signals that d3 is loaded. Best practice to use it in javascript:

document.observe("d3:loaded", function() {
  // here is your javascript code that uses the d3 javascript framework.
  console.log("d3js loaded");
});

Tested on

This extension has been tested with the following configurations.

Extension VersionXWiki FlavorNotes
1.1XWiki Enterprise 4.5.x, 5.4.x, 6.0.1

Using d3v3

Prerequisites & Installation Instructions

We recommend using the Extension Manager to install this extension (Make sure that the text "Installable with the Extension Manager" is displayed at the top right location on this page to know if this extension can be installed with the Extension Manager). Note that installing Extensions when being offline is currently not supported and you'd need to use some complex manual method.

You can also use the following manual method, which is useful if this extension cannot be installed with the Extension Manager or if you're using an old version of XWiki that doesn't have the Extension Manager:

  1. Log in the wiki with a user having Administration rights
  2. Go to the Administration page and select the Import category
  3. Follow the on-screen instructions to upload the downloaded XAR
  4. Click on the uploaded XAR and follow the instructions
  5. You'll also need to install all dependent Extensions that are not already installed in your wiki

Release Notes

v1.1

Added alternate usage of attachment content based on minify parameter. Circumvented jsx use of minify for caching purposes.

v1.0

Cache macro used in JavascriptExtension to load contents from attachment once.

Tags:
Created by Flavius Olaru on 2013/12/24 14:15
    

Get Connected