Skip to content

feature: y1 default to 0 for Area #97

@jamesscottbrown

Description

@jamesscottbrown

This example gives an error, because y1 is not explicitly set for the Area mark:

<Plot
    height={300}
    marginLeft={60}
    y={{ axis: null }}
    x={{ nice: true }}
    fy={{ domain: ['FEMALE', 'MALE'] }}
    color={{ legend: true }}
    facet={{ data: penguins, y: 'sex' }}>
    <AreaY
        {...binX(
            {
                data: penguins,
                x: 'culmen_length_mm',
                fill: 'species',
                fillOpacity: '.',
                thresholds: '',
                curve: 'natural',
            },
            { y2: 'count' }
        )} />
</Plot>

Whereas it works if y1: 0 is added:

<Plot
    height={300}
    marginLeft={60}
    y={{ axis: null }}
    x={{ nice: true }}
    fy={{ domain: ['FEMALE', 'MALE'] }}
    color={{ legend: true }}
    facet={{ data: penguins, y: 'sex' }}>
    <AreaY
        {...binX(
            {
                data: penguins,
                x: 'culmen_length_mm',
                fill: 'species',
                fillOpacity: '.',
                thresholds: '',
                curve: 'natural',
                y1: 0
            },
            { y2: 'count' }
        )} />
</Plot>

It also works if I specify y rather than y1:

<Plot
    height={300}
    marginLeft={60}
    y={{ axis: null }}
    x={{ nice: true }}
    fy={{ domain: ['FEMALE', 'MALE'] }}
    color={{ legend: true }}
    facet={{ data: penguins, y: 'sex' }}>
    <AreaY
        {...binX(
            {
                data: penguins,
                x: 'culmen_length_mm',
                fill: 'species',
                fillOpacity: '.',
                thresholds: '',
                curve: 'natural',
            },
            { y: 'count' }
        )} />
</Plot>

In Observable Plot, setting just y2 works (as in this example).

(this is one of the issues surfaced by #72)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy