Skip to content

[BUG] Providing domain with negative start value causes NPE #497

@corneil

Description

@corneil

Describe the bug

I am plotting geoPoints on a geoMap

When I get min and max for the column used to determine the geoPoint size and provide this range as the domain and the min is negative for the scale I experience the following:

java.lang.NullPointerException: null
	at org.jetbrains.letsPlot.core.plot.base.aes.AesScaling.strokeWidth(AesScaling.kt:18)
	at org.jetbrains.letsPlot.core.plot.base.geom.util.LinesHelper$decorate$1.invoke(LinesHelper.kt:228)
	at org.jetbrains.letsPlot.core.plot.base.geom.util.LinesHelper.decorate(LinesHelper.kt:241)
	at org.jetbrains.letsPlot.core.plot.base.geom.PolygonGeom.buildIntern(PolygonGeom.kt:33)

The plot as follows:

plot {
    withData(overviewGeoMap) {
         geoMap {
	    fillColor(countryCode) {
              legend.name = "Country Code"
              alpha = 0.7
              scale = categorical("USA" to Color.BLUE, "CAN" to Color.RED,"MEX" to Color.GREEN)
            }
            borderLine.color = Color.BLACK
            borderLine.width = 0.1
        }
    }
    withData(dataGeoPlot) {
       geoPoints {
           color(focusAreaColourColumn) {
               scale = continuous(Color.GREEN..Color.RED, domain = minColourValue..maxColourValue)
           }
           legend.name = messageSource.getMessageText(locale, focusAreaColourColumn.name())
           size(focusAreaSizeColumn) {
               scale = continuous(range = 3.0..12.0, domain = minSizeValue..maxSizeValue)
               legend.name = messageSource.getMessageText(locale, focusAreaSizeColumn.name())
           }				
       }
    }
    withData(level1Names) {
        text {
          label(level1Name)
	  alpha = 1.0
	  x(centerX)
	  y(centerY)
	  font.color = Color.BLACK
	  font.size = 6.0
	  font.family = FontFamily.SANS
       }
    }
}

When I remove the domain = to the continuous() scale the NPE doesn't occur.

Metadata

Metadata

Assignees

No one assigned

    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