Results 1 to 4 of 4

Thread: Scatter chart with 3rd dimension

  1. #1
    Sencha User
    Join Date
    Oct 2012
    Posts
    53
    Vote Rating
    0
      0  

    Default Scatter chart with 3rd dimension

    I have written below code for scatter chat and now I want to add group by filtering as well so I want to know how json will be form for this kind of chart which shows uptimes hours on xAxis, Downtime hours on yAxis and group by SKU. Bubble size is not important right now for me but if I can get any example with bubble size as well, it is very helpful for me scatter.jpg

    HTML Code:
    var chart = new Ext.chart.CartesianChart({
        animate: true,
        store: {
          fields: ['DE','DH'],
          data: [
              {'DE':10, 'DH':15},
               {'DE':15, 'DH':20},
               {'DE':20, 'DH':25},
             
          ]
        },
        axes: [{
            type: 'numeric',
            position: 'left',
            fields: ['DH'],
            title: {
                text: 'DH',
                fontSize: 15
            },
            grid: true,
            minimum: 0
        }, {
            type: 'numeric',
            position: 'bottom',
            fields: ['DE'],
            title: {
                text: 'DE',
                fontSize: 15
            },
            minimum: 0
        }],
        series: [{
            type: 'scatter',
            highlight: {
                size: 7,
                radius: 7
            },
            fill: true,
            xField: 'DE',
            yField: 'DH',
            marker: {
                type: 'circle',
                fillStyle: 'blue',
                radius: 10,
                lineWidth: 0
            }
        }]
    });
    Ext.Viewport.setLayout('fit');
    Ext.Viewport.add(chart);
    Thanks

  2. #2
    Sencha - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,556
    Vote Rating
    1272
      0  

    Default

    So you want to add a different series like:

    Code:
    var chart = new Ext.chart.CartesianChart({
        animate : true,
        store   : {
            fields : ['DE', 'DH', 'DA'],
            data   : [
                {'DE' : 10, 'DH' : 15, DA : 10},
                {'DE' : 15, 'DH' : 20, DA : 15},
                {'DE' : 20, 'DH' : 25, DA : 20}
            ]
        },
        legend  : true,
        axes    : [
            {
                type     : 'numeric',
                position : 'left',
                fields   : ['DH', 'DA'],
                title    : {
                    text     : 'DH',
                    fontSize : 15
                },
                grid     : true,
                minimum  : 0
            },
            {
                type     : 'numeric',
                position : 'bottom',
                fields   : ['DE'],
                title    : {
                    text     : 'DE',
                    fontSize : 15
                },
                minimum  : 0
            }
        ],
        series  : [
            {
                type      : 'scatter',
                highlight : {
                    size   : 7,
                    radius : 7
                },
                fill      : true,
                xField    : 'DE',
                yField    : 'DH',
                marker    : {
                    type      : 'circle',
                    fillStyle : 'blue',
                    radius    : 10,
                    lineWidth : 0
                }
            },
            {
                type      : 'scatter',
                highlight : {
                    size   : 7,
                    radius : 7
                },
                fill      : true,
                xField    : 'DE',
                yField    : 'DA',
                marker    : {
                    type      : 'circle',
                    fillStyle : 'red',
                    radius    : 10,
                    lineWidth : 0
                }
            }
        ]
    });
    Ext.Viewport.setLayout('fit');
    Ext.Viewport.add(chart);
    Mitchell Simoens @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it! Checkout the CODE tag!

    Check out my GitHub, lots of nice things for Ext JS and Sencha Touch
    https://github.com/mitchellsimoens

  3. #3
    Sencha User
    Join Date
    Oct 2012
    Posts
    53
    Vote Rating
    0
      0  

    Default

    Can you please let me know a json for below chat with dummy data? It should should show 5 bubbles in the chart.
    scatter.jpg

  4. #4
    Sencha User
    Join Date
    Oct 2012
    Posts
    53
    Vote Rating
    0
      0  

    Default

    I am using below code for chart:

    HTML Code:
            RA.app.newChart[RA.app.currentActivePanelIndex] = new Ext.chart.Chart({
                id: 'chart'+RA.app.currentActivePanelIndex,
                store: store,
                renderTo: Ext.getBody(),
                flex: 1,
                shadow: true,
                autoShow: true,
                animate:true,
                legend: {
                    position: 'right',
                },
                //maxGutter: [30, 30],
                axes: [
                    {
                        type: 'Numeric',
                        position: 'left',
                        fields:['A-Crew',B-Crew','C-crew','D-crew','others'] ,                    
                        title: DowntimeEvents,
                        minimum: 0,
                        maximum: RA.app.Ymax
                        
                    },
                    {
                        type: 'Numeric',
                        position: 'bottom',
                        fields:[DowntimeHours] ,
                        title:DowntimeHours,
                        minimum: 0,
                        maximum: RA.app.Xmax
                        
                    }
                ],
                series: [
                {
                    type: 'scatter',
                    //axis: ['left', 'bottom'],
                    //markerConfig: {},
                    xField: DowntimeHours,
                    yField: 'A-crew'                
                },
                
                {
                    type: chartType,
                    //axis: ['left', 'bottom'],    
                    //markerConfig: {},
                    xField: DowntimeHours,
                    yField:'B-crew'
                    
                },
                
                {
                    type: 'scatter',
                    //axis: ['left', 'bottom'],
                    //markerConfig: {},
                    xField: DowntimeHours,
                    yField: 'C-crew'
                    
                },
                
                {
                    type: chartType,
                    //axis: ['left', 'bottom'],    
                    //markerConfig: {},
                    xField: DowntimeHours,
                    yField: 'D-Crew'
                    
                },
                {
                    type: chartType,
                    //axis: ['left', 'bottom'],    
                    //markerConfig: {},
                    xField: DowntimeHours,
                    yField: 'others'
                    
                }
                
                ], //close series
                

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •