jqplot - Labels for tooltips on primefaces barchartseries -


i have tried search both forum , google extensively, have problems understanding how should make work:

primefaces6

i have barchartmodel based on tutorial in showcase: code: select private barchartmodel initstatusbarchart() { barchartmodel model = new barchartmodel();

    chartseries statusmessages = new chartseries();     statusmessages.setlabel("label"));     statusmessages.set("some string 1", list1.size());     statusmessages.set("some string 2", list2.size());       model.addseries(statusmessages);     return model; } 

the issue on render, tooltips format of

"1, 515" , "2, 432", 515 , 432 sizes of list1 , list2, respectively.

how can replace 1 , 2 values "some string" 1 , 2 ? have tried extending highlighter , using datatipformat, no success.

i solved problem using datatip editor of chart model (with primefaces 6.1, way). used stacked bar chart. needed apply solution @ 2 places: backing bean , jsf page.

in backing bean had set javascript function name way:

barmodel.setdatatipeditor("chartdatatipeditor"); 

i tried set using corresponding tag attribute in jsf page no effect.

in jsf inserted javascript code:

<script type="text/javascript"> function chartdatatipeditor(str, seriesindex, pointindex, plot) {   //console.log('chartdatatipeditor: '+str+" - "+seriesindex+" - "+pointindex);   var point = seriesindex+','+pointindex;   #{bean.datatipsjs} } </script> 

this js function gets chart coordinates parameters. concat them following js code gets easier. seriesindex index of chart series. pointindex index on x scale of diagram.

to find out correct values chart can uncomment console.log line above.

the inserted js code constructed in backing bean way:

private map<string, string> chartdatatips;  public string getdatatipsjs() {     stringbuilder sb = new stringbuilder("switch ( point ) {\n");     (string point : chartdatatips.keyset()) {         sb.append("case '").append(point).append("': return '").append(chartdatatips.get(point)).append("'; break;\n");     }     sb.append("default: return 'unknown point'; break; }");     return sb.tostring(); } 

the map chartdatatips has coordinate point key (e.g., "2,1") , tooltip value.

during chart setup have fill map useful details ;-)

like this:

chartdatatips.put("2,5", "label ..."); ... 

hope helps, if didn't solved this.

~alex


Comments

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -