B4J Library [B4X] [XUI] xChart Class and b4xlib

klaus

Expert
Licensed User
Longtime User
Can you test the attached project.

Note: "STACKED_BAR" has not Y axis values. ..
Thank you for reporting it.
I had seen it a few days ago and amended it for version 3.2, not yet published.
I will update the whole with the modifications in the project above.
 

Attachments

  • charttest1.zip
    74.7 KB · Views: 443
Last edited:

Tayfur

Well-Known Member
Licensed User
Longtime User
Can you test the attached project.


Thank you for reporting it.
I had seen it a few days ago and amended it for version 3.2, not yet published.
I will update the whole with the modifisations in the project above.

Thank you so much @klaus
Now its work . I seen your added lines on chart class.
 

klaus

Expert
Licensed User
Longtime User
How and where do you set the transparent background color?
Transparent background color works.
If you set it in the Designer.
If you set it in the code, you should set it before xChart.DrawChart.
Setting it in the code, doesn't work with B4J.

What do you expect with a transparent background color?
What you see is the backround of the parent view, if its color is white you see white.
 

rraswisak

Active Member
Licensed User
How and where do you set the transparent background color?
I set in Chart background color property at design time with a color and alpha value set to 0

What do you expect with a transparent background color?
my app has image background behind the chart, so i think it would be nice it the chart background following the app background.

i have manually replace set background color in DesignerCreateView sub just to make sure that transparent color will work with this:
B4X:
    Graph.ChartBackgroundColor = xui.Color_Transparent  'xui.PaintOrColorToColor(Props.Get("ChartBackgroundColor"))

and yes it does, the background has transparent color.

Perhaps there should be one property (boolean) for user if willing to have a transparent background color or not. some thing like this:
B4X:
If IsTransparentBackground = True Then
    Graph.ChartBackgroundColor = xui.Color_Transparent
Else
    Graph.ChartBackgroundColor = xui.PaintOrColorToColor(Props.Get("ChartBackgroundColor"))
End If

btw, thanks for the sharing this great xChart, indeed i will use it for my current and further app development. and the gradient color is so eye-catching
 

Peter Simpson

Expert
Licensed User
Longtime User
Hello @klaus,
I was just wondering is there a way to make the top of the actual chart start a bit lower. The reason being is that I would like to use CRLF in the title to have two lines of text at the top. When I use CRLF I do in fact get the two lines of text that I'm looking for but the second line runs into/below the chart border line at the top of the screen.

If you have the title and put a CRLF in the middle of the title you will soon see what I'm trying to explain.

Thank you...
 

klaus

Expert
Licensed User
Longtime User
I had never thought adding a second line in the title with CRLF.
Is the second line a kind of subtitle or is the title text too long?
I could add a SubTitle property, with a somewhat smaller text size.
Or check the number CRLF characters and adjust the grid size.
Personally, I would prefer a SubTitle.
 

Peter Simpson

Expert
Licensed User
Longtime User

Hello Klaus,
We wanted to use a second line as a subtitle. The first part/line is the item name, the second part/line the company name, the very bottom text at the bottom of the page is already being used to display the chart period including the grand total.

Thank you...
 

klaus

Expert
Licensed User
Longtime User
Hi Peter, can you please test the attached class?
I added following properties: Subtitle, SubtitleTextSize, SubtitleTextColor.

EDIT: 2019.01.12 Removed the file, obsolete.
 
Last edited:

Peter Simpson

Expert
Licensed User
Longtime User
Hi Peter, can you please test the attached class?
I added following properties: Subtitle, SubtitleTestSize, SubtitleTextColor.

Hello Klaus,
I've tested the class but I do not see Subtitle, SubtitleTestSize or SubtitleTextColor properties. I've removed the chart from the designer, added it back into the designer and hit save, you know all the usual stuff. I can see that you've added the properties but I can't access them.


Thank you.
 

Peter Simpson

Expert
Licensed User
Longtime User
Just one more question.
Would it be possible to allow the values in the barchart to display vertically as well as horizontally which is how they are currently displayed.

The reason why I ask is that the client need to view a daily orders chart, 20 bars the text values are starting to get a bit close to the outer bar edge, displaying the barchart values vertically would cure that issue.

Thank you @klaus
 

Peter Simpson

Expert
Licensed User
Longtime User
I added following properties: Subtitle, SubtitleTestSize, SubtitleTextColor.

Hello Klaus,
Of course I've got it now, you clearly said the word properties (as in designer) and not the word method (as in code), I missed that completely. It only just came to me whilst I was doing a quick 17 mile bike ride, I'm back now. How the strangest things that pops into ones mind when not actually coding.

Sorry about that Klaus.
 

klaus

Expert
Licensed User
Longtime User
Don't worry, I understood your concern when I wanted to modify the property in the code and saw that it was missing!
The update is almost finished, needs still some 'fine tuning'.
Just to show the progress:



I will draw a background for the text when it is outsides the bar.
And there are still some special cases when the space between the 0 axis and the chart border is too small.

But, I have to leave now, to do some work in my daughters house.
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…