[ExtJs] pie chart, extjs

Source: Internet
Author: User

[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"> 


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.