gpt4 book ai didi

javascript - DOJO 工具提示给出 "Uncaught TypeError: object is not a function "

转载 作者:行者123 更新时间:2023-11-29 22:09:23 24 4
gpt4 key购买 nike

我有以下尝试使用 dojox/charting/action2d/Tooltip 的代码:

require([
"dojox/charting/Chart",
"dojox/charting/themes/Claro",
"dojox/charting/plot2d/MarkersOnly",
"dojox/charting/plot2d/Columns",
"dojox/fx/easing",
"dojox/charting/action2d/Tooltip",
"dojox/charting/axis2d/Default",
"dojo/ready"
], function(Chart, Theme, MarkersOnly, easing, Tooltip, Columns, Default, ready) {

ready(function(){
var chart1 = new Chart("chartArea");
chart1.setTheme(Theme);
chart1.addPlot("budget", {type: "MarkersOnly"});
chart1.addPlot("actual", {type: "Columns", gap: 3, animate: { duration: 300, easing: dojox.fx.easing.linear}});

//add the axis (both x and y) below
chart1.addAxis("x",{labels: [
{value:1, text: "01 - AXA"},{value:2, text: "02 - MR"},{value:3, text: "03 - CT"},{value:4, text: "04 - XP WH"},
{value:5, text: "06 - XP RF"},{value:6, text: "07 - XPC"},{value:7, text: "09 - ECS"},{value:8, text: "10 - XPU"}],
rotation:-90,
font: "normal normal bold 12pt Arial"
});//end adding axis to the chart
chart1.addAxis("y", {vertical: true, font: "normal normal bold 12pt Arial"});

chart1.addSeries("Series 2", [80,80,80,80,80,80,80,80,80,80,80,80,80], {plot:"budget"});
//chart1.addSeries("Series 1", [73,71,78,93,70,,,83,100,,,], {plot:"actual"});
chart1.addSeries("Series 1", [{y:75, tooltip:"custom"},{y:71},{y:78},{y:93},{y:70},{y:83},{y:100}], {plot:"actual"});


var tip = new Tooltip(chart1, "default");
chart1.render();
});//end of DOJO ready
});//end function chart stuff

DOJO 给我以下错误:

未捕获的类型错误:对象不是函数

我可以弄清楚为什么会出现这个问题,特别是因为我发现了多个以这种方式处理它的示例。有人知道吗?

最佳答案

您的依赖项列表和您的回调参数列表不匹配。

require([
"dojox/charting/Chart",
"dojox/charting/themes/Claro",
"dojox/charting/plot2d/MarkersOnly",
"dojox/charting/plot2d/Columns",
"dojox/fx/easing",
"dojox/charting/action2d/Tooltip",
"dojox/charting/axis2d/Default",
"dojo/ready"
], function(Chart, Theme, MarkersOnly, Columns, easing, Tooltip, Default, ready) { /* ... */ });

请注意参数的不同顺序:ColumnsMarkersOnly 之后。

根据您的参数顺序,Tooltip 指向 dojo/fx/easing 模块并给出您描述的错误。

关于javascript - DOJO 工具提示给出 "Uncaught TypeError: object is not a function ",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18916721/

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