Hi Steema,
I'm having a problem to draw colorline behind series, anotations, etc. in my WPF .NET application.
I'm using these Colorlines as an tolerance limits for charts in steel mill visualization application.
Drawbehind = true property is used but Lines are always on top though.
Is there a way to fix it?
Thank you for your help.
Branislav Baran
WPF Colorline drawing priority
WPF Colorline drawing priority
- Attachments
-
- this chart has series and annotation drawn behind the colorlines, but it is requred to have them drawn behind everything else.
- strip_thick_chart.png (28.58 KiB) Viewed 6807 times
-
- Guru
- Posts: 1603
- Joined: Fri Nov 15, 2002 12:00 am
Re: WPF Colorline drawing priority
Hello Branislav,
Unfortunately the Drawbehind is non-functional in WPF as the tool uses an AdornerLayer to do its drawing, and this layer is always drawn before all others.
However, this behaviour can be overridden using a very simple derivative of the ColorLine class, e.g.
And then used like this:
Unfortunately the Drawbehind is non-functional in WPF as the tool uses an AdornerLayer to do its drawing, and this layer is always drawn before all others.
However, this behaviour can be overridden using a very simple derivative of the ColorLine class, e.g.
Code: Select all
public class MyColorLine : ColorLine
{
public MyColorLine(Chart c)
: base(c) { }
public MyColorLine()
: this(null) { }
protected override void ChartEvent(EventArgs e)
{
if ((iAxis != null) &&
((e is BeforeDrawSeriesEventArgs) || (e is AfterDrawEventArgs)))
{
Chart.Graphics3D.Pen = Pen;
DrawColorLine(Chart.Graphics3D, e is BeforeDrawSeriesEventArgs);
}
}
}
Code: Select all
private void InitializeChart()
{
Steema.TeeChart.WPF.Styles.Line line = new Steema.TeeChart.WPF.Styles.Line(tChart1.Chart);
tChart1.Aspect.View3D = false;
line.LinePen.Width = 3;
line.FillSampleValues();
MyColorLine tool = new MyColorLine(tChart1.Chart);
tool.Axis = tChart1.Axes.Bottom;
tool.Value = 5;
tool.Pen.Color = Colors.LimeGreen;
tool.Pen.Width = 2;
tool.DrawBehind = true;
}
Best Regards,
Christopher Ireland / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
Re: WPF Colorline drawing priority
Thank you Christopher,
it works fine!
Branislav Baran
it works fine!
Branislav Baran