你好我的PHP代码和javascript有问题!问题是 “未捕获的TypeError:无法读取未定义的jqplot.highlighter.min.js的属性'eventListenerHooks':4”
我不知道为什么我会接受这个错误。有问题的javascript中的行是:
d.jqplot.eventListenerHooks.push(["jqplotMouseMove", f]);"
并写
无法读取未定义
的属性'eventListenerHooks'
我的jqplot的代码是:
$(document).ready(function() {
var tips = [<?php
if (!empty($scheduledTips)) {
foreach ($scheduledTips as $value) {
echo "['" . $value->date . "'," . $value->tips . '],';
}
} else {
echo '["No_tips",0]';
}
?>];
var quizzes = [<?php
if (!empty($scheduledQuizzes)) {
foreach ($scheduledQuizzes as $value) {
echo "['" . $value->date . "'," . $value->quizzes . '],';}
} else {
echo '["No_Quizzes",0]';
}
?>];
var commitments =[ <?php
if (!empty($scheduledCommitments)) {
foreach ($scheduledCommitments as $value) {
echo "['". $value->date . "'," . $value->commitments . '],';
}
} else {
echo '["No_Commitments",0]';
}
?>];
var plot1 = $.jqplot('ScheduledTips', [tips,quizzes,commitments], {
title: 'Actions',seriesColors: ['#00749F','#7bc523','#e87511','#00ffd2','#6b4423','#c7bebe','#847847', '#153115', '#FF0000', '#F0A804', '#800080','#000000','#fc9758',
'#4c3d00','#800080','#4c393c','#000099','4c4c4c','#122a11','52c6c5','#112a2a','#6c8e3b'],
animate: true,
// Will animate plot on calls to plot1.replot({resetAxes:true})
animateReplot: true,
legend:{
show:true,
location: 'e',
rendererOptions:{numberRows: 3, placement: 'outside'}
},
cursor: {
show: true,
zoom: true,
looseZoom: true,
showTooltip: false
},
series: [{pointLabels: {
show: false
},rendererOptions: {
// Speed up the animation a little bit.
// This is a number of milliseconds.
// Default for bar series is 3000.
lineWidth:4,
animation: {
speed: 2500
},
varyBarColor: true,
barWidth: 20,
barPadding: -15,
barMargin: 0,
highlightMouseOver: true
}}], series: [ {label: "Tips"},{label: "Quizzes"},{label: "Commitments"}],
grid: {
drawGridLines: true, // wether to draw lines across the grid or not.
gridLineColor: '#cccccc', // CSS color spec of the grid lines.
background: 'white', // CSS color spec for background color of grid.
borderColor: '#999999', // CSS color spec for border around grid.
borderWidth: 2.0, // pixel width of border around grid.
shadow: true, // draw a shadow for grid.
shadowAngle: 45, // angle of the shadow. Clockwise from x axis.
shadowOffset: 1.5, // offset from the line of the shadow.
shadowWidth: 3, // width of the stroke for the shadow.
shadowDepth: 3
},
axes:{
yaxis: { pad: 1.05,min:0} ,
xaxis:{
renderer:$.jqplot.DateAxisRenderer,
pad: 1.05,
tickOptions: {
showGridline: false
}
}
},
highlighter: {
show: true,tooltipLocation: 'n',
tooltipContentEditor : tooltip,
sizeAdjust: 18.5}
});
});
html的代码是:
if (!empty($stats)) {
echo '<div class="col-md-12"><div id="ScheduledTips" style="height:400px;width:700px;margin-left:00px;padding-bottom:20px"></div></div><br/>';
}
我已经加载了所有的js库。但是我从页面开始那个问题!任何人都知道如何解决它?