Android Tutorial Android Charts Framework

Status
Not open for further replies.

Erel

Administrator
Staff member
Licensed User
The purpose of this framework is to allow you to easily add different types of charts to your projects.
The current version supports pie charts, line charts and bar charts.

The framework is implemented as code modules. You are free to customize the code as needed.

I also recommend you to go over the code. It demonstrates several concepts including: usage of custom types, drawings, string measurements and region clipping.









The code module is attached as part of the example project.
Questions, comments and suggestions are welcomed.

Klaus has posted a version that includes automatic scaling: http://www.basic4ppc.com/android/forum/threads/android-charts-framework.8260/page-7#post-240181
 

Attachments

Last edited:

Erel

Administrator
Staff member
Licensed User
First post was updated with a new version. This version adds support for line charts.
A line chart can show a single line or multiple lines.
Some notes about the line chart:
- The X axis values are treated as strings.
- The Y axis values are treated as numbers.
- The data is added by adding the next X point. For this point you need to supply the Y value in case of a single line, or an array of Y values in case of multiple lines.

The code in the first post demonstrates both a single line and multiple lines charts.

All the drawing code is included in the Charts module. You are free to customize it as needed.
 

tresor

New Member
Licensed User
Vertical lines

Hello, I´m trying to draw a vertical line in a multiline chart, like changes between 0 and 1 in binary code or like a rectangle with vertical lines. When I use the multiline chart facilities of B4A and I plot a new point, the x-axis value is incremented 1 step so I never get a vertical line but a slope. Does anyone know how to draw a vertical line in a multiline chart? Thank you in advance.
 

tresor

New Member
Licensed User
Thanks. I´ve got it. At the end of "Sub Create2LinesTab" I appended a sentence LD.Canvas.DrawLine() and it works. Also I put a sentence LD.Canvas.DrawCircle() and it works also.
 

Nyptop

Active Member
Licensed User
I get the error 'Error description: Unknown type: graph Are you missing a library reference?'. Any suggestions?

Thanks
 

Nyptop

Active Member
Licensed User
Thanks Erel,

One question still though: How is the layout laid out? I'm having problems knowing what to do with panels.

Thanks Again,

Neil
 

klaus

Expert
Licensed User
As Erel already told you, you need to add the Chart module.
You need to download the Charts.zip file in the first post.
Then add the the Charts.bas file into your project with Project/Add Existing Module.

Best regards.
 

Nyptop

Active Member
Licensed User
Sorry, I have added chart module etc. Just uploaded the wrong one. Here is the correct one.
 
Status
Not open for further replies.
Top