2014-07-07 82 views
0

是否有可能逆转amcharts基于时间的图表的分类轴?我知道价值轴可以轻松翻转,但我还没有看到类别轴的解决方案。我需要在左边有最相关的,因此最近的数据。amcharts:逆时(类别)轴?

我使用基于时间的面积图。这里有一个演示:http://jsfiddle.net/N5rpu/1/

在这个例子中,我颠倒了价值轴,做了同样的类别轴只是为了显示没有任何反应。

var chart = AmCharts.makeChart("chartdiv", { 
    "type": "serial", 
    "theme": "none", 
    "pathToImages": "http://www.amcharts.com/lib/3/images/", 
    "dataProvider": chartData, 
    "valueAxes": [{ 
     "position": "left", 
     "title": "Unique visitors", 
     "reversed": true 
    }], 
    "graphs": [{ 
     "fillAlphas": 0.4, 
     "valueField": "visits" 
    }], 
    "chartScrollbar": {}, 
    "chartCursor": { 
     "categoryBalloonDateFormat": "JJ:NN, DD MMMM", 
     "cursorPosition": "mouse" 
    }, 
    "categoryField": "date", 
    "categoryAxis": { 
     "minPeriod": "mm", 
     "parseDates": true, 
     "reversed": true 
    } 
}); 
+0

不幸的是,这是不可能的。 – zeroin

回答

0

事实上,我有相反的问题 - 在AmCharts categoryAxis中的日期显示与时间顺序相反!

这是由数据提供程序数组中的排序从最近的日期最近不太实现,即

"dataProvider": [{ 
     "value": 74, 
     "date": "2014-11-16" 
    }, 
    { 
     "value": 73, 
     "date": "2014-11-15" 
    }, 
    { 
     "value": 70, 
     "date": "2014-11-14" 
    }]; 
+0

一个说明,这个工作你必须设置“parseDates”为假(默认值),然后以格式日期是手工做图“categoryFunction”。此处更新演示http://jsfiddle.net/pfitzgerald/12ampu3f/2/ – fitzpaddy