Javascript Flot图表-获取工具提示插件以显示的问题
我正在使用Flot Charts(),在使用一些插件时遇到了问题。下面是我的折线图,我无法让工具提示插件显示()。我也无法让axis标签插件工作。然而,resize插件工作良好。我的代码怎么了?谢谢你的帮助Javascript Flot图表-获取工具提示插件以显示的问题,javascript,charts,flot,Javascript,Charts,Flot,我正在使用Flot Charts(),在使用一些插件时遇到了问题。下面是我的折线图,我无法让工具提示插件显示()。我也无法让axis标签插件工作。然而,resize插件工作良好。我的代码怎么了?谢谢你的帮助 <head> <!--<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>--> <scrip
<head>
<!--<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>-->
<script src="https://cdnjs.cloudflare.com/ajax/libs/FitText.js/1.2.0/jquery.fittext.min.js"></script>
<script language="javascript" type="text/javascript" src="js/flot/jquery.js"></script>
<script language="javascript" type="text/javascript" src="js/flot/jquery.flot.js"></script>
<script language="javascript" type="text/javascript" src="js/flot/jquery.flot.tooltip.js"></script>
<script language="javascript" type="text/javascript" src="js/flot/jquery.flot.resize.js"></script>
<!--<script language="javascript" type="text/javascript" src="js/flot/jquery.flot.time.js"></script>-->
<script language="javascript" type="text/javascript">
$(document).ready(function(){
$.ajax({
//usually, we'll just call the same URL, a script
//connected to a database, but in this case we only
//have static example files so we need to modify the
//URL
url: "views/sales_year_line_data.php",
method: 'GET',
dataType: 'json',
success: onOutboundReceived
});
function onOutboundReceived(series) {
var length = series.length;
var finalData = series;
var options = {
lines: { show: true, fill: true},
points: { show: true, hoverable:true },
grid: { show: true, aboveData: false, color: "rgba(255, 255, 255, 1.0)", borderWidth: 0, hoverable: true, clickable: true },
legend: {position: "sw", backgroundOpacity: 0},
xaxis: { ticks: [[1,'Jan'],[2,'Feb'],[3,'Mar'],[4,'Apr'],[5,'May'],[6,'Jun'],[7,'Jul'],[8,'Aug'],[9,'Sep'],[10,'Oct'],[11,'Nov'],[12,'Dec']] },
yaxis: { show: false },
tooltip: { show: true, content: "%s | x: %x; y: %y"}
};
$.plot($("#test-flot"), finalData, options);
}
});
</script>
</head>
$(文档).ready(函数(){
$.ajax({
//通常,我们只调用相同的URL,一个脚本
//连接到数据库,但在本例中,我们仅
//有静态示例文件,所以我们需要修改
//网址
url:“views/sales\u year\u line\u data.php”,
方法:“GET”,
数据类型:“json”,
成功:收到
});
函数onOutboundReceived(系列){
变量长度=系列长度;
var finalData=系列;
变量选项={
行:{show:true,fill:true},
点:{show:true,hoverable:true},
网格:{show:true,overdata:false,颜色:“rgba(255,255,255,1.0)”,边框宽度:0,可悬停:true,可点击:true},
图例:{位置:“sw”,背景不透明度:0},
X轴:{ticks:[1,'Jan'],[2,'Feb'],[3,'Mar'],[4,'Apr'],[5,'May'],[6,'Jun'],[7,'Jul'],[8,'Aug'],[9,'Sep'],[10,'Oct'],[11,'Nov'],[12,'Dec'],
yaxis:{show:false},
工具提示:{显示:true,内容:“%s | x:%x;y:%y”}
};
$.plot($(“#测试flot”)、最终数据、选项;
}
});
我使用了cloudflare.com cdn中的jquery.flot.tooltip.js,现在工具提示可以工作了
<script language="javascript" type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/flot.tooltip/0.8.5/jquery.flot.tooltip.js"></script>
需要更多信息。错误消息、数据格式等。如果可能,请生成一个显示问题的。