React-vis: VerticalBar time series does not render with only one datapoint

Created on 6 Jun 2019  路  1Comment  路  Source: uber/react-vis

Using react-vis 1.11.7, when I render a VerticalBarSeries on a time-based x-axis and the data only has one datapoint I get the error Received NaN for thexattribute. If this is expected, cast the value to a string.
When the data has more than one datapoint everything works alright.

Example:

const chart = props => {
  const timestamp = new Date('May 23 2017').getTime();
  const ONE_DAY = 86400000;
  const data = [
    {x: timestamp, y: 1}, // when there is only one datapoint the chart errors
    // {x: timestamp + ONE_DAY, y: 1}, // when this is uncommented the chart renders normally
  ];

  return (
      <XYPlot
        height={300}
        width={350}
        xType="time"
      >
        <XAxis />
        <YAxis />
        <VerticalBarSeries
          data={data}
        />
      </XYPlot>
    );
};

Most helpful comment

Having same problem.

>All comments

Having same problem.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

zavrick picture zavrick  路  4Comments

Falieson picture Falieson  路  3Comments

wroughtec picture wroughtec  路  4Comments

codewithsk picture codewithsk  路  5Comments

cvalmonte picture cvalmonte  路  4Comments