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

LucaMs

Expert
Licensed User
Longtime User
1) Luca, are you kidding me?
Absolutely NEVER !!!

Must I really post 'What error do you get' like for newbies?
I don't remember what error I got because I was doing other things and don't remember why I tried to change the chart size at runtime (I really don't needed this)

Do you have a concrete example of a chart where you need different strokes or line types in the SAME line ?
I've explained badly, probably; I don't need different strokes nor line types in the same line but in a single chart.
Having 6 lines in a lines chart, which are 2 groups of 3, paired (damned English, lol):
Group of lines a, b, c
Group of lines a1, b1, c1
(have to "compare" a to a1, b to b1, c to c1 and the lines should appear as part of their related group)

Also, I am ("fortunately" I'm not the only one) slightly color-blind, colors only are not enough.

Trying to draw something...


 
Last edited:

LucaMs

Expert
Licensed User
Longtime User
Klaus, do not hit me, I found another bug (lines chart - I'm using this your great view and my app is almost complete).

You can see it in the project I'm attaching. It is yours with a few changes; you can see what happens by clicking on the Activity.

If you set the legend to bottom, all it's ok if you draw more than one line but if you draw one line only the chart overlaps the x axis text.
 

Attachments

  • ChartsDemoBug.zip
    18.8 KB · Views: 842

klaus

Expert
Licensed User
Longtime User
Thank for the bug report!
Klaus, do not hit me ...
I will never complain about bug reports!
As a developper, it's almost impossible to test everything.
Therefore I am open to and welcome bug reports, this is the good way to improve programs!

Tomorrow I will publish an update with new features, the bug above is amended.
 

LucaMs

Expert
Licensed User
Longtime User
Klaus, do not hit me,
Therefore I am open to and welcome bug reports, this is the good way to improve programs!
Anyway, if you wanted to...:




Fighting with a simple CLV (chart color preferences), maybe I found something strange:
B4X:
Public Sub setScaleTextColor(Color As Int)
    Texts.ScaleTextColor = xui.PaintOrColorToColor(Color)
End Sub

I don't see places where ScaleTextColor is used.

[I still have to "understand" what colors I have to allow the user to change - bad English, I know ]
 
Last edited:

LucaMs

Expert
Licensed User
Longtime User
Well, next time I will add a post in the concerned thread.
Thank you, Klaus.

I changed something because I "needed" to pass a list instead of an array to AddLineMultiplePoints.
My routine now looks so:
B4X:
'adds multiline points data
Public Sub AddLineMultiplePoints(X As String, lstData As List, ShowTick As Boolean)
' lm version
    If Points.IsInitialized = False Then Points.Initialize
    Private PD As PointData
    PD.Initialize
    PD.X = X
    Dim YArray(lstData.Size) As Double
    For Q = 0 To lstData.Size - 1
        YArray(Q) = lstData.Get(Q)
    Next
    PD.YArray = YArray
    PD.ShowTick = ShowTick
    Points.Add(PD)
End Sub


I think that you could do it better than me, to keep compatibility (AddLineMultiplePoints2 - "List version").
 

klaus

Expert
Licensed User
Longtime User
The xChart Class has been updated to version 1.4.
Added GradientColors.
In B4i, the gradient colors for pie charts don't work yet. The FillRadialGradient routine is not yet in the iBitmapCreator library.



 
Last edited:

Kevin L. Johnson

Member
Licensed User
Longtime User
Is it possible to produce an XY scatter plot like for plotting Latitude, Longitude Coordinates?

By the Way … Great Work! … Such a blessing to have B4X, and experts such as Klaus and Erel and others willing to give so much of their time and efforts! Incredible!
 

Peter Simpson

Expert
Licensed User
Longtime User
Hello @klaus,
Firstly thank you for these extremely simple to implement charts (xCharts),

Today decided to implement your xCharts into a clients app, but i have a couple of questions. The chart below auto-generates each months data for the current year as the month is reached, from start to finish it only took about 90 minutes to implement and I've never used this custom view before, it works really well.

Questions:
1.
When touching the screen and the following line below is set to False , I'm under the impression that the x = value and y = value legend box (top left in screen shots below) should not in fact appear. Am I missing something obvious or does this method not apply to the bar chart.
B4X:
MixCountBarChart.DisplayValues = False

2. If you looks at January below in the 2 screen shots, you can see that because there was no data for January, the value is in fact zero. The zero is actually displayed below the actual x axis line for 0, so zero overlaps the word January.

EDIT: I tried quickly cheating by using MixCountBarChart.XScaleTextOrientation = "45 DEGREES", but the 'y' in 'January' is still under the zero.

10" Tablet


7" Tablet


Thank you...
 
Last edited:

klaus

Expert
Licensed User
Longtime User
1. You didn't miss anything!
I missed to add the method.
In Sub DrawItemValues add the line below.
Private Sub DrawItemValues(x As Int, y As Int)
If Values.Show = False Then Return


2. In Sub DrawBarValues replace line 1114
If h > 0 Then
by
If h >= 0 Then

An update with a new YX chart will come soon.
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…