Reputation: 10346
I'm using android graphview 3.1.1. I am trying to set an axis label, a label identifying what the axis is.
The only thing I've found close to this in Android GraphView is setting individual tick-mark labels as withgraphView.setHorizontalLabels(horlabels)
. Is it possible to set the entire label?
Example here, the axis labels are Month and Weight in Kg.
Upvotes: 1
Views: 1042
Reputation: 749
I have had a similar problem, so I set a by -90° rotated TextView beside my LinearLayout where i draw the graph.
<TextView
android:layout_height="fill_parent"
android:layout_width="wrap_content"
android:id="@+id/test"
android:textColor="#FFFFFF"
android:gravity="center"
android:rotation="-90"
android:textSize="12dp"
android:text="°C"/>
The problem with this method: The width of my rotated TextView stays the same like if's not rotated. So there is a huge amount of space to the left and right if you use a long text. If you shorten the layout_widht
there is a line break.
For short text it looks nice: https://i.sstatic.net/KWMk8.jpg
Upvotes: 2
Reputation: 4207
There are no ways provided to set the entire label. You may have to do this with TextViews.
Upvotes: 1
Reputation: 6417
there is no build-in feature for that, but you can achieve this by nesting the GraphView-View in layouts with TextViews
Upvotes: 1