RhoInc/Webcharts

Distinguish Between x and y range_band

Closed this issue · 4 comments

Right now range_band applies to any variables that are ordinal. So if both x and y are ordinal they are both affected. If you have two ordinal variables, you might only want the range_band to apply to one of them (like if you're making a heatmap and you don't want the rects to be squares). Right now working around this by making the x axis linear at the start then recoding it later)

Test notes

  • Test x.range_band on vertical bars and y.range_band on horizontal bars in webcharts-tests.
  • The range_band setting governs the width or height that an ordinal value is allotted, e.g. the width of the bars in a bar chart. Define a bar chart and set its range band like so:
    • range_band: 25 for a bar chart whose ordinal axis is on the x- or y-axis.
    • x.range_band: 25 for a bar chart whose ordinal axis is on the x-axis.
    • y.range_band: 25 for a bar chart whose ordinal axis is on the y-axis.
  • Verify that x.range_band or y.range_band overrides range_band.

@pburnsdata Good find - want to work on a PR?

I think I would add a range_band property to both the config.x and config.y. To maintain backwards compatibility, if a user just sets, config.range_band then it should be applied to both places, but if both config.range_band and config.x.range_band are set x.range_band should take precedence.

Make sense to you @samussiah?

Tested and passed in Webcharts visual tests using version x-y-range-band. Can update the object settings to add range_band: x to either a y-axis or x-axis ordinal bar chart and change the size of the bars accordingly.