diff options
author | Jens Bache-Wiig <jens.bache-wiig@digia.com> | 2012-12-13 21:18:19 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2012-12-13 23:50:25 +0100 |
commit | 8ac4e62fe50b3f4d9abc8136a98babe4d306f686 (patch) | |
tree | d86e266531288f4dbbe1f58db1d73663d77fa9ea /examples/quick/demos/stocqt/content/StockChart.qml | |
parent | 93c7cf2cbc650d1590037d86f8eba6d0be029159 (diff) |
Improved cosmetics for StockQt
This will not get us any design awards but it looks
a bit more professional than the original.
Change-Id: Ib01a20ebad5888af44c174cbd493ce8d99dcf7b6
Reviewed-by: Alan Alpert (Personal) <416365416c@gmail.com>
Diffstat (limited to 'examples/quick/demos/stocqt/content/StockChart.qml')
-rw-r--r-- | examples/quick/demos/stocqt/content/StockChart.qml | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/examples/quick/demos/stocqt/content/StockChart.qml b/examples/quick/demos/stocqt/content/StockChart.qml index 97f6b47535..ea2d54db9c 100644 --- a/examples/quick/demos/stocqt/content/StockChart.qml +++ b/examples/quick/demos/stocqt/content/StockChart.qml @@ -95,6 +95,7 @@ Rectangle { anchors.top: toDate.bottom anchors.bottom: parent.bottom renderTarget: Canvas.FramebufferObject + antialiasing: true property int frames: first property int mouseX: 0 property int mouseY: 0 @@ -106,6 +107,8 @@ Rectangle { property int first: 0 property int last: 0 + property int pixelSkip: 1 + function drawBackground(ctx) { ctx.save(); ctx.fillStyle = "#272822"; @@ -142,7 +145,7 @@ Rectangle { var w = canvas.width/points.length; var end = points.length; - for (var i = 0; i < end; i++) { + for (var i = 0; i < end; i+=pixelSkip) { var x = points[i].x; var y = points[i][price]; y = canvas.height * y/highest; @@ -162,7 +165,7 @@ Rectangle { ctx.globalAlpha = 0.4; ctx.lineWidth = 2; var end = points.length; - for (var i = 0; i < end; i++) { + for (var i = 0; i < end; i+=pixelSkip) { var x = points[i].x; var open = canvas.height * points[i].open/highest - canvas.movedY; var close = canvas.height * points[i].close/highest - canvas.movedY; @@ -204,7 +207,7 @@ Rectangle { ctx.lineWidth = 1; var end = points.length; - for (var i = 0; i < end; i++) { + for (var i = 0; i < end; i+=pixelSkip) { var x = points[i].x; var y = points[i][price]; y = canvas.height * (1 - y/highest); @@ -231,7 +234,7 @@ Rectangle { var highestVolume = stockModel.highestVolume; console.log("highest price:" + highestPrice + ", highest volume:" + highestVolume) var points = []; - for (var i = 0; i <= last - first; i++) { + for (var i = 0; i <= last - first; i+=pixelSkip) { var price = stockModel.get(i + first); points.push({ x: i*canvas.width/(last-first+1), |