简体   繁体   中英

Primefaces Bar Chart disable all Series

i have a system running with Primefaces on a Server for some Diagramms, like the Bar Chart and stuff.

My Problem is: the bar chart is full with Series so it is a little slow, but more importantly is that it is not very clear. So I wanted to have a function to unclick/disable all Series from the start and then manually enable which one I need, but I am not an expert in Javascript nor with Primefaces.

I found out that I can do something with the Extender but it turns out the show function there disables the whole chart so it doesnt render.

Does anyone already solved something like this or has a tip for me?

So i did find the solution myself. For everyone who is searching something similiar:

function toggleAllLabels(model) {
for(var i = 0; i < model.getElementsByClassName("jqplot-table-legend-label").length; i++){
    model.getElementsByClassName("jqplot-table-legend-label")[i].click();
    }

}

where model is the (Bar-)Chart Object. The idea is: you simulate a click on every label so it is triggered and disabled. The function has to be called from the page with the chart and with the argument "model" for the id of the Chart Object.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM