Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

Show color scale axis with Graph and IntensityRenderer

Solved!
Go to solution

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?

0 Kudos
Message 1 of 5
(6,648 Views)
Solution
Accepted by topic author cbgapac

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>

~ Paul H
0 Kudos
Message 2 of 5
(6,639 Views)

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>

 

0 Kudos
Message 3 of 5
(6,627 Views)

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"

~ Paul H
0 Kudos
Message 4 of 5
(6,625 Views)

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.

~ Paul H
0 Kudos
Message 5 of 5
(5,067 Views)