Updated to 1.1.9

This commit is contained in:
Sambo Chea 2021-11-11 16:30:02 +07:00
parent e3d5cedc1d
commit ab50c04230
Signed by: sombochea
GPG Key ID: 3C7CF22A05D95490
4 changed files with 15 additions and 33 deletions

View File

@ -3,7 +3,7 @@
"version": "0.1.0", "version": "0.1.0",
"private": true, "private": true,
"dependencies": { "dependencies": {
"@cubetiq/react-chart-js": "^1.1.7", "@cubetiq/react-chart-js": "^1.1.8",
"@testing-library/jest-dom": "^4.2.4", "@testing-library/jest-dom": "^4.2.4",
"@testing-library/react": "^9.3.2", "@testing-library/react": "^9.3.2",
"@testing-library/user-event": "^7.1.2", "@testing-library/user-event": "^7.1.2",

View File

@ -5,40 +5,21 @@ function LineChartExample(props: any) {
return ( return (
<ReactChartJs <ReactChartJs
chartConfig={{ chartConfig={{
type: 'line', type: 'pie',
options: {
responsive: true,
title: {
display: true,
text: 'Monthly Payments',
},
tooltips: {
mode: 'index',
intersect: false,
},
hover: {
mode: 'nearest',
intersect: true,
},
},
data: { data: {
labels: ['Red', 'Blue', 'Yellow'],
datasets: [ datasets: [
{ {
label: 'Part-time', label: 'My First Dataset',
data: [5, 10, 30], data: [300, 50, 100],
fill: false, backgroundColor: ['rgb(255, 99, 132)', 'rgb(54, 162, 235)', 'rgb(255, 205, 86)'],
borderColor: '#ff6384', hoverOffset: 4,
},
{
label: 'Full-time',
data: [10, 15, 45],
fill: false,
borderColor: '#36a2eb',
}, },
], ],
labels: ['Jan', 'Feb', 'Mar'],
}, },
}} }}
containerProps={null}
canvasProps={null}
/> />
); );
} }

View File

@ -1,6 +1,6 @@
{ {
"name": "@cubetiq/react-chart-js", "name": "@cubetiq/react-chart-js",
"version": "1.1.8", "version": "1.1.9",
"description": "Chart.js for React and TypeScript", "description": "Chart.js for React and TypeScript",
"main": "./dist/index.js", "main": "./dist/index.js",
"types": "./dist/index.d.ts", "types": "./dist/index.d.ts",

View File

@ -1,12 +1,13 @@
import { Chart, ChartConfiguration } from 'chart.js'; import Chart from 'chart.js/auto';
import { ChartConfiguration } from 'chart.js';
import React, { FunctionComponent, useEffect, useRef } from 'react'; import React, { FunctionComponent, useEffect, useRef } from 'react';
interface ReactChartJSProps { interface ReactChartJSProps {
chartConfig?: ChartConfiguration; chartConfig: ChartConfiguration;
width?: number; width?: number;
height?: number; height?: number;
containerProps: any; containerProps?: any;
canvasProps: any; canvasProps?: any;
} }
interface RefForChartInstance { interface RefForChartInstance {