Automattic / ghactivity

WordPress plugin. Build reports of all your GitHub activity.
https://wordpress.org/plugins/ghactivity/
6 stars 2 forks source link

Charts: refactor the way chart data is added to each chart #6

Open jeherve opened 6 years ago

jeherve commented 6 years ago

When I started working on the plugin, my idea was to have a central place where the chart js was enqueued: https://github.com/jeherve/ghactivity/blob/master/charts.ghactivity.php

And then feed the data for each chart with filters: https://github.com/jeherve/ghactivity/blob/master/charts.ghactivity.php#L68 https://github.com/jeherve/ghactivity/blob/master/reports.ghactivity.php#L24

This may not be the best approach as we add more places and shortcodes where the charts can be displayed, with different data needed in each.

brbrr commented 6 years ago

As part of https://github.com/Automattic/ghactivity/pull/16, I added chartJS as yarn dependency (together with React wrapper) and added an API endpoint to get the data. This approach may be a bit verbose, but it is much understandable for me.

If we plan to move to React, I think we should stick with api-based approach.