Is there any way to rotate the independent value axis

Jul 9, 2009 at 8:26 PM

I have been working with the chart over that last few days and ran into a problem, I would like to rotate the independent value axis label.  The image in the link show's the labels are stacked what I would like is to be able to rotate these about 45 degrees and so they line up a little nicer.  I have been able to rotate the DependentRangeAxis but I have been unable to do this with the independent axis.  This seems to be a problem only when the independent values are datetime objects

http://s849.photobucket.com/albums/ab57/masontwo23/?action=view&current=axis_1.png

 

Coordinator
Jul 10, 2009 at 10:15 PM

Something like the following seems to do the trick for me:

<charting:Chart x:Name="chart">
    <charting:LineSeries
        ItemsSource="{Binding}"
        IndependentValuePath="Key"
        DependentValuePath="Value">
        <charting:LineSeries.IndependentAxis>
            <charting:DateTimeAxis
                Orientation="X">
                <charting:DateTimeAxis.AxisLabelStyle>
                    <Style TargetType="charting:AxisLabel">
                        <Setter Property="LayoutTransform">
                            <Setter.Value>
                                <RotateTransform Angle="-45"/>
                            </Setter.Value>
                        </Setter>
                    </Style>
                </charting:DateTimeAxis.AxisLabelStyle>
            </charting:DateTimeAxis>
        </charting:LineSeries.IndependentAxis>
    </charting:LineSeries>
</charting:Chart>

Where:
chart.DataContext = new KeyValuePair<DateTime, int>[]
{
    new KeyValuePair<DateTime, int>(DateTime.Today.AddDays(-7), 1),
    new KeyValuePair<DateTime, int>(DateTime.Today.AddDays(0), 2),
    new KeyValuePair<DateTime, int>(DateTime.Today.AddDays(7), 3),
};
Jul 14, 2009 at 8:37 PM

That works to rotate the axis labels, but the position of the labels is still "stacked" (in 2 rows).   Like this:

http://picasaweb.google.com/jrmyczek/Screenshots#5358379526842705442

Is it possible to make it look like the photoshopped sample?

http://picasaweb.google.com/jrmyczek/Screenshots#5358401807974825682