Wednesday, August 29, 2012

Customize WPF Toolkit column chart

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.

Answers & Comments...

Answer: 1

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.

by : vorrtexhttp://stackoverflow.com/users/427225




No comments:

Post a Comment

Send us your comment related to the topic mentioned on the blog