gpt4 book ai didi

javascript - $super 不是 Rickshaw JS 中的函数错误

转载 作者:行者123 更新时间:2023-11-28 08:53:36 26 4
gpt4 key购买 nike

我正在使用 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)
});
.......

}

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

TypeError: $super is not a function

最佳答案

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

define(["rickshaw"], function() {...});

关于javascript - $super 不是 Rickshaw JS 中的函数错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18797425/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com