G grafsoft Well-Known Member Licensed User Longtime User Sep 1, 2025 #1 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.
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.
klaus Expert Licensed User Longtime User Sep 1, 2025 #2 CustomViews cannot be added with AddView. Put the four xChart objects onto a Panel in the Designer in a layout file and load this layout onto the ScrollView.Panel. Upvote 0
CustomViews cannot be added with AddView. Put the four xChart objects onto a Panel in the Designer in a layout file and load this layout onto the ScrollView.Panel.
G grafsoft Well-Known Member Licensed User Longtime User Sep 2, 2025 #3 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
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.
AnandGupta Expert Licensed User Longtime User Sep 2, 2025 #4 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
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.
klaus Expert Licensed User Longtime User Sep 2, 2025 #5 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 Test4xCharts.zip 11.5 KB · Views: 271 Upvote 0
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.
G grafsoft Well-Known Member Licensed User Longtime User Sep 2, 2025 #6 klaus said: 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. Click to expand... 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
klaus said: 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. Click to expand... 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.
klaus Expert Licensed User Longtime User Sep 2, 2025 #7 grafsoft said: that LoadLayout is not restricted to the activity. Click to expand... No layout is restricted to any activity ! You can load a layout to any Panel ! Upvote 0
grafsoft said: that LoadLayout is not restricted to the activity. Click to expand... No layout is restricted to any activity ! You can load a layout to any Panel !