| 10826 | }; |
| 10827 | } |
| 10828 | function 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 | } |
| 10872 | function finalizeLegend(colorBinType, colorColumn, legend, language) { |
| 10873 | const rowTexts = []; |
| 10874 | for(let i in legend.rows){ |