|
@@ -413,15 +413,34 @@ export default {
|
|
|
//劳动课程
|
|
|
this.$el.querySelector("#person_canvas2")
|
|
|
);
|
|
|
+ var b = this.randarJson.reduce(function (acc, obj) {
|
|
|
+ var found = acc.findIndex(function (element) {
|
|
|
+ return element.target[0] === obj.target[0];
|
|
|
+ });
|
|
|
+
|
|
|
+ if (found !== -1) {
|
|
|
+ acc[found].count += obj.count;
|
|
|
+ acc[found].value += obj.value;
|
|
|
+ } else {
|
|
|
+ acc.push(obj);
|
|
|
+ }
|
|
|
+
|
|
|
+ return acc;
|
|
|
+ }, []);
|
|
|
+
|
|
|
+ b.forEach(function (element) {
|
|
|
+ element.value /= element.count;
|
|
|
+ });
|
|
|
+
|
|
|
+ this.randarJson = b;
|
|
|
+
|
|
|
let radarOption = JSON.parse(JSON.stringify(this.radarOption));
|
|
|
for (var i = 0; i < this.randarJson.length; i++) {
|
|
|
radarOption.radar.indicator.push({
|
|
|
- name: this.randarJson[i].target,
|
|
|
+ name: this.randarJson[i].target[0],
|
|
|
max: 5,
|
|
|
});
|
|
|
- radarOption.series[0].data[0].value.push(
|
|
|
- (this.randarJson[i].value / this.randarJson[i].count).toFixed(1)
|
|
|
- );
|
|
|
+ radarOption.series[0].data[0].value.push(this.randarJson[i].value);
|
|
|
}
|
|
|
|
|
|
this.chartObj3 = chartObj3;
|