數(shù)值轉(zhuǎn)坐標(biāo)
/**
* @return 數(shù)值到坐標(biāo)的轉(zhuǎn)換器
*/
public Function<Float, Float> getCanvasY(int maxY, int minY, float maxValue, float minValue) {
return value -> {
float canvasDistance = maxY - minY;
float valueDistance = maxValue - minValue;
float scale = canvasDistance / valueDistance;
return maxY - (value - minValue) * scale;
};
}