循环在fusioncharts多系列图表栏2D中的值列表

时间:2016-07-13 08:14:50

标签: javascript html fusioncharts

像我在标题中写的那样,我有一个网页,我在其中从控制器渲染一个对象列表。我必须迭代它来显示值并创建一个多系列图表栏。 在过程结束时,我获得的唯一值是列表的最后一个。 html页面的模板是groovy。 如何解决并显示所有值以获得正确的图表? 这是代码:

<script type="text/javascript">
  FusionCharts.ready(function(){
    var fusioncharts = new FusionCharts({
    type: 'msbar2d',
    renderAt: 'chart-container',
    width: '800',
    height: '800',
    dataFormat: 'json',
    dataSource: {
    	
        "chart": {
            "caption": "Title",
            "subCaption": "Subtitle",
            "xAxisname": "x",
            "yAxisName": "y",
            "plotFillAlpha": "80",
            "paletteColors": "#0075c2,#1aaf5d",
            "baseFontColor": "#333333",
            "baseFont": "Helvetica Neue,Arial",
            "captionFontSize": "14",
            "subcaptionFontSize": "14",
            "subcaptionFontBold": "0",
            "showBorder": "0",
            "bgColor": "#ffffff",
            "showShadow": "0",
            "usePlotGradientColor": "0",
            "showplotborder": "0",
            "valueFontColor": "#ffffff",
            "placeValuesInside": "1",
            "showHoverEffect": "1",
            "rotateValues": "1",
            "showXAxisLine": "1",
            "xAxisLineThickness": "1",
            "xAxisLineColor": "#999999",
            "showAlternateHGridColor": "0",
            "legendBgAlpha": "0",
            "legendBorderAlpha": "0",
            "legendShadow": "0",
            "legendItemFontSize": "10",
            "legendItemFontColor": "#666666",
            "exportEnabled": "1"
        },
        #{list poList, as:'person'}
        
        "categories": [{
            "category": [{
                "label": "${person?.surname} ${person?.name}"
            },]
        }],
        "dataset": [{
            "seriesname": "Ore di straordinario",
            "data": [{
                "value": "${person?.overtimeHour}"
            },]
        }, {
            "seriesname": "Ore in più",
            "data": [{
                "value": "${person?.positiveHourForOvertime}"
            },]
        }],
        #{/list}
    }
}
);
    fusioncharts.render();
});
</script>

0 个答案:

没有答案