Skip to content

Commit

Permalink
Minor bugfix.
Browse files Browse the repository at this point in the history
  • Loading branch information
PhilJay committed Mar 13, 2015
1 parent a543bb2 commit ddf205f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ protected void onCreate(Bundle savedInstanceState) {

// draw bars behind lines
mChart.setDrawOrder(new DrawOrder[] {
DrawOrder.BAR, DrawOrder.LINE, DrawOrder.CANDLE
DrawOrder.BAR, DrawOrder.LINE
});

YAxis rightAxis = mChart.getAxisRight();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ public void drawData(Canvas c) {
}

c.drawBitmap(mPathBitmap, 0, 0, mRenderPaint);

drawCircles(c);
}

protected void drawDataSet(Canvas c, LineDataSet dataSet) {
Expand Down Expand Up @@ -269,11 +271,11 @@ protected void drawLinear(Canvas c, LineDataSet dataSet, ArrayList<Entry> entrie
float phaseY = mAnimator.getPhaseY();

mRenderPaint.setStyle(Paint.Style.STROKE);

Canvas canvas = null;

// if the data-set is dashed, draw on bitmap-canvas
if(dataSet.isDashedLineEnabled()) {
if (dataSet.isDashedLineEnabled()) {
canvas = mBitmapCanvas;
} else {
canvas = c;
Expand Down Expand Up @@ -324,7 +326,8 @@ protected void drawLinear(Canvas c, LineDataSet dataSet, ArrayList<Entry> entrie
mRenderPaint.setColor(dataSet.getColor());

// c.drawLines(buffer.buffer, mRenderPaint);
canvas.drawLines(buffer.buffer, from, to >= buffer.size() ? buffer.size() - from : range,
canvas.drawLines(buffer.buffer, from, to >= buffer.size() ? buffer.size() - from
: range,
mRenderPaint);
}

Expand Down Expand Up @@ -450,11 +453,11 @@ public void drawValues(Canvas c) {

@Override
public void drawExtras(Canvas c) {
drawCircles(c);

}

protected void drawCircles(Canvas c) {

mRenderPaint.setStyle(Paint.Style.FILL);

float phaseX = mAnimator.getPhaseX();
Expand All @@ -468,7 +471,7 @@ protected void drawCircles(Canvas c) {

if (!dataSet.isVisible() || !dataSet.isDrawCirclesEnabled())
continue;

mCirclePaintInner.setColor(dataSet.getCircleHoleColor());

Transformer trans = mChart.getTransformer(dataSet.getAxisDependency());
Expand All @@ -483,7 +486,7 @@ protected void drawCircles(Canvas c) {
float halfsize = dataSet.getCircleSize() / 2f;

for (int j = 0; j < buffer.size(); j += 2) {

float x = buffer.buffer[j];
float y = buffer.buffer[j + 1];

Expand All @@ -494,13 +497,16 @@ protected void drawCircles(Canvas c) {
// bounds
if (!mViewPortHandler.isInBoundsLeft(x) || !mViewPortHandler.isInBoundsY(y))
continue;

mRenderPaint.setColor(dataSet.getCircleColor(j / 2));

int circleColor = dataSet.getCircleColor(j / 2);

mRenderPaint.setColor(circleColor);

c.drawCircle(x, y, dataSet.getCircleSize(),
mRenderPaint);

if (dataSet.isDrawCircleHoleEnabled())
if (dataSet.isDrawCircleHoleEnabled()
&& circleColor != mCirclePaintInner.getColor())
c.drawCircle(x, y,
halfsize,
mCirclePaintInner);
Expand Down

0 comments on commit ddf205f

Please sign in to comment.