Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
87 views
in Technique[技术] by (71.8m points)

java - PrimeFaces 3.4 Charts datatipFormat

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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Primefaces uses a jqPlot Library for Charts. There I found the following entry:

Highlighter.formatString

I tried (example from Primefaces Showcase):

   <p:lineChart  id="basic" value="#{userBean.categoryModel}" legendPosition="ne" 
   datatipFormat="#{userBean.datatipFormat}"  title="Basic Bar Chart" min="0"
    max="200" style="height:300px"/>

UserBean

public String getDatatipFormat(){
   return "<span style="display:none;">%s</span><span>%s</span>";
}

and with this little trick is only y-axis displays.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...