我有一个包含单个系列的dimple.js图,但我不想显示该系列中的所有图例键。有没有办法选择我想要显示的图例键?
我搜索了dimple.js应用程序接口和堆栈溢出,但没有找到答案。
发布于 2015-06-24 19:41:42
我希望我对你的问题的理解是正确的。如果您正在寻找从图例中删除元素或完全删除图例的方法,那么是的,有一个简单的解决方案可以解决您的问题。
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
https://stackoverflow.com/questions/29836794
复制相似问题