Line Chart Display Numbers percision

UI Components for JSF
Post Reply
macros14
Posts: 46
Joined: 26 Feb 2010, 19:44

13 Mar 2012, 15:48

Currently I am trying to use a line chart, but am having issues making the display look correct. I am adding integers and BigDecimals to the LineChartSeries (though I have tried the primefaces example and can duplicate it as well).

What happens is if I set a minX and maxX and a height, well a combination of those things makes primefaces use some algorithm to determine what numbers should be displayed on the X and Y axis. The problem is if you don't set the chart up exactly correct, the numbers being displayed end up having 5 decimal places. Is there any fix for this? Even when you hover over the markers the data that is displayed is the data I entered with trailing zeros, and it looks really weird.

At the very least in the future there should be something like incrementX and incrementY. And the numbers inside of the chart should always display what was inputed into it...

Code: Select all

<p:lineChart id="linear" value="#{myChartModelBean.chartModel}" legendPosition="e"  
     title="Linear Chart" minY="0" maxY="7" minX="0" style="height:400px"/>


public CartesianChartModel getChartModel() {
       myModel = new CartesianChartModel();
        LineChartSeries chartSeries= new LineChartSeries();

        chartSeries.set(1, 2);  
        chartSeries.set(2, 1);  
        chartSeries.set(3, 3);  
        chartSeries.set(4, 6);  
        chartSeries.set(5, 8);
        
        myModel .addSeries(chartSeries);
return myModel ;
    }
Using primefaces 3.0.1 on glassfish 3.1.1
Last edited by macros14 on 13 Mar 2012, 16:10, edited 1 time in total.

macros14
Posts: 46
Joined: 26 Feb 2010, 19:44

13 Mar 2012, 16:00

Actually it looks like only the minX and minY is causing the issue... Though if you leave them out then all of my data is rounded to the nearest integer rather than the two decimal place that I inputed into the chart.

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 43 guests