Monday, October 8, 2012

Setting static number of "DependentRangeAxis" values on LinearAxis

Setting static number of "DependentRangeAxis" values on LinearAxis

I'm using Silverlight toolkit's charts. I use filters to modify the charts ItemsSource, so the X-axis' value (this is a horizontal bar graph) range changes based on the filter selections. The chart draws correctly, but I'd like to have more control over the values that display on the X-axis. Currently, the number of x-axis values changes...but I'd like to only ever have, for example, 15 "ticks" and have the labels calculate from there.

Here is how I'm currently formatting things:

<charts:Chart.Axes>     <charts:LinearAxis Orientation="X" Interval="Auto" >         <charts:LinearAxis.AxisLabelStyle>             <Style TargetType="charts:AxisLabel">                 <Setter Property="StringFormat" Value="{}{0:$#,##0,,.0##M}"/>                 <Setter Property="FontSize" Value="10"/>             </Style>         </charts:LinearAxis.AxisLabelStyle>     </charts:LinearAxis>     <charts:CategoryAxis Orientation="Y">         <charts:CategoryAxis.AxisLabelStyle>             <Style TargetType="charts:AxisLabel">                 <Setter Property="FontSize" Value="10"/>             </Style>         </charts:CategoryAxis.AxisLabelStyle>     </charts:CategoryAxis> </charts:Chart.Axes> 

I want the values to display as decimals of millions, which it is doing...but I'd like to say, show me 0 to Max in 15 ticks.

Here are some examples of current results: One Two

And the links in case the images show too small:

One - http://i.stack.imgur.com/er1H5.jpg

Two - http://i.stack.imgur.com/Gx994.jpg

Answers & Comments...




No comments:

Post a Comment

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