Statistics 2.0
The Statistics add-on has received a complete re-write in order to add support for showing charts and statistical data on the front end of your website. The add-on comes with pre-set types of data that you can select to show either as a table or using charts (or both).
Depending on your websites size or the number of transaction it processes, querying these data can be “expensive”. So to minimize load on your database, results are “cached”. By default, these data is updated each time a users balance changes or if a log entry is added / edited / deleted. But you can also select if you want to store data longer and only update it once an hour, every six hours, twice a day or once a day. This way, sites with large number of transactions will not need to query new stats on every transaction.
All charts are powered by Charts.js 2.7.0
New Shortcodes
You can create charts using the following new shortcodes:
Chart Types
Depending on which shortcode you select to use, you can choose between: Line charts, Bar Charts, Radar Charts, Pie Chart, Doughnut Charts and Radial Charts.
New Settings
As of version 2.0, the Statistics add-on will have it’s own tab on the settings page. This is where you can set optimization options and colors for each point type.
For Developers
The new myCred_Chart object has been added to help render charts. When using this object, we render canvas elements where the chart will be rendered, while the actual data is populated under the $mycred_charts
global. This global is then fed to Chart.js in the footer of the website. This means that charts will not render if the wp_footer function is used!