Montells
Montells

Reputation: 6679

amcharts custom period date

AmCharts have some defaults formats for dates:

[{period:'fff',format:'JJ:NN:SS'},
 {period:'ss',format:'JJ:NN:SS'},
 {period:'mm',format:'JJ:NN'},
 {period:'hh',format:'JJ:NN'},
 {period:'DD',format:'MMM DD'},
 {period:'WW',format:'MMM DD'},
 {period:'MM',format:'MMM'},
 {period:'YYYY',format:'YYYY'}]

I can use categoryAxis.minPeriod = "DD"; like in example below.

categoryAxis = chart.categoryAxis;
categoryAxis.gridAlpha = 0.00;
categoryAxis.axisAlpha = 0.30;
categoryAxis.inside = false;
categoryAxis.gridPosition = "start";
categoryAxis.title = gon.graph_info.horizontal_label
categoryAxis.parseDates = true
categoryAxis.minPeriod = "DD";

But I want to define or use periods with formats for four weeks, six month, etc in way that I can write like below

categoryAxis = chart.categoryAxis;
categoryAxis.gridAlpha = 0.00;
categoryAxis.axisAlpha = 0.30;
categoryAxis.inside = false;
categoryAxis.gridPosition = "start";
categoryAxis.title = gon.graph_info.horizontal_label
categoryAxis.parseDates = true
categoryAxis.minPeriod = "TOW_MONTHS";

Upvotes: 2

Views: 3342

Answers (1)

Pudge601
Pudge601

Reputation: 2068

Looking at the documentation, this should be possible to do with the minPeriod property of the category axis. See http://docs.amcharts.com/javascriptcharts/CategoryAxis#minPeriod

It's also possible to supply a number for increments, i.e. "15mm" which will instruct the chart that your data is supplied in 15 minute increments.

In the case of two months, it should be 2MM

Upvotes: 3

Related Questions