-
-
Notifications
You must be signed in to change notification settings - Fork 9k
Expand file tree
/
Copy pathCustomScatterShapeRenderer.java
More file actions
31 lines (25 loc) · 1001 Bytes
/
CustomScatterShapeRenderer.java
File metadata and controls
31 lines (25 loc) · 1001 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package com.xxmassdeveloper.mpchartexample.custom;
import android.graphics.Canvas;
import android.graphics.Paint;
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;
/**
* Custom shape renderer that draws a single line.
* Created by philipp on 26/06/16.
*/
public class CustomScatterShapeRenderer implements IShapeRenderer
{
@Override
public void renderShape(Canvas c, IScatterDataSet dataSet, ViewPortHandler viewPortHandler,
float posX, float posY, Paint renderPaint) {
final float shapeHalf = Utils.convertDpToPixel(dataSet.getScatterShapeSize()) / 2f;
c.drawLine(
posX - shapeHalf,
posY - shapeHalf,
posX + shapeHalf,
posY + shapeHalf,
renderPaint);
}
}