creating dojox chart with tooltip returns error: TypeError: invalid 'in' operand source
creating dojox chart with tooltip returns error: TypeError: invalid 'in' operand source
Dojo 版本:1.10.4 下载 11/24/2015
当我创建一个新的工具提示时,返回了一个错误:
类型错误:无效的 'in' 操作数源
从 dojox/lang/utils.js 第 46 行抛出
if(x in source && !(x in empty)){...}
其中 source 是文本 "default",但它需要一个对象。
文本 "default" 似乎来自创建工具提示的调用,
在下面的代码中指出。
(我删除了我认为对理解问题来说不必要的代码。)
require([ "dojox/charting/Chart", "dojox/charting/widget/Legend",
"dojox/charting/axis2d/Default", "dojox/charting/action2d/Tooltip",
"dojox/charting/plot2d/Bars", "dojox/charting/plot2d/ClusteredBars",
"dojox/charting/plot2d/StackedBars", "dojo/domReady!"],
function(Chart, Legend, Tooltip){
var barChart = new Chart("WPDDashboard_DojoBarChart3_1",
{ title: 'Finance Comparison', titleFont: 'bold 100% Arial});
barChart.addPlot("default", {
type: 'ClusteredBars' , gap: 5, stroke: {
color: 'black', width: 2}, fill: '#3366cc', shadow: {
dx: 2, dy: 2}});
barChart.connectToPlot("default" ........);
barChart.addAxis(.......);
//I think this is the offending line
var tip = new Tooltip(barChart, "default");
barChart.render();
});
您对所需物品的订购与声明不符。在声明 Chart、Legend 和 Tooltip 时,您需要 Chart、Legend、Default 和 Tooltip。所以你所做的就是将默认图表命名为工具提示并尝试使用它。尝试修复订单,这应该有效。
Dojo 版本:1.10.4 下载 11/24/2015 当我创建一个新的工具提示时,返回了一个错误: 类型错误:无效的 'in' 操作数源 从 dojox/lang/utils.js 第 46 行抛出 if(x in source && !(x in empty)){...} 其中 source 是文本 "default",但它需要一个对象。 文本 "default" 似乎来自创建工具提示的调用, 在下面的代码中指出。 (我删除了我认为对理解问题来说不必要的代码。)
require([ "dojox/charting/Chart", "dojox/charting/widget/Legend",
"dojox/charting/axis2d/Default", "dojox/charting/action2d/Tooltip",
"dojox/charting/plot2d/Bars", "dojox/charting/plot2d/ClusteredBars",
"dojox/charting/plot2d/StackedBars", "dojo/domReady!"],
function(Chart, Legend, Tooltip){
var barChart = new Chart("WPDDashboard_DojoBarChart3_1",
{ title: 'Finance Comparison', titleFont: 'bold 100% Arial});
barChart.addPlot("default", {
type: 'ClusteredBars' , gap: 5, stroke: {
color: 'black', width: 2}, fill: '#3366cc', shadow: {
dx: 2, dy: 2}});
barChart.connectToPlot("default" ........);
barChart.addAxis(.......);
//I think this is the offending line
var tip = new Tooltip(barChart, "default");
barChart.render();
});
您对所需物品的订购与声明不符。在声明 Chart、Legend 和 Tooltip 时,您需要 Chart、Legend、Default 和 Tooltip。所以你所做的就是将默认图表命名为工具提示并尝试使用它。尝试修复订单,这应该有效。