Skip to content

Commit c699c92

Browse files
Bump chart.js from 2.9.4 to 3.2.1 in /apps/client/assets (#1647)
* Bump chart.js from 2.9.4 to 3.2.1 in /apps/client/assets Bumps [chart.js](https://github.com/chartjs/Chart.js) from 2.9.4 to 3.2.1. - [Release notes](https://github.com/chartjs/Chart.js/releases) - [Commits](chartjs/Chart.js@v2.9.4...v3.2.1) Signed-off-by: dependabot[bot] <[email protected]> * 3.0 upgrade Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Justin Toniazzo <[email protected]>
1 parent 75da19d commit c699c92

File tree

3 files changed

+31
-83
lines changed

3 files changed

+31
-83
lines changed

apps/client/assets/js/components/twitch/TwitchEmoteWatcher.tsx

Lines changed: 26 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11
import * as React from "react";
22
import { StyleSheet, css } from "aphrodite";
33
import { Header } from "semantic-ui-react";
4-
import { Chart } from "chart.js";
4+
import {
5+
BarController,
6+
BarElement,
7+
CategoryScale,
8+
Chart,
9+
LinearScale,
10+
} from "chart.js";
511
import { Socket } from "phoenix";
612

713
import { FormBox } from "@components/FormBox";
@@ -81,11 +87,11 @@ export class TwitchEmoteWatcher extends React.Component<Props, State> {
8187
componentDidMount() {
8288
const { chartId } = this.state;
8389
const canvas = document.getElementById(chartId) as HTMLCanvasElement;
90+
Chart.register(BarController, BarElement, CategoryScale, LinearScale);
8491
const context = canvas.getContext("2d");
8592
const chart = new Chart(context, {
86-
type: "horizontalBar",
93+
type: "bar",
8794
data: {
88-
labels: [],
8995
datasets: [
9096
{
9197
label: "",
@@ -96,31 +102,7 @@ export class TwitchEmoteWatcher extends React.Component<Props, State> {
96102
],
97103
},
98104
options: {
99-
scales: {
100-
yAxes: [
101-
{
102-
scaleLabel: {
103-
display: false,
104-
},
105-
ticks: {
106-
min: 0,
107-
beginAtZero: true,
108-
},
109-
},
110-
],
111-
xAxes: [
112-
{
113-
scaleLabel: {
114-
display: false,
115-
},
116-
ticks: {
117-
min: 0,
118-
suggestedMax: 3,
119-
beginAtZero: true,
120-
},
121-
},
122-
],
123-
},
105+
indexAxis: "y",
124106
},
125107
});
126108
this.setState({ chart });
@@ -159,20 +141,22 @@ export class TwitchEmoteWatcher extends React.Component<Props, State> {
159141

160142
oneMinuteWindowUpdate(emotes) {
161143
const entries = Object.keys(emotes).map((key) => [key, emotes[key]]);
162-
const sortedEntries = entries.sort((a, b) => {
163-
const [aEmote, aCount] = a;
164-
const [bEmote, bCount] = b;
165-
166-
if (aCount < bCount) {
167-
return 1;
168-
}
169-
170-
if (aCount > bCount) {
171-
return -1;
172-
}
173-
174-
return 0;
175-
});
144+
const sortedEntries = entries
145+
.sort((a, b) => {
146+
const [aEmote, aCount] = a;
147+
const [bEmote, bCount] = b;
148+
149+
if (aCount < bCount) {
150+
return 1;
151+
}
152+
153+
if (aCount > bCount) {
154+
return -1;
155+
}
156+
157+
return 0;
158+
})
159+
.slice(0, 15);
176160

177161
const sortedKeys = sortedEntries.map((entry) => entry[0]);
178162
const sortedValues = sortedEntries.map((entry) => entry[1]);

apps/client/assets/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"apollo-boost": "^0.4.9",
1919
"babel-preset-es2017": "^6.24.1",
2020
"babel-preset-react": "^6.24.1",
21-
"chart.js": "^2.9.4",
21+
"chart.js": "^3.2.1",
2222
"clipboard": "^2.0.8",
2323
"graphql": "^14.7.0",
2424
"graphql-tag": "^2.12.4",
@@ -46,7 +46,6 @@
4646
"three": "^0.127.0"
4747
},
4848
"devDependencies": {
49-
"@types/chart.js": "^2.9.31",
5049
"@types/react": "^16.14.5",
5150
"@types/react-dom": "^17.0.3",
5251
"@types/react-redux": "^7.1.16",

apps/client/assets/yarn.lock

Lines changed: 4 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -215,13 +215,6 @@
215215
resolved "https://registry.yarnpkg.com/@types/anymatch/-/anymatch-1.3.1.tgz#336badc1beecb9dacc38bea2cf32adf627a8421a"
216216
integrity sha512-/+CRPXpBDpo2RK9C68N3b2cOvO0Cf5B9aPijHsoDQTHivnGSObdOF2BRQOYjojWTDy6nQvMjmqRXIxH55VjxxA==
217217

218-
"@types/chart.js@^2.9.31":
219-
version "2.9.31"
220-
resolved "https://registry.yarnpkg.com/@types/chart.js/-/chart.js-2.9.31.tgz#e8ebc7ed18eb0e5114c69bd46ef8e0037c89d39d"
221-
integrity sha512-hzS6phN/kx3jClk3iYqEHNnYIRSi4RZrIGJ8CDLjgatpHoftCezvC44uqB3o3OUm9ftU1m7sHG8+RLyPTlACrA==
222-
dependencies:
223-
moment "^2.10.2"
224-
225218
"@types/color-name@^1.1.1":
226219
version "1.1.1"
227220
resolved "https://registry.yarnpkg.com/@types/color-name/-/color-name-1.1.1.tgz#1c1261bbeaa10a8055bbc5d8ab84b7b2afc846a0"
@@ -2016,28 +2009,10 @@ chalk@^2.0.0, chalk@^2.4.1, chalk@^2.4.2:
20162009
ansi-styles "^4.1.0"
20172010
supports-color "^7.1.0"
20182011

2019-
chart.js@^2.9.4:
2020-
version "2.9.4"
2021-
resolved "https://registry.yarnpkg.com/chart.js/-/chart.js-2.9.4.tgz#0827f9563faffb2dc5c06562f8eb10337d5b9684"
2022-
integrity sha512-B07aAzxcrikjAPyV+01j7BmOpxtQETxTSlQ26BEYJ+3iUkbNKaOJ/nDbT6JjyqYxseM0ON12COHYdU2cTIjC7A==
2023-
dependencies:
2024-
chartjs-color "^2.1.0"
2025-
moment "^2.10.2"
2026-
2027-
chartjs-color-string@^0.6.0:
2028-
version "0.6.0"
2029-
resolved "https://registry.yarnpkg.com/chartjs-color-string/-/chartjs-color-string-0.6.0.tgz#1df096621c0e70720a64f4135ea171d051402f71"
2030-
integrity sha512-TIB5OKn1hPJvO7JcteW4WY/63v6KwEdt6udfnDE9iCAZgy+V4SrbSxoIbTw/xkUIapjEI4ExGtD0+6D3KyFd7A==
2031-
dependencies:
2032-
color-name "^1.0.0"
2033-
2034-
chartjs-color@^2.1.0:
2035-
version "2.3.0"
2036-
resolved "https://registry.yarnpkg.com/chartjs-color/-/chartjs-color-2.3.0.tgz#0e7e1e8dba37eae8415fd3db38bf572007dd958f"
2037-
integrity sha512-hEvVheqczsoHD+fZ+tfPUE+1+RbV6b+eksp2LwAhwRTVXEjCSEavvk+Hg3H6SZfGlPh/UfmWKGIvZbtobOEm3g==
2038-
dependencies:
2039-
chartjs-color-string "^0.6.0"
2040-
color-convert "^0.5.3"
2012+
chart.js@^3.2.1:
2013+
version "3.2.1"
2014+
resolved "https://registry.yarnpkg.com/chart.js/-/chart.js-3.2.1.tgz#1a17d6a88cef324ef711949e227eb51d6c4c26d3"
2015+
integrity sha512-XsNDf3854RGZkLCt+5vWAXGAtUdKP2nhfikLGZqud6G4CvRE2ts64TIxTTfspOin2kEZvPgomE29E6oU02dYjQ==
20412016

20422017
"chokidar@>=3.0.0 <4.0.0", chokidar@^3.4.1:
20432018
version "3.5.1"
@@ -2159,11 +2134,6 @@ collection-visit@^1.0.0:
21592134
map-visit "^1.0.0"
21602135
object-visit "^1.0.0"
21612136

2162-
color-convert@^0.5.3:
2163-
version "0.5.3"
2164-
resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-0.5.3.tgz#bdb6c69ce660fadffe0b0007cc447e1b9f7282bd"
2165-
integrity sha1-vbbGnOZg+t/+CwAHzER+G59ygr0=
2166-
21672137
color-convert@^1.9.0:
21682138
version "1.9.2"
21692139
resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.2.tgz#49881b8fba67df12a96bdf3f56c0aab9e7913147"
@@ -5071,11 +5041,6 @@ mkdirp@^0.5.0, mkdirp@^0.5.1, mkdirp@^0.5.3, mkdirp@~0.5.1:
50715041
dependencies:
50725042
minimist "^1.2.5"
50735043

5074-
moment@^2.10.2:
5075-
version "2.24.0"
5076-
resolved "https://registry.yarnpkg.com/moment/-/moment-2.24.0.tgz#0d055d53f5052aa653c9f6eb68bb5d12bf5c2b5b"
5077-
integrity sha512-bV7f+6l2QigeBBZSM/6yTNq4P2fNpSWj/0e7jQcy87A8e7o2nAfP/34/2ky5Vw4B9S446EtIhodAzkFCcR4dQg==
5078-
50795044
move-concurrently@^1.0.1:
50805045
version "1.0.1"
50815046
resolved "https://registry.yarnpkg.com/move-concurrently/-/move-concurrently-1.0.1.tgz#be2c005fda32e0b29af1f05d7c4b33214c701f92"

0 commit comments

Comments
 (0)