drawText method

  1. @override
void drawText(
  1. Canvas canvas,
  2. VolumeEntity data,
  3. double x
)
override

Implementation

@override
void drawText(Canvas canvas, VolumeEntity data, double x) {
  if (chartStyle.isShowStrategyTypeBottom) {
    TextSpan span = TextSpan(
      children: [
        /// 成交量
        TextSpan(
            text: "VOL:",
            // text: "VOL:${NumberUtil.format(data.vol)}    ",
            // style: getTextStyle(chartColors.volColor)),
            style: getTextStyle(
                chartColors.infoWindowTitleColor.withValues(alpha: 0.5))),
        formatValueSpan(
            (double.tryParse('${data.vol}') ?? 0.0),
            getTextStyle(
                chartColors.infoWindowTitleColor.withValues(alpha: 0.5))),
        if (data.MA5Volume.notNullOrZero && chartStyle.isShowBottomMa)
          TextSpan(
              text: "MA5:${NumberUtil.format(data.MA5Volume!)}    ",
              style: getTextStyle(chartColors.ma5Color)),
        if (data.MA10Volume.notNullOrZero && chartStyle.isShowBottomMa)
          TextSpan(
              text: "MA10:${NumberUtil.format(data.MA10Volume!)}    ",
              style: getTextStyle(chartColors.ma10Color)),
      ],
    );
    TextPainter tp =
        TextPainter(text: span, textDirection: TextDirection.ltr);
    tp.layout();
    tp.paint(canvas, Offset(x, chartRect.top - topPadding));
  }
}