Primefaces 5.2折线图忽略了tickcount JSF 2.2

时间:2015-06-17 10:53:00

标签: jsf primefaces

我正在使用这样的折线图:

    <ui:define name="head">
        <h:outputScript library="js" name="jqplot.dateAxisRenderer.min.js"/>
        <h:outputScript library="js" name="jqplot.categoryAxisRenderer.min.js"/>
        <h:outputScript library="js" name="jqplot.canvasAxisTickRenderer.min.js"/>
    </ui:define>
        <h:form>
        <p:chart type="line" widgetVar="chart" model="#{resultsViewController.areaModel}" style="height:300px" />
        </h:form>

在我的bean中,我设置了折线图模型:

    totalCounts = resultFacade.getTotalResult("day");
    areaModel = new LineChartModel();

    LineChartSeries count_up_series = new LineChartSeries();
    count_up_series.setFill(true);
    count_up_series.setLabel("count up");

    LineChartSeries count_down_series = new LineChartSeries();
    count_down_series.setFill(true);
    count_down_series.setLabel("count down");

    Calendar calendar = Calendar.getInstance();
    for(ResultsView result : getItems())
    {
        calendar.setTime(result.getDate());
        calendar.add(Calendar.MINUTE, result.getMinutes() * 5);
        count_up_series.set(calendar.getTime().toString(), result.getCountUp());
        count_down_series.set(calendar.getTime().toString(), result.getCountDown());

    }


    areaModel.addSeries(count_up_series);
    areaModel.addSeries(count_down_series);

    areaModel.setTitle("Area Chart");
    areaModel.setLegendPosition("ne");
    areaModel.setStacked(true);
    areaModel.setShowPointLabels(true);
    areaModel.setAnimate(true);

    Axis xAxis = new CategoryAxis("Date");
    xAxis.setTickCount(20);
    xAxis.setTickAngle(-50);
    areaModel.getAxes().put(AxisType.X, xAxis);
    Axis yAxis = areaModel.getAxis(AxisType.Y);
    yAxis.setLabel("Count");
    yAxis.setMin(0);
    yAxis.setMax(100);

但是,setTickCount方法什么都不做。我看到很多很多蜱虫。 我找到了一些建议使用chartExtender的解决方案,但这并没有产生任何影响,而且我检查了PF生成的内容并且看起来没问题:

xaxis: {label:"Date",renderer:$.jqplot.CategoryAxisRenderer,tickOptions:{angle:"-50"},numberTicks:20}},series:[{label:'count up',renderer: $.jqplot.LineRenderer,fill:true,fillAlpha:1.0,showLine:true,markerOptions:{show:true, style:'filledCircle'}},{label:'count down',renderer: $.jqplot.LineRenderer,fill:true,fillAlpha:1.0,showLine:true,markerOptions:{show:true, style:'filledCircle'}}],stackSeries:true,animate:true,showPointLabels:true,datatip:true},'charts');});</script><input type="hidden" name="javax.faces.ViewState" id="j_id1:javax.faces.ViewState:16" value="5469798536346298278:5748043847734473197" autocomplete="off" />

0 个答案:

没有答案