1

我正在使用 requirej 加载所有 Rickshaw js 文件,这样:

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)
    });
 .......

}

当我加载页面时,我收到此错误:

类型错误:$super 不是函数

4

1 回答 1

0

我没有单独的 js 文件,而是将所有 Rickshaw.... js 合并到一个文件中,现在它可以正常工作了。现在,define 方法将只有一个文件引用。

define(["rickshaw"], function() {...});
于 2013-09-24T19:58:04.240 回答