EXTJS4自学手册——分组点状图

一、创建数据容器:

var groupScatterCharStore = Ext.create('Ext.data.JsonStore', {
    fields: ['', '', '', ''],
    data: [
        { '': 10000, '': 8000, '': 7000, '': '2008' },
        { '': 11000, '': 10000, '': 8000, '': '2009' },
        { '': 8000, '': 11000, '': 10000, '': '2010' },
        { '': 15000, '': 11500, '': 11000, '': '2011' }
    ]
});

二、创建分组点状图

注意其和点状图的区别,在于将series的属性重复了多遍

Ext.define("ExtStudy.GroupScatterChar", {
    extend: 'Ext.window.Window',
    width: 500,
    height: 300,
    layout: 'fit',
    maximizable: true,
    items: {
        xtype: 'chart',
        style: 'background:#fff',
        animate: true,
        store: groupScatterCharStore,
        axes: [{
            type: 'Numeric',
            position: 'left',
            fields: ['', '', ''],
            title: '数量',
            grid: true,
            minimum: 0
        }, {
            type: 'Category',
            position: 'bottom',
            fields: [''],
            calculateCategoryCount: false,
            title: '年份'
        }],
        legend: {
            position: 'right'
        },
        series: [{//
            type: 'scatter',//采用线形图
            highlight: {//设置鼠标指向报告曲线时,曲线会高亮显示
                size: 7,
                radius: 7
            },
            tips: {//鼠标指向节点时的提示信息
                trackMouse: true,
                width: 140,
                height: 28,
                renderer: function (storeItem, item) {
                    this.setTitle( '铁: '+ storeItem.
                    get('') + '万吨');
                }
            },
           // axis: 'left',
            xField: '',//x轴数据
            yField: '',//y轴数据
            smooth: true,//报告显示成曲线而不是一条一条的直线
            markerConfig: {//节点样式
                type: 'cross',
                radius: 5,
                'fill': 'blue'
            },
            showMarkers: true,//是否显示节点
            fill: false//报告曲线下面的填充

        }, {//
            type: 'scatter',//采用线形图
            highlight: {//设置鼠标指向报告曲线时,曲线会高亮显示
                size: 7,
                radius: 7
            },
            tips: {//鼠标指向节点时的提示信息
                trackMouse: true,
                width: 140,
                height: 28,
                renderer: function (storeItem, item) {
                    this.setTitle('铜: ' + storeItem.
                    get('') + '万吨');
                }
            },
            // axis: 'left',
            xField: '',//x轴数据
            yField: '',//y轴数据
            smooth: true,//报告显示成曲线而不是一条一条的直线
            markerConfig: {//节点样式
                type: 'cross',
                radius: 5,
                'fill': '#000000'
            },
            showMarkers: true,//是否显示节点
            fill: false//报告曲线下面的填充

        }, {//
            type: 'scatter',//采用线形图
            highlight: {//设置鼠标指向报告曲线时,曲线会高亮显示
                size: 7,
                radius: 7
            },
            tips: {//鼠标指向节点时的提示信息
                trackMouse: true,
                width: 140,
                height: 28,
                renderer: function (storeItem, item) {
                    this.setTitle('铝: ' + storeItem.
                    get('') + '万吨');
                }
            },
            // axis: 'left',
            xField: '',//x轴数据
            yField: '',//y轴数据
            smooth: true,//报告显示成曲线而不是一条一条的直线
            markerConfig: {//节点样式
                type: 'cross',
                radius: 5,
                'fill': '#f00'
            },
            showMarkers: true,//是否显示节点
            fill: false//报告曲线下面的填充

        }]
    }
})

效果图:

image

posted @ 2014-01-09 13:38  争世不悔  阅读(331)  评论(0编辑  收藏  举报