Reader small image

You're reading from  PrimeFaces Beginner's Guide

Product typeBook
Published inNov 2013
Reading LevelIntermediate
PublisherPackt
ISBN-139781783280698
Edition1st Edition
Languages
Right arrow
Author (1)
Siva Prasad Reddy Katamreddy
Siva Prasad Reddy Katamreddy
author image
Siva Prasad Reddy Katamreddy

K. Siva Prasad Reddy is a Senior Software Engineer living in Hyderabad, India, and having more than seven years of experience in developing enterprise applications with Java and JavaEE technologies. Siva is a Sun Certified Java Programmer and has a lot of experience in server-side technologies such as Java, JavaEE, Spring, Hibernate, MyBatis, JSF, PrimeFaces, and WebServices (SOAP/REST). Siva is also the author of Java Persistence with MyBatis 3, Packt Publishing. Siva normally shares the knowledge he has acquired on his blog at www.sivalabs.in. If you want to find out more about his work, you can follow him on Twitter (@sivalabs) and GitHub (https://github.com/sivaprasadreddy).
Read more about Siva Prasad Reddy Katamreddy

Right arrow

Time for action – creating a Bar chart


Let us look at creating a Bar chart with horizontal orientation displaying the number of posts with PrimeFaces and jQuery tags from years 2009 to 2013.

  1. Create a Bar chart using horizontal orientation with custom seriesColors and dataTipFormat.

    <p:barChart value="#{chartController.chartModel}" 
      style="width: 400px; height: 250px;"
      xaxisLabel="No. of Posts" yaxisLabel="Year" 
      xaxisAngle="45" 
      datatipFormat="#{chartController.datatipFormat}"
      legendPosition="se" barMargin="5" barPadding="4" 
      seriesColors="A52A2A, 1E90FF"
      orientation="horizontal" animate="true" 
      />
  2. Write a method to return the custom dataTipFormat.

    public String getDatatipFormat() 
    {
      return "<span>No. of Posts: %s</span>";
    }

What just happened?

We have created a horizontal Bar chart by setting orientation="horizontal". We have customized the series colors by setting seriesColors="A52A2A, 1E90FF".

Also we have customized the datatip format using the datatipFormat...

lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
PrimeFaces Beginner's Guide
Published in: Nov 2013Publisher: PacktISBN-13: 9781783280698

Author (1)

author image
Siva Prasad Reddy Katamreddy

K. Siva Prasad Reddy is a Senior Software Engineer living in Hyderabad, India, and having more than seven years of experience in developing enterprise applications with Java and JavaEE technologies. Siva is a Sun Certified Java Programmer and has a lot of experience in server-side technologies such as Java, JavaEE, Spring, Hibernate, MyBatis, JSF, PrimeFaces, and WebServices (SOAP/REST). Siva is also the author of Java Persistence with MyBatis 3, Packt Publishing. Siva normally shares the knowledge he has acquired on his blog at www.sivalabs.in. If you want to find out more about his work, you can follow him on Twitter (@sivalabs) and GitHub (https://github.com/sivaprasadreddy).
Read more about Siva Prasad Reddy Katamreddy