Kaushik
Kaushik

Reputation: 449

How to make StripLine appear over chart data points

I have a microsoft chart control and I use a StripLine. How do I make the StripLine appear in front of the data points. Currently the strip line is hidden behind some data. The chart is an area chart.

Upvotes: 1

Views: 1598

Answers (1)

zeFrenchy
zeFrenchy

Reputation: 6591

As far as I'm aware StripLine will always be drawn behind the data points. One way to fudge this howerver would be to use a PostPaint event handler and draw the rectangle yourself.

inside the handler your can get drawing coordinates as follows

private void chart_PostPaint(object sender, ChartPaintEventArgs e)
{
  ChartArea a = sender as ChartArea;
  if (a != null)
  {
    Gaphics g = e.ChartGrpahics.Graphics;
    RectangleF r = e.ChartGraphics.GetAbsoluteRectangle(new RectangleF(0,0,10,50)); // the rect you need
    g.FillRectangle(new Brushes.Yellow, r);
  }
}

Upvotes: 1

Related Questions