MCPcopy Create free account
hub / github.com/microsoft/SandDance / selectQuantitative

Function selectQuantitative

docs/app/js/sanddance-app.js:10828–10871  ·  view source on GitHub ↗
(colorBinType, column, legend, clickedIndex)

Source from the content-addressed store, hash-verified

10826 };
10827}
10828function selectQuantitative(colorBinType, column, legend, clickedIndex) {
10829 const keys = Object.keys(legend.rows).map((key)=>+key).sort((a, b)=>+a - +b);
10830 let lowValue;
10831 let lowOperator;
10832 let highValue;
10833 let highOperator;
10834 const rowText = legend.rows[clickedIndex].label;
10835 switch(colorBinType){
10836 case "continuous":
10837 lowValue = rowText;
10838 if (clickedIndex < keys.length - 1) highValue = legend.rows[clickedIndex + 1].value;
10839 break;
10840 default:
10841 {
10842 if (rowText.indexOf("null") > 0) {
10843 const ex = {
10844 expressions: [
10845 (0, _expression.selectNullOrEmpty)(column)
10846 ]
10847 };
10848 return ex;
10849 }
10850 const dash = rowText.indexOf("\u2013"); //this is not the common dash character!
10851 if (dash > 0) {
10852 //bug in Vega for quantize?
10853 //lowOperator = '>';
10854 //highOperator = '<=';
10855 lowValue = rowText.substr(0, dash);
10856 highValue = rowText.substr(dash + 1);
10857 } else {
10858 if (rowText.indexOf("<") >= 0) highValue = rowText.substring(2);
10859 else if (rowText.indexOf("\u2265") >= 0) lowValue = rowText.substring(2);
10860 }
10861 }
10862 }
10863 if (lowValue) lowValue = (0, _expression.notNice)(lowValue);
10864 if (highValue) highValue = (0, _expression.notNice)(highValue);
10865 if (lowValue === highValue) return {
10866 expressions: [
10867 (0, _expression.selectExact)(column, lowValue)
10868 ]
10869 };
10870 else return (0, _expression.selectBetween)(column, lowValue, highValue, lowOperator, highOperator);
10871}
10872function finalizeLegend(colorBinType, colorColumn, legend, language) {
10873 const rowTexts = [];
10874 for(let i in legend.rows){

Callers 1

legendRangeFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected