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

Fix scatter shape size bug #5371

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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 @@ -5,6 +5,7 @@

import com.github.mikephil.charting.interfaces.datasets.IScatterDataSet;
import com.github.mikephil.charting.renderer.scatter.IShapeRenderer;
import com.github.mikephil.charting.utils.Utils;
import com.github.mikephil.charting.utils.ViewPortHandler;

/**
Expand All @@ -18,7 +19,7 @@ public class CustomScatterShapeRenderer implements IShapeRenderer
public void renderShape(Canvas c, IScatterDataSet dataSet, ViewPortHandler viewPortHandler,
float posX, float posY, Paint renderPaint) {

final float shapeHalf = dataSet.getScatterShapeSize() / 2f;
final float shapeHalf = Utils.convertDpToPixel(dataSet.getScatterShapeSize()) / 2f;

c.drawLine(
posX - shapeHalf,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public class ChevronDownShapeRenderer implements IShapeRenderer
public void renderShape(Canvas c, IScatterDataSet dataSet, ViewPortHandler viewPortHandler,
float posX, float posY, Paint renderPaint) {

final float shapeHalf = dataSet.getScatterShapeSize() / 2f;
final float shapeHalf = Utils.convertDpToPixel(dataSet.getScatterShapeSize()) / 2f;

renderPaint.setStyle(Paint.Style.STROKE);
renderPaint.setStrokeWidth(Utils.convertDpToPixel(1f));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public class ChevronUpShapeRenderer implements IShapeRenderer
public void renderShape(Canvas c, IScatterDataSet dataSet, ViewPortHandler viewPortHandler,
float posX, float posY, Paint renderPaint) {

final float shapeHalf = dataSet.getScatterShapeSize() / 2f;
final float shapeHalf = Utils.convertDpToPixel(dataSet.getScatterShapeSize()) / 2f;

renderPaint.setStyle(Paint.Style.STROKE);
renderPaint.setStrokeWidth(Utils.convertDpToPixel(1f));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public class CircleShapeRenderer implements IShapeRenderer
public void renderShape(Canvas c, IScatterDataSet dataSet, ViewPortHandler viewPortHandler,
float posX, float posY, Paint renderPaint) {

final float shapeSize = dataSet.getScatterShapeSize();
final float shapeSize = Utils.convertDpToPixel(dataSet.getScatterShapeSize());
final float shapeHalf = shapeSize / 2f;
final float shapeHoleSizeHalf = Utils.convertDpToPixel(dataSet.getScatterShapeHoleRadius());
final float shapeHoleSize = shapeHoleSizeHalf * 2.f;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public class CrossShapeRenderer implements IShapeRenderer
public void renderShape(Canvas c, IScatterDataSet dataSet, ViewPortHandler viewPortHandler,
float posX, float posY, Paint renderPaint) {

final float shapeHalf = dataSet.getScatterShapeSize() / 2f;
final float shapeHalf = Utils.convertDpToPixel(dataSet.getScatterShapeSize()) / 2f;

renderPaint.setStyle(Paint.Style.STROKE);
renderPaint.setStrokeWidth(Utils.convertDpToPixel(1f));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public class SquareShapeRenderer implements IShapeRenderer
public void renderShape(Canvas c, IScatterDataSet dataSet, ViewPortHandler viewPortHandler,
float posX, float posY, Paint renderPaint) {

final float shapeSize = dataSet.getScatterShapeSize();
final float shapeSize = Utils.convertDpToPixel(dataSet.getScatterShapeSize());
final float shapeHalf = shapeSize / 2f;
final float shapeHoleSizeHalf = Utils.convertDpToPixel(dataSet.getScatterShapeHoleRadius());
final float shapeHoleSize = shapeHoleSizeHalf * 2.f;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public class TriangleShapeRenderer implements IShapeRenderer
public void renderShape(Canvas c, IScatterDataSet dataSet, ViewPortHandler viewPortHandler,
float posX, float posY, Paint renderPaint) {

final float shapeSize = dataSet.getScatterShapeSize();
final float shapeSize = Utils.convertDpToPixel(dataSet.getScatterShapeSize());
final float shapeHalf = shapeSize / 2f;
final float shapeHoleSizeHalf = Utils.convertDpToPixel(dataSet.getScatterShapeHoleRadius());
final float shapeHoleSize = shapeHoleSizeHalf * 2.f;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public class XShapeRenderer implements IShapeRenderer
public void renderShape(Canvas c, IScatterDataSet dataSet, ViewPortHandler viewPortHandler,
float posX, float posY, Paint renderPaint) {

final float shapeHalf = dataSet.getScatterShapeSize() / 2f;
final float shapeHalf = Utils.convertDpToPixel(dataSet.getScatterShapeSize()) / 2f;

renderPaint.setStyle(Paint.Style.STROKE);
renderPaint.setStrokeWidth(Utils.convertDpToPixel(1f));
Expand Down