Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to draw limit lines on top of data #3451

Merged
merged 1 commit into from
May 9, 2018
Merged
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 @@ -212,9 +212,14 @@ protected void onDraw(Canvas canvas) {
mAxisRendererLeft.renderAxisLine(canvas);
mAxisRendererRight.renderAxisLine(canvas);

mXAxisRenderer.renderGridLines(canvas);
mAxisRendererLeft.renderGridLines(canvas);
mAxisRendererRight.renderGridLines(canvas);
if (mXAxis.isDrawGridLinesBehindDataEnabled())
mXAxisRenderer.renderGridLines(canvas);

if (mAxisLeft.isDrawGridLinesBehindDataEnabled())
mAxisRendererLeft.renderGridLines(canvas);

if (mAxisRight.isDrawGridLinesBehindDataEnabled())
mAxisRendererRight.renderGridLines(canvas);

if (mXAxis.isEnabled() && mXAxis.isDrawLimitLinesBehindDataEnabled())
mXAxisRenderer.renderLimitLines(canvas);
Expand All @@ -231,6 +236,15 @@ protected void onDraw(Canvas canvas) {

mRenderer.drawData(canvas);

if (!mXAxis.isDrawGridLinesBehindDataEnabled())
mXAxisRenderer.renderGridLines(canvas);

if (!mAxisLeft.isDrawGridLinesBehindDataEnabled())
mAxisRendererLeft.renderGridLines(canvas);

if (!mAxisRight.isDrawGridLinesBehindDataEnabled())
mAxisRendererRight.renderGridLines(canvas);

// if highlighting is enabled
if (valuesToHighlight())
mRenderer.drawHighlighted(canvas, mIndicesToHighlight);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,11 @@ public abstract class AxisBase extends ComponentBase {
*/
protected boolean mDrawLimitLineBehindData = false;

/**
* flag indicating the grid lines layer depth
*/
protected boolean mDrawGridLinesBehindData = true;

/**
* Extra spacing for `axisMinimum` to be added to automatically calculated `axisMinimum`
*/
Expand Down Expand Up @@ -444,6 +449,18 @@ public boolean isDrawLimitLinesBehindDataEnabled() {
return mDrawLimitLineBehindData;
}

/**
* If this is set to false, the grid lines are draw on top of the actual data,
* otherwise behind. Default: true
*
* @param enabled
*/
public void setDrawGridLinesBehindData(boolean enabled) { mDrawGridLinesBehindData = enabled; }

public boolean isDrawGridLinesBehindDataEnabled() {
return mDrawGridLinesBehindData;
}

/**
* Returns the longest formatted label (in terms of characters), this axis
* contains.
Expand Down