drawCrossLine method
draw cross lines
Implementation
void drawCrossLine(Canvas canvas, Size size) {
var index = calculateSelectedX(selectX);
KLineEntity point = getItem(index);
Paint paintY = Paint()
..color = this.chartColors.vCrossColor
..strokeWidth = this.chartStyle.vCrossWidth
..isAntiAlias = true;
double x = getX(index);
double y = getMainY(point.close);
// K-line chart vertical line
canvas.drawLine(Offset(x, mTopPadding),
Offset(x, size.height - mBottomPadding), paintY);
Paint paintX = Paint()
..color = this.chartColors.hCrossColor
..strokeWidth = this.chartStyle.hCrossWidth
..isAntiAlias = true;
// K-line chart horizontal line
canvas.drawLine(Offset(-mTranslateX, y),
Offset(-mTranslateX + mWidth / scaleX, y), paintX);
if (scaleX >= 1) {
canvas.drawOval(
Rect.fromCenter(center: Offset(x, y), height: 2.0 * scaleX, width: 2.0),
paintX,
);
} else {
canvas.drawOval(
Rect.fromCenter(center: Offset(x, y), height: 2.0, width: 2.0 / scaleX),
paintX,
);
}
}