AmCharts线图与Axis断开连接

时间:2015-08-31 14:28:07

标签: javascript graph charts amcharts

我的图表在创建时与我的y轴断开连接。我想知道是否有人有同样的问题?你可以看到我尝试使用轴偏移。没有解决问题。

Image Link

enter image description here

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

请帮忙

1 个答案:

答案 0 :(得分:1)

if (datePeriod.isBefore(cutOffDate) && daysDiff < 61){ return dateSelection = 'purchased before'; } else if (datePeriod.isBefore(cutOffDate) && daysDiff > 61 && monthsDiff < 6) { // purchased date is before the cut off date or less than 61 days return dateSelection = 'between 61 days and 6 months' } else if (datePeriod.isAfter(cutOffDate) || datePeriod.isSame(cutOffDate) || daysDiff < 31) { // purchased date is after/the same as cut off date or less than 31 days return dateSelection = 'purchased after'; } else if (datePeriod.isAfter(cutOffDate) || datePeriod.isSame(cutOffDate) || daysDiff > 31 && monthsDiff < 6) { return dateSelection = 'between 31 days 6 months'; } else if (monthsDiff > 6 && yearDiff < 6) { return dateSelection = 'between 6 months and 6 years'; } else if (yearDiff > 6) { return dateSelection = 'over 6 years'; } 对象的startOnAxis属性设置为categoryAxis

true

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

编辑: 正如martynasma建议的那样,您应该注意,除非您将chart.categoryAxis.startOnAxis = true; 设置为chart.categoryAxis.parseDates,否则如果您将true设置为chart.categoryAxis.equalSpacing,这将无效。正如关于&#34; startOnAxis&#34;的amcharts CategoryAxis文档中所述。属性:

  

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