renderItem method
Renders a single tuple if called by renderGroup.
Implementation
@override
List<Figure> renderItem(
Aes item,
CoordConv coord,
Offset origin,
) {
assert(item.shape is CandlestickShape);
final path = Path();
// Candle stick shape dosen't allow NaN value.
final points = item.position.map((p) => coord.convert(p)).toList();
final x = points.first.dx;
final ys = points.map((p) => p.dy).toList()..sort();
final bias = (item.size ?? defaultSize) / 2;
final top = ys[0];
final topEdge = ys[1];
final bottomEdge = ys[2];
final bottom = ys[3];
if (hollow) {
path.moveTo(x, top);
path.lineTo(x, topEdge);
path.moveTo(x, bottomEdge);
path.lineTo(x, bottom);
} else {
// If the stoke style is fill, the lines created by Path.lineTo will not
// be rendered.
final strokeBias = strokeWidth / 2;
path.addRect(Rect.fromPoints(
Offset(x - strokeBias, top),
Offset(x + strokeBias, topEdge),
));
path.addRect(Rect.fromPoints(
Offset(x - strokeBias, bottomEdge),
Offset(x + strokeBias, bottom),
));
}
path.addRect(Rect.fromPoints(
Offset(x - bias, topEdge),
Offset(x + bias, bottomEdge),
));
// Color variation should be controled by color attribute.
return renderBasicItem(
path,
item,
hollow,
strokeWidth,
);
// No labels.
}