WebReference.com - Drawing Charts with JavaScript (1/7)
[next] |
Drawing Charts with JavaScript
By Russell Bloom ([email protected])
In this column, we will tackle a technique that is often thought to be the domain of the graphic artist or the compiled application programmer -- drawing charts -- using JavaScript.
In this column we will:
- Demonstrate the algorithm for drawing simple bar charts
- Refresh our memories on advanced array manipulation (see Peter Belesis' fine column)
- Examine one of the more powerful aspects of array manipulation -- undo functionality.
- See how to dynamically add and remove options from select elements.
- Draw some charts, and finally...
- Let the end user draw charts by entering and selecting data to chart.
I like working examples, and I like 'em on the first page:
For the sake of example, we will be charting student's scores on a test. Here we have eight students and their respective test scores. Throughout this article, we will use this example and expand upon it. Most of the techniques discussed will work in JavaScript 1.1 browsers (I dusted off the old Netscape 3.04 and made sure). All will work in JavaScript 1.2+ browsers. Ok, let's have some fun.
[next] |
Created: March 6, 2002
Revised: March 6, 2002
URL: https://webreference.com/programming/javascript/charts/