PDA

View Full Version : How do I get dynamic code into my Ext.draw?



RiaanSA
30 Mar 2012, 6:10 AM
Hey guys.

What I want to achieve is the following.

I have a draw component and a lot of circles / dot's inside.

For example.


var drawComponent = Ext.create('Ext.draw.Component', {
viewBox: false,
items: [{
type: 'image',
x: 0,
y: 0,
width: 600,
height: 800,
src: '/datashed_media/SEATTLE.jpg'
},
{
type: 'circle',
fill: '#3399FF',
listeners: {
'mouseup': function(item) {
alert('ProperTies of this Dot')
}
},
radius: 3,
x: Math.floor(Math.random()*601),
y: Math.floor(Math.random()*801)
},
{
type: 'circle',
fill: '#3399FF',
listeners: {
'mouseup': function(item) {
alert('ProperTies of this Dot')
}
},
radius: 3,
x: Math.floor(Math.random()*601),
y: Math.floor(Math.random()*801)
}]
});


I want to be able to replace all the circle items with real data.

Is is possible to retrieve this from a locasion?

Lets say "site/get_data/"

That will do some python calculation's and just return the result?

Any recommendations are welcome.

mitchellsimoens
30 Mar 2012, 9:48 AM
What would the calculations returned look like? Will you need to iterate through it to add items to the draw component?

RiaanSA
1 Apr 2012, 9:06 PM
Well my idea was to return a whole build up string.

In essence the calculation return's x,y co-ordinates and the colours.