创建时,我的图形与y轴断开连接。我想知道是否有人遇到同样的问题?如您所见,我尝试使用轴偏移。无法解决问题。

Image Link

javascript - AmCharts折线图与Axis断开连接-LMLPHP

            AmCharts.ready(function () {
            chart = new AmCharts.AmSerialChart();
            chart.dataProvider = chartData;
            chart.categoryField = "timestamp";
            chart.startDuration = 0;
            chart.pathToImages = "/design/javascripts/amcharts/images/";
            chart.zoomOutButton = {

            var valueAxis = new AmCharts.ValueAxis();
            valueAxis.title = "{t}Impressions{/t}";
            valueAxis.offset = -25;
            valueAxis.stackType = "regular";
            valueAxis.position = "left";
            valueAxis.gridAlpha = 0.1;
            valueAxis.axisAlpha = 0.2;
            valueAxis.dashLength = 1;
            chart.addValueAxis(valueAxis);
                backgroundColor: '#000000',
                backgroundAlpha: 0.15
            };


请帮忙

最佳答案

startOnAxis对象的categoryAxis属性设置为true

chart.categoryAxis.startOnAxis = true;


http://docs.amcharts.com/javascriptcharts/CategoryAxis

编辑:
根据martynasma的建议,您应该注意,如果将chart.categoryAxis.parseDates设置为true,则除非将chart.categoryAxis.equalSpacing设置为true,否则该方法将无效。如amcharts CategoryAxis文档中有关“ startOnAxis”属性的说明:


  指定图形是否应从轴开始。如果显示列,建议将其设置为false。如果parseDates设置为true,除非equalSpacing设置为true,否则startOnAxis始终为false。

10-06 05:20