Commit 86279d4f authored by Anne Blankert's avatar Anne Blankert

fix: add last quantile class

parent 74f703ee
...@@ -407,9 +407,9 @@ ...@@ -407,9 +407,9 @@
break; break;
case 'quantile': case 'quantile':
let percentileBreaks = globalStats.percentiles.reduce((result, percentile)=>{ let percentileBreaks = globalStats.percentiles.reduce((result, percentile)=>{
percentile.pcount = 1;
if (result.length === 0) { if (result.length === 0) {
result.push(Object.assign({}, percentile)); // spread operator not supported by current Edge result.push(Object.assign({}, percentile)); // spread operator not supported by current Edge
result[result.length - 1].pcount = 1;
return result; return result;
} }
if (result[result.length - 1].to === percentile.from) { if (result[result.length - 1].to === percentile.from) {
...@@ -419,6 +419,7 @@ ...@@ -419,6 +419,7 @@
return result; return result;
} }
result.push(Object.assign({}, percentile)); result.push(Object.assign({}, percentile));
result[result.length - 1].pcount = 1;
return result; return result;
},[]); },[]);
const legendType = (typeof percentileBreaks[0].from === "string") ? 'qual' : 'seq'; const legendType = (typeof percentileBreaks[0].from === "string") ? 'qual' : 'seq';
...@@ -433,7 +434,7 @@ ...@@ -433,7 +434,7 @@
let sumClassCount = 0 let sumClassCount = 0
percentileBreaks = percentileBreaks.reduce((result, percentile)=>{ percentileBreaks = percentileBreaks.reduce((result, percentile)=>{
sumPCount += percentile.pcount; sumPCount += percentile.pcount;
if (sumPCount >= sumClassCount * pCountPerClass && result.length < classCount) { if (sumPCount > sumClassCount * pCountPerClass && result.length < classCount) {
// new class // new class
result.push(percentile); result.push(percentile);
sumClassCount++; sumClassCount++;
...@@ -506,7 +507,7 @@ ...@@ -506,7 +507,7 @@
</select><label for="numclasses">number of classes</label><br> </select><label for="numclasses">number of classes</label><br>
<button onclick="classButton('interval')">equal interval</button> <button onclick="classButton('interval')">equal interval</button>
<button onclick="classButton('quantile')">quantile</button> <button onclick="classButton('quantile')">quantile</button>
<button onclick="classButton('qualitative')">qualitative</button><br> <button onclick="classButton('qualitative')">most frequent</button><br>
<input type="checkbox" id="hidenulls" name="hidenulls" checked><label for="hidenulls">Hide no-data</label> <input type="checkbox" id="hidenulls" name="hidenulls" checked><label for="hidenulls">Hide no-data</label>
</div> </div>
</div> </div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment