Ad Hoc Charting Help
-
I am trying to chart out some numbers on the fly by creating little rectangles in locations that correspond with a number over a period of time. I am using the Qt.createQMLObject command and it works great except for it kills the object every time it creates a new one. How can I get it to keep making new rectangles without trashing the one before it?
@property int moveOver: 0
function chartYield(){moveOver = moveOver + 5 Qt.createQmlObject('import Qt 4.7; Rectangle {color: "white"; width: 3; height: 3; x: moveOver; y: yieldIndicator - 50 }', dash, "dynamicSnippet1"); }@
-
Hi,
In the above code, it looks like each of the newly created objects might have its x-position bound to the same "global" variable, moveOver. If that is the case, when you increment moveOver all of the items would move to the new position (which might look like the previous items were being deleted). If that is the problem, "assigning the x in Component.onCompleted":http://doc.qt.nokia.com/4.7/qdeclarativejavascript.html#property-assignment-vs-property-binding should fix it.
Regards,
Michael