bobt Posted September 8, 2008 Report Share Posted September 8, 2008 As part of a chart Reset/ReInit/Refresh operation, I have written code to programmatically set the Axis.Title.Content property to a new value. The dynamic title works fine on the first pass or layout chart, but upon user chosen operation and chart refresh, the axis title does not show. I inspected the Content and Visibility property variables before refresh at runtime using the debugger, and there are indeed appropriate values. I perform the refresh using the Chart.Refresh() method. Is there another property I must set before refresh? Thoughts? Hints? Tips? Thanks, Bishr Quote Link to comment Share on other sites More sharing options...
JuanC Posted September 8, 2008 Report Share Posted September 8, 2008 Is it possible you are creating new Y axes in your reset/refresh operation? I tried the following code in a button int n;if (chart1.AxisY.Title.Content == null) n = 0;else n = (int) chart1.AxisY.Title.Content; chart1.AxisY.Title.Content = n + 1; This works fine everytime you press the button so I think it is possible a new Y axis is being created (either in your code or as a result of how you are refreshing the chart). Regards, JuanC Quote Link to comment Share on other sites More sharing options...
bobt Posted September 8, 2008 Author Report Share Posted September 8, 2008 Here is the general template... Reset(); // calls Chart.Series.Clear() InitPlot(); // programmatically binds to DataContext since it can hold arbitrary number of series Refresh(); // calls Chart.Refresh() In my Reset() method, I perform a Chart.Series.Clear() operation. I added a button and event handler to perform the increment and title set operations you described and this works as long as I do not previously clear the series data in the Reset(). I understand that the Series represents the underlying chart data, and it appears that there is an dependency event fired when the Series.Count == 0 because I wrote a loop to emulate Series.Clear and the effect was the same. The legend appears just fine as do the series of points upon reset/reinit/refresh. But is there a way to pin both the x- and y- axis? Many Thanks, Bob 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.