MattHolmes Posted February 17, 2010 Report Share Posted February 17, 2010 In our software, we allow the user to choose from several curves our math package pushes out to our data model. Basically each curve is represented by a series, and we do some automatic axis management to make sure a properly labeled and unit converted / scale axis exists for that curve (this works). The issue is that when a user removes a curve, and we attempt to remove the associated axes, we get a crash inside of Chart FX. Our CleanAxes function looks like this: private void CleanAxes () { List<Axis> rem = new List<Axis> (); foreach (Axis axis in _chart.AxesX) { var query = from s in _chart.Series where s.AxisX == axis select s; if (query.Count () <= 0) { rem.Add (axis); } } foreach (Axis axis in rem) { _chart.AxesX.Remove (axis); } rem.Clear (); foreach (Axis axis in _chart.AxesY) { var query = from s in _chart.Series where s.AxisY == axis select s; if (query.Count () <= 0) { rem.Add (axis); } } foreach (Axis axis in rem) { _chart.AxesY.Remove (axis); } } Basically it goes through the X and Y Axes lists and removes any axis that no longer has any series using it. When this code is finished running, and the chart tries to draw again, we get the following exception: Message: Object reference not set to an instance of an object.Stack Trace: at ChartFX.WPF.Internal.PlotAreaCore.a(Axis A_0, IList`1& A_1, Axis A_2, IList`1& A_3) at ChartFX.WPF.Internal.PlotAreaCore.a(PaintMark A_0, AttributesResolver A_1, Boolean A_2, Boolean A_3, Double A_4, Double A_5, PaintSeriesInfo[] A_6) at ChartFX.WPF.Internal.PlotAreaCore.a(AttributesResolver A_0, Double A_1, Double A_2) at ChartFX.WPF.Internal.PlotAreaCore.a(Double A_0, Double A_1, Boolean A_2) at ChartFX.WPF.Internal.PlotAreaCore.b(Double A_0, Double A_1, Boolean A_2) at ChartFX.WPF.Internal.PlotAreaItems.OnRenderSizeChanged(SizeChangedInfo sizeInfo) at System.Windows.ContextLayoutManager.fireSizeChangedEvents() at System.Windows.ContextLayoutManager.UpdateLayout() at System.Windows.ContextLayoutManager.UpdateLayoutCallback(Object arg) at System.Windows.Media.MediaContext.InvokeOnRenderCallback.DoWork() at System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks() at System.Windows.Media.MediaContext.RenderMessageHandlerCore(Object resizedCompositionTarget) at System.Windows.Media.MediaContext.RenderMessageHandler(Object resizedCompositionTarget) at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Boolean isSingleParameter) at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler) Is there some safe way to remover axes that I am not aware of? Another addition question that isn't really crucial right now, but has me curious: When I do Chart.Series.Clear(), why does ChartFX add two default series back to the chart? When I clear the series, I'd really like it to actually be clear. Quote Link to comment Share on other sites More sharing options...
JuanC Posted February 18, 2010 Report Share Posted February 18, 2010 We have found and fixed the exception when removing an axis, any build marked 3701 or later will include the fix. >> When I do Chart.Series.Clear(), why does ChartFX add two default series back to the chart? When I clear the series, I'd really like it to actually be clear. This is because we want a default chart (no series) to show some random data as opposed to showing "No Data Available", you might want to try setting Chart.ItemsSource to null and see if that gives you an empty chart instead of the 2 random series. If this doesn't work please try posting a simple app that shows this behavior. Regards, JuanC Quote Link to comment Share on other sites More sharing options...
MattHolmes Posted February 19, 2010 Author Report Share Posted February 19, 2010 When can I expect to be able to get a version with build number 3701 or later? Looking at my Software FX Resource center, I have build 3581 installed, and it tells me I have the latest build. Quote Link to comment Share on other sites More sharing options...
JuanC Posted February 19, 2010 Report Share Posted February 19, 2010 You can download the most recent hotfix here, note that you need to run IE as Administrator if UAC is enabled in your machine as it will try to update your Chart FX files. You have our current "service pack" build (service packs go through more testing including some manual testing not run on hotfix builds). JuanC graphstocks.zip Quote Link to comment Share on other sites More sharing options...
MattHolmes Posted February 19, 2010 Author Report Share Posted February 19, 2010 Oh, awesome, I didn't know about the hotfix feature. It still lists build 3700 as the latest, but I'll keep an eye out for 3701. Thanks. FinancialStudies.zip Quote Link to comment Share on other sites More sharing options...
MattHolmes Posted February 19, 2010 Author Report Share Posted February 19, 2010 The hotfix site now lists build 3702 as being up, but when I attempt to install or download that build, it just gives me 3700 again. Is there an issue with the hotfixer? I've tried both doing the automated download, and doing the Download link that gives me an exe installer. In both cases, build 3700 is installed despite it saying 3702 is available. Quote Link to comment Share on other sites More sharing options...
JuanC Posted February 19, 2010 Report Share Posted February 19, 2010 The reason for this is that the control in the page actually downloads the bits from additional FTP sites and these sites are typically refreshed every night. We just pushed a manual update so if you apply the hotfix now you should receive the 3702 build. JuanC Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.