The original and popular Chartmaker extension has been in use by AI2 developers for years, and has provided a quick method to generate simple charts for pie, bar or line.
This extension is a complete rewrite of the original, builds on what was there, and offers many new features:
- two new charts: column and table
- a boolean to turn zoom on and off
- exposes the ability to add other options
- simplifies data compilation - straightforward and user-friendly lists of lists
- returns selected data to the app through the webviewstring
- works with the custom webview extension
- multi bar and column charts now possible
- under the hood, deletes the chart html once chart is rendered
The extension uses "classic" google charts, the material charts on offer are less featureful.
- Latest Version: 3.0
- Tested: This has been tested on App Inventor 2 using Android 10 and 12 devices, companion 2.62, and compiled apk. It may work on other derivatives....
- Released: 2021-07-02T23:00:00Z
- Last Updated:2021-12-07T00:00:00Z
- Built: Using the Rush Extension Builder by @Shreyash
Please note there was a small update with V3 with the addition of a
css socket to all the chart types (there already was one for the Table Chart)
I could write a book about how you might use this, the configuration options for google charts appear to be endless (which is why Mills College did such a good job of keeping it simple!). In essence all chart blocks require a webviewer, a data table, and a selection for whether the user wants the chart to zoom on the screen when dragged (the plus and minus zoom buttons). After that it is about configuration. For each chart I have shown a few ideas of what can be done, and provided a link to the specific documentation for each chart. Syntax is important.
- Pie Chart
- Table Chart
- Bar Chart
If you test the aia, you will see that this chart is also animated. The data blocks are for the second chart, and show how to set the colour of the bars for a single row of data.
- Column Chart
- Line Chart
- Using Custom Webview
You will need to bring in the custom webview extension, Below are the blocks required to show a pie chart (you will also need the custom webview webviewstring change block to get data feedback):
The order of the blocks is important...
AIX (v3k1) AI2 & Kodular: uk.co.metricrat.chartmakerplusv3k1.aix (10.0 KB)
AIX (v2k1) AI2 & Kodular: uk.co.metricrat.chartmakerplusv2k1.aix (9.9 KB)
AIA (V1) AI2 only: ChartMakerPlusDemoV1.aia (43.9 KB)
JAVA (V1) AI2 only: ChartMakerPlus.java.txt (18.8 KB)
- V1 - initial release
- V2k1 - updated to provide for file access in Kodular
- V3 - small update to add a css socket to all chart types. See here for usage
7. Bits and Bobs
- Also see Strings and Numbers further down for information about handling numbers as strings in the
- ChartMakerPlus relies on json arrays (lists with square brackets) to send to Google Charts. Ensure that
ShowListsAsJsonis ticked in Screen1 properties in the designer (or convert your round bracket lists to square bracket lists)
Enjoy :D, and all feedback and comments welcome.
Available for use in any MIT AppInventor projects or competitions