[英]Android GraphView
我正在嘗試使用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>
這就是我得到的:
大編輯!
現在標簽出現但是它們太大了,我如何減少字體字母以及整體顯示?
問題可能在於您的文字是白色。 你試一試
。graphView.getGraphViewStyle()setHorizontalLabelsColor(Color.BLACK); 。graphView.getGraphViewStyle()setVerticalLabelsColor(Color.BLACK);
文本的大小可以改變如下... graphView.getGraphViewStyle()。setTextSize(11);
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.