-
- {{ green.total }}
- kjøpte
-
-
-
{{ green.win }} vinn - {{ greenPercentage }}% vinn
+
+ {{ color.win }} vinn -
+ {{ color.totalPercentage }}%
+
+
+ {{ color.percentage }}% vinn
+
Totalt
@@ -52,6 +40,7 @@
export default {
data() {
return {
+ colors: [],
red: 0,
blue: 0,
yellow: 0,
@@ -88,8 +77,42 @@ export default {
this.yellowPercentage = this.round(
this.yellow.win == 0 ? 0 : (this.yellow.win / this.totalWin) * 100
);
+
+ this.colors.push({
+ name: "red",
+ total: this.red.total,
+ win: this.red.win,
+ totalPercentage: this.getPercentage(this.red.win, this.totalWin),
+ percentage: this.getPercentage(this.red.win, this.red.total)
+ });
+ this.colors.push({
+ name: "blue",
+ total: this.blue.total,
+ win: this.blue.win,
+ totalPercentage: this.getPercentage(this.blue.win, this.totalWin),
+ percentage: this.getPercentage(this.blue.win, this.blue.total)
+ });
+ this.colors.push({
+ name: "yellow",
+ total: this.yellow.total,
+ win: this.yellow.win,
+ totalPercentage: this.getPercentage(this.yellow.win, this.totalWin),
+ percentage: this.getPercentage(this.yellow.win, this.yellow.total)
+ });
+ this.colors.push({
+ name: "green",
+ total: this.green.total,
+ win: this.green.win,
+ totalPercentage: this.getPercentage(this.green.win, this.totalWin),
+ percentage: this.getPercentage(this.green.win, this.green.total)
+ });
+
+ this.colors = this.colors.sort((a, b) => (a.win > b.win ? -1 : 1));
},
methods: {
+ getPercentage: function(win, total) {
+ return this.round(win == 0 ? 0 : (win / total) * 100);
+ },
round: function(number) {
return Math.round(number * 100) / 100;
}
@@ -172,6 +195,12 @@ export default {
font-weight: bold;
}
+.small {
+ font-weight: bold;
+ font-size: 1.25rem;
+ display: inline-block;
+}
+
.green {
color: $green;
}