Changing PointLineSeries parent View issue
Posted: Wed Feb 22, 2017 8:44 pm
Hi,
I am not sure if the way I did this is correct but I tried to change the parent view of a PointLineSeries and I am facing an issue.
I did the following:
It worked and the PointLineSeries was displayed in the new chart. Perfect.
Now I tried to set the scale using the following:
Here I am getting the out minSeriesVal and maxSeriesVal as 0.
So I tried the following:
and I am able to set the scale properly. The problem with the above is that I am setting a style for the PointLineSeries and I don't want to set it again when changing the layout.
So I am wondering if there is a way to deep clone the PointLineseries or switch the parent? (I think I am able to switch actually, I see the pointlineseries on the new chart.)
For now I could just use the scale of the previous parent, but the code might add a new PointLineSeries to the chart and then the scaling won't be proper.
Thanks.
Regards,
Lokesh
I am not sure if the way I did this is correct but I tried to change the parent view of a PointLineSeries and I am facing an issue.
I did the following:
Code: Select all
pls.OwnerView.PointLineSeries.Remove(pls);
pls.AssignYAxisIndex = 0;
pls.Visible = true;
pls.SeriesEventMarkers[0].Visible = true;
_xyCharts[i].ViewXY.PointLineSeries.Add(pls);
Now I tried to set the scale using the following:
Code: Select all
_xyCharts[i].ViewXY.XAxes[0].SetRange(_xyCharts[0].ViewXY.XAxes[0].Minimum, _xyCharts[0].ViewXY.XAxes[0].Maximum);
_xyCharts[i].ViewXY.YAxes[0].GetSeriesMinMax(out minSeriesVal, out maxSeriesVal);
offset = Math.Abs(maxSeriesVal - minSeriesVal) / 10;
_xyCharts[i].ViewXY.YAxes[0].SetRange(minSeriesVal - offset, maxSeriesVal + offset);
So I tried the following:
Code: Select all
PointLineSeries newpls = new PointLineSeries(); // _xyCharts[i].ViewXY, _xyCharts[i].ViewXY.XAxes[0], _xyCharts[i].ViewXY.YAxes[0]);
newpls.AssignYAxisIndex = 0;
newpls.AssignXAxisIndex = 0;
newpls.Points = pls.Points;
newpls.Visible = true;
newpls.PointsVisible = true;
newpls.LineStyle.Color = pls.LineStyle.Color;
_xyCharts[i].ViewXY.PointLineSeries.Add(newpls);
So I am wondering if there is a way to deep clone the PointLineseries or switch the parent? (I think I am able to switch actually, I see the pointlineseries on the new chart.)
For now I could just use the scale of the previous parent, but the code might add a new PointLineSeries to the chart and then the scaling won't be proper.
Thanks.
Regards,
Lokesh