Chartjs-Statistics page โ€“ Load every stats <div> one by one

1๐Ÿ‘

โœ…

You need to

  1. Move / copy the block you have in your $(document).ready above into your AJAX callback.

  2. Replace the (currently hardcoded) array with your AJAX result (reformatting if necessary into a flat array)

  3. Attach an onclick event handler for your refresh button that

    1. Calls a .destroy() on the corresponding chart instance

    2. Replaces the canvas element with your loading icon

    3. Does the AJAX call (that has the callback from Step 1 above)

  4. In Your AJAX callback handler, you replace the loading icon with the canvas before doing the remaining steps (from Step 1 above) to (re)initialize the chart

Leave a comment