05-22-2013 12:11 PM
When using the IntensityGraph, the z scale is represented by a color scale legend which is shown on screen. We are using the Graph control for more flexibility as recommended in the documentation. How do we show the color scale for the z axis legend on screen like the IntensityGraph does?
Solved! Go to Solution.
05-22-2013 04:33 PM
Currently, the way to display a scale outside of a control is a little convoluted, and we plan to change it in the future. For now, you can accomplish this with the following XAML:
<niPrimitives:RegionPanel HorizontalAlignment="Left">
<niPrimitives:RegionPanel.LayoutDefinitions>
<niPrimitives:ContentDefinition Name="Content" />
<niPrimitives:EdgeDefinition Name="FarVertical" Parent="Content"
From="1,0" To="1,1" />
</niPrimitives:RegionPanel.LayoutDefinitions>
<niPrimitives:ScalePresenter
niPrimitives:RegionPanel.Region="FarVertical"
niPrimitives:RegionPanel.RelativeWidth="1"
niPrimitives:LayeredGraph.TargetLocation="Far"
Owner="{Binding ElementName=graph}"
Scale="{StaticResource colorScale}" />
</niPrimitives:RegionPanel>
05-23-2013 10:22 AM
Thanks Paul.
Note, for anyone looking in the future, some namespaces have changed. The following is the correct namespacing:
xmlns:niPrimitives="clr-namespace:NationalInstruments.Controls.Primitives;assembly=NationalInstruments.Controls"
xmlns:niRegions="clr-namespace:NationalInstruments.Controls.Primitives.Regions;assembly=NationalInstruments.Controls"
xmlns:niGraphs="clr-namespace:NationalInstruments.Controls.Primitives;assembly=NationalInstruments.Controls.Graphs"
<niRegions:RegionPanel HorizontalAlignment="Left">
<niRegions:RegionPanel.LayoutDefinitions>
<niRegions:ContentDefinition Name="Content" />
<niRegions:EdgeDefinition Name="FarVertical" Parent="Content" From="1,0" To="1,1" />
</niRegions:RegionPanel.LayoutDefinitions>
<niPrimitives:ScalePresenter niRegions:RegionPanel.Region="FarVertical"
niRegions:RegionPanel.RelativeWidth="1"
niGraphs:LayeredGraph.TargetLocation="Far"
Owner="{Binding ElementName=graph}"
Scale="{StaticResource colorScale}" />
</niRegions:RegionPanel>
05-23-2013 10:33 AM
Sorry for not mentioning that: I was using the schema namespaces, which include Regions:
xmlns:ni="http://schemas.ni.com/controls/2009/xaml/presentation"
xmlns:niPrimitives="http://schemas.ni.com/controls/2009/xaml/presentation/primitives"
08-11-2015 11:17 AM
Just wanted to let you know we have added a new ScaleHost
type to display a scale outside of a control, as shown in the "NonUniformIntensity" example installed with the Measurement Studio 2015 release.