AmCharts有一些日期的默认格式:
[{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'}]
我可以使用下面示例中的categoryAxis.minPeriod = "DD";
。
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";
但我希望定义或使用格式为四周,六个月等的句号,以便我可以像下面这样编写
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";
答案 0 :(得分:3)
查看文档,可以使用类别轴的minPeriod
属性。见http://docs.amcharts.com/javascriptcharts/CategoryAxis#minPeriod
它也可以提供一个增量数字,即" 15mm"这将指示图表以15分钟为增量提供数据。
如果是两个月,那应该是2MM