Amchart X轴位置和填充轴

时间:2015-05-21 09:44:07

标签: graph charts amcharts

我使用AmChartXY绘制图形区域,这里是小提琴: https://jsfiddle.net/ap60fhsu/1/

            var chart = AmCharts.makeChart("chartdiv", {
            "type": "xy",
            "autoMarginOffset": 20,
            "dataProvider": [{
                "ax": 0,
                "ay": 0,
                "bx": 0,
                "by": 0,
            }, {
                "ax": 8,
                "ay": 1,
                "bx": 12,
                "by": -2,
            },
            {
                "ax": 32,
                "ay": 9,
                "bx": 35,
                "by": -1,
            },
            {
                "ax": 45,
                "ay": 6,
                "bx": 45,
                "by": -2,
            },
            {
                "ax": 60,
                "ay": 2,
                "bx": 60,
                "by": -2,
            },
            {
                "ax": 70,
                "ay": 0,
                "bx": 70,
                "by": 0,
            },
            {
                "ax": 75,
                "ay": 0,
                "bx": 72,
                "by": 0,

            },
            {
                "ax": 85,
                "ay": 6,
                "bx": 80,
                "by": -1,
            },
            {
                "ax": 90,
                "ay": 0,
                "bx": 90,
                "by": 0,
            }],
            "valueAxes": [ {
                "position": "bottom",
                "axisAlpha": 0,
                "dashLength": 1,
                "id": "x",
                "title": "X Axis"
            }, {
                "axisAlpha": 0,
                "dashLength": 1,
                "position": "left",
                "id": "y",
                "title": "Y Axis"
            }],
            "plotAreaBorderAlpha": 1,
            "startDuration": 1,
            "graphs": [ {
                "balloonText": "x:[[x]] y:[[y]]",
                "fillAlphas": 0.3,
                "fillToAxis": "x",
                "lineAlpha": 1,
                "xField": "ax",
                "yField": "ay",
                "lineColor": "#FF6600"
            }, {
                "balloonText": "x:[[x]] y:[[y]]",
                "lineAlpha": 1,
                "fillToAxis": "x",
                "fillAlphas": 0.3,
                "xField": "bx",
                "yField": "by",
                "lineColor": "#FCD202"
            }],
            "marginLeft": 64,
            "marginBottom": 60,
            "chartScrollbar": {},
            "chartCursor": {},
            "export": {
                "enabled": true,
                "position": "bottom-right"
            }
        });

如你所见,Y轴有负值,这使得X轴从Y = 0下降到Y = -4,当我使用fillToAxis:x时,预计图形填充区域将是以图形为界的区域和X轴对应的值Y = 0,得到另一个结果。如何将X轴移动到Y = 0,或者至少得到填充区域的结果?

提前致谢

0 个答案:

没有答案