更改amCharts的标签样式

时间:2016-03-18 16:37:30

标签: javascript charts amcharts

请参阅amCharts中的图片。我只想显示月份,二月,三月等短名称,而不是像Jan那样显示一年中的第一个月,而不是显示2016年......请参见突出显示的部分:

enter image description here

    AmCharts.makeChart("MonthlySaleChart",
            {
                "type": "serial",
                "categoryField": "date",
                "dataDateFormat": "YYYY-MM",
                "theme": "default",
                "categoryAxis": {
                    "minPeriod": "MM",
                    "parseDates": true
                },
                "chartCursor": {
                    "categoryBalloonDateFormat": "MMM YYYY"
                },
                "chartScrollbar": {},
                "trendLines": [],
                "graphs": [
                    {
                        "bullet": "round",
                        "id": "AmGraph-1",
                        "title": "This Year",
                        "valueField": "ThisMonth"
                    },
                    {
                        "bullet": "square",
                        "id": "AmGraph-2",
                        "title": "Last Year",
                        "valueField": "LastMonth"
                    }
                ],
                "guides": [],
                "valueAxes": [
                    {
                        "id": "ValueAxis-1",
                        "title": "Sales in Thousands (000)"
                    }
                ],
                "allLabels": [],
                "balloon": {},
                "legend": {
                    "useGraphSettings": true
                },
                "titles": [
                    {
                        "color": "#20C5AE",
                        "id": "Title-1",
                        "size": 15,
                        "text": "SALES By Month"
                    }
                ],
                "dataProvider": data
            }
        );

1 个答案:

答案 0 :(得分:0)

要禁用显示年份而不是Jan,请在index.html.erb中将markPeriodChange设置为false

categoryAxis