Zindex and Different types of series

1 Answer 54 Views
Chart
Michal
Top achievements
Rank 1
Iron
Michal asked on 19 Jan 2022, 07:20 AM

Hey!

In my RadCartesianChart  I have three types of series:

1. ScatterAreaSeries

2. Multiple SactterLineSeries (using SeriesProvider) - the amount of this series is dynamic.

3. Other SactterLineSeries / SactterPointSeries with some data.

I know that zindex is automatically determined by the order in which the series is created.

I need to set the zindex in a way that ScatterAreaSeries will be the background of the data from SeriesProvider and the other series will be on top the data from SeriesProvider.

What is the best practice to handle it?

 

Thanks

Michal

1 Answer, 1 is accepted

Sort by
0
Dilyan Traykov
Telerik team
answered on 21 Jan 2022, 01:54 PM

Hello Michal,

Each of the Series exposes a ZIndex property which you can set to the desired value. You can read more about it here: Controlling the stack order of the elements.

When using a SeriesProvider, you can handle its SeriesCreated event and set the ZIndex property there:

        private void ChartSeriesProvider_SeriesCreated(object sender, Telerik.Windows.Controls.ChartView.ChartSeriesCreatedEventArgs e)
        {
            if (e.Series is ScatterAreaSeries)
            {
                e.Series.ZIndex = 0;
            }
            else
            {
                e.Series.ZIndex = 1000;
            }
        }

For the rest of the series, you can set the property manually to the desired value in relation to the already set values in the event handler.

Please let me know if doing so provides the desired result.

Regards,
Dilyan Traykov
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Michal
Top achievements
Rank 1
Iron
commented on 25 Jan 2022, 08:16 AM

Hi Dilyan 

 

Thank you

I did that, for most of the series it worked, but I still have two series that suppose to be above series provider and it appears under.

In SeriesCreated event I set Zindex  to 40.

For the problematic series I set Zindex to 110.

 

where should I check?

 

Michal

Dilyan Traykov
Telerik team
commented on 26 Jan 2022, 01:18 PM

Hi Michal,

Can you please specify which these problematic series are so that I can further investigate?

I've prepared a small sample project which you can modify to demonstrate the issue if you find this more convenient. Please find it attached.
Michal
Top achievements
Rank 1
Iron
commented on 27 Jan 2022, 06:30 AM

Thank you Dilyan

I can not compile the project using VS2019.

I have an error "The tag 'RadCartesianChart' does not exist in XML namesapce..."

 

Michal

Dilyan Traykov
Telerik team
commented on 27 Jan 2022, 01:09 PM

Hi Michal,

I assume that the Telerik references cannot be resolved automatically. Please try to manually add the Telerik.Windows.ControlsTelerik.Windows.Controls.Chart and Telerik.Windows.Data references to point to the assemblies from the Binaries\WPF40 folder of your Telerik UI for WPF installation.
Tags
Chart
Asked by
Michal
Top achievements
Rank 1
Iron
Answers by
Dilyan Traykov
Telerik team
Share this question
or