Charting library

agraham

Expert
Licensed User
Longtime User
A charting library that can produce Bar, Line and Pie charts with an optional legend. Also the capability of saving images in several formats. Help file included. Requires .NET 2.0 and for the desktop only. I tried to port it to the device but had to give up. There is no GDI+ on the device and it would have been too big a rewrite. Also the bit of code that I (sort of) got working showed that the device really doesn't have enough resolution for this.

No credit to me for the charting code. It is some example Microsoft code from 2002 that I have taken, debugged, marginally ehnanced and written a Basic4PPC front end.

EDIT :- Device library and updated help added to zip.

EDIT :- Version 1.1 posted with X axis "tick" bug fixed http://www.b4x.com/forum/questions-...ce-dll-thick-line-bottom-chart.html#post20472

EDIT :- Version 1.2 posted, ChartsDevice is now VGA aware when used with Basic4ppc version 6.80 or later. See post #24.
 

Attachments

  • Charts1.2.zip
    63.3 KB · Views: 443
Last edited:

Erel

B4X founder
Staff member
Licensed User
Longtime User
Nice job:

Picture1.jpg


Picture2.jpg


Picture3.jpg
 

yildi

Member
Licensed User
Thank you very much Agraham! This was an old wish of mine (I have already suggested this to Erel in a post). We will be totally spoiled if a device version of this library (or a similar one) can be developed. Any idea Erel?

Regards,
Murat
 

agraham

Expert
Licensed User
Longtime User
We will be totally spoiled if a device version of this library (or a similar one) can be developed.
Regard yourself spoiled. After starting over five times I finally made it work acceptably on the device. A few quirks probably remain. The device version is now posted in the zip together with the desktop version and an updated help. Because of the limited resolution on the device you may have to play around with properties a bit in order to get an acceptable chart.
 

yildi

Member
Licensed User
Regard yourself spoiled. After starting over five times I finally made it work acceptably on the device. A few quirks probably remain. The device version is now posted in the zip together with the desktop version and an updated help. Because of the limited resolution on the device you may have to play around with properties a bit in order to get an acceptable chart.

Wow Agraham,
I definitely feel spoiled! Thank you very much for this new library :sign0098:

Best regards,

Murat
 

Heinz

Active Member
Licensed User
Longtime User
How can i print out the image (chart) in my program ?
i don't want save it as image and print it with paint etc.
 

agraham

Expert
Licensed User
Longtime User
How can i print out the image (chart) in my program ?
i don't want save it as image and print it with paint etc.
Use the latest version (1.5) of my desktop only printing library here http://www.b4x.com/forum/showpost.php?p=8057&postcount=27

Use

CopyImageToClipboard(Img AS Image) : Copies the specified image to the clipboard from where it may be pasted into a document. Image can be any source of an image in Basic4PPC. .e.g. Form.Image or ImageControl.Image or ImageList.Item(x) etc.

And then

PasteBitmap : If there is a bitmap on the clipboard it will be pasted into the RichTextBoxDesktop object. No control is available over size so some experimentation will be necessary to get the required result.

You can do loads of other pretty stuff with text as well.
 

Heinz

Active Member
Licensed User
Longtime User
hello agraham,
this was a brilliant idea.
with only a few commands.

Thank you verry much.

B4X:
Sub Button3_Click
    RT.New1("Form1", 10, 310, 570, 180)
    RT.Clear
    RT.Visible = False
    RT.CopyImageToClipBoard(Image1.Image)
    RT.PasteBitmap
    RT.PrintPreview
End Sub
 

davelew1s

Active Member
Licensed User
Longtime User
Help file

Hi!
I have only just found this charting library..and it works great but when I open the help file it says 'Page cannot be displayed', all other help files work OK... any help on help?
Dave.
 

Bobbes

Active Member
Licensed User
Longtime User
Thanx agraham,
that is very usefull for a Programm to displayed Weather or Bloodpresuredates

Regards Bernd
 

klaus

Expert
Licensed User
Longtime User
Hi Andrew,

In looking at Paulsche's question in the German forum, I was 'playing' a bit with the Chart library and more specifically with LineChart.

Is there a reason why the MinScaleValue, MaxScaleValue and GridSpacingValue are Integer values, could these become Double?

With MaxScaleValue = 1.2 I would have expected GridSpacingValue = 0.2 but it is rounded to 0.

With MaxScaleValue = 1.2 without a line the MaxScaleValue becomes 1
With MaxScaleValue = 1.2 and with a line with a max point value of 1.05 the MaxValue in the graph becomes this value and the GridSpacingValue on the graph the tenth but reading the MaxScaleValue and GridSpacingValue parameters these are rounded to an integer value.
It seems that the values on the graph can be Doubles.

The XAxisIntervalValue is a Double, but in the AddXAxisText method the interval values are integers. Could these also be changed to Doubles ?

Attached the test program I payed with.

Best regards.
 

Attachments

  • TestLineChart.sbp
    3.6 KB · Views: 25
Last edited:

agraham

Expert
Licensed User
Longtime User
Is there a reason why the MinScaleValue, MaxScaleValue and GridSpacingValue are Integer values, could these become Double?
I tried the obvious and redeclared them as double but after fixing all the compilation errors about incompatible types it didn't work so deep down in the code (which is based on a Microsoft graphics example from the early days of .NET) there are probably some assumptions about integer working burnt in.

There's quite a lot of interdependent code in there, particularly that concerned with scaling, so I'm afraid that I am not going to start digging around as it would take too much time to relearn what's going on.
 

Paulsche

Well-Known Member
Licensed User
Longtime User
Linechart XaxisText in Kollision with Y Zero Value

Hello Agraham,

I have my program converted to VGA, now is the line chart as shown, that the text in the X axis of the zero value of Y axis superimposed.

Can I change the Y position of the text of the X axis somehow change?
 

Attachments

  • capture001.jpg
    capture001.jpg
    49.7 KB · Views: 44
Top