From 79370b923fcdb5479e0266d34436e772420d7f73 Mon Sep 17 00:00:00 2001 From: Lawrence Luk Date: Wed, 15 Apr 2020 18:08:46 -0500 Subject: [PATCH 1/3] Added color coding for ranges in display table --- css/styles.css | 22 ++++++++++++++++++++++ js/scripts.js | 19 ++++++++++++++++--- 2 files changed, 38 insertions(+), 3 deletions(-) diff --git a/css/styles.css b/css/styles.css index 8ccf924..bae5887 100644 --- a/css/styles.css +++ b/css/styles.css @@ -368,7 +368,29 @@ input[type=number] { white-space: nowrap; } +#turnipTable td.range5 { + background-color: rgb(255, 200, 200); +} + +#turnipTable td.range4 { + background-color: rgb(255, 230, 230); +} + +#turnipTable td.range3 { + background-color: rgb(255, 255, 255); +} +#turnipTable td.range2 { + background-color: rgb(230, 255, 230); +} + +#turnipTable td.range1{ + background-color: rgb(180, 255, 180); +} + +#turnipTable td.range0 { + background-color: rgb(200, 200, 255); +} .waves { diff --git a/js/scripts.js b/js/scripts.js index 24f1376..c13db66 100644 --- a/js/scripts.js +++ b/js/scripts.js @@ -159,6 +159,16 @@ const getSellPrices = function () { }) } +const getPriceClass = function(max) { + const priceBrackets = [500, 190, 137, 91, 60, 0]; + for(var i=0; i= priceBrackets[i]) { + return "range" + i; + } + } + return ""; +} + const calculateOutput = function (data, first_buy, previous_pattern) { if (isEmpty(data)) { $("#output").html(""); @@ -169,13 +179,16 @@ const calculateOutput = function (data, first_buy, previous_pattern) { var out_line = "" + poss.pattern_description + "" out_line += `${Number.isFinite(poss.probability) ? ((poss.probability * 100).toPrecision(3) + '%') : '—'}`; for (let day of poss.prices.slice(1)) { + var price_class = getPriceClass(day.max); if (day.min !== day.max) { - out_line += `${day.min} to ${day.max}`; + out_line += `${day.min} to ${day.max}`; } else { - out_line += `${day.min}`; + out_line += `${day.min}`; } } - out_line += `${poss.weekGuaranteedMinimum}${poss.weekMax}`; + + var max_class = getPriceClass(poss.weekMax); + out_line += `${poss.weekGuaranteedMinimum}${poss.weekMax}`; output_possibilities += out_line } From 54f2dc83f311ac3f9b8b4ff1a045a4c21b15cc32 Mon Sep 17 00:00:00 2001 From: Lawrence Luk Date: Wed, 15 Apr 2020 18:48:13 -0500 Subject: [PATCH 2/3] Adjust price brackets --- js/scripts.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/scripts.js b/js/scripts.js index 9e35df5..de1351d 100644 --- a/js/scripts.js +++ b/js/scripts.js @@ -242,7 +242,7 @@ const getSellPrices = function () { } const getPriceClass = function(max) { - const priceBrackets = [500, 190, 137, 91, 60, 0]; + const priceBrackets = [400, 170, 135, 91, 60, 0]; for(var i=0; i= priceBrackets[i]) { return "range" + i; From c36290d83acaeb50c85fd3f0df8b09463029f039 Mon Sep 17 00:00:00 2001 From: Lawrence Luk Date: Thu, 23 Apr 2020 13:00:05 -0500 Subject: [PATCH 3/3] calculate pretty pastel colours based on potential profit --- css/styles.css | 38 +++++++++++++++++++++++++++----------- js/scripts.js | 15 +++++++++------ 2 files changed, 36 insertions(+), 17 deletions(-) diff --git a/css/styles.css b/css/styles.css index 57932e0..fa575e3 100644 --- a/css/styles.css +++ b/css/styles.css @@ -401,28 +401,44 @@ input[type=number] { white-space: nowrap; } -#turnipTable td.range0 { - background-color: rgb(200, 200, 255); +#turnipTable td.range4 { + background-color: hsl(0, 80%, 85%); } -#turnipTable td.range1{ - background-color: rgb(180, 255, 180); +#turnipTable td.range3{ + background-color: hsl(30, 80%, 85%); } #turnipTable td.range2 { - background-color: rgb(230, 255, 230); + background-color: hsl(60, 80%, 85%); } -#turnipTable td.range3 { - background-color: rgb(255, 255, 255); +#turnipTable td.range1 { + background-color: hsl(90, 80%, 85%); } -#turnipTable td.range4 { - background-color: rgb(255, 230, 230); +#turnipTable td.range0 { + background-color: hsl(140, 80%, 85%); +} + +.darkmode--activated #turnipTable td.range0 { + background-color: hsl(0, 80%, 85%); +} + +.darkmode--activated #turnipTable td.range1{ + background-color: hsl(30, 80%, 85%); +} + +.darkmode--activated #turnipTable td.range2 { + background-color: hsl(60, 80%, 85%); +} + +.darkmode--activated #turnipTable td.range3 { + background-color: hsl(90, 80%, 85%); } -#turnipTable td.range5 { - background-color: rgb(255, 200, 200); +.darkmode--activated #turnipTable td.range4 { + background-color: hsl(140, 80%, 85%); } .chart-wrapper { diff --git a/js/scripts.js b/js/scripts.js index 9c083c4..1bd48b8 100644 --- a/js/scripts.js +++ b/js/scripts.js @@ -249,10 +249,11 @@ const getSellPrices = function () { }) } -const getPriceClass = function(max) { - const priceBrackets = [400, 170, 135, 91, 60, 0]; +const getPriceClass = function(buy_price, max) { + const priceBrackets = [200, 30, 0, -30, -99]; + let diff = max - buy_price; for(var i=0; i= priceBrackets[i]) { + if(diff >= priceBrackets[i]) { return "range" + i; } } @@ -267,6 +268,7 @@ const calculateOutput = function (data, first_buy, previous_pattern) { let output_possibilities = ""; let predictor = new Predictor(data, first_buy, previous_pattern); let analyzed_possibilities = predictor.analyze_possibilities(); + let buy_price = parseInt(buy_input.val()); previous_pattern_number = "" for (let poss of analyzed_possibilities) { var out_line = "" + poss.pattern_description + "" @@ -280,7 +282,7 @@ const calculateOutput = function (data, first_buy, previous_pattern) { } out_line += `${percentage_display(poss.probability)}`; for (let day of poss.prices.slice(1)) { - var price_class = getPriceClass(day.max); + let price_class = getPriceClass(buy_price, day.max); if (day.min !== day.max) { out_line += `${day.min} ${i18next.t("output.to")} ${day.max}`; } else { @@ -288,8 +290,9 @@ const calculateOutput = function (data, first_buy, previous_pattern) { } } - var max_class = getPriceClass(poss.weekMax); - out_line += `${poss.weekGuaranteedMinimum}${poss.weekMax}`; + var min_class = getPriceClass(buy_price, poss.weekGuaranteedMinimum); + var max_class = getPriceClass(buy_price, poss.weekMax); + out_line += `${poss.weekGuaranteedMinimum}${poss.weekMax}`; output_possibilities += out_line }