C#.NET

来源:互联网 发布:淘宝仓库 编辑:程序博客网 时间:2024/06/03 19:41

做饼图实例

Ext.onReady(function () {
           
    var data = [
              { name: '英语', score: 60 },
              { name: '语文', score: 50 },
              { name: '数学', score: 78 }
               ];
    var store = Ext.create('Ext.data.Store', {
        fields: ['name', 'score'],
        autoLoad: true,
        proxy: 'memory',
        data: data
    });
 
    var chart3 = Ext.create('Ext.chart.Chart', {
        renderTo: Ext.getBody(),
        animate: true,
        store: store,
        width: 500,
        height: 300,
        legend: {
            position: 'left'  //定位
        },
        series: [{
            legend: {
                position: 'top'
            },
            type: 'pie', //統計圖的類型
            highlight: {
                segment: {
                    margin: 10  //扇區的margin
                }
            },
            field: 'score',   //根據score字段來分扇區的大小
            showInLegend: true,
            label: {
                field: 'name',   //扇區裏顯示的字段
                display: 'rotate',
                contrast: true,
                font: '20px Arial'
            }
        }]
    })
 
});