protected Cairo.Color CalcValueColor(float val) { double factor = (val - valuesMin) / (valuesMax - valuesMin); // should be able to handle division by zero (NaN) return(coloring.GetColor(factor)); }
// must be able to handle double.NaN ! public System.Drawing.Color GetColor(double prop) { // can handle NaN, returns Cairo.Color, must convert to Drawing.Color return(coloring.GetColor(prop).ToWinformsColor()); }