Ext.js 餅圖

2022-05-20 11:46 更新

描述

此圖表用于表示餅圖格式的數(shù)據(jù)。它是一個極坐標(biāo)圖。

語法

這里是簡單的語法。

 Ext.create('Ext.chart.PolarChart', {
 series: [{
   Type: 'pie'
   ..
   }]
   render and other properties.
 });

下面是一個簡單的例子顯示用法。

<!DOCTYPE html>
<html>
<head>
   <link href="./ext-6.0.0/build/classic/theme-classic/resources/theme-classic-all.css" rel="stylesheet" />
   <script src="./ext-6.0.0/build/ext-all.js"></script>
   <script src="./ext-6.0.0/build/packages/charts/classic/charts.js"></script>
   <script type="text/javascript">
      Ext.onReady(function() {
         Ext.create('Ext.chart.PolarChart', {
             renderTo: document.body,
             width: 600,
             height: 300,
             store: {
                 fields: ['name', 'g1'],
                 data: [
                     {"name": "Item-0", "g1": 57},
                     {"name": "Item-1", "g1": 45},
                     {"name": "Item-2", "g1": 67}
                 ]
             },

             //configure the legend.
             legend: {
                 docked: 'bottom'
             },

             //describe the actual pie series.
             series: [{
                 type: 'pie',
                 xField: 'g1',
                 label: {
                     field: 'name'
                 },
                 donut: 30 // increase or decrease for increasing or decreasing donut area in middle.
             }]
         });
      });
   </script>
</head>
<body>
</body>
</html>

運行效果截圖為:


以上內(nèi)容是否對您有幫助:
在線筆記
App下載
App下載

掃描二維碼

下載編程獅App

公眾號
微信公眾號

編程獅公眾號