Skip to content

Commit

Permalink
Fix total
Browse files Browse the repository at this point in the history
  • Loading branch information
Juliafk committed Mar 10, 2024
1 parent df6bea8 commit 9feebb0
Showing 1 changed file with 37 additions and 24 deletions.
61 changes: 37 additions & 24 deletions pages/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,6 @@ export default{
max: 100,
min: 0,
ticks: {
stepSize: 10,
callback: function(value, index, ticks) {
return value + '%';
}
Expand Down Expand Up @@ -172,8 +171,8 @@ export default{
this.myChart.options.scales.y.min = 0;
this.myChart.options.scales.y.ticks.callback = function(value, index, ticks) {
return " " + value;
};
return " " + value;
};
this.resetTable();
},
Expand All @@ -194,8 +193,9 @@ export default{
this.myChart.options.scales.y.min = 0;
this.myChart.options.scales.y.ticks.callback = function(value, index, ticks) {
return " " + value;
};
return " " + value;
};
this.resetTable();
},
Expand All @@ -217,8 +217,8 @@ export default{
this.myChart.options.scales.y.min = 0;
this.myChart.options.scales.y.ticks.callback = function(value, index, ticks) {
return value + '%';
};
return value + '%';
};
this.resetTable();
},
Expand Down Expand Up @@ -268,11 +268,12 @@ export default{
if (!this.percent) {
this.myChart.options.scales.y.max = numberOfRolls;
this.myChart.options.scales.y.min = 0;
this.myChart.options.scales.y.stepSize = this.getStepCount(numberOfRolls);
}
this.updateChart();
//this.fixLables();
//this.updateChart();
this.myChart.update();
},
rollDice() {
let dice = this.$refs.dice;
Expand Down Expand Up @@ -313,7 +314,7 @@ export default{
this.diceResults[0].schnecke = 0;
this.diceResults[0].igel = 0;
if (this.absolut || this.percent) {
if (this.total || this.percent) {
this.diceResults[1].ameise = 0;
this.diceResults[1].frosch = 0;
this.diceResults[1].schnecke = 0;
Expand All @@ -333,25 +334,37 @@ export default{
this.setTableToZero();
},
getStepCount(number){
fixLables(number){
switch(number) {
case number < 20:
return 1;
break;
case number < 50:
return 5;
case number < 10:
this.myChart.options.scales.y.ticks.callback = function(value, index, ticks) {
return value;
};
break;
case number < 100:
return 10;
this.myChart.options.scales.y.ticks.callback = function(value, index, ticks) {
return value;
};
break;
case number < 1000:
this.myChart.options.scales.y.ticks.callback = function(value, index, ticks) {
return value;
};
break;
case number < 200:
return 20;
case number < 10000:
this.myChart.options.scales.y.ticks.callback = function(value, index, ticks) {
return value;
};
break;
case number < 500:
return 50;
case number < 100000:
this.myChart.options.scales.y.ticks.callback = function(value, index, ticks) {
return value;
};
break;
case number < 1000:
return 100;
case number < 1000000:
this.myChart.options.scales.y.ticks.callback = function(value, index, ticks) {
return " " + value;
};
break;
}
Expand Down

0 comments on commit 9feebb0

Please sign in to comment.