(Nothing fancy in regards to pie-charting. I aimed at just good enough for demonstration purposes !)
Although "web apps" would look better and perform better in pure javascript and CSS, I much prefer programming in BASIC.
This "Pie Chart Service" demonstrates how a BAM program, exported as a "Stand-Alone" program, can produce pie charts based on data provided to the program via a URL query string.
About "Stand-Alone" program export:
When you select the option to share a program as a stand-alone program, BAM exports to fairly small HTML file the BASIC program, the interpreter (i.e. all of the javascript code that interprets the BASIC program) and the HTML for the single-file web page to run in a web browser.
Share the exported HTML file by email or host it on the web, or store it locally for offline use.
The program accepts two parameters in the query string: screen mode (optional) and data.
Screen mode determines what colours are available to you in the pie chart. The screen mode options are:
12 (0-12 will be treated as 12; no screen mode specified, 12 will be assumed)
This mode will provide a 16-color palette (colour mode "p16"). Black and white reserved for the program, that will leave you with 14 colours for your pie chart. (See "About Colour Modes" for information about the ID numbers for the colours.)
17 (13-17 will be treated as 17)
This mode will provide a 64-color palette (colour mode "p256"). Black and white reserved for the program, that will leave you with 62 colours for your pie chart. (See "About Colour Modes" for information about the ID numbers for the colours.)
To view the available colours for "p16" and "p256", visit the SCREEN Modes documentation and scroll down to the "colour modes" section.
The program
- View the source code
- Run the program
- Screen mode 12 sample
- url query string: DATA=12,2,13,5,25,8,30,11,20,14,
- (screen mode 12 assumed)
- Screen mode 17 sample
- url query string: SCREEN=17&DATA=12,36,13,12,25,42,30,26,20,49,
- Screen mode 27 sample
- url query string: SCREEN=27&DATA=12,FF0000,13,550000,25,555500,30,00FF00,20,0000FF,
No comments:
Post a Comment