JavaScript GraphingDynamic Chart Creation from Datasets |
9
Summary
Using JavaScriptA language that can run in the browser to make websites interactive. classes to create customized bar charts based on the supplied dataset.
Overview
Implementation
Create Dataset Directory
The Datasets folder was created under the root folder (not the public folder) to hold the json file to be used supply data to the graphs in the Visualization and Dataset view pages.
- Dataset/001_Hospital_Contact_Network - Holds the first publicly available dataset to be analyzed on the site.
- Dataset/TestSample - Holds sample data used to illustrate graphs in the Visualization pages.
Modify Database Objects
- FACT_CONTENT - Add Script Text column to Content table.
- CONTENT_UPSERT - Modify Content upsert procedure to handle the new Script column.
- LKP_CONTENT_TYPE - Add Dataset and Visualization records to the Content Type table.
Modify Content Model Class
App/Models/Content.php - Modify Content model to include Script text.
Modify Controller Classes
- App/Core/Controller.php - Modify the core controller superclass to include a function that returns the content of a specified file in the Dataset folder. This function is to be called asynchronously via Javascript in order to retrieve the datasets used to generate graphs.
- App/Controller/Editor.php - Modify the Content EditorDevelopment of the code to support the editing of the site's content via an Editor page. to handle editing the new Script column.
- App/Controller/Dataset.php and App/Controller/Visualization.php - Create new controllers to manage the display of the subject area index and individual entries
Create / Modify View Files
- App/Views/Dataset and App/Views/Visualization - Add Dataset and Visualization pages.
- App/Views/base.html - Add Dataset and Visualization links to the menu.
- App/Views/Editor - Add Script textbox to Editor.
Create Visualization Directory & Files
Create the Visualization folder in the root directory.
- Visualizations/src - New folder to hold JavaScriptA language that can run in the browser to make websites interactive. class files representing SVG shapes, datasets, scales, chart areas, and graphs.
- Visualizations/jasmine - Location where JasmineA library used to automate unit testing of Javascript code. is installed and JavaScriptA language that can run in the browser to make websites interactive. testing specifications and HTML specification runners are kept.
- Visualizations/combine - Location of PHPServer-side scripting language for web development. script that consolidates all the JavaScriptA language that can run in the browser to make websites interactive. class files into a single module file in the public directory.
Create / Modify CSS Files
- public/css/tbd-base.css - Modify CSS to handle new subject area layouts.
- public/css/tbd-chart.css - Create new CSS file to apply formatting to SVG shape elements in charts.