User:Ndoiron/SocialCalc
Charting improvements to the SocialCalc Activity.
Pie and line charts are produced with the same steps as bar charts in the current version.
This page serves as a guide/lesson plan for producing different types of charts.
Bar Charts
The current version of SocialCalc supports bar charts. You can use a bar chart to compare different values to each other.
Pie Charts
You can use a pie chart to compare fractions making up the whole.
Line Charts
You can use a line chart to see a value change over time, compare multiple values over time, or show the relationship between any two variables.
Programming Notes
The chart is generated twice, using the HTML Canvas element and the Google Charts API. This allows users to view charts while offline, with the more professional chart images possible with an internet connection.
When programming the Canvas element, use deprecated Mozilla-specific code such as mozDrawText and mozTextStyle - newer methods like fillText are not supported by the laptop.
The Google Charts API produces a professional chart image, but has some quirks. The parameters for the chart are written at the same time as the graph is drawn onto the canvas.