Wish xChart - only plot as many bars that can be displayed


Active Member
Licensed User
Longtime User

The value of GetMaxNumberBars can be determined once all the data has been added to the chart but before the chart has been displayed.

In order to only show the maximum number of bars permitted by the screen's size without also showing a scroll bar, I have to proceed like this:
Add data to the chart
Determine GetMaxNumberBars
Remove data from the chart
Add columns from 0 to GetMaxNumberBars to the chart
Display chart

It would be useful to have the option to show only the bars up to GetMaxNumberBars.




Licensed User
Longtime User
I do not want to add a new specific method to draw bar charts.
I have added a GetMaxNumberBars2 method which calculates the max number of bars without knowing the bar values.
Not as precise as GetMaxNumberBars but not bad.
Can you please test the attached library version 9.1.


  • xChart.b4xlib
    44.9 KB · Views: 112