Results 1 to 5 of 5

Thread: Problem in ScatterChart

    Success! Looks like we've fixed this one. According to our records the fix was applied for TOUCH-3749 in a recent build.
  1. #1
    Sencha User
    Join Date
    May 2012
    Posts
    23
    Vote Rating
    0
      0  

    Default Problem in ScatterChart

    Hi!

    I am using scatter chart by using Sencha Touch 2.1
    I am facing below mention two issue:
    1). Inside ItemInfo interaction, Im using listeners where Im using show event
    show: function (me, item, panel, eOpts){}
    My problem is that Im not able to get item whose info is being displayed.
    When Im print it as: console.log(item);
    Its showing as HTMLCanvasElement
    Plz tell me in what way I can get the item, because I need the record which should be inside item.
    Even I have not find item record in me,panel.


    2). Im using legend, but not getting the corresponding colors basically it should be corresponding the color of charts.

    Below are the code for reference:
    Scatter Charts code:

    Code:
    Ext.define('BenefitAccess.view.StockPlanChart', {
    Code:
        extend: 'Ext.Panel',
        alias: 'widget.StockPlanChart',
        requires: ['Ext.chart.Chart', 'Ext.chart.series.Scatter', 'Ext.chart.axis.Numeric'],
        config: {
            id: 'StockPlanChart',
            cls: 'card1',
            layout: 'fit',
            items: [
                {
                    xtype: 'toolbar',
                    margin:'0 0 20 0',
                    docked: 'bottom',
                    items: [
                        {
                            xtype: 'spacer'
                        },
                    ]
                },
                {
                    xtype: 'chart',
                    store: 'StockPlanOrderItems',
                    background: 'white',
                    interactions: [{type:'panzoom'},
                    {type:'itemhighlight'}, {
                    type: 'iteminfo',
                    gesture: 'tap',
                listeners: {
                    show: function (me, item, panel,eOpts) {
                    console.log('insideeee');
                    console.log(item);
                    panel.setStyle('background:'+item.sprite.attr.fillStyle);
                    if(item.record.data.name=='Order')
            panel.setHtml('<font color="white">'+'<ul><li><b>Order: </b>' + item.storeItem.get('Order') + '</li>');
            else if(item.record.data.name=='Vesting')
            panel.setHtml('<ul><li><b>Vesting: </b>' + item.storeItem.get('Vesting') + '</li>');
                    }
                }
            }],
                    legend:{
                        docked: 'bottom',
                        itemTpl: ["<span class=\"x-legend-item-marker {[values.disabled?\'x-legend-inactive\':\'\']}\" style=\"background:{mark};\"></span>{name}"],
                    	},
                    series: [
                        {
                            type: 'scatter',
                            xField: 'year',
                            yField: 'Order',
                            title: ['Order'],
                            style: {
        						colors: ['#ccc', '#555']   						},
                                highlightCfg: {
                                strokeStyle: 'red',
                                lineWidth: 2
                            },
                            marker: {
                                type: 'path',
                                path: [
                                    ['M' , 0, 1],
                                    ['L', 1, 0],
                                    ['L', 0, -1],
                                    ['L', -1, 0],
                                    ['Z']
                                ],
                                scale: 5,
                                fill: 'rgba(143,203,203,0.90)',
                                miterLimit: 1,
                                lineCap: 'butt',
                                lineWidth: 1
                            }
                        },
                        {
                            type: 'scatter',
                            xField: 'year',
                            yField: 'Vesting',
                            title: ['Vesting'],
                            highlightCfg: {
                                strokeStyle: 'red',
                                lineWidth: 2
                            },
                            marker: {
                                type: 'circle',
                                radius: 5,
                                fill: 'rgba(203,143,203,0.90)',
                                miterLimit: 1,
                                lineCap: 'butt',
                                lineWidth: 1
                            }
                        },
                        {
                            type: 'scatter',
                            xField: 'year',
                            yField: 'Expiring',
                            title: ['Expiring'],
                            highlightCfg: {
                                strokeStyle: 'red',
                                lineWidth: 2
                            },
                            marker: {
                                type: 'ellipse',
                                cx: 8,
        						cy: 8,
        						rx: 6,
        						ry: 5,
        						fill: 'rgba(0,128,0,0.90)'
                            }
                        },
                         {
                            type: 'scatter',
                            xField: 'year',
                            yField: 'Grant/Award',
                            title: ['Grant / Award'],
                            highlightCfg: {
                                strokeStyle: 'red',
                                lineWidth: 2
                            },
                            marker: {
                                type: 'rect',
                                x: 8,
        						y: 8,
       							width: 8,
        						height: 8,
        						fillStyle: 'blue'
        						}
                        },
                        {
                            type: 'scatter',
                            xField: 'year',
                            yField: 'Share Acquisition',
                            title: ['Share Acquisition'],
                            highlightCfg: {
                                strokeStyle: 'red',
                                lineWidth: 2
                            },
                            marker: {
                                type: 'circle',
                                radius: 5,
                                fill: 'rgba(203,143,203,0.90)',
                                miterLimit: 1,
                                lineCap: 'butt',
                                lineWidth: 1,
                                fillStyle: 'green'
                            }
                        },
                        {
                            type: 'scatter',
                            xField: 'year',
                            yField: 'Sample Company',
                            title: ['Sample Company'],
                            highlightCfg: {
                                strokeStyle: 'red',
                                lineWidth: 2
                            },
                            marker: {
                                type: 'rect',
                                x: 8,
        						y: 8,
       							width: 8,
        						height: 8,
        						fillStyle: 'blue'
    //fill: 'rgba(0,128,0,0.90)'
                            }
                        }
                        
                    ],
                    animate: false,
                    store: 'StockPlanOrderItems',
                    axes: [
                        {
                            type: 'numeric',
                            position: 'left',
                            minimum: 1,
                           //maximum: 100000,
                           visibleRange: [0, 1],
                            style: {
                                estStepSize: 20
                            },
                            label: {
                                rotate: {
                                    degrees: -30
                                }
                            },
                            fields: ['Order', 'Vesting', 'Expiring','Grant/Award','Share Acquisition','Sample Company'],
                            title: {
                                fontSize: 20
                            }
                        },
                        {
                            type: 'numeric',
                            position: 'bottom',
                               visibleRange: [0, 1],
                               fields: ['year'],
                            title: {
                                text: 'Show Transactions',
                                fontSize: 20
                            },
                            
                        }
                    ]
                   
                }
            ]
        },
        initialize: function () {
            this.callParent();
            Ext.getStore('StockPlanOrderItems');
            var toolbar = Ext.ComponentQuery.query('toolbar', this)[0],
                interaction = Ext.ComponentQuery.query('interaction', this)[0];
            if (toolbar && interaction && !interaction.isMultiTouch()) {
                toolbar.add(interaction.getModeToggleButton());
            }
        }
    });


    For reference also attaching image where can see exact problem in legend, where can easily see the color of Legends come in black. Basically it should be like respective charts color.

    ImageForLegend.png





    Thanks in advance.

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

    Default

    I'm actually going to open a bug for this.
    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
    May 2012
    Posts
    23
    Vote Rating
    0
      0  

    Default

    Thanks..
    Is it bug for mention both issues or one of them?

  4. #4
    Sencha User BrendanC's Avatar
    Join Date
    Aug 2010
    Posts
    534
    Vote Rating
    3
      0  

    Default

    1. The problem is that you are using 'tap' instead of 'itemtap'.

    2. I have added a fix for the legend color issue and it will be in the next release.

  5. #5
    Sencha User
    Join Date
    May 2012
    Posts
    23
    Vote Rating
    0
      0  

    Default

    Thanks a lot...

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
  •