如何显示的Android 4.0统筹GraphView [英] How to display 4 co-ordinate GraphView in android
本文介绍了如何显示的Android 4.0统筹GraphView的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我得到错误的。
GraphViewSeries exampleSeries =新GraphViewSeries(新GraphViewData [] {
新GraphViewData(1,2.0D)
,新GraphViewData(2 -1.5d)
,新GraphViewData(-3,2.5D)
,新GraphViewData(-4,-1.0d)
}); GraphView graphView =新LineGraphView(
这种背景下//
GraphView//标题
);
graphView.addSeries(exampleSeries); //数据
。graphView.getGraphViewStyle()setNumHorizontalLabels(5);
。graphView.getGraphViewStyle()setNumVerticalLabels(5);
//graphView.getGraphViewStyle().setVerticalLabelsWidth(300);
graphView.setManualYAxisBounds(5,1);
的LinearLayout布局=(的LinearLayout)findViewById(R.id.layout);
layout.addView(graphView);
我想提请所有四个坐标线..但负分不工作..
帮我
iwant这样
堆栈跟踪
4月9日至1日:17:53.299:I /流程(2263):发送信号。 PID:2263 SIG:9
4月9日至1日:17:54.149:D / AndroidRuntime(2302):关闭VM
4月9日至1日:17:54.149:W / dalvikvm(2302):主题ID = 1:螺纹未捕获的异常(组= 0xb3afcba8)退出
4月9日至1日:17:54.169:E / AndroidRuntime(2302):致命异常:主要
4月9日至1日:17:54.169:E / AndroidRuntime(2302):工艺:com.jsk.simplegraph,PID 2302
4月9日至1日:17:54.169:E / AndroidRuntime(2302):了java.lang.RuntimeException:无法启动活动ComponentInfo {com.jsk.simplegraph / com.jsk.simplegraph.SimpleGraphMainActivity}:java.lang.IllegalArgumentException异常:该值的顺序是不正确的。 X值必须订购ASC。第一最低x值和至少最高x值。
4月9日至1日:17:54.169:E / AndroidRuntime(2302):在android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2195)
4月9日至1日:17:54.169:E / AndroidRuntime(2302):在android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
4月9日至1日:17:54.169:E / AndroidRuntime(2302):在android.app.ActivityThread.access $ 800(ActivityThread.java:135)
4月9日至1日:17:54.169:E / AndroidRuntime(2302):在android.app.ActivityThread $ H.handleMessage(ActivityThread.java:1196)
4月9日至1日:17:54.169:E / AndroidRuntime(2302):在android.os.Handler.dispatchMessage(Handler.java:102)
4月9日至1日:17:54.169:E / AndroidRuntime(2302):在android.os.Looper.loop(Looper.java:136)
4月9日至1日:17:54.169:E / AndroidRuntime(2302):在android.app.ActivityThread.main(ActivityThread.java:5017)
4月9日至1日:17:54.169:E / AndroidRuntime(2302):在java.lang.reflect.Method.invokeNative(本机方法)
4月9日至1日:17:54.169:E / AndroidRuntime(2302):在java.lang.reflect.Method.invoke(Method.java:515)
4月9日至1日:17:54.169:E / AndroidRuntime(2302):在com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run(ZygoteInit.java:779)
4月9日至1日:17:54.169:E / AndroidRuntime(2302):在com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
4月9日至1日:17:54.169:E / AndroidRuntime(2302):在dalvik.system.NativeStart.main(本机方法)
4月9日至1日:17:54.169:E / AndroidRuntime(2302):java.lang.IllegalArgumentException异常:原因主要值的顺序是不正确的。 X值必须订购ASC。第一最低x值和至少最高x值。
4月9日至1日:17:54.169:E / AndroidRuntime(2302):在com.jjoe64.graphview.GraphViewSeries.checkValueOrder(GraphViewSeries.java:200)
4月9日至1日:17:54.169:E / AndroidRuntime(2302):在com.jjoe64.graphview.GraphViewSeries<&初始化GT;(GraphViewSeries.java:74)
解决方案
您堆栈信息是很清楚的:
的值的顺序是不正确的。 X值必须订购ASC。第一最低x值和至少最高x值。
所以,你应该初始化 exampleSeries
通过以下方式:
GraphViewSeries exampleSeries =新GraphViewSeries(新GraphViewData [] {
新GraphViewData(-4,-1.0d)
新GraphViewData(-3,2.5D),
新GraphViewData(1,2.0D),
新GraphViewData(2,-1.5d)
});
i get error at
GraphViewSeries exampleSeries = new GraphViewSeries(new GraphViewData[] {
new GraphViewData(1, 2.0d)
, new GraphViewData(2, -1.5d)
, new GraphViewData(-3, 2.5d)
, new GraphViewData(-4, -1.0d)
});
GraphView graphView = new LineGraphView(
this // context
, "GraphView" // heading
);
graphView.addSeries(exampleSeries); // data
graphView.getGraphViewStyle().setNumHorizontalLabels(5);
graphView.getGraphViewStyle().setNumVerticalLabels(5);
//graphView.getGraphViewStyle().setVerticalLabelsWidth(300);
graphView.setManualYAxisBounds(5,1);
LinearLayout layout = (LinearLayout) findViewById(R.id.layout);
layout.addView(graphView);
I want to draw the line for all four co-ordinates.. but the negative points does not work.. help me
iwant like this
stack trace
09-01 04:17:53.299: I/Process(2263): Sending signal. PID: 2263 SIG: 9
09-01 04:17:54.149: D/AndroidRuntime(2302): Shutting down VM
09-01 04:17:54.149: W/dalvikvm(2302): threadid=1: thread exiting with uncaught exception (group=0xb3afcba8)
09-01 04:17:54.169: E/AndroidRuntime(2302): FATAL EXCEPTION: main
09-01 04:17:54.169: E/AndroidRuntime(2302): Process: com.jsk.simplegraph, PID: 2302
09-01 04:17:54.169: E/AndroidRuntime(2302): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.jsk.simplegraph/com.jsk.simplegraph.SimpleGraphMainActivity}: java.lang.IllegalArgumentException: The order of the values is not correct. X-Values have to be ordered ASC. First the lowest x value and at least the highest x value.
09-01 04:17:54.169: E/AndroidRuntime(2302): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2195)
09-01 04:17:54.169: E/AndroidRuntime(2302): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
09-01 04:17:54.169: E/AndroidRuntime(2302): at android.app.ActivityThread.access$800(ActivityThread.java:135)
09-01 04:17:54.169: E/AndroidRuntime(2302): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
09-01 04:17:54.169: E/AndroidRuntime(2302): at android.os.Handler.dispatchMessage(Handler.java:102)
09-01 04:17:54.169: E/AndroidRuntime(2302): at android.os.Looper.loop(Looper.java:136)
09-01 04:17:54.169: E/AndroidRuntime(2302): at android.app.ActivityThread.main(ActivityThread.java:5017)
09-01 04:17:54.169: E/AndroidRuntime(2302): at java.lang.reflect.Method.invokeNative(Native Method)
09-01 04:17:54.169: E/AndroidRuntime(2302): at java.lang.reflect.Method.invoke(Method.java:515)
09-01 04:17:54.169: E/AndroidRuntime(2302): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
09-01 04:17:54.169: E/AndroidRuntime(2302): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
09-01 04:17:54.169: E/AndroidRuntime(2302): at dalvik.system.NativeStart.main(Native Method)
09-01 04:17:54.169: E/AndroidRuntime(2302): Caused by: java.lang.IllegalArgumentException: The order of the values is not correct. X-Values have to be ordered ASC. First the lowest x value and at least the highest x value.
09-01 04:17:54.169: E/AndroidRuntime(2302): at com.jjoe64.graphview.GraphViewSeries.checkValueOrder(GraphViewSeries.java:200)
09-01 04:17:54.169: E/AndroidRuntime(2302): at com.jjoe64.graphview.GraphViewSeries.<init>(GraphViewSeries.java:74)
解决方案
Your stack message is quite clear:
The order of the values is not correct. X-Values have to be ordered ASC. First the lowest x value and at least the highest x value.
So, you should initialize exampleSeries
the following way:
GraphViewSeries exampleSeries = new GraphViewSeries(new GraphViewData[] {
new GraphViewData(-4, -1.0d),
new GraphViewData(-3, 2.5d),
new GraphViewData(1, 2.0d),
new GraphViewData(2, -1.5d)
});
这篇关于如何显示的Android 4.0统筹GraphView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文