简体   繁体   中英

Customize WPF Toolkit column chart

I want to create a column chart using the WPF toolkit, but I want to hide the Y axis and display the dependant value for each column below the X value.

Is this possible?? If not, what other way could be used to get this result??

Thanks in advance.

Yes, you can hide the Y-axis. You should add the y-axis explicitly to the Axes property of the chart and set the Opacity property, like this:

<charting:Chart.Axes>
    <charting:LinearAxis Orientation="Y" Opacity="0" />
</charting:Chart.Axes>

As to the second question, you should change the AxisLabelStyle property. I answered a similar question here , you can look at the code and change the ControlTemplate according to your needs.

The template will look something like this, don't forget change bindings:

<Style x:Key="twoLabelsStyle" TargetType="charting:AxisLabel">
    <Setter Property="Template">
        <Setter.Value>
            <ControlTemplate TargetType="charting:AxisLabel">
                <StackPanel>
                    <TextBlock Text="{Binding Month}" />
                    <TextBlock Text="{Binding Number}" />
                </StackPanel>
            </ControlTemplate>
        </Setter.Value>
    </Setter>
</Style>

Anyway if it will not still work - add your source code to your question, it can help much better.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM