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

klaus

Expert
Licensed User
Longtime User
The xChart class and library has been update to version 7.3 in the first post.
- Amended problem with cursor when clicking on a chart with no data
- Added check in SetZoomIndexes for values out of range.
 

Alessandro71

Well-Known Member
Licensed User
Longtime User
i think there's a bug in one of the latest releases (tested with 7.2 and 7.3)
the same source, using a previous version of the library (sadly i have no history of which lib version was used, probably a 6.x) used to produce this output in XY chart


now, with latest version i have this:


just to tell if someone has faced the same issue, while i'm trying to reproduce it in a small demo project
 

klaus

Expert
Licensed User
Longtime User
I see it too, it is amended for the next update.
I have updated the files xChart.bas and xChart.b4xlib in the first post.
The next update will come quite soon.

Version number, I missed to update that one, it is amended.
 
Last edited:

Alessandro71

Well-Known Member
Licensed User
Longtime User
I see it too, it is amended for the next update.
I have updated the files xChart.bas and xChart.b4xlib in the first post.
The next update will come quite soon.

Version number, I missed to update that one, it is amended.

i can confirm the issue is solved using the updated b4xlib in the first post
may i suggest to keep version n-1 online for rapid checking of regressions?
 

Alessandro71

Well-Known Member
Licensed User
Longtime User
Sorry, I do not understand what you mean.

instead of having only the latest version in the first page, keep also at least the previous one, or even the full version history, for rapid checking of new misbehavior
 

madru

Active Member
Licensed User
Longtime User
Hi Klaus,

creating a small minimalistic 'line' chart gives me a display problem....


if DrawYScale = false then the 1st YValue is not shown



if set to true the 1st value is shown



B4X:
Sub aa11(chart As xChart,  name As String, color As Int) As xChart
    chart.ChartType="LINE"
    'chart.ChartType="BAR"
    chart.ClearData
    chart.AddLine("", color)
    chart.DisplayValues=False
    chart.DrawOuterFrame = False
    chart.DrawGridFrame=False
    chart.ChartBackgroundColor=xui.Color_White
    chart.IncludeBarMeanLine=False
    chart.IncludeMaxLine=False
    chart.IncludeMeanLine=False
    chart.IncludeMinLine=False
    chart.YAxisName = ""
    chart.IncludeLegend = False
    chart.YZeroAxisHighlight = False
    chart.Title = name
    chart.Subtitle = ""
    chart.XAxisName = ""
    chart.YAxisName = ""
    chart.DrawXScale = True
    chart.DrawYScale = True''''
    chart.DrawHorizontalGridLines = False
    chart.DrawVerticalGridLines = True
    chart.AutomaticScale=True
    Return chart
End Sub


can you double check?

THX
 

klaus

Expert
Licensed User
Longtime User
I tested your problem in the demo program, but I could not reproduce it in a first step.
Then, I saw that you also do not display the Y axis name, and in that case the first number is not displayed.
I found the problem, it has been amended for the next update.
If you have an urgent need for an update I can send you the current version. There are other additions included which need some more time before publishing.

In your code you transmit chart As xChart when you call the routine.
Then you return chart as xChart, why?
How do you call aa11 ?
And what do you do with the returned xChart ?
When you transmit a chart to the routine, this chart is known in the routine and modified according to your code, therefore no need to return it.
 
Last edited:

madru

Active Member
Licensed User
Longtime User
THX, take your time

missed your 2nd paragraph on my mobile .... mmh, no idea why I did it that way will change it
 
Last edited:

Alessandro71

Well-Known Member
Licensed User
Longtime User
The display of the values on touch event in a bar chart shows strange values
I would expect only the name and the value of the selected bar

 

Alessandro71

Well-Known Member
Licensed User
Longtime User
sure, please do not mind the actual code, since it's just a testbed
 

Attachments

  • testcharts.zip
    7.4 KB · Views: 147

klaus

Expert
Licensed User
Longtime User
The problem is here:

B4X:
    xC_bar.SetBarMeanValueFormat(1, 3, 3, False)
   
   
'    For i = 0 To cells - 1
        xC_bar.AddBar("Test", xui.Color_Blue)
'    Next
   
    Log(xC_bar.GetMaxNumberBars)
You are adding 96 bars, why !?
You must add only one !

As you want to get the max number possible of bars you could use the code below:

B4X:
    xC_bar.AddBar("Test", xui.Color_Blue)
    For i = 0 To cells - 1
        xC_bar.AddBarPointData(i, Rnd(10, 20))
    Next
    Log(xC_bar.GetMaxNumberBars)
 
Last edited:

Alessandro71

Well-Known Member
Licensed User
Longtime User
My fault: I assumed that a chart with 96 bars would need 96 bars, each one with a single value, rather than a single bar with 96 values.
thank you
 

klaus

Expert
Licensed User
Longtime User
The xChart class and library has been update to version 7.4 in the first post.
Added AREA and STACKED_AREA charts.
Added AreaFillAlphaValue for the fill color for RADAR, AREA and STACKED_AREA charts.
Amended some bugs .
 

adriano.freitas

Active Member
Hi! This library is fantastic! Congratulations to the developer!
I just have a little problem. My layout uses dark background colors. I need to change the color of the subtitles text in the stacked bars chart. Does not work! Is there a problem with this library property?
Another good idea would be to be able to change the color of the panel that appears by clicking on the graphic! Thank you very much!
 

klaus

Expert
Licensed User
Longtime User
What exactly does not work ?
I tested with the demo program and the SubtitleTextColor property works as expected in both, the Designer and in the code:
Can you upload a small project showing the problem?
What kind of color would you like to see.
Currently the color is a semitransparent white.
 

adriano.freitas

Active Member
The property that isn't working is LegendTextColor and not SubtitleTextColor. In the bar graph (stacked), I put the background black and the subtitle letters are also black, I can't change it. As for the suggestion of the panel, I put the white grid with paler colors for the bars, so when you click on the chart, the panel that appears with information is white, semi-transparent, which in this case is confusing. It would be nice if there was a way to set the background color.
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…