0

I am trying to customize my date on line chart to display weekly data but for some reason it does not render. This question is exactly what I am facing and people have been telling that adding a min attribute would fixed it. I've tried adding a min attribute and still no luck to avail and even the stated min value nor max is not showing on the chart. Firebug doesn't give me any errors either so I am lost right now, all I know is the fact that setting for min, max and tickInterval does not work.

Here's a screenshot of what's happening on my chart: enter image description here

And here's my code for extender:

function chartExtender() {
this.cfg.axes = {
    xaxis: {
        renderer: $.jqplot.DateAxisRenderer,
        rendererOptions: {
            tickRenderer: $.jqplot.CanvasAxisTickRenderer
        },
        tickOptions: {
            formatString: '%b-%d'
        },
        min: 'Dec 01, 2013',
        max: 'Dec 30, 2013'
    },
    yaxis: {
        min: 0,
        rendererOptions: {
            tickRenderer: $.jqplot.CanvasAxisTickRenderer
        }
    }
};
this.cfg.axes.xaxis.ticks = this.cfg.categories;

}

Here's my jsf page:

<h:head>
    <h:outputScript name="./js/jqplot.canvasAxisTickRenderer.js"/>
    <h:outputScript name="./js/jqplot.dateAxisRenderer.js"/>
    <h:outputScript name="./js/jqplotExtender.js"/>
</h:head>
<h:body>
    <ui:composition template="./../../../WEB-INF/template/stencil.xhtml">
        <ui:define name="content">
            <p:lineChart id="dailyChart" value="#{jqplot.chart.trafficModel}" legendPosition="ne" fill="true" extender="chartExtender"
                         seriesColors="FFB200" style="height:300px;margin:20px 10px" title="Last 30 Days" xaxisAngle="315"/>
        </ui:define>
    </ui:composition>
</h:body>

And lastly here's my backing bean:

private AreaChart chart;
private List<DailyVisitBean> dailyvisit;

/*setters and getters omitted for brevity*/

public Jqplot() {
    chart = new AreaChart();
    dailyvisit = new ArrayList<>();

    dailyvisit.add(new DailyVisitBean("2013-12-09", "55"));
    dailyvisit.add(new DailyVisitBean("2013-12-10", "55"));
    dailyvisit.add(new DailyVisitBean("2013-12-11", "51"));
    dailyvisit.add(new DailyVisitBean("2013-12-12", "79"));
    dailyvisit.add(new DailyVisitBean("2013-12-13", "49"));
    dailyvisit.add(new DailyVisitBean("2013-12-14", "20"));
    dailyvisit.add(new DailyVisitBean("2013-12-15", "32"));
    dailyvisit.add(new DailyVisitBean("2013-12-16", "62"));
    dailyvisit.add(new DailyVisitBean("2013-12-17", "58"));
    dailyvisit.add(new DailyVisitBean("2013-12-18", "39"));

    chart.setTrafficModel(dailyvisit);
}
Community
  • 1
  • 1
Darth
  • 433
  • 4
  • 14
  • I forgot to mention that the second parameter that is being passed to DailyVisitBean gets converted to int on setter inside the class. – Darth Jan 10 '14 at 11:24
  • and by adding `console.log(this.cfg.axes.xaxis)` I saw that _ticks_ only has the values of the dates and the other value is missing. – Darth Jan 10 '14 at 11:25

0 Answers0