[ExtJs] pie chart, extjs
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 the statement of outstanding effect. The larger the margin, hover your mouse over the pie. The more segments the pie is, the more segments: {margin: 5 }}, animate: true}]}.
Iii. Summary
For this reason, the entire pie.html code is as follows:
<! Doctype html public "-// W3C // dtd html 4.01 // EN" "http://www.w3.org/TR/html4/strict.dtd">