esnet / react-timeseries-charts

Declarative and modular timeseries charting components for React
http://software.es.net/react-timeseries-charts
Other
859 stars 283 forks source link

Line Chart Not Rendering #415

Closed cmac458 closed 4 years ago

cmac458 commented 4 years ago

❔Line on LineChart not rendering

Trying to create a LineChart following the docs, the LineChart doesn't render. The Axes all render correctly but there is not data displayed. It is almost certainly something i'm doing wrong, would love some feedback on this. See CodeSandbox here - https://codesandbox.io/s/still-sun-w9rlf

renderTestChart() {
    let date = moment(new Date("2018-09-02 07:45:00"));
    let date2 = moment(new Date("2018-09-06 08:45:00"));

    let datapoints = [
      [date.toDate().getTime(), 100],
      [date2.toDate().getTime(), 200]
    ];

    let series = new TimeSeries({
      name: "test",
      columns: ["time", "count"],
      points: datapoints
    });

    let timerange = series.timerange();

    const style = {
      count: {
        stroke: "#a02c2c",
        opacity: 0.9
      }
    };
    return (
      <ChartContainer timeRange={timerange}>
        <ChartRow height="200">
          <YAxis id="1" />
          <Charts>
            <LineChart
              axis="1"
              series={series}
              columns={["count"]}
              style={style}
            />
          </Charts>
        </ChartRow>
      </ChartContainer>
    );
  }

Environment

Software Name/Version
react-timeseries-charts 0.16.1
Browser Chrome
Operating System MacOS