【问题标题】:Decimal point in secondary Y axis and integer value in primary Y axis in fusion chart融合图中辅助 Y 轴的小数点和主 Y 轴的整数值
【发布时间】:2017-12-01 15:25:26
【问题描述】:

如何在融合图中创建双轴,主 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'>

【问题讨论】:

    标签: fusioncharts


    【解决方案1】:

    尝试使用 FusionCharts v 3.12.2,通过在图表属性级别设置“sForceDecimals”属性,可以获得十进制的辅助 y 轴值。参考以下代码:

    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();
    });
    <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>

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-03-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-01-23
      相关资源
      最近更新 更多