Profile Picture

Axes Issues

Posted By Pedram . 11 Years Ago
Author
Message
Pedram .
Posted 11 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)

Group: Forum Members
Last Active: 11 Years Ago
Posts: 7, Visits: 1
I have a few questions with regards to Axes.

1) When is NAxis.IsUsed updated? For example, if I do Chart.Series.Clear() to clear all Series from the chart, I expect all the axes on the chart to immediately update and IsUsed == false. However it takes "time" for that to be updated, and if I have immediate code checking IsUsed==true. If I run this code "later", ie after a button press, they will be updated and IsUsed will correctly be false;.

ie

(assuming there is an axis with axis.axisid=5)
......
Chart.Series.Clear
List NotUsedAxes = new List();
foreach(NAxis axis in Chart.Axes)
{
if(!axis.IsUsed && axis.AxisId>4)
NotUsedAxes.Add(axis);
}

foreach(NAxis axis in NotUsedAxes)
Chart.Axes.Remove(axis);
.........

the expected result is that axis.axisId==5 should have axis.IsUsed = false; but is true and doesn't get removed.

2)

If I run the above code at a "later" time, and open the Chart Editor from the ChartCommandBar I get an exception, relating to Nevron.Chart.NSeriesBase.IsDisplayedOnAxis(Int32 axisId). I think there may be some coherence issue and I've included the stacktrace in the attached file.

In summary, what's the best way to remove an axis from the chart that may have a Series on it?

Attachments
stacktrace.txt (102 views, 5.00 KB)
Nevron Support
Posted 11 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)

Group: Forum Members
Last Active: Last Week
Posts: 3,054, Visits: 4,009

Hi Pedram,

1. The axis IsUsed property is a calculated property and is not immediately updated - you can force the property to update by calling the chart control document Calculate method:
nChartControl1.Document.Calculate();

2. Most likely the control document is left damaged by this operation because you removed custom axes, but obviously there are series that scale on them. To correct the problem you also need to loop through the series and turn off their display on axis property for each removed axis id.

Hope this helps - let us know if you meet any problems...



Best Regards,
Nevron Support Team





Similar Topics


Reading This Topic