In my chart I want to display text before Y axis as a vertical Title in center for y axis like "% Volume" and below X axis in center want to display label as "Sales". How do I add these labels on X & Y axis respectively ? My XML code is :
Grid>
<DVC:Chart Name="bsiPlaceChart" Title="SI Placement" LegendTitle="Legend" Width="850" Height="450">
<DVC:Chart.Series>
<DVC:ColumnSeries Name="layer1Chart" Title="Title 1" ItemsSource="{Binding}" IndependentValuePath="Name"
DependentValuePath="Volume"></DVC:ColumnSeries>
<DVC:ColumnSeries Name="layer2Chart" Title="Title 2" ItemsSource="{Binding}" IndependentValuePath="Name"
DependentValuePath="Volume" ></DVC:ColumnSeries>
<DVC:ColumnSeries Name="layer3Chart" Title="Title 3" ItemsSource="{Binding}" IndependentValuePath="Name"
DependentValuePath="Volume" ></DVC:ColumnSeries>
</DVC:Chart.Series>
</DVC:Chart>
<TextBlock HorizontalAlignment="Center" Text="Layers" FontSize="12" FontWeight="Bold" Margin="343,440,472,0" />
</Grid>
For X axis, I tried adding a text block below the chart, but when window size changes, the text also moves up and down. I wan it to stay below the chart - as if it is part of the chart.
How do I set such titles for X & Y axis respectively.
UPDATIONS : Solution Provided by Paul : I added in Resources for X & Y axis respectively :
<Grid.Resources>
<DVC:LinearAxis Orientation="Y" Title="% Volume" HorizontalAlignment="Left" x:Key="YAxis" />
<DVC:LinearAxis Orientation="X" Title="Layers" HorizontalAlignment="Center" x:Key="XAxis" />
</Grid.Resources>
And in each Column series modified as below :
<DVC:ColumnSeries Name="layer1Chart" Title="Viscosity 1" ItemsSource="{Binding}" IndependentValuePath="Name" DependentValuePath="Volume" DependentRangeAxis="{StaticResource YAxis}">
</DVC:ColumnSeries>
This managed the Y axis point. How do I add the XAxis also to it ?
SOLUTION : Removed the resources and added Chart.Axes in Chart as shown below. This adds "% Volume" label on left of Y Axis and "Layers" label on bottom of X Axis. Perfect.
<!-- Add Title on Y axis and X Axis -->
<DVC:Chart.Axes>
<DVC:LinearAxis Orientation="Y" Title="% Volume" HorizontalAlignment="Left" />
<DVC:CategoryAxis Orientation="X" Title="Layers" Location="Bottom" />
</DVC:Chart.Axes>
Thanks Paul.