Compare commits

..

No commits in common. "24d3fe60f43b6a3bd0092d21b14c3ea3feb1b291" and "55e9969a8c21c38a0d53efd9a786031e62144cc8" have entirely different histories.

4 changed files with 34 additions and 14 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.9", "@cubetiq/react-chart-js": "^1.1.6",
"@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,17 +5,38 @@ function LineChartExample(props: any) {
return ( return (
<ReactChartJs <ReactChartJs
chartConfig={{ chartConfig={{
type: 'pie', type: 'line',
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: 'My First Dataset', label: 'Part-time',
data: [300, 50, 100], data: [5, 10, 30],
backgroundColor: ['rgb(255, 99, 132)', 'rgb(54, 162, 235)', 'rgb(255, 205, 86)'], fill: false,
hoverOffset: 4, borderColor: '#ff6384',
},
{
label: 'Full-time',
data: [10, 15, 45],
fill: false,
borderColor: '#36a2eb',
}, },
], ],
labels: ['Jan', 'Feb', 'Mar'],
}, },
}} }}
/> />

View File

@ -1,6 +1,6 @@
{ {
"name": "@cubetiq/react-chart-js", "name": "@cubetiq/react-chart-js",
"version": "1.1.9", "version": "1.1.7",
"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",
@ -30,7 +30,7 @@
"scripts": { "scripts": {
"build": "tsc", "build": "tsc",
"test": "jest", "test": "jest",
"pub": "npm publish --access public --registry https://registry.npmjs.org", "pub": "yarn build && npm publish --access public",
"build:test": "yarn jest && yarn build", "build:test": "yarn jest && yarn build",
"run:example": "cd examples/line-chart-example && yarn start" "run:example": "cd examples/line-chart-example && yarn start"
}, },

View File

@ -1,13 +1,12 @@
import Chart from 'chart.js/auto'; import { Chart, ChartConfiguration } from 'chart.js';
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 {