src/nicemap5.js
// compute value range and build the color scale
compute value range and build the color scale
compute value range and build the color scale
processData(options) {  
        let series = options.data;
        const valueTable = this.valueTable = {}
        if(series) {
            series.forEach(item => valueTable[item[0]] = item[1]);
            this.valueRange = d3.extent(series.map(v=>v[1]));               
        } else {
            this.valueRange = [0,1];
        }
        if(Array.isArray(this.colorScaleArg)) {
            this.colorScale = d3.scaleLinear()
                .range(this.colorScaleArg)
                .domain(this.valueRange);
        } else if(typeof(this.colorScaleArg) == "function") {
            this.colorScale = this.colorScaleArg(this.valueRange);
        }
        const bubbleDataTable = this.bubbleDataTable = {}
        if(options.bubbleData) {
            options.bubbleData.forEach(q => {
                bubbleDataTable[q[0]] = q[1];
            })
        }
    }
processData ( options ) { let series = options . data ; const valueTable = this . valueTable = { } if ( series ) { series . forEach ( item => valueTable [ item [ 0 ] ] = item [ 1 ] ) ; this . valueRange = d3 . extent ( series . map ( v => v [ 1 ] ) ) ; } else { this . valueRange = [ 0 , 1 ] ; } if ( Array . isArray ( this . colorScaleArg ) ) { this . colorScale = d3 . scaleLinear ( ) . range ( this . colorScaleArg ) . domain ( this . valueRange ) ; } else if ( typeof ( this . colorScaleArg ) == "function" ) { this . colorScale = this . colorScaleArg ( this . valueRange ) ; } const bubbleDataTable = this . bubbleDataTable = { } if ( options . bubbleData ) { options . bubbleData . forEach ( q => { bubbleDataTable [ q [ 0 ] ] = q [ 1 ] ; } ) } }
compute value range and build the color scale
compute value range and build the color scale