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
1886
Column Series - Category Axis and Label Location
posted

We have a chart with a numeric Y axis and a Category X axis and a column Series of data.  We need to produce a Bar Chart (A histogram)  BUT we need the X Axis labels to appear at the category breaks and not centered under the category bar.

This is relativly simple if you have a fixed number of categories and a fixed chart size using transforms and transform origin in the label datatemplate BUT...  Our users can dynamically change the number of categories and resize the screen.  Any idea how we can accomplish this?  How do I know the width of the label as it does not honor the "Stretch" attribute and grow/shrink with the label width.

 

<ig:CategoryXAxis.Label>

    <DataTemplate>

        <!--Text="{Binding Item.EndX}"-->

        <TextBlock  VerticalAlignment="Stretch" HorizontalAlignment="Stretch" RenderTransformOrigin="0,0">

            <TextBlock.Text>

                <MultiBinding Converter="{StaticResource Axis_DisplayUnitsMultiConverterInstance}">

                    <Binding Path="Item.EndX" />

                    <Binding Path="Axis.DataContext.XAxis"/>

                </MultiBinding>

            </TextBlock.Text>

            <TextBlock.LayoutTransform>

                <TransformGroup>

                    <RotateTransform Angle="90" />

                    <TranslateTransform Y="90" />

                </TransformGroup>

            </TextBlock.LayoutTransform>

        </TextBlock>

    </DataTemplate>

</ig:CategoryXAxis.Label>

 

 

 

thanks