Page 1 of 1

How to change the display level of the line

Posted: Mon Oct 26, 2020 3:10 am
by 15687497
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?

Re: How to change the display level of the line

Posted: Mon Oct 26, 2020 9:23 am
by Christopher
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();
        }

Re: How to change the display level of the line

Posted: Mon Oct 26, 2020 10:56 am
by 15687497
Why is there no ZOrder property in 2d mode,Will it be implemented in a future version?

Re: How to change the display level of the line

Posted: Tue Oct 27, 2020 8:38 am
by Christopher
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.