0

我正在尝试使用 amCharts API 绘制误差线。我无法设置 yAxis 限制,因此,与实际条形相比,我的误差线很小。

var valueAxis = new AmCharts.ValueAxis();
var chart = AmCharts.makeChart("chartdiv", {
    "type": "serial",
  "theme": "none",
  "dataProvider": [{
        "year": "C",
        "value": 85.07 ,
        "error": 0.57,
        "lower": 84.50,
        "upper": 85.64
    }, {
        "year": "V1",
        "value": 84.67 ,
        "error": 0.58,
        "lower": 84.09,
        "upper":85.25
    }, {
        "year": "V2",
        "value": 86.76 ,
        "error": 0.58,
        "lower": 86.18,
        "upper":87.34
    }, {
        "year": "V3",
        "value": 84.55 ,
        "error": 0.58,
        "lower": 83.97,
        "upper":85.13
    }],
    "balloon": {
        "textAlign": "left"
    },
    "valueAxes": [{
        "id":"v1",
        "axisAlpha": 0
    }],
    "startDuration": 1,
    "graphs": [{
        "balloonText": "value:<b>[[value]]</b><br>error:<b>[[error]]</b><br>lower:<b>[[lower]]</b><br>upper:<b>[[upper]]</b>",
        "labelText": "[[value]]",
        "type": "column",
        "bullet": "yError",
        "bulletColor": "#000",
        "errorField": "error",
        "lineThickness": 2,
        "valueField": "value",
        "bulletAxis": "v1",
    "fillAlphas": 1
    }],
    "chartCursor": {
        "cursorAlpha": 0,
        "cursorPosition": "mouse",
        "graphBulletSize": 1,
        "zoomable": false
    },
    "categoryField": "year",
    "categoryAxis": {
        "gridPosition": "start",
        "axisAlpha": 0,
        "min":60
    },
    "exportConfig": {
        "menuTop":"20px",
        "menuRight":"20px",
        "menuItems": [{
            "icon": 'http://www.amcharts.com/lib/3/images/export.png',
            "format": 'png'
        }]
    }
});

这是 jsFiddle http://jsfiddle.net/amcharts/hD58C/utm_source=website&utm_medium=embed&utm_campaign=hD58C

4

0 回答 0