-
22 Nov 2012 9:50 PM #1
Problem in ScatterChart
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, I’m using listeners where I’m using show event
show: function (me, item, panel, eOpts){}
My problem is that I’m not able to get item whose info is being displayed.
When I’m print it as: console.log(item);
It’s 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). I’m 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.
-
26 Nov 2012 6:02 AM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,684
- Vote Rating
- 435
I'm actually going to open a bug for this.
Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.
-
27 Nov 2012 12:55 AM #3
Thanks..
Is it bug for mention both issues or one of them?
-
4 Jan 2013 12:04 PM #4
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.
-
6 Jan 2013 10:45 PM #5
Success! Looks like we've fixed this one. According to our records the fix was applied for
TOUCH-3749
in
Sprint 28.


Reply With Quote