| 6 | import Chart from "../../utils/chart"; |
| 7 | |
| 8 | class 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 |
nothing calls this directly
no outgoing calls
no test coverage detected