简体   繁体   中英

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.

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);
  }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM