Skip to content

TypeError when using errorbarY #851

@dragonstyle

Description

@dragonstyle

I'm attempting to use the errorBarY mark (adapting the athletes example) like so:

Excerpt:

...
    plot:
    - mark: errorbarY
      data: { from: athletesBatched, filterBy: $query }
      ci: $ci
      y: height
      x: sport
      stroke: sex
      strokeWidth: 1
      marker: tick
      sort: { x: -y }
...

However, when I run this example, I receive the following error in the browser console:

TypeError: Cannot read properties of undefined (reading 'ci')
    at new ErrorBarMark (ErrorBarMark.js:10:13)
    at marks.js:45:18
    at plot.js:6:36
    at Array.forEach (<anonymous>)
    at Object.plot (plot.js:6:21)
    at PlotNode.instantiate (PlotNode.js:39:25)
    at VConcatNode.js:15:54
    at Array.map (<anonymous>)
    at VConcatNode.instantiate (VConcatNode.js:15:43)
    at HConcatNode.js:16:54

It appears that the issue somehow stems from this being an implicit type and the ErrorMark constructor expecting 3 args rather than the 2 that are passed for implicit types.

I wasn't able to ascertain what the appropriate fix for this is, but am hoping someone might be able to take a look.

Complete Reproducible Case:

meta:
  title: Athlete Height Intervals
  description: >
    Confidence intervals of Olympic athlete heights, in meters. Data are
    batched into groups of 10 samples per sport. Use the samples slider to see
    how the intervals update as the sample size increases (as in
    [online aggregation](https://en.wikipedia.org/wiki/Online_aggregation)).
    For each sport, the numbers on the right show the maximum number of
    athletes in the full dataset.
data:
  athletesBatched:
    file: data/athletes.parquet
    select:
      - '*'
      - 10 * CEIL(ROW_NUMBER() OVER (PARTITION BY sport) / 10) AS batch
    where: height IS NOT NULL
params:
  ci: 0.95
  query: { select: single }
hconcat:
- vconcat:
  - hconcat:
    - input: slider
      select: interval
      as: $query
      column: batch
      from: athletesBatched
      step: 10
      value: 20
      label: Max Samples
    - input: slider
      as: $ci
      min: 0.5
      max: 0.999
      step: 0.001
      label: Conf. Level
  - name: heights
    plot:
    - mark: errorbarY
      data: { from: athletesBatched, filterBy: $query }
      ci: $ci
      y: height
      x: sport
      stroke: sex
      strokeWidth: 1
      marker: tick
      sort: { x: -y }
    - mark: text
      data: { from: athletesBatched }
      frameAnchor: right
      fontSize: 8
      fill: "#999"
      dx: 25
      text: { count: }
      y: sport
    xDomain: [1.5, 2.1]
    yDomain: Fixed
    yGrid: true
    yLabel: null
    marginTop: 5
    marginLeft: 105
    marginRight: 30
    height: 420
  - legend: color
    for: heights

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions