MCPcopy Create free account
hub / github.com/DesignRevision/shards-dashboard-react / UsersOverview

Class UsersOverview

src/components/blog/UsersOverview.js:8–118  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6import Chart from "../../utils/chart";
7
8class UsersOverview extends React.Component {
9 constructor(props) {
10 super(props);
11
12 this.canvasRef = React.createRef();
13 }
14
15 componentDidMount() {
16 const chartOptions = {
17 ...{
18 responsive: true,
19 legend: {
20 position: "top"
21 },
22 elements: {
23 line: {
24 // A higher value makes the line look skewed at this ratio.
25 tension: 0.3
26 },
27 point: {
28 radius: 0
29 }
30 },
31 scales: {
32 xAxes: [
33 {
34 gridLines: false,
35 ticks: {
36 callback(tick, index) {
37 // Jump every 7 values on the X axis labels to avoid clutter.
38 return index % 7 !== 0 ? "" : tick;
39 }
40 }
41 }
42 ],
43 yAxes: [
44 {
45 ticks: {
46 suggestedMax: 45,
47 callback(tick) {
48 if (tick === 0) {
49 return tick;
50 }
51 // Format the amounts using Ks for thousands.
52 return tick > 999 ? `${(tick / 1000).toFixed(1)}K` : tick;
53 }
54 }
55 }
56 ]
57 },
58 hover: {
59 mode: "nearest",
60 intersect: false
61 },
62 tooltips: {
63 custom: false,
64 mode: "nearest",
65 intersect: false

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected