Skip to content

GitLab

  • Menu
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • G g1
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 68
    • Issues 68
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 4
    • Merge requests 4
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • cto
  • g1
  • Issues
  • #172

Closed
Open
Created Jun 20, 2019 by Tejesh@tejesh.p🖖Maintainer

G1.mapviewer does not support Ordinal scales correctly

domain gets calculated from

MapViewer.prototype._calculateMinMax = function (layer, metricFormula) {
  var minVal, maxVal
  layer.eachLayer(function (sublayer) {
    var metricVal = metricFormula(sublayer.feature.properties)
    if (!metricVal) return
    if (!(maxVal && minVal)) maxVal = metricVal, minVal = metricVal
    if (metricVal < minVal) {
      minVal = metricVal
    }
    if (metricVal > maxVal) {
      maxVal = metricVal
    }
  })
  return [minVal, maxVal]
}

This would return [undefined, undefined] incase the metric provided in the mapviewer options is Qualitative data.

Implications:

Even if domain is provided as array of unique categoricals and range as array of colors, the first color in range are already mapped to undefined value in domain. So, the domain mapping gets shifted by one place.

Possible Solutions: Create a domain calculator module in G1, that can take a accessor as parameter. Such that the input can be array of objects (collections), or an array itself. In mapviewer case, the input is an array of sublayer.feature.properties.

This g1.domain will be reused in g1.scales module.

Note for Tejesh: For discrete type scales (ordinal/band/point), if domain option is not provided and metric (Tejesh to make this as mandatory option) is provided, domain gets calculated internally irrespective of type of input data metric. If domain is provided but the provided domain does not span entire possible input values, discrete range values must be rotated after mapping provided domain values to discrete range.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking