Reputation: 151
I'm trying to use the GraphView but I can't seem to have labels :/
This is my 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);
And this is my 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>
This is what I get:
Big Edit!
Now the labels appear but they are too large, how can I reduce the font letter as well as the display overall ?
Upvotes: 1
Views: 1097
Reputation: 347
The problem might be with your text being white color. Just try
graphView.getGraphViewStyle().setHorizontalLabelsColor(Color.BLACK); graphView.getGraphViewStyle().setVerticalLabelsColor(Color.BLACK);
The size of text could be altered as follows... graphView.getGraphViewStyle().setTextSize(11);
Upvotes: 3