show initial chart in motion chart example

Change-Id: I39297ced1c532f633a7c9c6c64c0818bbc852084
This commit is contained in:
Charles Yin 2011-05-18 13:46:16 +10:00
parent 8df66dbeb5
commit 2e68186a80
1 changed files with 7 additions and 2 deletions

View File

@ -4,7 +4,7 @@ Canvas {
id:motionChart id:motionChart
width:1300 width:1300
height: 700 height: 700
property int progress:0 property int progress:-1
property variant applesFrom: [1000, 300]; property variant applesFrom: [1000, 300];
property variant applesTo:[1200, 400]; property variant applesTo:[1200, 400];
property variant orangesFrom: [1150, 200]; property variant orangesFrom: [1150, 200];
@ -24,8 +24,12 @@ Canvas {
Text {id:expenses; text: "Expenses 1300"; x:1170; y:670;font.bold:true; font.pixelSize:15; opacity:0} Text {id:expenses; text: "Expenses 1300"; x:1170; y:670;font.bold:true; font.pixelSize:15; opacity:0}
Timer { Timer {
id:timer id:timer
interval: 1; running: false; repeat: true interval: 1; running: true; repeat: true
onTriggered: { onTriggered: {
if (motionChart.progress == -1) {
motionChart.setup();
running = false;
}
motionChart.draw(); motionChart.draw();
} }
} }
@ -46,6 +50,7 @@ Canvas {
} }
} }
function setup() { function setup() {
var ctx = motionChart.getContext("2d"); var ctx = motionChart.getContext("2d");
ctx.globalCompositeOperation = "source-over"; ctx.globalCompositeOperation = "source-over";