WebRoot/js/custom/charts.js
(开头部分) 4KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
jQuery(document).ready(function(){
/*****折线图*****/
var flash = [[0, 20], [1, 6], [2,30], [3, 8], [4, 5], [5, 13], [6, 80]];
var html5 = [[0, 50], [1, 40], [2,4], [3, 10], [4, 9], [5, 10], [6, 13]];
var hsg1 = [[0, 3], [1, 10], [2,80], [3, 4], [4, 30], [5, 20],[6, 57], [12, 11]];
function showTooltip(x, y, contents) {
jQuery('<div id="tooltip" class="tooltipflot">' + contents + '</div>').css( {
position: 'absolute',
display: 'none',
top: y + 5,
left: x + 5
}).appendTo("body").fadeIn(200);
}
var plot = jQuery.plot(jQuery("#chartplace"),
[ { data: flash, label: "Flash(x)", color: "#069"}, { data: html5, label: "HTML5(x)", color: "#FF6600"} , { data: hsg1, label: "hsg1(x)", color: "#CC3333"} ], {
series: {
lines: { show: true, fill: true, fillColor: { colors: [ { opacity: 0.05 }, { opacity: 0.15 } ] } },
points: { show: true }
},
legend: { position: 'nw'},
grid: { hoverable: true, clickable: true, borderColor: '#ccc', borderWidth: 1, labelMargin: 10 },
yaxis: { min: 0, max: 100 } //设置Y坐标最大高度
});
var previousPoint = null;
jQuery("#chartplace").bind("plothover", function (event, pos, item) {
jQuery("#x").text(pos.x.toFixed(2));
jQuery("#y").text(pos.y.toFixed(2));
if(item) {
if (previousPoint != item.dataIndex) {
previousPoint = item.dataIndex;
jQuery("#tooltip").remove();
var x = item.datapoint[0].toFixed(2),
y = item.datapoint[1].toFixed(2);
showTooltip(item.pageX, item.pageY,
item.series.label + " of " + x + " = " + y);
}
} else {
jQuery("#tooltip").remove();
previousPoint = null;
}
});
jQuery("#chartplace").bind("plotclick", function (event, pos, item) {
if (item) {
jQuery("#clickdata").text("You clicked point " + item.dataIndex + " in " + item.series.label + ".");
plot.highlight(item.series, item.datapoint);
}
后面还有 95 行代码,购买后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。