B4J Tutorial Charts Framework

The attached project is a port of Basic4android charts framework: http://www.b4x.com/android/forum/threads/android-charts-framework.8260/#content

SS-2013-11-20_16.48.12.png



SS-2013-11-20_16.48.30.png


Note that this example uses a TabPane. TabPanes are currently not wrapped as a B4J type. However you can still use them with the help of the Scene Builder.

Another important point is the way we add the Canvases to each of the panes.
We want the canvas to fill the pane.

Usually the best way to do it is by setting all the anchors to 0:
B4X:
AnchorPane.SetAnchors(SomeNode, 0, 0, 0, 0)
However the automatic layout only works with resizeable nodes. Canvas and ImageView are not resizable. This means that we need to explicitly set the width and height.
B4X:
panePie.AddNode(cvs, 0, 0, panePie.PrefWidth, panePie.PrefHeight)
We use PrefWidth and PrefHeight instead of Width and Height as the Width and Height of the tab panes are not available when the layout is created. They will only later be available.


This example requires v1.00 BETA 3+.
 

Attachments

  • Charts.zip
    5.1 KB · Views: 1,593
Last edited:

positrom2

Active Member
Licensed User
Longtime User
Where in the B4J code is the action defined that determines the plot types to be shown?
 

positrom2

Active Member
Licensed User
Longtime User
Are the different charts after having been created by the B4J code sent to the foreground just by JavaFx upon clicking on the respective tab?
Is the click event seen in the B4J code? In Debug mode, nothing happens after Appstart has finished.
 

positrom2

Active Member
Licensed User
Longtime User
I see the different chart screens -the program works as to be expected, I did not modify it.
I just wanted to understand what happens when I click on a tab.
In B4A, a click event would be handled by the code.
Here, I don't see a Sub to handle an event.
 
Top