Moves pie chart generation logic to frontend

Takes the logic from the flask backend used to initialize pie chart to
frontend. Allows code reuse to update table data and pie chart