3

棒グラフの上に別のテキスト値を表示したいと考えています。対数的な種類のスケーリングが必要なため、値が異なります。どうすればこれを達成できますか?どうもありがとう。

他の質問を検索しましたが、これらの質問はすべて 1 年以上前のものであり、最新の情報が見つかりません:(

series.addAnnotation(...); を追加した後の新しい例外。

コード

public GraphicalView getView(Context context, List<Double> height, List<String> text, List<String> time) {

    XYSeries series = new XYSeries(null);
    for(int i = 0; i < height.size(); i++) {
        series.add(i, height.get(i));
        series.addAnnotation(text.get(i), (double) i, height.get(i));
    }
    XYMultipleSeriesDataset dataset = new XYMultipleSeriesDataset();
    dataset.addSeries(series);

    XYSeriesRenderer renderer = new XYSeriesRenderer();     
    //renderer.setDisplayChartValues(true);
    renderer.setColor(Color.parseColor("#3399cc"));

    XYMultipleSeriesRenderer mRenderer = new XYMultipleSeriesRenderer();
    mRenderer.addSeriesRenderer(renderer);

    ...

例外

    06-11 13:49:49.256: E/AndroidRuntime(18424): FATAL EXCEPTION: main
    06-11 13:49:49.256: E/AndroidRuntime(18424): java.lang.NullPointerException
    06-11 13:49:49.256: E/AndroidRuntime(18424):    at org.achartengine.chart.XYChart.draw(XYChart.java:305)
    06-11 13:49:49.256: E/AndroidRuntime(18424):    at org.achartengine.GraphicalView.onDraw(GraphicalView.java:168)
    06-11 13:49:49.256: E/AndroidRuntime(18424):    at android.view.View.draw(View.java:13776)
    06-11 13:49:49.256: E/AndroidRuntime(18424):    at android.view.View.getDisplayList(View.java:12727)
    06-11 13:49:49.256: E/AndroidRuntime(18424):    at android.view.View.getDisplayList(View.java:12771)
    06-11 13:49:49.256: E/AndroidRuntime(18424):    at android.view.View.draw(View.java:13500)
    06-11 13:49:49.256: E/AndroidRuntime(18424):    at android.view.ViewGroup.drawChild(ViewGroup.java:3171)
    06-11 13:49:49.256: E/AndroidRuntime(18424):    at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3041)
    06-11 13:49:49.256: E/AndroidRuntime(18424):    at android.view.View.getDisplayList(View.java:12725)
    06-11 13:49:49.256: E/AndroidRuntime(18424):    at android.view.View.getDisplayList(View.java:12771)
    06-11 13:49:49.256: E/AndroidRuntime(18424):    at android.view.View.draw(View.java:13500)
    06-11 13:49:49.256: E/AndroidRuntime(18424):    at android.view.ViewGroup.drawChild(ViewGroup.java:3171)
    06-11 13:49:49.256: E/AndroidRuntime(18424):    at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3041)
    06-11 13:49:49.256: E/AndroidRuntime(18424):    at android.view.View.getDisplayList(View.java:12725)
    06-11 13:49:49.256: E/AndroidRuntime(18424):    at android.view.View.getDisplayList(View.java:12771)
    06-11 13:49:49.256: E/AndroidRuntime(18424):    at android.view.View.draw(View.java:13500)
    06-11 13:49:49.256: E/AndroidRuntime(18424):    at android.view.ViewGroup.drawChild(ViewGroup.java:3171)
    06-11 13:49:49.256: E/AndroidRuntime(18424):    at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3041)
    06-11 13:49:49.256: E/AndroidRuntime(18424):    at android.view.View.draw(View.java:13779)
    06-11 13:49:49.256: E/AndroidRuntime(18424):    at android.widget.FrameLayout.draw(FrameLayout.java:467)
    06-11 13:49:49.256: E/AndroidRuntime(18424):    at android.widget.ScrollView.draw(ScrollView.java:1821)
    06-11 13:49:49.256: E/AndroidRuntime(18424):    at android.view.View.getDisplayList(View.java:12727)
    06-11 13:49:49.256: E/AndroidRuntime(18424):    at android.view.View.getDisplayList(View.java:12771)
    06-11 13:49:49.256: E/AndroidRuntime(18424):    at android.view.View.draw(View.java:13500)
    06-11 13:49:49.256: E/AndroidRuntime(18424):    at android.view.ViewGroup.drawChild(ViewGroup.java:3171)
    06-11 13:49:49.256: E/AndroidRuntime(18424):    at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3041)
    06-11 13:49:49.256: E/AndroidRuntime(18424):    at android.view.View.draw(View.java:13779)
    06-11 13:49:49.256: E/AndroidRuntime(18424):    at android.view.View.getDisplayList(View.java:12727)
    06-11 13:49:49.256: E/AndroidRuntime(18424):    at android.view.View.getDisplayList(View.java:12771)
    06-11 13:49:49.256: E/AndroidRuntime(18424):    at android.view.View.draw(View.java:13500)
    06-11 13:49:49.256: E/AndroidRuntime(18424):    at android.view.ViewGroup.drawChild(ViewGroup.java:3171)
    06-11 13:49:49.256: E/AndroidRuntime(18424):    at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3041)
    06-11 13:49:49.256: E/AndroidRuntime(18424):    at android.view.View.draw(View.java:13779)
    06-11 13:49:49.256: E/AndroidRuntime(18424):    at android.widget.FrameLayout.draw(FrameLayout.java:467)
    06-11 13:49:49.256: E/AndroidRuntime(18424):    at android.view.View.getDisplayList(View.java:12727)
    06-11 13:49:49.256: E/AndroidRuntime(18424):    at android.view.View.getDisplayList(View.java:12771)
    06-11 13:49:49.256: E/AndroidRuntime(18424):    at android.view.View.draw(View.java:13500)
    06-11 13:49:49.256: E/AndroidRuntime(18424):    at android.view.ViewGroup.drawChild(ViewGroup.java:3171)
    06-11 13:49:49.256: E/AndroidRuntime(18424):    at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3041)
    06-11 13:49:49.256: E/AndroidRuntime(18424):    at android.view.View.getDisplayList(View.java:12725)
    06-11 13:49:49.256: E/AndroidRuntime(18424):    at android.view.View.getDisplayList(View.java:12771)
    06-11 13:49:49.256: E/AndroidRuntime(18424):    at android.view.View.draw(View.java:13500)
    06-11 13:49:49.256: E/AndroidRuntime(18424):    at android.view.ViewGroup.drawChild(ViewGroup.java:3171)
    06-11 13:49:49.256: E/AndroidRuntime(18424):    at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3041)
    06-11 13:49:49.256: E/AndroidRuntime(18424):    at android.view.View.draw(View.java:13779)
    06-11 13:49:49.256: E/AndroidRuntime(18424):    at android.widget.FrameLayout.draw(FrameLayout.java:467)
    06-11 13:49:49.256: E/AndroidRuntime(18424):    at com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java:2420)
    06-11 13:49:49.256: E/AndroidRuntime(18424):    at android.view.View.getDisplayList(View.java:12727)
    06-11 13:49:49.256: E/AndroidRuntime(18424):    at android.view.View.getDisplayList(View.java:12771)
    06-11 13:49:49.256: E/AndroidRuntime(18424):    at android.view.HardwareRenderer$GlRenderer.draw(HardwareRenderer.java:1144)
    06-11 13:49:49.256: E/AndroidRuntime(18424):    at android.view.ViewRootImpl.draw(ViewRootImpl.java:2278)
    06-11 13:49:49.256: E/AndroidRuntime(18424):    at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:2150)
    06-11 13:49:49.256: E/AndroidRuntime(18424):    at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1961)
    06-11 13:49:49.256: E/AndroidRuntime(18424):    at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1115)
    06-11 13:49:49.256: E/AndroidRuntime(18424):    at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:4526)
    06-11 13:49:49.256: E/AndroidRuntime(18424):    at android.view.Choreographer$CallbackRecord.run(Choreographer.java:725)
    06-11 13:49:49.256: E/AndroidRuntime(18424):    at android.view.Choreographer.doCallbacks(Choreographer.java:555)
    06-11 13:49:49.256: E/AndroidRuntime(18424):    at android.view.Choreographer.doFrame(Choreographer.java:525)
    06-11 13:49:49.256: E/AndroidRuntime(18424):    at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:711)
    06-11 13:49:49.256: E/AndroidRuntime(18424):    at android.os.Handler.handleCallback(Handler.java:615)
    06-11 13:49:49.256: E/AndroidRuntime(18424):    at android.os.Handler.dispatchMessage(Handler.java:92)
    06-11 13:49:49.256: E/AndroidRuntime(18424):    at android.os.Looper.loop(Looper.java:137)
    06-11 13:49:49.256: E/AndroidRuntime(18424):    at android.app.ActivityThread.main(ActivityThread.java:4921)
    06-11 13:49:49.256: E/AndroidRuntime(18424):    at java.lang.reflect.Method.invokeNative(Native Method)
    06-11 13:49:49.256: E/AndroidRuntime(18424):    at java.lang.reflect.Method.invoke(Method.java:511)
    06-11 13:49:49.256: E/AndroidRuntime(18424):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1027)
    06-11 13:49:49.256: E/AndroidRuntime(18424):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:794)
    06-11 13:49:49.256: E/AndroidRuntime(18424):    at dalvik.system.NativeStart.main(Native Method)
4

1 に答える 1

2

あなたが持っているオプションは注釈に関連しています。次のように、バーごとに 1 つ追加します。

series.addAnnotation("text", x, y);
于 2013-06-11T09:49:18.833 に答える