Browse Source

Corrected strength axis labels.

Neal Wilson 11 years ago
parent
commit
d3b17ae5e0
1 changed files with 100 additions and 100 deletions
  1. 100
    100
      qml/BrewPlot/BrewingControlChart.qml

+ 100
- 100
qml/BrewPlot/BrewingControlChart.qml View File

@@ -2,7 +2,7 @@ import CustomComponents 1.0
2 2
 import QtQuick 1.0
3 3
 
4 4
 Item {
5
-	id: chartOuter
5
+    id: chartOuter
6 6
 
7 7
     property real xmin: 0.14
8 8
     property real xmax: 0.26
@@ -11,63 +11,63 @@ Item {
11 11
     property real xrange: xmax - xmin
12 12
     property real yrange: ymax - ymin
13 13
 
14
-	function plotPoint(px, py, pcolor) {
15
-		chart.plotPoint(px, py, pcolor);
16
-	}
17
-	function setFit(x1, y1, x2, y2) {
18
-		chart.setFit(x1, y1, x2, y2)
19
-	}
20
-	function setFitVisible(visible) {
21
-		fitline.visible = visible
22
-	}
23
-	function setFitColor(color) {
24
-		fitline.color = color
25
-	}
26
-	function clear() {
27
-		points.clear();
28
-	}
29
-
30
-	Item {
31
-		id: chart
32
-
33
-		height: parent.height
34
-		width: parent.width
35
-
36
-		function plotPoint(px, py, pcolor) {
37
-			points.append({"px": px, "py": py, "pcolor": pcolor});
38
-		}
39
-		function mapToX(px) {
40
-			return (chart.width / xrange) * (px - xmin)
41
-		}
42
-		function mapToY(py) {
43
-			return chart.height - ((chart.height / yrange) * (py - ymin))
44
-		}
45
-		function setFit(x1, y1, x2, y2) {
46
-			fitline.x1 = mapToX(x1);
47
-			fitline.x2 = mapToX(x2);
48
-			fitline.y1 = mapToY(y1);
49
-			fitline.y2 = mapToY(y2);
50
-		}
51
-
52
-		Line {
53
-			id: fitline
54
-
55
-			x1: 0
56
-			x2: 0
57
-			y1: 0
58
-			y2: 0
59
-			color: "red"
60
-			visible: false
61
-		}
62
-		ListModel {
63
-			id: xGridLines
64
-		}
65
-		ListModel {
66
-			id: yGridLines
67
-		}
68
-		ListModel {
69
-			id: points
70
-		}
14
+    function plotPoint(px, py, pcolor) {
15
+        chart.plotPoint(px, py, pcolor);
16
+    }
17
+    function setFit(x1, y1, x2, y2) {
18
+        chart.setFit(x1, y1, x2, y2)
19
+    }
20
+    function setFitVisible(visible) {
21
+        fitline.visible = visible
22
+    }
23
+    function setFitColor(color) {
24
+        fitline.color = color
25
+    }
26
+    function clear() {
27
+        points.clear();
28
+    }
29
+
30
+    Item {
31
+        id: chart
32
+
33
+        height: parent.height
34
+        width: parent.width
35
+
36
+        function plotPoint(px, py, pcolor) {
37
+            points.append({"px": px, "py": py, "pcolor": pcolor});
38
+        }
39
+        function mapToX(px) {
40
+            return (chart.width / xrange) * (px - xmin)
41
+        }
42
+        function mapToY(py) {
43
+            return chart.height - ((chart.height / yrange) * (py - ymin))
44
+        }
45
+        function setFit(x1, y1, x2, y2) {
46
+            fitline.x1 = mapToX(x1);
47
+            fitline.x2 = mapToX(x2);
48
+            fitline.y1 = mapToY(y1);
49
+            fitline.y2 = mapToY(y2);
50
+        }
51
+
52
+        Line {
53
+            id: fitline
54
+
55
+            x1: 0
56
+            x2: 0
57
+            y1: 0
58
+            y2: 0
59
+            color: "red"
60
+            visible: false
61
+        }
62
+        ListModel {
63
+            id: xGridLines
64
+        }
65
+        ListModel {
66
+            id: yGridLines
67
+        }
68
+        ListModel {
69
+            id: points
70
+        }
71 71
         ListModel {
72 72
             id: yLabels
73 73
         }
@@ -75,45 +75,45 @@ Item {
75 75
             id: xLabels
76 76
         }
77 77
 
78
-		Repeater {
79
-			model: xGridLines
80
-
81
-			Line {
82
-				x1: (chart.width / xrange) * (value - xmin)
83
-				x2: x1
84
-				y1: 0
85
-				y2: chart.height
86
-				penWidth: pwidth
87
-				color: "black"
88
-			}
89
-		}
90
-		Repeater {
91
-			model: yGridLines
92
-
93
-			Line {
94
-				x1: 0
95
-				x2: chart.width
96
-				y1: chart.height - ((chart.height / yrange) * (value - ymin))
97
-				y2: y1
98
-				penWidth: pwidth
99
-				color: "black"
100
-			}
101
-		}
102
-		Repeater {
103
-			model: points
104
-
105
-			Item {
106
-				Rectangle {
107
-					x: ((chart.width / xrange) * (px - xmin)) - (width / 2)
108
-					y: chart.height - ((chart.height / yrange) * (py - ymin)) - (height / 2)
109
-					width: 5
110
-					height: 5
111
-					color: pcolor
112
-					smooth: true
113
-				}
114
-			}
115
-		}
116
-	}
78
+        Repeater {
79
+            model: xGridLines
80
+
81
+            Line {
82
+                x1: (chart.width / xrange) * (value - xmin)
83
+                x2: x1
84
+                y1: 0
85
+                y2: chart.height
86
+                penWidth: pwidth
87
+                color: "black"
88
+            }
89
+        }
90
+        Repeater {
91
+            model: yGridLines
92
+
93
+            Line {
94
+                x1: 0
95
+                x2: chart.width
96
+                y1: chart.height - ((chart.height / yrange) * (value - ymin))
97
+                y2: y1
98
+                penWidth: pwidth
99
+                color: "black"
100
+            }
101
+        }
102
+        Repeater {
103
+            model: points
104
+
105
+            Item {
106
+                Rectangle {
107
+                    x: ((chart.width / xrange) * (px - xmin)) - (width / 2)
108
+                    y: chart.height - ((chart.height / yrange) * (py - ymin)) - (height / 2)
109
+                    width: 5
110
+                    height: 5
111
+                    color: pcolor
112
+                    smooth: true
113
+                }
114
+            }
115
+        }
116
+    }
117 117
     Repeater {
118 118
         id: yTickLabels
119 119
 
@@ -124,7 +124,7 @@ Item {
124 124
 
125 125
         Item {
126 126
             Text {
127
-                text: (value * 100).toFixed(1) + "%"
127
+                text: (value * 100).toFixed(2) + "%"
128 128
                 y: chart.mapToY(value) - (height/2)
129 129
                 x: -width
130 130
             }
@@ -166,7 +166,7 @@ Item {
166 166
         anchors.topMargin: 20
167 167
     }
168 168
 
169
-	Component.onCompleted: {
169
+    Component.onCompleted: {
170 170
         for(var i = 0.14; i < 0.261; i += 0.01) {
171 171
             xGridLines.append({"value": i, "pwidth": i.toFixed(2) == 0.18 || i.toFixed(2) == 0.22 ? 2 : 1});
172 172
             xLabels.append({"value": i});
@@ -175,5 +175,5 @@ Item {
175 175
             yGridLines.append({"value": i, "pwidth": i.toFixed(4) == 0.0115 || i.toFixed(4) == 0.0135 ? 2 : 1});
176 176
             yLabels.append({"value": i});
177 177
         }
178
-	}
178
+    }
179 179
 }

Loading…
Cancel
Save