我正在使用GraphView库(参见:https://github.com/jjoe64/GraphView或http://www.jjoe64.com/p/graphview-library.html)
但我想使用日期/时间作为X-as.有谁知道一个简单的方法来完成这个或任何人都可以推动我朝着正确的方向?
我在Android中使用GraphView来绘制从蓝牙(BLE)连接的传感器接收的实时数据(ECG).
过了一会儿(5-10秒= 500-1000分),应用程序变得极其缓慢且滞后.
传感器的输出数据速率为100Hz,数据一经生成就会被接收并绘制(每10ms).
如同类似情况所示,我只保留我需要显示的数据.我尝试最小化视图(2秒= 200分),在不同的Android设备上测试应用程序,但问题仍然存在.有任何想法吗?
import com.jjoe64.graphview.GraphView;
import com.jjoe64.graphview.series.DataPoint;
import com.jjoe64.graphview.series.LineGraphSeries;
import com.jjoe64.graphview.GridLabelRenderer;
Run Code Online (Sandbox Code Playgroud)
...
//GraphView init
static LinearLayout GraphView1;
static GraphView graphView1;
static LineGraphSeries<DataPoint> Series1;
static LinearLayout GraphView2;
static GraphView graphView2;
static LineGraphSeries<DataPoint> Series2;
static LinearLayout GraphView3;
static GraphView graphView3;
static LineGraphSeries<DataPoint> Series3;
private static int Xview = 5;
private static int maxpoints = 500;
private static double xstep = 0.01d;
private static double graph2LastXValue = 0;
static boolean AutoScrollX = true;
Run Code Online (Sandbox Code Playgroud)
初始化通道1的Graphview(init_ch2()和init_ch3()类似):
void init_ch1(){
GraphView1 = (LinearLayout) findViewById(R.id.Channel1); …Run Code Online (Sandbox Code Playgroud) 所以我正在寻找我的应用程序的图形解决方案,我偶然发现了GraphView.
我正在环顾github和源文件,我似乎无法找到集成指南.也许它就在我面前,但我无法在任何地方看到它.
我以前从未将别人的代码集成到我自己的代码中,所以如果有人能给我一个关于如何将GraphView与我当前项目集成的快速概述,我将非常感激.
我有一个线图,我每次用户输入数字时都会添加数据.用户输入一个数字50次,所以我希望x轴的范围从1到50,增量为1.在y轴上,我希望它的范围是2 - 15(用户输入2到15之间的数字)增量为1.我真的不确定如何做到这一点,这就是我所拥有的:
graph = (GraphView) findViewById(R.id.session_graph);
series = new LineGraphSeries<DataPoint>(new DataPoint[] {});
graph.addSeries(series);
graph.getViewport().setMinX(1);
graph.getViewport().setMaxX(50);
graph.getViewport().setMinY(2.0);
graph.getViewport().setMaxY(15.0);
Run Code Online (Sandbox Code Playgroud)
但是,当我启动我的应用程序时,x和y轴的范围为0 - 2,间隔为0.5
当试图在android studio中创建一个带有图形视图库的折线图时,垂直线上的数字部分正在被删除.有人知道如何解决这个问题吗?
<com.jjoe64.graphview.GraphView
android:layout_width="300dp"
android:layout_height="200dip"
android:id="@+id/graph"
android:layout_centerVertical="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_gravity="center_horizontal"
android:nestedScrollingEnabled="false" />
final GraphView graph = (GraphView)findViewById(R.id.graph);
final LineGraphSeries<DataPoint> graphSeries = new LineGraphSeries<DataPoint>(new DataPoint[] {
}); // the points are added progressively`
Run Code Online (Sandbox Code Playgroud) 有可能做这样的事情:
?我在应用程序LineChart中有X轴上的时间值(秒)和Y轴上的温度.
而且我可能没有更长时间间隔的数据(例如白天和更多),如果用户不得不重新刷一下,它将不会是非常用户.所以我想创建这个"快捷方式"或以某种方式"删除"图形的空白部分(没有X值).有可能吗?也许不必有这个差距,但我需要在一个图表中从时间"10:30"到时间"14:20",而不需要大滚动.
你有什么建议吗?
我只想在这些轴上仅显示XY轴和标签,并且不希望在Android中GraphView显示网格线.我怎样才能做到这一点?
提前致谢.
我希望x轴标记如上图所示.我尝试过使用AxisValueFormatter接口,但它的作用是从0到1重复标签'jh ow'3次,同时错过了这里显示的一些标签.
这是我得到的输出.虽然图形的形状是正确的,但标签不是.
我正在分享图表数据,以便有兴趣的人可以尝试制作如图所示的图表.任何帮助都会很棒,谢谢.
使用MPAndroid并不重要.任何其他图书馆的任何帮助也很好.
数据是:
"lables" : ["jh ow", "n ih l", "b iy", "hh iy r", "s uw n"]
"values":[[{"x":"0.00","y":"0.00"},{"x":"0.99","y":"0.00"}],
[{"x":"0.99","y":"1.00"},{"x":"1.19","y":"0.50"}]
, [{"x":"1.19","y":"0.50"},{"x":"1.37","y":"0.50"}]
, [{"x":"1.37","y":"0.50"},{"x":"1.59","y":"0.50"}]
, [{"x":"1.59","y":"0.50"},{"x":"2.12","y":"1.00"}]]
Run Code Online (Sandbox Code Playgroud) android ×8
java ×2
anychart ×1
background ×1
charts ×1
datetime ×1
graph ×1
graphing ×1
integration ×1
linechart ×1