Question

I am loading all the Rickshaw js files using requirej such that:

define([       "rickshaw","rickshaw/Rickshaw.Class","rickshaw/Rickshaw.Compact.ClassList","rickshaw/Rickshaw.Graph","rickshaw/Rickshaw.Graph.Renderer",
    "rickshaw/Rickshaw.Graph.Renderer.Area","rickshaw/Rickshaw.Graph.Renderer.Line","rickshaw/Rickshaw.Graph.Renderer.Bar","rickshaw/Rickshaw.Graph.Renderer.ScatterPlot",
    "rickshaw/Rickshaw.Graph.RangeSlider","rickshaw/Rickshaw.Graph.HoverDetail","rickshaw/Rickshaw.Graph.Annotate","rickshaw/Rickshaw.Graph.Legend",
    "rickshaw/Rickshaw.Graph.Axis.Time","rickshaw/Rickshaw.Graph.Behavior.Series.Toggle","rickshaw/Rickshaw.Graph.Behavior.Series.Order",
    "rickshaw/Rickshaw.Graph.Behavior.Series.Highlight","rickshaw/Rickshaw.Graph.Smoother","rickshaw/Rickshaw.Graph.Unstacker","rickshaw/Rickshaw.Fixtures.Time",
    "rickshaw/Rickshaw.Fixtures.Number","rickshaw/Rickshaw.Fixtures.RandomData","rickshaw/Rickshaw.Fixtures.Color","rickshaw/Rickshaw.Color.Palette",
    "rickshaw/Rickshaw.Graph.Axis.Y","rickshaw/Rickshaw.Series","rickshaw/extensions"], function() {

   function draw(dObj, containerId, sliderId, timelineId, legendId) {
    var graph = new Rickshaw.Graph({
        element: document.getElementById(containerId),
        renderer: 'area',
        height: 400,
        stroke: true,
        series: dObj
    });

    graph.render();

    var slider = new Rickshaw.Graph.RangeSlider({
        graph: graph,
        element: $(sliderId)
    });
 .......

}

When I load the page I am getting this error:

TypeError: $super is not a function

Was it helpful?

Solution

Instead of having seperate js files, I merged all Rickshaw.... js into one file and now it works fine. Now the define method will have only one file reference.

define(["rickshaw"], function() {...});
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top