Skip to content

Document xType prop on XYPlot #1050

Open
@CAYdenberg

Description

If I create the following component:

import {XYPlot, VerticalRectSeries, XAxis} from 'react-vis'

storiesOf('VerticalRectSeries', module)
  .add('broken draw coordinates', () => {
    const data = [
      {x0: 0, x: 0.25, y0: 0, y: 10},
      {x0: 0.25, x: 0.5, y0: 0, y: 114},
      {x0: 0.5, x: 0.75, y0: 0, y: 26},
      {x0: 0.75, x: 1, y0: 0, y: 0}
    ]
    return (
      <XYPlot xType="ordinal" width={300} height={300} xDistance={100}>
        <XAxis />
        <VerticalRectSeries data={data} opacity={0.5} />
      </XYPlot>
    )
  })

I get:

screenshot-localhost-9001-2018 11 22-15-47-00

As you can see the first two recangles are rendered out of place: the first begins where the second one should, while the second one is twice the width it should be.

I thought the zero values were perhaps throwing it - but it actually doesn't matter what value you give x0 for the first datapoint - it always renders the same way.

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions