ChartTransform.forScale constructor
ChartTransform.forScale({})
Implementation
factory ChartTransform.forScale({
required int minTime,
required int maxTime,
required int width,
required int leftMargin,
required double minValue,
required double maxValue,
required int height,
required int topMargin,
}) {
final sx = (width) / (maxTime - minTime);
final tx = leftMargin - sx * minTime;
final rawSy = (height) / (maxValue - minValue);
final sy = -rawSy;
final ty = height + topMargin + rawSy * minValue;
return ChartTransform(sx: sx, tx: tx, sy: sy, ty: ty);
}