General information about representations and canvas
First, you should study the Canvas and Drawables Guide from the official Android documentation. In particular, it is important to note that LineChart, BarChartetc. Are subclasses Viewthat display themselves by overriding the callback of the onDraw(Canvas c)View superclass. Note also the definition of "canvas":
The canvas works for you as a pretense or an interface on the actual surface on which your graphics will be drawn - it contains all your calls to "draw".
When you work with renderers, you will deal with the functionality of drawing lines, bars, etc. on canvas.
Translation between values on a chart and pixels on a canvas
x y . , x = 0. y- 52.28.

. x = 0 , . , y = 0, 52.28 ( y ). / , , x = 165 y = 1150.
A Transformer ( ) . ( ), .
, . , , . ViewPortHandler, , . ViewPortHandler#isInBoundsLeft(float x) isInBoundsRight(float x) , .
BarChart " " BarEntry 6 , , , 6 . , x- 0 5 .
ChartAnimator
ChartAnimator , . . , , , y 1 . phaseY, , 0.000 0ms 1.000 1000ms.
, , LineChartRenderer:
protected void drawHorizontalBezier(ILineDataSet dataSet) {
float phaseY = mAnimator.getPhaseY();
Transformer trans = mChart.getTransformer(dataSet.getAxisDependency());
mXBounds.set(mChart, dataSet);
cubicPath.reset();
if (mXBounds.range >= 1) {
Entry prev = dataSet.getEntryForIndex(mXBounds.min);
Entry cur = prev;
cubicPath.moveTo(cur.getX(), cur.getY() * phaseY);
for (int j = mXBounds.min + 1; j <= mXBounds.range + mXBounds.min; j++) {
prev = cur;
cur = dataSet.getEntryForIndex(j);
final float cpx = (prev.getX())
+ (cur.getX() - prev.getX()) / 2.0f;
cubicPath.cubicTo(
cpx, prev.getY() * phaseY,
cpx, cur.getY() * phaseY,
cur.getX(), cur.getY() * phaseY);
}
}
if (dataSet.isDrawFilledEnabled()) {
cubicFillPath.reset();
cubicFillPath.addPath(cubicPath);
drawCubicFill(mBitmapCanvas, dataSet, cubicFillPath, trans, mXBounds);
}
mRenderPaint.setColor(dataSet.getColor());
mRenderPaint.setStyle(Paint.Style.STROKE);
trans.pathValueToPixel(cubicPath);
mBitmapCanvas.drawPath(cubicPath, mRenderPaint);
mRenderPaint.setPathEffect(null);
}
for - . , phaseY ChartAnimator, Transformer .
for " , ". x-, .
x y- dataSet.getEntryForIndex(j) . , phaseY .
, , , trans.pathValueToPixel(cubicPath);, mBitmapCanvas.drawPath(cubicPath, mRenderPaint);
- .
com.github.mikephil.charting.renderer XAxisRenderer LineChartRenderer .. . void drawHorizontalBezier(ILineDataSet dataSet) super ( ) . , , :
Canvas class (drawBitmap ..), , .
, , , , LineRadarRenderer, .
, , Chart#setRenderer(DataRenderer renderer) BarLineChartBase#setXAxisRenderer(XAxisRenderer renderer) .