本文介绍了如何使StripLine出现在图表数据点上方的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个Microsoft图表控件,并且使用了StripLine
.如何使StripLine
出现在数据点的前面.目前,带状线隐藏在某些数据后面.该图表是一个面积图.
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.
推荐答案
据我所知,StripLine
将始终被绘制在数据点后面.解决这个问题的一种方法是使用PostPaint
事件处理程序并自己绘制矩形.
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);
}
}
这篇关于如何使StripLine出现在图表数据点上方的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!