O'Reilly logo

Ext JS 4 Web Application Development Cookbook by Stuart Ashworth, Andrew Duncan

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating a pie chart with local data

The pie chart is a very common chart type and is very good at representing proportional data where each slice of the pie equates to the percentage that particular slice holds against the sum of the entire dataset.

This recipe is going to demonstrate how to create a pie chart representing the distribution of GitHub repositories across programming languages.

How to do it...

  1. As with all of our data-bound examples, we start by creating an Ext.data.Model. We give it two fields—Language and Percentage:
    Ext.define('LanguageShare', {
        extend: 'Ext.data.Model',
        fields: [{
            name: 'Language',
            type: 'string'
        }, {
            name: 'Percentage',
            type: 'int'
        }]
    });
  2. Now we define a data set to display in our chart. I have omitted some of the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required