In our application a varying number of charts can be created based upon user configuration. The axis information is also user configurable, and this is where the problem comes in.
In creating the axes for the chart, can the name be bound to a property on our axis viewmodel? (I do not think so as my experimentation with x:Name={Binding Path=ViewModel.Name} so far) or is there some way to use RelativeSource binding to locate the axis information? Can this be done for the legend as well? Thank you!
Hello,
The x:Name directive uniquely identifies XAML-defined elements in a XAML namescope the name is equivalent to the variable that holds an object reference or an instance as returned by a constructor so binding not a valid value for this property. You can bind to a different ItemsSource to change the data used by the axis or you can add the axis to the grid at runtime. Please let me know more about what you are trying to accomplish if you need further assistance.
Valerie
Okay, I'll see if I can explain differently to fully convey the scenario. There's two real issues, one is creating a legend in the code-behind that will display on the chart. I have the chart being placed inside a XamDock, then the legend is added to the chart in the code behind via:
var legend = new Legend {Content = "Common Legend", Margin = new Thickness(10) };
XamDock.SetEdge( legend, DockEdge.InsideRight );
Chart1.Legend = legend;
But I don't see any legend generated.
The other problem is with the axis. I can get the axis to show up, but there are multiple series in a chart and the series get updated asynchronously, but to the same points in the end. So for example; series1 and series2 may have 50 datapoints starting out, then series2 gets updated to 60 points, then series 1 gets updated to 60 points, but during the period between series 2 being updated and series 1 being updated the new data is not displayed. Axis is bound initially to series1, which I believe is the problem, but I cannot find a way in the code behind to bind the series to a series collection viewmodel, which holds the series objects.
Hopefully that explains better! If it's still confusing I'll try to figure out how to paste code so it shows up readable to explain better what I'm after.