Skip to content

Commit

Permalink
Change label spacing and alignment. #12
Browse files Browse the repository at this point in the history
  • Loading branch information
dbaelz committed Jan 14, 2018
1 parent a9f3a72 commit 6af3c57
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import android.content.Context
import android.graphics.Bitmap
import android.graphics.Canvas
import android.graphics.Color
import android.graphics.Paint
import android.os.Bundle
import android.view.View
import android.widget.RemoteViews
Expand Down Expand Up @@ -132,19 +133,20 @@ class PlotWidget : BaseWidget() {

// add space for the labels
size = Size.FILL
marginLeft = PixelUtils.dpToPix(12f)
marginLeft = PixelUtils.dpToPix(8f)
marginTop = PixelUtils.dpToPix(8f)
marginRight = PixelUtils.dpToPix(32f)
marginBottom = PixelUtils.dpToPix(24f)

lineLabelInsets.right = PixelUtils.dpToPix(-15f)
lineLabelInsets.bottom = PixelUtils.dpToPix(-8f)
lineLabelInsets.bottom = PixelUtils.dpToPix(-10f)

// format the labels
getLineLabelStyle(XYGraphWidget.Edge.RIGHT).paint.color = Color.WHITE
getLineLabelStyle(XYGraphWidget.Edge.RIGHT).paint.textSize = textSize
getLineLabelStyle(XYGraphWidget.Edge.BOTTOM).paint.color = Color.WHITE
getLineLabelStyle(XYGraphWidget.Edge.BOTTOM).paint.textSize = textSize
getLineLabelStyle(XYGraphWidget.Edge.BOTTOM).paint.textAlign = Paint.Align.LEFT

// format the DateTime
getLineLabelStyle(XYGraphWidget.Edge.BOTTOM).format = object : Format() {
Expand Down Expand Up @@ -175,7 +177,7 @@ class PlotWidget : BaseWidget() {
plot.domainTitle.labelPaint.textSize = textSize
plot.domainTitle.position(
0f, HorizontalPositioning.ABSOLUTE_FROM_CENTER,
25f, VerticalPositioning.ABSOLUTE_FROM_BOTTOM)
20f, VerticalPositioning.ABSOLUTE_FROM_BOTTOM)
plot.legend.isVisible = false

val widgetWidth = appWidgetManager.getAppWidgetOptions(appWidgetId).getInt(AppWidgetManager.OPTION_APPWIDGET_MAX_WIDTH)
Expand Down

0 comments on commit 6af3c57

Please sign in to comment.