xr0master/chartjs-react

TypeScript: Export 'ChartProps' interface from ReactChart.d.ts

Closed this issue · 5 comments

@xr0master Thanks for coming up with this wrapper for Chart.js. I'm trying to integrate it in my TS-React project and one thing I noticed is that the ChartProps interface defined in ReactChart.d.ts isn't being exported currently.

Can you export that interface, so that we can use it as type for props of wrapper components inside our projects.

Example usage:

import { ReactChart, ChartProps } from 'chartjs-react'

ReactChart.register(LineController, LinearScale, TimeScale, Tooltip);

export const LineChart = (props: ChartProps) => {
    const { data, options, height } = props;
    return (
      <ReactChart
        type="line"
        data={data}
        options={options}
        height={height}
      />
    );
};

ok, I will do it soon

Version 3.1.8 is released. Added chart.js-beta.10 and export for the props interface

@xr0master Thank you for such a fast turnaround on this, appreciate it very much! :)
Also, I would be glad to provide help I can, on fixing any minor issues on this library. I am integrating Charts-v3 using your current chartjs-react version, so maybe I can lend some help while I'm at it.
Cheers!

@xr0master Have you released version 3.1.8? Latest master still shows 3.1.7.

@kashifshamaz21 yes, it's published to npm, but you are right, I forgot to push.
You are welcome with your PRs! It's open-source, everyone can offer their own idea or solution.

In principle, there are three tasks that I'm going to do:

  1. add the integration tests (I have a branch, need to finish)
  2. think about how to give access to the chart instance (I have the idea only, something like an antd useForm concept, however, there are difficulties)
  3. add the React interface for customizing the tooltip (there is a working version for v2, I'm waiting for the v3 release to implement it)