我似乎无法让我的基本的海军报图工作的标签,我已经剥离下来的基础知识,但我仍然不能得到它的工作;
<div id="graph" style="width:600px;height:300px;"></div>
<script type="text/javascript">
$(function () {
var d1 = [[0, 13], [1, 13], [2, 13], [3, 0], [4, 17], [5, 17], [6, 13]];
$.plot($("#graph"), [
{
data: d1,
bars: {
show: true
},
xaxis: {
axisLabel: 'Hops'
},
yaxis: {
axisLabel: 'Traceroute'
}
}
]);
});
</script>
下面是我得到的曲线图。 正如你所看到的,在Chrome调试窗口没有错误。 我也有以下简单的轴标签还包括格式设置,但它仍然是行不通的:
axisLabelUseCanvas: true,
axisLabelFontSizePixels: 12,
axisLabelFontFamily: 'Verdana, Arial, Helvetica, Tahoma, sans-serif',
axisLabelPadding: 5
我不知道我怎么有固定的这个,而是使之更复杂,我有。 也许一个错误?
现在,它的工作原理与此代码:
<div id="graph" style="width:600px;height:300px;"></div>
<script type="text/javascript">
$(function () {
var d1 = [[0, 13]];
var d2 = [[1, 13]];
var d3 = [[2, 13]];
var d4 = [[3, 30]];
var d5 = [[4, 17]];
var d6 = [[5, 17]];
var d7 = [[6, 13]];
var data1 = [
{
data: d1,
bars: {
show: true,
fillColor: "#CAFFD8"
},
color: "#CAFFD8"
},
{
data: d2,
bars: {
show: true,
fillColor: "#CAFFD8"
},
color: "#CAFFD8"
},
{
data: d3,
bars: {
show: true,
fillColor: "#CAFFD8"
},
color: "#CAFFD8"
},
{
data: d4,
bars: {
show: true,
fillColor: "#FF7575"
},
color: "#FF7575"
},
{
data: d5,
bars: {
show: true,
fillColor: "#FFFF75"
},
color: "#FFFF75"
},
{
data: d6,
bars: {
show: true,
fillColor: "#FFFF75"
},
color: "#FFFF75"
},
{
data: d7,
bars: {
show: true,
fillColor: "#CAFFD8"
},
color: "#CAFFD8"
},
];
$.plot($("#graph"), data1, {
xaxis: {
axisLabel: 'Hops',
axisLabelUseCanvas: true,
axisLabelFontSizePixels: 12,
axisLabelFontFamily: 'Verdana, Arial, Helvetica, Tahoma, sans-serif',
axisLabelPadding: 5
},
yaxis: {
min: 0,
max: 30,
axisLabel: 'Traceroute',
axisLabelUseCanvas: true,
axisLabelFontSizePixels: 12,
axisLabelFontFamily: 'Verdana, Arial, Helvetica, Tahoma, sans-serif',
axisLabelPadding: 5
}
});
});
</script>
您需要包括jquery.flot.axislabels在HTML代码的插件。