在amChart中,如何为图表的X轴和Y轴标题设置自定义名称(字符串)?
(水平轴和垂直轴)
var chart = AmCharts.makeChart( "chartdiv", {
"type": "xy",
"pathToImages": "http://www.amcharts.com/lib/3/images/",
"dataProvider": chartData,
"mouseWheelZoomEnabled": true,
"graphs": [ {
/*"bullet": "circle",
"bulletSize": 8,*/
"lineAlpha": 1,
"lineThickness": 2,
"fillAlphas": 0,
"xField": "x",
"yField": "y",
} ],
} );
答案 0 :(得分:2)
您可以为每个轴使用title
参数。但是,您需要将valueAxes
定义添加到图表配置中。即使它们只包含title
参数。
var chart = AmCharts.makeChart( "chartdiv", {
"type": "xy",
"pathToImages": "http://www.amcharts.com/lib/3/images/",
"dataProvider": chartData,
"mouseWheelZoomEnabled": true,
"graphs": [ {
/*"bullet": "circle",
"bulletSize": 8,*/
"lineAlpha": 1,
"lineThickness": 2,
"fillAlphas": 0,
"xField": "x",
"yField": "y",
} ],
"valueAxes": [ {
"position": "left",
"title": "Y axis"
}, {
"position": "bottom",
"title": "X axis"
} ]
} );