This project is read-only.

Setting axis title in code

Feb 18, 2009 at 1:20 PM
Is it possible to set the titles of the axis in code? And if this is possible how do you do this?
Mar 27, 2009 at 10:46 AM

What do you mean saying 'titles of the axis'? Do you mean the very title of axis, which is situated near (down or left, for example) to axis and describes what does the axis show (1)? Or you mean custom string labels near ticks of axis (2)?

If (1), you can add to Plotter.Children an instance of special class - HorizontalAxisTitle or VerticalAxisTitle from C# or from XAML. These classes are successors of ContentControl, so you can assign anything to want to their Content property - both descriptive string or ant WPF control with such description.
If you want to change title of AxisTitle which has already been added to plotter, you should firstly get an instance of this AxisTitle - this can be done in several ways - you can assing to your AxisTitle a name, when creating it in Xaml, and then call it by name, or you can perform a search for instances of class you want to find in Plotter.Children collection using LINQ methods, such as Plotter.Children.OfType<HorizontalAxisTitle>().FirstOrDefault() (do not forget to check whether this method returned not null).

If (2), you should wait for some time, as we are only developing this feature, and it will be included in one of next D3's releases.