0
下面是海军报堆栈图表我js代码,堆栈FLOT图表工具提示与阵列内容
我想在其堆栈工具提示和d2的拉布勒[0]显示d1的标签[0]上的那部分堆栈
目前它没有显示任何工具提示。
数据示例:
d1 = [["Name1",10],["Name2",5]];
d2 = [["Name1",8],["Name2",10]];
因此工具提示应显示名称1(10)和名1(8)在各自的栈和 名称2(5)和NAME2(10)在其respactive堆栈。
function getTooltip2(label, x, y) {
return "" + x + "(" + y +")";
}
var d1 = [];
var d2 = [];
<?php
for($i=0;$i<count($tchart)-1;$i++){
echo "d1.push(['".$tchart[$i][0]."', ".$tchart[$i][1]."]);";
echo "d2.push(['".$tchart[$i][0]."', ".$tchart[$i][2]."]);";
}
?>
var d4 = { label: "Within Benchmark", data: d1 };
var d5 = { label: "Out Of Benchmark", data: d2 };
var data =[d4,d5];
var stack = 0,
bars = true,
lines = false,
steps = false;
function plotWithOptions() {
$.plot("#placeholder5", data, {
valueLabels: {
show: true
},
series: {
stack: stack,
lines: {
show: lines,
fill: true,
steps: steps
},
bars: {
show: bars,
barWidth: 0.6,
align: "center"
}
},
xaxis: {
mode: 'categories',
tickLength: 0
},
tooltip: true,
tooltipOpts: {
content: getTooltip2,
defaultTheme: false
},
colors: [ "#51a351", "#da4f49"]
});
}
plotWithOptions();
你见过吗? http://stackoverflow.com/a/18190027/839456 – anurupr
是的,它的工作很好,谢谢。但我的要求就像我想显示不同的系列,然后在工具提示中显示x和y。可能吗? – TechnoPulseLabs
你想要显示'Jan'而不是'January'吧? – anurupr