【问题标题】:how to display multiple plots(linecharts) in android using achartengine?如何使用 achartengine 在 android 中显示多个图(折线图)?
【发布时间】:2012-06-24 07:11:00
【问题描述】:

我是编程新手,因此是 android 编程新手。 我正在制作一个 android 应用程序,我必须在其中以图形方式显示 eeg 数据(我的意思是动态地在其中不断接收数据并且图形不断更新,新值添加到右侧,旧值的图形移动到左侧并最终看不见)。现在我可以一次显示 1 个图,但如果我可以在一个屏幕上从上到下显示所有图(总共 14 个),那就太好了。现在可能无法同时查看 14 个图表,因此我可以添加滚动功能,以便一次可以看到一些图表,而通过向上或向下滑动可以看到其他图表。 我正在使用 AChartengine 进行绘图。有没有办法通过滚动在单个屏幕上从上到下显示多个图?感谢您抽出时间。

【问题讨论】:

    标签: android android-layout plot achartengine


    【解决方案1】:

    我想,即使您可以使用ScrollView 在同一个活动/屏幕上放置许多图表,它也会太沉重和混乱。为什么不对每个图使用不同的数据集来复用数据?这样你就可以只显示一些图表,数据比较会更直观......

    您可以参考 achartengine 示例中的“平均温度”,了解如何将不同的系列(数据集)放入同一个图表中。

    无论如何,如果您真的想创建一个包含 14 个图表的“长”滚动屏幕,只需像这样使用ScrollView

    <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/ScrollViewChartContainer" android:layout_width="fill_parent" android:layout_height="fill_parent">
    
     <LinearLayout android:id="@+id/trendchart" android:layout_width="fill_parent" android:layout_height="match_parent" android:background="@android:color/transparent" android:orientation="horizontal" /> 
     <LinearLayout android:id="@+id/trendchart2" android:layout_width="fill_parent" android:layout_height="match_parent" android:background="@android:color/transparent" android:orientation="horizontal" /> 
     ...
    </ScrollView>
    

    我还没有测试过这样的布局,但它应该可以工作。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-24
      • 1970-01-01
      • 1970-01-01
      • 2023-03-25
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多