kYAxis method

dynamic kYAxis(
  1. dynamic x,
  2. dynamic y,
  3. dynamic w,
  4. dynamic h,
)

Implementation

kYAxis(x, y, w, h) {
  var pathData = {};
  var linePath = [];
  var txtPath = [];
  var txt = "";
  double hh = h - yCall['yVGap']! / 2;
  //竖线
  // linePath = [
  //   [
  //     "moveTo",
  //     [x + w, y]
  //   ],
  //   [
  //     "lineTo",
  //     [x + w, y + h]
  //   ]
  // ];

  //从大到小
  //最大值
  txt = Tools.toFixed(kYMax, klineState.widget.propertys['priceDigits']);
  txtPath.add([
    txt,
    yCall['strx'],
    y,
    {'xlayout': 'right'}
  ]);
  //中间值
  for (int i = yCall['yVGap'] as int; i < hh; i += yCall['yVGap'] as int) {
    txt = Tools.yToPrice(
        h, i, kYMin, kScale, klineState.widget.propertys['priceDigits']);
    txtPath.add([
      txt,
      yCall['strx'],
      y + i,
      {'ylayout': 'bottom','xlayout': 'right'}
    ]);
  }

  //最小值
  txt = Tools.toFixed(kYMin, klineState.widget.propertys['priceDigits']);
  txtPath.add([
    txt,
    yCall['strx'],
    y + h,
    {'ylayout': 'bottom','xlayout': 'right'}
  ]);
  pathData = {
    'linePath': linePath,
    'txtPath': txtPath,
  };
  return pathData;
}