我正在使用AngularJs应用程序,我正在使用AmCharts。
const writeemp = data => {
const {
total,
employees,
} = data;
empChart.dataProvider = e;
empChart.write('emp');
empChart.validateData();
};
AmCharts.handleLoad();
var configChart = function () {
empChart = new AmCharts.AmSerialChart();
empChart.categoryField = "state";
empChart.labelRotation = 90;
var yAxis = new AmCharts.ValueAxis();
yAxis.position = "left";
empChart.addValueAxis(yAxis);
empBarGraph = new AmCharts.AmGraph();
empBarGraph.valueField = "count";
empBarGraph.type = "column";
empBarGraph.fillAlphas = 1;
empBarGraph.lineColor = "#f0ab00";
empBarGraph.valueAxis = yAxis;
empChart.addGraph(empBarGraph);
empChart.write('empChart');
$http.get(hostNameService.getHostName()+"/dashboard/employees/statecount")
.then(response => writeemp(response.data));
}
html中的代码:
<div class='panel-body'>
<div id="empChart"></div>
</div>
这将返回x轴上的State值和y轴上的count。我想添加一些复选框,用于过滤我在图表中的数据。每个复选框应代表员工的“状态”。如果我取消选中一个框,则显示的数据应在图表中更改。任何人都可以告诉我如何实现这一目标。