融合图中辅助Y轴的小数点和主Y轴的整数值

时间:2017-11-08 09:47:23

标签: fusioncharts

如何创建具有整数值的主Y轴和辅助Y轴在融合图中具有小数点的双轴。下面是我当前的代码,它将两个轴显示为小数点值。

<graph animation='0' PYAxisName='Units' SYAxisName='PPB' bgColor='f5f5f5' rotateNames='1' PYAxisMaxValue='" + maxYVal + "'  SYAxisMaxValue='" + maxY1Val + "' canvasBorderColor='cccccc' canvasBorderThickness='0' canvasBgAlpha='100' showColumnShadow='0' showvalues='0' formatNumberScale='1' anchorSides='10' anchorRadius='3'  decimalPrecision='1' showShadow='0' showDivLineValue='1' numdivlines='" + numLines + "' divlinecolor='DCDCDC' divLineThickness='1'>

1 个答案:

答案 0 :(得分:0)

尝试使用FusionCharts v 3.12.2,可以通过设置&#34; sForceDecimals&#34;来获得十进制的辅助y轴值。图表属性级别的属性。请参阅以下代码:

&#13;
&#13;
FusionCharts.ready(function() {
    var revenueChart = new FusionCharts({
        type: 'stackedcolumn3dlinedy',
        renderAt: 'chart-container',
        width: '550',
        height: '350',
        dataFormat: 'json',
        dataSource: {
            "chart": {
                "caption": "Product-wise Quarterly Revenue vs. Profit %",
                "subCaption": "Harry's SuperMart - Last Year",
                "xAxisname": "Quarter",
                "pYAxisName": "Sales",
                "sYAxisName": "Profit %",
                "numberPrefix": "$",
                "sNumberSuffix": "%",
                //This "sForceDecimals" attribute will make only the secondary y-axis values in decimals.
                "sForceDecimals": "1",
                "sYAxisMaxValue": "25",
                "paletteColors": "#0075c2,#1aaf5d,#f2c500",
                "bgColor": "#ffffff",
                "borderAlpha": "20",
                "showCanvasBorder": "0",
                "usePlotGradientColor": "0",
                "plotBorderAlpha": "10",
                "legendBorderAlpha": "0",
                "legendShadow": "0",
                "legendBgAlpha": "0",
                "valueFontColor": "#ffffff",
                "showXAxisLine": "1",
                "xAxisLineColor": "#999999",
                "divlineColor": "#999999",
                "divLineIsDashed": "1",
                "showAlternateHGridColor": "0",
                "subcaptionFontBold": "0",
                "subcaptionFontSize": "14",
                "showHoverEffect": "1"
            },
            "categories": [{
                "category": [{
                    "label": "Q1"
                }, {
                    "label": "Q2"
                }, {
                    "label": "Q3"
                }, {
                    "label": "Q4"
                }]
            }],
            "dataset": [{
                "seriesname": "Food Products",
                "data": [{
                    "value": "11000"
                }, {
                    "value": "15000"
                }, {
                    "value": "13500"
                }, {
                    "value": "15000"
                }]
            }, {
                "seriesname": "Non-Food Products",
                "data": [{
                    "value": "11400"
                }, {
                    "value": "14800"
                }, {
                    "value": "8300"
                }, {
                    "value": "11800"
                }]
            }, {
                "seriesname": "Profit %",
                "renderAs": "line",
                "parentYAxis": "S",
                "showValues": "0",
                "data": [{
                    "value": "14"
                }, {
                    "value": "16"
                }, {
                    "value": "15"
                }, {
                    "value": "17"
                }]
            }]
        }
    }).render();
});
&#13;
<script src="https://static.fusioncharts.com/code/latest/fusioncharts.charts.js"></script>
<script src="https://static.fusioncharts.com/code/latest/fusioncharts.js"></script>
<div id="chart-container">FusionCharts will render here</div>
&#13;
&#13;
&#13;