Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ protected boolean adjustVerticalSecondScale() {
int p = mGraphView.getGraphContentTop(); // start
int pixelStep = height / (numVerticalLabels - 1);
for (int i = 0; i < numVerticalLabels; i++) {
mStepsVerticalSecondScale.put(p, v);
mStepsVerticalSecondScale.put((int) (p+(1-i)*0.5*pixelStep), v);
p += pixelStep;
v -= exactSteps;
}
Expand Down Expand Up @@ -479,7 +479,7 @@ protected boolean adjustVertical() {
for (int i = 0; i < numVerticalLabels; i++) {
mStepsVertical.put(p, v);
p += pixelStep;
v -= exactSteps;
v -= exactSteps; // active
}

return true;
Expand Down Expand Up @@ -863,7 +863,7 @@ protected void drawHorizontalSteps(Canvas canvas) {
}
}
if (mStyles.gridStyle.drawVertical()) {
canvas.drawLine(e.getKey(), mGraphView.getGraphContentTop(), e.getKey(), mGraphView.getGraphContentTop() + mGraphView.getGraphContentHeight(), mPaintLine);
canvas.drawLine(e.getKey(), mGraphView.getGraphContentTop(), e.getKey(), mGraphView.getGraphContentTop() + mGraphView.getGraphContentHeight(), mPaintLine); // active
}

// draw label
Expand All @@ -883,7 +883,7 @@ protected void drawHorizontalSteps(Canvas canvas) {
for (int li = 0; li < lines.length; li++) {
// for the last line y = height
float y = (canvas.getHeight() - mStyles.padding - getHorizontalAxisTitleHeight()) - (lines.length - li - 1) * getTextSize() * 1.1f + mStyles.labelsSpace;
canvas.drawText(lines[li], e.getKey(), y, mPaintLabel);
canvas.drawText(lines[li], e.getKey(), y, mPaintLabel); // active
}
}
i++;
Expand Down Expand Up @@ -938,6 +938,7 @@ protected void drawVerticalSteps(Canvas canvas) {
float startLeft = mGraphView.getGraphContentLeft();
mPaintLabel.setColor(getVerticalLabelsColor());
mPaintLabel.setTextAlign(getVerticalLabelsAlign());
int lIndex = -1;
for (Map.Entry<Integer, Double> e : mStepsVertical.entrySet()) {
// draw line
if (mStyles.highlightZeroLines) {
Expand All @@ -948,7 +949,7 @@ protected void drawVerticalSteps(Canvas canvas) {
}
}
if (mStyles.gridStyle.drawHorizontal()) {
canvas.drawLine(startLeft, e.getKey(), startLeft + mGraphView.getGraphContentWidth(), e.getKey(), mPaintLine);
canvas.drawLine(startLeft, e.getKey(), startLeft + mGraphView.getGraphContentWidth(), e.getKey(), mPaintLine); // active
}

// draw label
Expand All @@ -963,7 +964,12 @@ protected void drawVerticalSteps(Canvas canvas) {
}
labelsOffset += mStyles.padding + getVerticalAxisTitleWidth();

float y = e.getKey();
float labelMinMaxOffset = 0f;
if (mNumVerticalLabels==3) {
lIndex ++;
labelMinMaxOffset = (1-lIndex) * labelsWidth * 0.4f;
}
float y = e.getKey() + labelMinMaxOffset;

String label = mLabelFormatter.formatLabel(e.getValue(), false);
if (label == null) {
Expand All @@ -974,7 +980,7 @@ protected void drawVerticalSteps(Canvas canvas) {
for (int li = 0; li < lines.length; li++) {
// for the last line y = height
float y2 = y - (lines.length - li - 1) * getTextSize() * 1.1f;
canvas.drawText(lines[li], labelsOffset, y2, mPaintLabel);
canvas.drawText(lines[li], labelsOffset, y2, mPaintLabel); // active
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -767,7 +767,8 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList

val graph = GraphView(context)
graph.layoutParams =
LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, rh.dpToPx(skinProvider.activeSkin().secondaryGraphHeight)).also { it.setMargins(0, rh.dpToPx(15), 0, rh.dpToPx(10)) }
LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, rh.dpToPx(skinProvider.activeSkin().secondaryGraphHeight)).also { it.setMargins(0, rh.dpToPx(0), 0, rh.dpToPx(0)) }
//LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, rh.dpToPx(skinProvider.activeSkin().secondaryGraphHeight)).also { it.setMargins(0, rh.dpToPx(15), 0, rh.dpToPx(10)) }
graph.gridLabelRenderer?.gridColor = rh.gac(context, app.aaps.core.ui.R.attr.graphGrid)
graph.gridLabelRenderer?.reloadStyles()
graph.gridLabelRenderer?.isHorizontalLabelsVisible = false
Expand All @@ -777,7 +778,8 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList
relativeLayout.addView(graph)

val label = TextView(context)
val layoutParams = RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT).also { it.setMargins(rh.dpToPx(30), rh.dpToPx(25), 0, 0) }
val layoutParams = RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT).also { it.setMargins(rh.dpToPx(35), rh.dpToPx(10), 0, 0) }
//val layoutParams = RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT).also { it.setMargins(rh.dpToPx(30), rh.dpToPx(25), 0, 0) }
layoutParams.addRule(RelativeLayout.ALIGN_PARENT_TOP)
layoutParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT)
label.layoutParams = layoutParams
Expand Down