How to change the display level of the line

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
Elite
Newbie
Newbie
Posts: 11
Joined: Tue Dec 03, 2019 12:00 am

How to change the display level of the line

Post by Elite » Mon Oct 26, 2020 3:10 am

Hello,

I added a blue line and a red line to the chart. When the points of the two lines are the same, the red line will cover the blue line. How can I make the blue line display to the top layer without changing the order of addition. Is there a z-index like attribute?
Attachments
1.PNG
1.PNG (12.98 KiB) Viewed 10044 times

Christopher
Guru
Posts: 1603
Joined: Fri Nov 15, 2002 12:00 am

Re: How to change the display level of the line

Post by Christopher » Mon Oct 26, 2020 9:23 am

Hello,
Elite wrote:
Mon Oct 26, 2020 3:10 am
I added a blue line and a red line to the chart. When the points of the two lines are the same, the red line will cover the blue line. How can I make the blue line display to the top layer without changing the order of addition. Is there a z-index like attribute?
The Series class has a ZOrder property, but this only works when the Chart is in 3D mode. This means that the only way to achieve this, as things stand, is to swap the order of the Series in the Series collection, as in the following example:

Code: Select all

        private void InitializeChart(TChart chart)
        {
            var line1 = new Line(chart.Chart);
            var line2 = new Line(chart.Chart);

            //chart.Aspect.View3D = true;

            for (var i = 0; i < 10; i++)
            {
                line1.Add(i, 5);
                line2.Add(i, 5);
            }
        }

        private void button1_Click(object sender, EventArgs e)
        {
            //var firstZ = _tChart[0].ZOrder;
            //_tChart[0].ZOrder = _tChart[1].ZOrder;
            //_tChart[1].ZOrder = firstZ;

            //_tChart.Invalidate();

            var series = _tChart[0];
            _tChart[0] = _tChart[1];
            _tChart[1] = series;

             _tChart.Invalidate();
        }
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

Elite
Newbie
Newbie
Posts: 11
Joined: Tue Dec 03, 2019 12:00 am

Re: How to change the display level of the line

Post by Elite » Mon Oct 26, 2020 10:56 am

Why is there no ZOrder property in 2d mode,Will it be implemented in a future version?

Christopher
Guru
Posts: 1603
Joined: Fri Nov 15, 2002 12:00 am

Re: How to change the display level of the line

Post by Christopher » Tue Oct 27, 2020 8:38 am

Hello,
Elite wrote:
Mon Oct 26, 2020 10:56 am
Why is there no ZOrder property in 2d mode
Basically because we consider 2D mode as having two axes (x,y), and 3D mode as having three (x,y,z).
Elite wrote:
Mon Oct 26, 2020 10:56 am
Will it be implemented in a future version?
I have added this feature request to our issue tracker with id=2382, meaning that an implementation of it will be considered for inclusion in a future version.
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

Post Reply