cancel
Showing results for 
Search instead for 
Did you mean: 

VizChart: how to hide 1 specific label from the legend

0 Kudos
322

Hello everyone,

I'm looking for a way to hide 1 legend item of the legend group

i know how to hide/display the legend group but i just need to hide 1 of the legend item from this legend group.

eg my chart would display legend group listing legend_item_1, legend_item_2 and legend_item_3.

in my scenario i want to display only the 1st 2 legend items: legend_item_1 and legend_item_2

I'm wondering if there would be a way to build something using rules eg (pseudo code) if legend_item.value = "i want to hide this one" then legend_item.visible = false;

Thanks

View Entire Topic
0 Kudos

Maybe a better solution exists.

For now I'm simply moving the last legend item away from the legend area so it is now hidden behind a table

this.getChart().attachRenderComplete(function(oEvent){
var oVizFrameID = oEvent.getSource().getId();  
var oLegendItems = $('#'+oVizFrameID).find('.v-legend-item'); 
for(var i=0;i<oLegendItems.length;i++){
    if (i === (oLegendItems.length - 1)) {
        var oAttribute = "translate (" + 500 + "," + 22 + ")";
        oLegendItems[i].setAttribute("transform", oAttribute);
    }
 }
});