B4J Question How to clear a Chart?

positrom2

Active Member
Licensed User
Longtime User
I have added a series of points to a Scatterchart using Adddata:
B4X:
For j=3 To steps-2
    AddData(GetdataMaxr, j*stepp, maxr_array(j,0))
Next
Usually, I remove that series prior to adding a new series of points to avoid filling up the memory space:
B4X:
GetdataMaxr.RunMethod("remove",Array As Object(SeriesJO))
Occasionally, however, I wish to keep a series of plotted points to compare with a previous series.
This I do by once omitting the "remove" method. That preserves a previous plotted series and a new series of plotted additionally.
However, when the screen has been messed up by repeatedly omitting the "remove" method, how to clear the Chart, i.e. remove also the "old" data points?
 

stevel05

Expert
Licensed User
Longtime User
Are you running from the examples from the forum? In which case it would be similar to adding the data series:

B4X:
'Assuming Linechart and LCGetData are JavaObjects
LCGetData=LineChart.RunMethod("getData",Null)
LCGetData.RunMethod("clear",Null)

If this isn't the case, please zip and post your code.
 
Upvote 0
Top