Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
860
Rotateing OlapXAxis Labels
posted

Hello

I have a chart based on an OlapXAxis. This work overall fine, but my challenge is that I want to rotate the labels on the X axis. The reason for that is I sometimes have many rows on the X-axis and the labels overlaps. Rotateing them will generate more space

What I done so far:

Set a LabelStyle on the axis. 

x:Name="olapXAxis"
OlapAxisSource="Rows"
YAxis="{Binding ElementName=xmYAxis1}"
LabelStyle="{StaticResource OlapLabelControlStyle}">

The Style:

    <Style TargetType="ig:OlapLabelControl" x:Key="OlapLabelControlStyle">

        <Setter Property="Foreground" Value="Black" />

            <Setter Property="LayoutTransform">

            <Setter.Value>

                <RotateTransform Angle="90" />

            </Setter.Value>

            </Setter>

        </Style>

I tried to change various margins and height, but nothing seems to work.This will rotate the text. But my problem is that the control does not resize and only the first few letters is shown, the rest is cut off (see attached file)

Any suggestions or alternative ways to do it?

Parents
No Data
Reply
  • 34510
    Offline posted

    Hi logimatic,

    I wouldn't say this is one of the correct ways to rotate the labels but it definitely seems weird that the chart is not resizing properly to account for the rotated OlapLabelControl.  Normally the correct approach would be to set the OlapXAxis.LabelSettings.Angle property to the desired angle but this doesn't appear to be working correctly for OlapXAxis like it does with other axis types.  I logged a development issue for this so our engineers can investigate.  The dev issue ID is 229381.

    I also created a private support case for you so that you can track the status of this dev issue.  The case number is CAS-179285-Z6S9K2 and you can view it here.  In the mean time you can use a workaround which I have attached to this post.

    The workaround consists of setting up an attached property on the XamDataChart which then finds the OlapLabelPanelHorizontal element in the visual tree and hooks up to its SizeChanged event.  When the SizeChanged event fires, it updates another attached property on the XamDataChart with the actual height value.  I then bind the AxisLabelSettings.Extent property to the XamDataChart and the actual height attached property.  So now whenever the height of the panel changes, it will update that attached property and update the Extent which will adjust the panel area height accordingly.

    Let me know if you have any questions.

    WpfApplication1.zip
Children