Changeset View
Changeset View
Standalone View
Standalone View
Modules/energy/package/contents/ui/Graph.qml
Show All 31 Lines | |||||
32 | Canvas | 32 | Canvas | ||
33 | { | 33 | { | ||
34 | width: 500 | 34 | width: 500 | ||
35 | height: 500 | 35 | height: 500 | ||
36 | id: canvas | 36 | id: canvas | ||
37 | antialiasing: true | 37 | antialiasing: true | ||
38 | 38 | | |||
39 | property int xPadding: 45 | 39 | property int xPadding: 45 | ||
40 | property int yPadding: 25 | 40 | property int yPadding: 10 | ||
41 | 41 | | |||
42 | property var data //expect an array of QPointF | 42 | property var data //expect an array of QPointF | ||
43 | 43 | | |||
44 | property real yMax: 100 | 44 | property real yMax: 100 | ||
45 | property real xMax: 100 | 45 | property real xMax: 100 | ||
46 | property real yMin: 0 | 46 | property real yMin: 0 | ||
47 | property real xMin: 0 | 47 | property real xMin: 0 | ||
48 | property real yStep: 20 | 48 | property real yStep: 20 | ||
49 | 49 | | |||
50 | property string yUnits: "" | 50 | property string yUnits: "" | ||
51 | property string xUnits: "" | 51 | property string xUnits: "" | ||
52 | 52 | | |||
53 | //internal | 53 | //internal | ||
54 | 54 | | |||
55 | property real plotWidth: width - xPadding *2 | 55 | property real plotWidth: width - xPadding | ||
56 | property real plotHeight: height - yPadding *2 | 56 | property real plotHeight: height - yPadding *2 | ||
57 | 57 | | |||
58 | onDataChanged: { | 58 | onDataChanged: { | ||
59 | canvas.requestPaint(); | 59 | canvas.requestPaint(); | ||
60 | } | 60 | } | ||
61 | 61 | | |||
62 | //take a QPointF | 62 | //take a QPointF | ||
63 | function scalePoint(plot) { | 63 | function scalePoint(plot) { | ||
▲ Show 20 Lines • Show All 75 Lines • Show Last 20 Lines |