From 8a609acf15e3db6de9e90a300315a919e78a62d1 Mon Sep 17 00:00:00 2001 From: lishutong Date: Tue, 29 Jun 2021 17:07:45 +0000 Subject: [PATCH 1/2] Use pie chart for visualization of anaylsis result. echarts_data.js will take the raw data and convert it into vue-echarts readable option. PieChart.vue take this option and render it into a pie chart. Test: Mannual tested. Change-Id: I54af3603031f0e23afa743ffc420d240a1b07bb2 --- .../src/components/PayloadComposition.vue | 44 +++++++++----- tools/otagui/src/components/PieChart.vue | 53 +++++++++++++++++ tools/otagui/src/services/echarts_data.js | 57 ++++++++++++++++++- 3 files changed, 139 insertions(+), 15 deletions(-) create mode 100644 tools/otagui/src/components/PieChart.vue diff --git a/tools/otagui/src/components/PayloadComposition.vue b/tools/otagui/src/components/PayloadComposition.vue index 420b96df6..96a4884dd 100644 --- a/tools/otagui/src/components/PayloadComposition.vue +++ b/tools/otagui/src/components/PayloadComposition.vue @@ -3,28 +3,31 @@ v-model="partitionInclude" :labels="updatePartitions" /> - -
-
-      {{ listData }}
-    
+ +
+
+ + \ No newline at end of file diff --git a/tools/otagui/src/services/echarts_data.js b/tools/otagui/src/services/echarts_data.js index faddeecc9..6e3b41c8d 100644 --- a/tools/otagui/src/services/echarts_data.js +++ b/tools/otagui/src/services/echarts_data.js @@ -1,9 +1,19 @@ -// This function will be used later for generating a pie chart through eCharts export class EchartsData { - constructor(statisticData) { + /** + * Given a set of [key, value] pairs and title, create an object for further + * usage in Vue-Echarts. + * @param {Map} statisticData + * @param {String} title + */ + constructor(statisticData, title) { this.statisticData = statisticData + this.title = title } + /** + * Convert the raw data into a string. + * @return {String} A list of [key, value]. + */ listData() { let table = '' for (let [key, value] of this.statisticData) { @@ -11,4 +21,47 @@ export class EchartsData { } return table } + + /** + * Generate necessary parameters (option) for vue-echarts. + * Format of the parameters can be found here: + * https://echarts.apache.org/en/option.html + * @return {Object} an ECharts option object. + */ + getEchartsOption() { + let option = new Object() + option.title = { + text: this.title, + left: "center" + } + option.tooltip = { + trigger: "item", + formatter: "{a}
{b} : {c} ({d}%)" + } + option.legend = { + orient: "horizontal", + left: "top", + top: "10%", + data: Array.from(this.statisticData.keys()) + } + option.series = [ + { + name: this.title, + type: "pie", + radius: "55%", + center: ["50%", "60%"], + data: Array.from(this.statisticData).map((pair) => { + return { value: pair[1], name: pair[0] } + }), + emphasis: { + itemStyle: { + shadowBlur: 10, + shadowOffsetX: 0, + shadowColor: "rgba(0, 0, 0, 0.5)" + } + } + } + ] + return option + } } \ No newline at end of file From 18e0c887d8e96a698e20b111e9ab93b50aaa37b9 Mon Sep 17 00:00:00 2001 From: lishutong Date: Wed, 30 Jun 2021 17:35:28 +0000 Subject: [PATCH 2/2] Add 'Select/Unselect All' in partition selection. Now both OTA configuration and OTA analysis page support select/unselect all partitions. Test: Mannual tested. Change-Id: I684912886f3d3da259aeafea6aea1e53ae4a1c9a --- .../otagui/src/components/PartialCheckbox.vue | 24 +++++++++++++++++++ .../src/components/PayloadComposition.vue | 5 ---- tools/otagui/src/views/SimpleForm.vue | 3 ++- 3 files changed, 26 insertions(+), 6 deletions(-) diff --git a/tools/otagui/src/components/PartialCheckbox.vue b/tools/otagui/src/components/PartialCheckbox.vue index fc7694fa6..3cd2de887 100644 --- a/tools/otagui/src/components/PartialCheckbox.vue +++ b/tools/otagui/src/components/PartialCheckbox.vue @@ -1,5 +1,11 @@