User:Ndoiron/SocialCalc/Mongolian
Charting additions to the SocialCalc Activity.
Test the code with a Firefox browser here
For all Charts
- 1) Select a row or column of numbers
- 2) Click the Graph tab
- 3) Select a graph type
- 4) Click the OK button
Continue reading for examples of each chart type.
Bar Charts
You can use a bar chart to compare different values to each other.
For example, you can make a bar chart that compares the lifespan of different animals.
- 1) Make a list of animals
- 2) To the right, make a list of animals' lifespans
- 3) Click and drag to highlight the list of numbers
Click the Graph tab, select the Vertical Bar Chart type, then click OK.
Click Graph or OK again to change the colors in the chart
Also try the Horizontal Bar Chart type - which works the same way but has bars in a different direction:
Pie Charts
You can use a pie chart to compare fractions making up the whole.
For example, you can make a pie chart that shows how people divided for a vote on their favorite class.
- 1) Make a list of classes
- 2) To the right, put a count of how many people voted for that class
- 3) Click and drag to highlight the list of numbers
Click the Graph tab, select the Pie Chart type, then click OK.
Click Graph or OK again to change the chart colors.
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.
For example, you can make a line chart showing how temperature of water changes as it is heated.
- 1) Make a list of times (they do not need to be equally spaced)
- 2) To the right, make a list of temperatures
- 3) Click and drag to highlight the list of numbers in the right column
Click the Graph tab, select the Line Chart option and click OK.
Without a list of x-values in the left column, the points will be placed at [0,1,2,3...)
You can also make a line chart with more than one line (more than one data set). Click on the Edit tab and add a second list of numbers below the first list.
This example shows the temperature of a block over time. The experiment with this block takes longer and is measured at different intervals.
Select the entire column of numbers, press the Graph tab, and click OK.
SocialCalc draws a second line when the next X value is less than the current one. If you were graphing a line from (1,0) to (2,0) and a line from (3,1) to (4,1) you would need to list the rightmost line - (3,1) to (4,1) - first.
Graph Window
The line chart will set the window to fit your data. You can set the window yourself (X Min, X Max, Y Min, Y Max) in the textboxes above the chart. For example, you can set Y Min to zero so that the X-axis is visible in your chart.
Clicking OK resets the window, and clicking Graph will change line colors without changing the window.