jsf - How to set custom interval labels on Primefaces barchart -


i having difficulty understanding how customize data labels axes in pf bar chart. want populate actual data points / intervals variables other on series. want more control , flexibility of how label axes in pf charts. example, have following bar chart:

public void barchartmod() {      chartseries rigseries = new chartseries();     list<rigtest> blist = rigfacade.findall();             map<object, number> barmap = new hashmap<>();     map<object, string> tickmap= new hashmap<>();     (rigtest t : blist) {         barmap.put(t.getrigtestid(), t.getrignum());     }      barmodel = new barchartmodel();      rigseries.setdata(barmap);     barmodel.addseries(rigseries);     barmodel.setseriescolors("ff0000");     barmodel.setshowpointlabels(true);     axis xaxis = barmodel.getaxis(axistype.x);  } 

the x axis chart series takes values map consisting of primary key , number of rigs table called rigtest. table has following schema:

rigtestid(pk int), country(foreign key entity country table), rignum (int - number of rigs)

i want x axis lebeled country names. if include country names in map results in duplicate values , show values unique country names. show values each record in series.

this can achieved if use primary key iterate through each value in series (as above). acceptable way obtain values, need way label each point on x-axis names of country instead of numbers.

currently bar chart looks this:

enter image description here

this graph used compare numbers of different countries during date range specified user query. x axis labels values unique primary key (rigestid). instead of using pk x axis label, want use country names , produce graph this:

enter image description here

in above graph, countryname belongs country entity pertaining each pk , should obtained looping through instance of country entity, example:

map<object, string> tickmap= new hashmap<>();  for(rigtest b: blist) {         tickmap.put(b.getrigtestid(), b.getcountry().getcountryname());     } 

if try put county names instead of primary keys, 4 instead of 6 bars (since duplicated country names ignored). therefore, if stick primary key way of obtaining values x axis, need way of populating labels country names.

the pf documentation , of online material says how add labels axis, not how customize individual points of axes in pf charts. looked @ jqplot. seems deal manually hardcoding axis labels, can't find guide on how populate interval points dynamically database.

basically i'm trying label x axis other mapping used obtain values, included in same underlying data schema. i'm sure there simple way achieve , i'm missing something.

thanks in advance!


Comments