[英]flot graph legend and axislabel not working together
我正在使用JQuery Flot圖形插件,並且遇到了一些困難。 如果有人有更多知識,請幫幫我!
我試圖在圖形外部的單獨div中顯示軸圖例,並且還顯示X / Y軸的軸標簽。 但是無論如何,兩者都無法協同工作。 如果我注釋掉其中一個,則另一個可以正常工作。 但不能在一起 這是我的工作代碼:
$.plot($(container), [
{label:'Label1',data: dataPoints, lines: {show: true, lineWidth:1}, color:"#72BA82"},
{label:'Label2',data: dataPoints2, lines: {show: true, lineWidth:1}, color:"#000"}
],
{legend: { show: true, noColumns:3, container: '#graph1LegendHolder' }},
{xaxis:{show: true,axisLabel: "Time",axisLabelFontSizePixels: 12 },
yaxis:{show: true,axisLabel: "Amount",axisLabelFontSizePixels:12
}}
);
如前所述,圖例和軸線無法同時使用,但我相信代碼是正確的。 任何想法如何使兩者一起工作?
謝謝!
您將圖例和軸選項作為兩個單獨的選項對象傳遞; Flot將忽略其中之一,因為它只期望一組選項。 您需要將它們結合起來:
...
], {
legend: { ... },
xaxis: { ... },
yaxis: { ... }
});
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.