private double GetYFromValue(double val) { Rectangle rect = GradientRectangle; Rectangle all = Allocation.ToCairoRectangle (); return all.Y + ypad * all.Height + rect.Height * (255 - val) / 255; }