From 8fe5c72987734d807e8a53fea3d37d76e116314c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=84=8B=E1=85=A2=E1=84=91=E1=85=B3=E1=86=AF=20=E1=84=82?= =?UTF-8?q?=E1=85=A9=E1=84=90=E1=85=B3=E1=84=87=E1=85=AE=E1=86=A8?= Date: Thu, 17 May 2018 20:31:53 +0900 Subject: [PATCH] Fix: graph text, height --- src/game/start/start.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/game/start/start.js b/src/game/start/start.js index 4f259d9..8eb9b4c 100644 --- a/src/game/start/start.js +++ b/src/game/start/start.js @@ -30,12 +30,15 @@ class Start { let underValue = historyRecordManager.underValueForGraph(); let upperValue = historyRecordManager.upperValueForGraph(); + + let minValue = underValue - (upperValue - underValue) / 10; + let maxValue = upperValue;// + (upperValue - underValue) / 10; for(let i = 0; i < historyRecordManager.count; i++) { if(i > 6) break; 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) { 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); console.log(dateTime); @@ -94,7 +98,7 @@ class Start { this.chartGraphics.lineStyle(50, 0xdddddd, 1); 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() {