onCompute method
获取画布宽度和高度 计算当前屏内相对转换后的X轴位置 根据X轴位置,计算屏内起始和结束展示数据的索引 计算最大值和最小值
Implementation
@override
void onCompute(Size size) {
super.onCompute(size);
double diff =
math.max((maxValue - lastClose!).abs(), (minValue - lastClose!).abs()) *
1.5;
if (diff < 1) {
diff = 1;
}
maxValue = lastClose! + diff;
minValue = lastClose! - diff;
_radio = contentHeight / (maxValue - minValue);
}