[ExtJs] Pie Chart
The ExtJs pie chart is not as hard as the [ExtJs] bar chart, changing the color of each column (click to open the link), because the color of each piece of cake is naturally different, you do not need to write the Renderer yourself. The key is to make the animation effect well.
I. Basic Objectives
For example, an animated ExtJs pie chart. Hover your mouse over a piece of pie to highlight it.
Ii. Production Process
It is the same as the [ExtJs] bar chart, changing the color of each column (click to open the link), and the [ExtJs] line chart (click to open the link, any chart in ExtJs4 must first define the corresponding model and data center.
Ext.define('graphData',{extend:'Ext.data.Model',fields:[{name:'graphName',type:'string'},{name:'graphData',type:'int'}]});var graphDataStore=Ext.create('Ext.data.Store',{model:'graphData',data:[{graphName:A,graphData:700},{graphName:B,graphData:800},{graphName:C,graphData:600},{graphName:D,graphData:50}]});
Next, the key is to draw a bar chart. For details, see the notes:
Var chart = new Ext. chart. chart ({width: 480, height: 400, store: graphDataStore, renderTo: Ext. getBody (), shadow: false, // The shadow will be disabled. Otherwise, the pie is not nice when it is highlighted. Series: [{type: 'pie ', field: 'graphdata', label: {// the fields that belong to the pie: 'graphname', display: 'rotate', font: '18px arial'}, highlight: {// here is a statement of outstanding effect. The larger the margin is, the mouse is hovering over the pie, more segments: {margin: 5 }}, animate: true}]});
<Script type = text/javascript src = .. /js/ext-all.js> </script> <script type = text/javascript src = .. /js/bootstrap. js> </script> <script type = text/javascript src = .. /js/ext-lang-zh_CN.js> </script>