2015-04-24 97 views
0

我有一個dimple.js圖形與一個系列,但我不想顯示系列中的所有圖例。有什麼方法可以選擇我想要顯示哪些圖例鍵?刪除圖例dimple.js

我搜索了dimple.js API和Stack Overflow,但沒有找到答案。

+0

你可以創建一個虛擬的一系列只有在點你想要的傳說鍵,然後用'dimple.legend.series'顯示了大量的附加信息假人系列?如果你可以發佈你正在使用的東西,它也可能更容易幫助。 – figurine

回答

2

我希望我能解釋你的問題。如果您正在尋找從圖例中刪除元素或完全刪除圖例的方法,那麼可以,您的問題有一個簡單的解決方案。

myLegend.series = [myFirstSeries, mySecondSeries]; 

默認情況下會包含所有圖表系列,但是您可以使用此語句選擇特定的圖表系列。

例如,

myFirstSeries = myChart.addSeries("Key1", dimple.plot.bar); 
mySecondSeries= myChart.addSeries("Key2", dimple.plot.bar); 
myThirdSeries= myChart.addSeries("Key3", dimple.plot.bar); 
myFourthSeries= myChart.addSeries("Key4", dimple.plot.bar); 

myLegend.series = [myFirstSeries, mySecondSeries]; 
//Displays only the first two keys in the legend 

這應該解決您的問題。

你可以找到關於這裏的傳說dimple.legend