Skip to content

Allow x/y shorthands for ruleY/ruleX #93

Open
@jamesscottbrown

Description

@jamesscottbrown

ObservablePlot has some shorthands not present in SveltePlot:

For ruleX:

If y is specified, it is shorthand for y2 with y1 equal to zero; this is the typical configuration for a vertical lollipop chart with rules aligned at y = 0. If y1 is not specified, the rule will start at the top of the plot (or facet). If y2 is not specified, the rule will end at the bottom of the plot (or facet).

For ruleY:

If x is specified, it is shorthand for x2 with x1 equal to zero; this is the typical configuration for a horizontal lollipop chart with rules aligned at x = 0. If x1 is not specified, the rule will start at the left edge of the plot (or facet). If x2 is not specified, the rule will end at the right edge of the plot (or facet).

This was surfaced by #72, and affects the Lollipop example:

This works:

<Plot x={{  label: null,  tickPadding: 6,  tickSize: 0}} y={{  percent: true}} >
  <RuleX data={alphabet} x="letter" y1="frequency" strokeWidth={2} />
  <Dot data={alphabet} x="letter" y="frequency" fill="currentColor" r={4} />
</Plot>

But this has lines spanning the full height of the chart:

<Plot x={{  label: null,  tickPadding: 6,  tickSize: 0}} y={{  percent: true}} >
  <RuleX data={alphabet} x="letter" y="frequency" strokeWidth={2} />
  <Dot data={alphabet} x="letter" y="frequency" fill="currentColor" r={4} />
</Plot>

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