0

Update charting libraries

This commit is contained in:
Gabe Kangas 2021-04-12 19:56:37 -07:00
parent 5b01240992
commit 4794339b8a
3 changed files with 34 additions and 14 deletions

View File

@ -1,5 +1,6 @@
import { LineChart } from 'react-chartkick'; import { LineChart } from 'react-chartkick';
import 'chart.js'; import 'chartkick/chart.js'
import format from 'date-fns/format'; import format from 'date-fns/format';
interface TimedValue { interface TimedValue {
@ -19,7 +20,7 @@ function createGraphDataset(dataArray) {
const dataValues = {}; const dataValues = {};
dataArray.forEach(item => { dataArray.forEach(item => {
const dateObject = new Date(item.time); const dateObject = new Date(item.time);
const dateString = format(dateObject, 'p P'); const dateString = format(dateObject, 'H:mma');
dataValues[dateString] = item.value; dataValues[dateString] = item.value;
}); });
return dataValues; return dataValues;

39
web/package-lock.json generated
View File

@ -1072,14 +1072,33 @@
"integrity": "sha512-mKKUkUbhPpQlCOfIuZkvSEgktjPFIsZKRRbC6KWVEMvlzblj3i3asQv5ODsrwt0N3pHAEvjP8KTQPHkp0+6jOg==" "integrity": "sha512-mKKUkUbhPpQlCOfIuZkvSEgktjPFIsZKRRbC6KWVEMvlzblj3i3asQv5ODsrwt0N3pHAEvjP8KTQPHkp0+6jOg=="
}, },
"chart.js": { "chart.js": {
"version": "3.0.2", "version": "3.1.0",
"resolved": "https://registry.npmjs.org/chart.js/-/chart.js-3.0.2.tgz", "resolved": "https://registry.npmjs.org/chart.js/-/chart.js-3.1.0.tgz",
"integrity": "sha512-DR0GmFSlxcFJp/w//ZmbxSduAkH/AqwxoiZxK97KHnWZf6gvsKWS3160WvNMMHYvzW9OXqGWjPjVh1Qu+xDabg==" "integrity": "sha512-bKJi2VbC4fqZXlLbK7LKVvmG9crjoG9anfp96utZLyIGPuCx+YN+5/HDXy98QGt3lf74T8gKUPISUZL222tDJQ=="
},
"chartjs-adapter-date-fns": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/chartjs-adapter-date-fns/-/chartjs-adapter-date-fns-2.0.0.tgz",
"integrity": "sha512-rmZINGLe+9IiiEB0kb57vH3UugAtYw33anRiw5kS2Tu87agpetDDoouquycWc9pRsKtQo5j+vLsYHyr8etAvFw==",
"optional": true
}, },
"chartkick": { "chartkick": {
"version": "3.2.1", "version": "4.0.3",
"resolved": "https://registry.npmjs.org/chartkick/-/chartkick-3.2.1.tgz", "resolved": "https://registry.npmjs.org/chartkick/-/chartkick-4.0.3.tgz",
"integrity": "sha512-zV0kUeZNqrX28AmPt10QEDXHKadbVFOTAFkCMyJifHzGFkKzGCDXxVR8orZ0fC1HbePzRn5w6kLCOVxDQbMUCg==" "integrity": "sha512-e2WhXYE0VsevyTxol2J4WaHz26iuuSpduK9BVkvIIVrIt6TFlDw7Vm4iXSYIAsDMdC9/UsIV2ZtYIldMMXpvlA==",
"requires": {
"chart.js": ">=3.0.2",
"chartjs-adapter-date-fns": ">=2.0.0",
"date-fns": ">=2.0.0"
},
"dependencies": {
"chart.js": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/chart.js/-/chart.js-3.1.0.tgz",
"integrity": "sha512-bKJi2VbC4fqZXlLbK7LKVvmG9crjoG9anfp96utZLyIGPuCx+YN+5/HDXy98QGt3lf74T8gKUPISUZL222tDJQ==",
"optional": true
}
}
}, },
"chokidar": { "chokidar": {
"version": "3.5.1", "version": "3.5.1",
@ -4695,11 +4714,11 @@
} }
}, },
"react-chartkick": { "react-chartkick": {
"version": "0.4.1", "version": "0.5.1",
"resolved": "https://registry.npmjs.org/react-chartkick/-/react-chartkick-0.4.1.tgz", "resolved": "https://registry.npmjs.org/react-chartkick/-/react-chartkick-0.5.1.tgz",
"integrity": "sha512-ydShYzYGCkphlUUMaN6gHHyS+Na9hRj1nvkSvB+cIU3E9JkGkj0Eiin7Y/NJ5165uiQtIbvuWvrPq2vbZHQmCA==", "integrity": "sha512-2tcJTVVY2RaZ3JYI6Yk+ek07XyS5oFNwmXj4pbjJlbjmbsaK1UsFiYcK8dhkf4ES5KFyhJn9gWXLoU6GXjkOhQ==",
"requires": { "requires": {
"chartkick": "^3.2.0" "chartkick": "^4.0.0"
} }
}, },
"react-dom": { "react-dom": {

View File

@ -11,7 +11,7 @@
"dependencies": { "dependencies": {
"@ant-design/icons": "^4.6.2", "@ant-design/icons": "^4.6.2",
"antd": "^4.15.0", "antd": "^4.15.0",
"chart.js": "^3.0.2", "chart.js": "^3.1.0",
"classnames": "^2.3.1", "classnames": "^2.3.1",
"date-fns": "^2.20.0", "date-fns": "^2.20.0",
"markdown-it": "^12.0.4", "markdown-it": "^12.0.4",
@ -19,7 +19,7 @@
"prop-types": "^15.7.2", "prop-types": "^15.7.2",
"rc-util": "^5.9.8", "rc-util": "^5.9.8",
"react": "^17.0.2", "react": "^17.0.2",
"react-chartkick": "^0.4.1", "react-chartkick": "^0.5.0",
"react-dom": "^17.0.2", "react-dom": "^17.0.2",
"react-linkify": "^1.0.0-alpha", "react-linkify": "^1.0.0-alpha",
"react-markdown": "^5.0.3", "react-markdown": "^5.0.3",