我的代碼是:道場圖表沒有在Android設備上加載
require([
// Require the basic chart class
"dojox/charting/Chart",
// Require the theme of our choosing
"dojox/charting/themes/ThreeD",
// Charting plugins:
"dojox/charting/widget/SelectableLegend",
// We want to plot Lines
"dojox/charting/plot2d/Lines",
// We want to use Markers
"dojox/charting/plot2d/Markers",
// We'll use default x/y axes
"dojox/charting/axis2d/Default",
"dojox/charting/action2d/Tooltip",
"dojo/domReady!"
], function(Chart, theme,Legend, Line) {
dojo.ready(function(){
// When the DOM is ready and resources are loaded...
// Create the chart within it's "holding" node
var chart = new Chart("chartNode");
chart.title="Sales Revenue Trend";
// Set the theme
chart.setTheme(theme);
// Add the only/default plot
chart.addPlot("default", {
type: Line,labels:true,
markers: true
});
var myLabelFunc = function(text, value, precision){
if(text!="0")
return (parseFloat(text)/100000)+" lacs";
else
return text;
};
// Add axes
chart.addAxis("x",{labels: labels,majorTickStep:1,rotation: -90,title:"Date", titleOrientation:"away", titleFont: "normal normal bold",titleFontColor: "black"});
chart.addAxis("y", { vertical: true,minorLabels: false,minorTicks:true, fixLower: "major", fixUpper: "major",title:"Gross Revenue(INR)", titleFont: "normal normal bold",titleFontColor: "black",dropLabels: false, labelFunc: myLabelFunc});
// Add the series of data
for(i=0;i<cr.length;i++)
{
chart.addSeries(channels[i],cr[i]);
}
new dojox.charting.action2d.Tooltip(chart,"default");
// Render the chart!
chart.render();
var legend = new Legend({ chart: chart }, "legend");
});
});
上面的代碼工作以及在所有的PC瀏覽器以及iOS設備上。但問題出在Android設備上。我已經通過Android設備的logcat,發現有腳本錯誤(詳細錯誤:11-24 19:20:53.854:E/Web控制檯(335):錯誤:scriptError在文件:/// android_asset/www/dojo /dojo/dojo.js:15)。在PC瀏覽器上,它不顯示任何錯誤(使用螢火蟲調試)。
我試圖從require語句中刪除「dojox/charting/action2d/Tooltip」。它也適用於Android。但我需要使用工具提示在圖表中顯示標記的值,但會引發錯誤。那麼,有沒有解決辦法?