1

GraphView を使用しようとしていますが、ラベルがないようです:/

これは私のGraphViewです:

// init example series data
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 , "GraphViewDemo");
graphView.setHorizontalLabels(new String[] {"2 days ago", "yesterday", "today", "tomorrow"});
graphView.setVerticalLabels(new String[] {"high", "middle", "low"});
graphView.addSeries(exampleSeries);
 
LinearLayout layout = (LinearLayout) findViewById(R.id.layout);
layout.addView(graphView);

そして、これは私のxmlです:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context=".MainActivity" android:id="@+id/layout"
    android:orientation="vertical">
</LinearLayout>

これは私が得るものです:ここに画像の説明を入力

ビッグエディット!

ラベルが表示されるようになりましたが、大きすぎます。フォント文字と表示全体を縮小するにはどうすればよいですか?

フォントは表示されるが大きすぎる (グラフの種類を変更)

4

1 に答える 1

3

問題は、テキストが白色であることにある可能性があります。ちょうど試して

graphView.getGraphViewStyle().setHorizo​​ntalLabelsColor(Color.BLACK); graphView.getGraphViewStyle().setVerticalLabelsColor(Color.BLACK);

テキストのサイズは次のように変更できます... graphView.getGraphViewStyle().setTextSize(11);

于 2014-06-19T07:06:17.523 に答える