This is an automated email from the ASF dual-hosted git repository.

wangzx pushed a commit to branch gh-pages
in repository https://gitbox.apache.org/repos/asf/echarts-examples.git


The following commit(s) were added to refs/heads/gh-pages by this push:
     new e5e4a703 feat: add Half Donut Chart example (#72)
e5e4a703 is described below

commit e5e4a7033d736e4353be9cd3c81d7f51d638e4c9
Author: Guo Yunhe <[email protected]>
AuthorDate: Mon Mar 6 04:09:37 2023 +0800

    feat: add Half Donut Chart example (#72)
    
    * Create pie-half-donut.ts
    
    * Update pie-half-donut.ts
    
    * Update pie-half-donut.ts
    
    * Update pie-half-donut.ts
    
    * improve example for half doughnut chart (#72)
    
    ---------
    
    Co-authored-by: plainheart <[email protected]>
---
 public/examples/ts/pie-half-donut.ts | 55 ++++++++++++++++++++++++++++++++++++
 1 file changed, 55 insertions(+)

diff --git a/public/examples/ts/pie-half-donut.ts 
b/public/examples/ts/pie-half-donut.ts
new file mode 100644
index 00000000..a068dbfb
--- /dev/null
+++ b/public/examples/ts/pie-half-donut.ts
@@ -0,0 +1,55 @@
+/*
+title: Half Doughnut Chart
+category: pie
+titleCN: 半环形图
+difficulty: 1
+*/
+
+option = {
+  tooltip: {
+    trigger: 'item'
+  },
+  legend: {
+    top: '5%',
+    left: 'center',
+    // doesn't perfectly work with our tricks, disable it
+    selectedMode: false
+  },
+  series: [
+    {
+      name: 'Access From',
+      type: 'pie',
+      radius: ['40%', '70%'],
+      center: ['50%', '70%'],
+      // adjust the start angle
+      startAngle: 180,
+      label: {
+        show: true,
+        formatter(param) {
+          // correct the percentage
+          return param.name + ' (' + param.percent! * 2 + '%)';
+        }
+      },
+      data: [
+        { value: 1048, name: 'Search Engine' },
+        { value: 735, name: 'Direct' },
+        { value: 580, name: 'Email' },
+        { value: 484, name: 'Union Ads' },
+        { value: 300, name: 'Video Ads' },
+        {
+          // make an record to fill the bottom 50%
+          value: 1048 + 735 + 580 + 484 + 300,
+          itemStyle: {
+            // stop the chart from rendering this piece
+            color: 'none'
+          },
+          label: {
+            show: false
+          }
+        }
+      ]
+    }
+  ]
+};
+
+export {};


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to