From 1d0456089fa3732f812d88d41b7e10497f00f744 Mon Sep 17 00:00:00 2001 From: Tanner Collin Date: Fri, 1 May 2020 01:22:26 +0000 Subject: [PATCH] Add graph of signup counts --- webclient/src/Charts.js | 42 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) diff --git a/webclient/src/Charts.js b/webclient/src/Charts.js index eff4c24..44ca99f 100644 --- a/webclient/src/Charts.js +++ b/webclient/src/Charts.js @@ -1,14 +1,16 @@ import React, { useState, useEffect, useReducer, useContext } from 'react'; import { BrowserRouter as Router, Switch, Route, Link, useParams, useHistory } from 'react-router-dom'; import { Button, Container, Checkbox, Dimmer, Divider, Dropdown, Form, Grid, Header, Icon, Image, Menu, Message, Segment, Table } from 'semantic-ui-react'; -import { LineChart, Line, XAxis, YAxis, CartesianGrid, Tooltip, Legend, ResponsiveContainer, ReferenceLine } from 'recharts'; +import { BarChart, Bar, LineChart, Line, XAxis, YAxis, CartesianGrid, Tooltip, Legend, ResponsiveContainer, ReferenceLine } from 'recharts'; import { apiUrl, statusColor, BasicTable, staticUrl, requester } from './utils.js'; import { NotFound } from './Misc.js'; let memberCountCache = false; +let signupCountCache = false; export function Charts(props) { const [memberCount, setMemberCount] = useState(memberCountCache); + const [signupCount, setSignupCount] = useState(signupCountCache); useEffect(() => { requester('/charts/membercount/', 'GET') @@ -19,6 +21,15 @@ export function Charts(props) { .catch(err => { console.log(err); }); + + requester('/charts/signupcount/', 'GET') + .then(res => { + setSignupCount(res); + signupCountCache = res; + }) + .catch(err => { + console.log(err); + }); }, []); return ( @@ -68,6 +79,35 @@ export function Charts(props) {

The Green Count is the amount of Prepaid and Current members.

+
Signup Count
+ +

Monthly for the last sixteen months.

+ +

+ {signupCount && + + + + + + + + + + + + } +

+ +

The Signup Count is the number of brand new account registrations per month.

+ ); };