09-11-2013 07:19 AM
Is it possible to have axis ticks and/or labels inside plot area to conserve space? So that plot area would occupy 100% of the control, and all labels will be inside.
09-11-2013 10:42 AM
There is no configuration property to inset axes, but it is possible to override the presentation code to show them inside:
public class CustomAxisDouble : AxisDouble {
protected override void Present( ScalePresenter presenter ) {
// Set scale to present inside.
var parent = (RegionPanel)presenter.Parent;
string definitionName = RegionPanel.GetRegion( presenter );
var definition = parent.LayoutDefinitions
.OfType<EdgeDefinition>( )
.First( e => e.Name == definitionName );
definition.Location = EdgeLocation.Inside;
// Set plot area background below scale visuals.
var background = parent.RegionChildren.OfType<RegionFigure>( ).First( );
background.ZIndex = -10;
// Show scale.
base.Present( presenter );
}
}
You will probably want to use the custom presenter from this question as well to customize the display of the end labels.
Note that this relies on implementation details of the current release of the WPF controls. We intentionally left many of the underlying primitive types with minimal documentation, as we may change them in the future. In the current implementation, we use RegionPanel
and layout definitions to perform the layout for many of our controls. Although these exact members may be removed in a later release, we do plan to provide equivalent functionality and stabilize the primitive API over time.
Besides that caveat, I hope you find this useful.