private void DrawTriangles(Context g)
{
int px, py;
Gdk.ModifierType mask;
GdkWindow.GetPointer (out px, out py, out mask);
Rectangle rect = GradientRectangle;
Rectangle all = Allocation.ToCairoRectangle();
int index = FindValueIndex (py);
for (int i = 0; i < Count; i++) {
double val = vals [i];
double y = GetYFromValue (val);
bool hoover = ((index == i)) && (all.ContainsPoint (px, py) || ValueIndex != -1);
Color color = hoover ? new Color (0.1, 0.1, 0.9) : new Color (0.1, 0.1, 0.1);
//left triangle
PointD[] points = new PointD[] { new PointD (rect.X, y),
new PointD (rect.X - xpad * rect.Width, y + ypad * rect.Height),
new PointD (rect.X - xpad * rect.Width, y - ypad * rect.Height) };
g.FillPolygonal (points, color);
double x = rect.X + rect.Width;
//right triangle
PointD[] points2 = new PointD[] { new PointD (x , y),
new PointD (x + xpad * rect.Width, y + ypad * rect.Height),
new PointD (x + xpad * rect.Width, y - ypad * rect.Height) };
g.FillPolygonal (points2, color);
}
}