我在我的 AngularJS 应用程序中使用 amCharts,我正在寻找一种方法来重命名类别字段的标签。以下是我的代码:
var configChart = function () {
employeeChart = new AmCharts.AmSerialChart();
employeeChart.categoryField = "empId";
var yAxis = new AmCharts.ValueAxis();
yAxis.position = "left";
employeeChart.addValueAxis(yAxis);
mcfBarGraph = new AmCharts.AmGraph();
mcfBarGraph.valueField = "employeeRating";
mcfBarGraph.type = "column";
mcfBarGraph.fillAlphas = 1;
mcfBarGraph.lineColor = "#f0ab00";
mcfBarGraph.valueAxis = yAxis;
employeeChart.addGraph(empBarGraph);
employeeChart.write('employee');
}
在上面的代码中,如果您观察到 categoryField 是 empId,那么在 x 轴上它会显示员工 ID,我想将其设为“dept-empId”。例如,如果部门编号为 1,则在 x 轴上显示 1-1,1-2 等。部门 ID 不在数据提供者中,而是我的控制器中的范围变量之一。你能告诉我我怎么能做到这一点。