Skip to content

ChannelValueSpec is only partially supported #1873

Open
@mbostock

Description

@mbostock

We advertise that ChannelValueSpec can be used in place of ChannelValue, but there are quite a few places where we assume ChannelValue instead of ChannelValueSpec. I tried to do a survey here:

  • src/channel.js (createChannel is only called with a ChannelValue)
  • src/options.js (numberChannel is only called with a ChannelValue)
  • src/style.js (maybeColorChannel does not support fill as ChannelValueSpec)
  • src/style.js (maybeNumberChannel does not support fillOpacity as ChannelValueSpec)
  • src/style.js (maybeColorChannel does not support stroke as ChannelValueSpec)
  • src/style.js (maybeNumberChannel does not support strokeOpacity as ChannelValueSpec)
  • src/style.js (maybeNumberChannel does not support strokeWidth as ChannelValueSpec)
  • src/style.js (maybeNumberChannel does not support opacity as ChannelValueSpec)
  • src/marks/auto.js (materializeValue is only called with a ChannelValue)
  • src/marks/axis.js (channels only contains Channel with ChannelValue)
  • src/marks/cell.js (maybeColorChannel does not support stroke as ChannelValueSpec)
  • src/marks/cell.js (maybeColorChannel does not support stroke as ChannelValueSpec)
  • src/transforms/basic.js filterTransform (test must be a ChannelValue)
  • src/transforms/basic.js sortTransform (supports {value})
  • src/transforms/bin.js (does not support x as ChannelValueSpec)
  • src/transforms/bin.js (does not support y as ChannelValueSpec)
  • src/transforms/bin.js (z must be a ChannelValue)
  • src/transforms/bin.js (does not support fill as ChannelValueSpec)
  • src/transforms/bin.js (does not support stroke as ChannelValueSpec)
  • src/transforms/bin.js (maybeBin supports {value})
  • src/transforms/centroid.js (geometry must be a ChannelValue)
  • src/transforms/dodge.js (R.value must be a ChannelValue)
  • src/transforms/group.js (does not support x as ChannelValueSpec)
  • src/transforms/group.js (does not support y as ChannelValueSpec)
  • src/transforms/group.js (does not support fill as ChannelValueSpec)
  • src/transforms/group.js (does not support stroke as ChannelValueSpec)
  • src/transforms/group.js (z must be a ChannelValue)
  • src/transforms/group.js (maybeEvaluator does not support input as ChannelValueSpec)
  • src/transforms/hexbin.js (z must be a ChannelValue)
  • src/transforms/interval.js (maybeIntervalK supports {value})
  • src/transforms/interval.js (maybeIntervalK supports {value})
  • src/transforms/interval.js (maybeIntervalMidK supports {value})
  • src/transforms/map.js (maybeZ does not support {value} for fill and stroke)
  • src/transforms/select.js (maybeZ does not support {value} for fill and stroke)
  • src/transforms/select.js (selectChannel does not support {value} for v)
  • src/transforms/stack.js (does not support x as ChannelValueSpec)
  • src/transforms/stack.js (does not support y as ChannelValueSpec)
  • src/transforms/stack.js (maybeZ does not support {value} for fill and stroke)
  • src/transforms/stack.js (order must be a ChannelValue)
  • src/transforms/tree.js (path must be a ChannelValue)
  • src/transforms/tree.js (path must be a ChannelValue)

I don’t think the fix is to add ChannelValueSpec support to Plot.valueof (or at least, that isn’t sufficient). For example, there are places where we call maybeColorChannel that would need to support ChannelValueSpec, and maybeZ should allow a ChannelValueSpec for fill and stroke but not z. 🤔

Related #1869.

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