Android Question xcChart on ScrollView

grafsoft

Well-Known Member
Licensed User
Longtime User
B4X:
ScrollView1.Panel.AddView(chartalt, 0, 0, 100%x, 300dip)

throws an error. xChart cannot be converted into view.

How can I put a chart on a scrollview? Or is there any other method to put 4 xcharts on a scrollable panel (or whatever that scrolls)?

I need 4 charts because the values on the y-axis are totally different.
 

grafsoft

Well-Known Member
Licensed User
Longtime User
Thank you!

But I get
java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.

removeView() seems to be missing.

There is an Activbity.RemoveViewAt, but it needs an index.

B4X:
For Each v As View In Activity.GetAllViewsRecursive
        Log (v)
Next

gives no info I can use.
 
Upvote 0

AnandGupta

Expert
Licensed User
Longtime User
There is an example with code of graphs on a customlistview from data of covid around the world.
You can check that sample.
But I can not find that thread/message. Members here may have the proper link of that.
Please someone give that link for him.
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
Without seeing your code to know what exactly you have done i cannot help.

Attached a small project.
Be aware that the horizontal scrolling in the xCharts is not optimal because the event interferes with the scrolling of the ScrollView.
Depending on the type of charts, you could perhaps use xChartLite or even xChartMini.
 

Attachments

  • Test4xCharts.zip
    11.5 KB · Views: 16
Upvote 0

grafsoft

Well-Known Member
Licensed User
Longtime User
Without seeing your code to know what exactly you have done i cannot help.

Attached a small project.
Be aware that the horizontal scrolling in the xCharts is not optimal because the event interferes with the scrolling of the ScrollView.
Depending on the type of charts, you could perhaps use xChartLite or even xChartMini.
Thank you so much! This is what I did not understand:

ScrollView1.Panel.LoadLayout("ScrollViewPanel") ' ... that LoadLayout is not restricted to the activity.

Now everything makes sense, and this mthod might also be useful to administrate complex layouts.
 
Upvote 0
Top