Skip to content

Bug in createNumericScale.js #148

@bianchi-dy

Description

@bianchi-dy

The createNumericScale.js has this repeating bit of code where the presence of range in the passed scale is checked. If none is given, then a default array is set as the range.

The way it is currently written, regardless of what you feed to the range prop in scale, it gets ignored because of this:

  if (prop === 'radius') {
    //console.log('5467', !scalingOptions.range)
    if (!scalingOptions.range) {
      console.warn(`No range specified for prop ${prop}. Defaulting to [0, 8]`)
    }

    range = [0, 8]
    parseRange(range, scalingOptions) // parseRange does not alter range at all
  }

So the solution would be

  if (prop === 'radius') {
    //console.log('5467', !scalingOptions.range)
    if (!scalingOptions.range) {
      console.warn(`No range specified for prop ${prop}. Defaulting to [0, 8]`)
    }

    range = [0, 8]
    range = parseRange(range, scalingOptions) // parseRange alters the resulting range after some checks
  }

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions