Last week I broke down the Chart Project into three milestones. The first one:
Create a page to efficiently display real-time incoming data
This week I concentrated on the “efficiently” part of that requirement and have put off the “real-time incoming data” part until next week. I will summarize the progress here:
- I installed this plugin: Ninja Page Categories and Tags. This allows me to add categories to static pages in WordPress. This will come in handy because I only want to load certain scripts for certain types of pages.
- Then I added the following code into my theme specific “functions.php”Note that the category needs to be “Test Charts” in order for both scripts to load/execute. The ‘highcharts’ script is provided by HighCharts JS.
- I found the ‘firstchart’ script either on a forum or example from HighCharts. It was suggested that I put it in the header for all pages, but this would violate the “efficiently” requirement mentioned above. Instead I broke it out into its own JS file located at the path shown above.
- Now all that is required for a page (or post for that matter) to use HighCharts is the following:
That summarizes where we are now. Here’s our test chart: