Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

wpf graph: axis label formatting

Solved!
Go to solution

How do I configure the graph to show only first and last label on the axis? I think it's somehow should be done by modifying RangeLabeledDivisions.Mode property...

 

                     <ni:AxisDouble x:Name="horizontalAxis1" Orientation="Horizontal" Label="X" BaselineStroke="{x:Null}">
                        <ni:AxisDouble.MinorDivisions>
                            <ni:RangeDivisions TickVisibility="Hidden" />
                        </ni:AxisDouble.MinorDivisions>
                        <ni:AxisDouble.MajorGridLines>
                            <ni:GridLines Stroke="{StaticResource GraphGridLinesColorBrush}" />
                        </ni:AxisDouble.MajorGridLines>
                        <ni:AxisDouble.MajorDivisions>
                        <ni:RangeLabeledDivisions TickVisibility="Hidden">
                            <ni:RangeLabeledDivisions.LabelPresenter>
                                <ni:GeneralValueFormatter Format="0.00" />
                            </ni:RangeLabeledDivisions.LabelPresenter>
                        </ni:RangeLabeledDivisions>
                    </ni:AxisDouble.MajorDivisions>
                </ni:AxisDouble>
0 Kudos
Message 1 of 7
(6,847 Views)
Solution
Accepted by topic author eugenem

You can set the Mode on the MajorDivisions to a Count mode of two:


    <ni:AxisDouble.MajorDivisions>
        <ni:RangeLabeledDivisions Mode="Count: 2" TickVisibility="Hidden">
                ...
        </ni:RangeLabeledDivisions>
    </ni:AxisDouble.MajorDivisions>


This will show just the minimum and maximum divisions for the range.

~ Paul H
0 Kudos
Message 2 of 7
(6,839 Views)

thanks!

 

How do I make left label aligned left at 0 and right label aligned right at max? Now they both are aligned center.

0 Kudos
Message 3 of 7
(6,835 Views)

Have a look at this question.

~ Paul H
0 Kudos
Message 4 of 7
(6,832 Views)

got it, works!

0 Kudos
Message 5 of 7
(6,829 Views)

Another clarification: when I use count:2, all gridlines are also gone. How can I get both gridlines and 2 labels?

0 Kudos
Message 6 of 7
(6,819 Views)

The grid lines are tied to the major divisions shown by the axis. To show the divisions without the labels, you can leave Mode set to Auto and use the opacity technique from the hide labels question, switching the logic so the opacity is changed for the non-extreme labels.

~ Paul H
0 Kudos
Message 7 of 7
(6,814 Views)