today I wanted to try the new PrimeFaces release 3.4.RC1. For charts there is a new attribute called datatipFormat.
I want to show only the value (y-axis) in a line chart as datatip. Like this:
<p:lineChart value="#{...}" datatipFormat="y-value"/>
What do I have to do to show only this? I could not find an example with a template String.
Best Regards Veote
datatipFormat uses sprintf to format the string for the tooltip, so you can print only the second parameter (y-axis):
Tip for BarChartModel():
Tip for HorizontalBarChartModel():
Examples of usage:
Then, in JSF page:
You can use the
extender
property of all PrimeFaces chart tags to override default plot options. Example:Other available jqplot options can be found here: http://www.jqplot.com/docs/files/jqPlotOptions-txt.html but please note that the document says it is out of date.
You can show only the first 0 characters of the x value (%.0s), what means to hide it. Behind it you can do what you want with the y value in sprintf format.
Primefaces uses a jqPlot Library for Charts. There I found the following entry:
Highlighter.formatString
I tried (example from Primefaces Showcase):
UserBean
and with this little trick is only y-axis displays.