Update chartjs version.

Replcae date-fns to moment adapter.
This commit is contained in:
Фролов 2021-05-28 15:56:01 +05:00
parent 1db98b79e0
commit 89f7de7a49
3 changed files with 23 additions and 16 deletions

20
package-lock.json generated
View File

@ -4234,14 +4234,14 @@
"integrity": "sha512-kWWXztvZ5SBQV+eRgKFeh8q5sLuZY2+8WUIzlxWVTg+oGwY14qylx1KbKzHd8P6ZYkAg0xyIDU9JMHhyJMZ1jw=="
},
"chart.js": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/chart.js/-/chart.js-3.0.2.tgz",
"integrity": "sha512-DR0GmFSlxcFJp/w//ZmbxSduAkH/AqwxoiZxK97KHnWZf6gvsKWS3160WvNMMHYvzW9OXqGWjPjVh1Qu+xDabg=="
"version": "3.3.0",
"resolved": "https://registry.npmjs.org/chart.js/-/chart.js-3.3.0.tgz",
"integrity": "sha512-3pO3kL2st1Lzhw+HTGvDwcNYWustHwvApM/v7b2td6CrthyEygbPoXaN/iGZfUpfuovZfJ4dy129RCr39BR1Bg=="
},
"chartjs-adapter-date-fns": {
"version": "1.1.0-beta.1",
"resolved": "https://registry.npmjs.org/chartjs-adapter-date-fns/-/chartjs-adapter-date-fns-1.1.0-beta.1.tgz",
"integrity": "sha512-VNhuZ86kXKOwh61CyRLP7hoFqAR7+gjnrtf7KYLt/Wfh3jIQs14l1h+nagtQoFaabIYIo6UD5/jJb2/J6zOPcw=="
"chartjs-adapter-moment": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/chartjs-adapter-moment/-/chartjs-adapter-moment-1.0.0.tgz",
"integrity": "sha512-PqlerEvQcc5hZLQ/NQWgBxgVQ4TRdvkW3c/t+SUEQSj78ia3hgLkf2VZ2yGJtltNbEEFyYGm+cA6XXevodYvWA=="
},
"chartjs-plugin-datalabels": {
"version": "2.0.0-rc.1",
@ -10473,7 +10473,8 @@
"dependencies": {
"hosted-git-info": {
"version": "2.8.8",
"resolved": "",
"resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.8.tgz",
"integrity": "sha512-f/wzC2QaWBs7t9IYqB4T3sR1xviIViXJRJTWBlx2Gf3g0Xi5vI7Yy4koXQ1c9OYDGHN9sBy1DQ2AB8fqZBWhUg==",
"dev": true
},
"normalize-package-data": {
@ -16861,7 +16862,8 @@
},
"ssri": {
"version": "6.0.1",
"resolved": "",
"resolved": "https://registry.npmjs.org/ssri/-/ssri-6.0.1.tgz",
"integrity": "sha512-3Wge10hNcT1Kur4PDFwEieXSCMCJs/7WvSACcrMYrNp+b8kDL1/0wJch5Ni2WrtwEa2IO8OsVfeKIciKCDx/QA==",
"requires": {
"figgy-pudding": "^3.5.1"
}

View File

@ -9,8 +9,8 @@
"@testing-library/react": "^11.2.6",
"@testing-library/user-event": "^12.8.3",
"antd": "^4.15.0",
"chart.js": "^3.0.2",
"chartjs-adapter-date-fns": "^1.1.0-beta.1",
"chart.js": "^3.3.0",
"chartjs-adapter-moment": "^1.0.0",
"chartjs-plugin-datalabels": "^2.0.0-rc.1",
"craco-less": "^1.17.1",
"date-fns": "^2.20.0",

View File

@ -10,13 +10,13 @@ import {
ChartData,
ChartTypeRegistry,
ChartOptions} from 'chart.js'
import 'chartjs-adapter-date-fns';
import 'chartjs-adapter-moment';
import ChartDataLabels from 'chartjs-plugin-datalabels';
Chart.register( TimeScale, LinearScale, LineController, LineElement, PointElement, Legend, ChartDataLabels );
const defaultOptions = {
//maintainAspectRatio: false,
responsive: true,
aspectRatio: 0.45,
animation: false,
events: ['mousemove', 'mouseout', 'click', 'touchstart', 'touchmove'],
@ -25,8 +25,6 @@ const defaultOptions = {
type: 'time',
reverse: true,
time: {
//unit: 'second',
//round:'second',
stepSize: 20,
displayFormats: {
millisecond: 'HH:mm:ss.SSS',
@ -40,7 +38,6 @@ const defaultOptions = {
year: 'yyyy.MM',
},
},
//position:'center',
grid:{
drawTicks: false,
},
@ -64,6 +61,14 @@ const defaultOptions = {
hoverRadius:5,
},
},
plugins:{
legend:{
display: false,
},
datalabels: {
display: false,
},
}
}
export type ChartTimeData = ChartData<keyof ChartTypeRegistry, {