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",
"private": true,
"dependencies": {
"@cubetiq/react-chart-js": "^1.1.9",
"@cubetiq/react-chart-js": "^1.1.6",
"@testing-library/jest-dom": "^4.2.4",
"@testing-library/react": "^9.3.2",
"@testing-library/user-event": "^7.1.2",

View File

@ -5,17 +5,38 @@ function LineChartExample(props: any) {
return (
<ReactChartJs
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: {
labels: ['Red', 'Blue', 'Yellow'],
datasets: [
{
label: 'My First Dataset',
data: [300, 50, 100],
backgroundColor: ['rgb(255, 99, 132)', 'rgb(54, 162, 235)', 'rgb(255, 205, 86)'],
hoverOffset: 4,
label: 'Part-time',
data: [5, 10, 30],
fill: false,
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",
"version": "1.1.9",
"version": "1.1.7",
"description": "Chart.js for React and TypeScript",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
@ -30,7 +30,7 @@
"scripts": {
"build": "tsc",
"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",
"run:example": "cd examples/line-chart-example && yarn start"
},

View File

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