B4J Question xChartLite StackedBarChart - resizing charts with multiple bars vs single bar

Chris2

Active Member
Licensed User
Longtime User
I've been playing with the excellent xChartLite library and have come across what appears to be an inconsistency with the drawing of the Stacked Bar Chart.

If I have two Stacked Bar Charts on a form both displaying the same number of points, one with multiple (stacked) bars, one with only a single bar, then when reducing the chart width the chart with multiple bars disappears before the other one.

I understand the 'Bar width = too small !!! Drawing of Bar chart skipped' issue, and have no problem with that. But I would have thought that these two charts have the same number of bars and so should 'disappear' at the same width. They both return the same xchart.GetMaxNumberBars figure.

I've attached a small example.
If you slowly decrease the width of the form you'll see that the top chart disappears at some point while the bottom one remains.

Given that both charts are displaying 50 bars, shouldn't they both have the same 'Bar width = too small...' limit?
 

Attachments

  • xChartLiteSBCTest.zip
    4.2 KB · Views: 133

klaus

Expert
Licensed User
Longtime User
Thank you for reporting this.
I have begun to investigate but have not yet understood why this happens.
I tested also with xChart customviews and the problem is the same.
When I set only 1 bar for the stacked bar chart the problem disappears.
So, still some work to do.
 
Upvote 0

Chris2

Active Member
Licensed User
Longtime User
No problem. Thank you for looking into it.

I'm not sure that this will help but I've done a little further digging myself, and based on the attached test it appears that the number of bars in the stack has a direct bearing on the form width required to display the stacked bar chart.
E.g. When I have 50 data points...
A chart with 4 bars in the stack requires a form width of around (very roughly) 550.
A chart with 6 bars in the stack requires a form width of around (very roughly) 750.
A chart with 8 bars in the stack requires a form width of around (very roughly) 950.

This would make sense for a standard ('side by side') bar chart.
Is the same 'minimum width' calculation being used for both the "BAR" & "STACKED_BAR" charts?
 
Upvote 0
Top