getPixelX method
With this function we can convert our AFlSpot x to the view base axis x . the view 0, 0 is on the top/left, but the spots is bottom/left
Implementation
double getPixelX(double spotX, Size viewSize, PaintHolder<D> holder) {
final data = holder.data;
final deltaX = data.maxX - data.minX;
if (deltaX == 0.0) {
return 0;
}
return ((spotX - data.minX) / deltaX) * viewSize.width;
}