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

fix: add last quantile class

parent 74f703ee
......@@ -407,9 +407,9 @@
break;
case 'quantile':
let percentileBreaks = globalStats.percentiles.reduce((result, percentile)=>{
percentile.pcount = 1;
if (result.length === 0) {
result.push(Object.assign({}, percentile)); // spread operator not supported by current Edge
result[result.length - 1].pcount = 1;
return result;
}
if (result[result.length - 1].to === percentile.from) {
......@@ -419,6 +419,7 @@
return result;
}
result.push(Object.assign({}, percentile));
result[result.length - 1].pcount = 1;
return result;
},[]);
const legendType = (typeof percentileBreaks[0].from === "string") ? 'qual' : 'seq';
......@@ -433,7 +434,7 @@
let sumClassCount = 0
percentileBreaks = percentileBreaks.reduce((result, percentile)=>{
sumPCount += percentile.pcount;
if (sumPCount >= sumClassCount * pCountPerClass && result.length < classCount) {
if (sumPCount > sumClassCount * pCountPerClass && result.length < classCount) {
// new class
result.push(percentile);
sumClassCount++;
......@@ -506,7 +507,7 @@
</select><label for="numclasses">number of classes</label><br>
<button onclick="classButton('interval')">equal interval</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>
</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