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