Fix: graph text, height

This commit is contained in:
2018-05-17 20:31:53 +09:00
parent 7046958cb7
commit 8fe5c72987
+7 -3
View File
@@ -30,12 +30,15 @@ class Start {
let underValue = historyRecordManager.underValueForGraph(); let underValue = historyRecordManager.underValueForGraph();
let upperValue = historyRecordManager.upperValueForGraph(); let upperValue = historyRecordManager.upperValueForGraph();
let minValue = underValue - (upperValue - underValue) / 10;
let maxValue = upperValue;// + (upperValue - underValue) / 10;
for(let i = 0; i < historyRecordManager.count; i++) { for(let i = 0; i < historyRecordManager.count; i++) {
if(i > 6) if(i > 6)
break; break;
let data = historyRecordManager.getAt(i); let data = historyRecordManager.getAt(i);
this.drawRecordGraph(i, data.date, data.score, underValue, upperValue); this.drawRecordGraph(i, data.date, data.score, minValue, maxValue);
} }
}); });
@@ -74,7 +77,8 @@ class Start {
drawRecordGraph(index, date, score, min, max) { drawRecordGraph(index, date, score, min, max) {
const CHART_GAP_PX = 120; const CHART_GAP_PX = 120;
const style = { font: "32px Arial", fill: "#fff", align: "left", boundsAlignH: "center", boundsAlignV: "middle" }; const CHART_HEIGHT = 120;
const style = { font: "24px Arial", fill: "#fff", align: "left", boundsAlignH: "center", boundsAlignV: "middle" };
let dateTime = new Date(date); let dateTime = new Date(date);
console.log(dateTime); console.log(dateTime);
@@ -94,7 +98,7 @@ class Start {
this.chartGraphics.lineStyle(50, 0xdddddd, 1); this.chartGraphics.lineStyle(50, 0xdddddd, 1);
this.chartGraphics.moveTo(50 + index * CHART_GAP_PX, 0); this.chartGraphics.moveTo(50 + index * CHART_GAP_PX, 0);
this.chartGraphics.lineTo(50 + index * CHART_GAP_PX, -100 * ( (score - min) / (max - min) )); this.chartGraphics.lineTo(50 + index * CHART_GAP_PX, -1 * CHART_HEIGHT * ( (score - min) / (max - min) ));
} }
startStage() { startStage() {