简体   繁体   中英

PrimeFaces Bar Chart Formatting

I'm trying to do 2 things on my Bar Chart:

  1. Change the format of the number of yaxis to ###,###(12000) instead of ######(12000);
  2. Changing the mouse tooltip to show just the y axis value. 14554 in instead of 1,14554

I've tried using custom extender, but I couldn't find out the JPlot code to it.

I'm using PrimeFaces 5.1.

In order to achieve what you want with your primefaces bar chart, add following to your custom jqPlot extender:

  1. To format Y axes numbers as ###,### (digit grouping)

    this.cfg.axes.yaxis.tickOptions.formatString = "%'d";

    ( jqPlot uses single quote (') to format number with digit grouping)

  2. To force tooltip to show only yaxis values

    this.cfg.highlighter={show: true,tooltipAxes: 'y',useAxesFormatters: false,tooltipFormatString: "%'d"};

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