dksimon Posted May 15, 2009 Report Share Posted May 15, 2009 Is there any way to get the X-axis to take up less space? It seems to take up a good 10 pixels both above and below the label text, making it quite fat if the chart being displayed is small. I can't seem to find any way to reduce this. Quote Link to comment Share on other sites More sharing options...
JuanC Posted May 20, 2009 Report Share Posted May 20, 2009 The following XAML shows how to minimize the space used by the X axis <StackPanel Orientation="Horizontal" Grid.Row="1"> <cfx:Chart Gallery="Bar" x:Name="chart1" Width="300" Height="280" Style="{x:Static cfxMotifs:Basic.Style}"> <cfx:Chart.Series> <cfx:SeriesAttributes/> </cfx:Chart.Series> <cfx:Chart.LegendBox> <cfx:LegendBox Visibility="Collapsed"/> </cfx:Chart.LegendBox> </cfx:Chart> <cfx:Chart Gallery="Bar" x:Name="chart2" Width="300" Height="280" Style="{x:Static cfxMotifs:Basic.Style}"> <cfx:Chart.Series> <cfx:SeriesAttributes/> </cfx:Chart.Series> <cfx:Chart.LegendBox> <cfx:LegendBox Visibility="Collapsed"/> </cfx:Chart.LegendBox> <cfx:Chart.PlotArea> <cfx:PlotAreaAttributes Margin="8"/> </cfx:Chart.PlotArea> <cfx:Chart.AxisX> <cfx:Axis Separation="0"> <cfx:Axis.Grids> <cfx:Grids> <cfx:Grids.Major> <cfx:GridLine TickSize="4"/> </cfx:Grids.Major> <cfx:Grids.Minor> <cfx:GridLine TickSize="2"/> </cfx:Grids.Minor> </cfx:Grids> </cfx:Axis.Grids> </cfx:Axis> </cfx:Chart.AxisX> </cfx:Chart> </StackPanel> Note the following - Chart.Style set to Basic to simplify the chart layout - PlotArea.Margin set to 8, this is not directly related to your question but will minimize space taken on the top and right of the plot area. You could set the margin to 0 if you do not show the chart border, otherwise it might look a little crowded - Axis.Separation set to 0 - GridLine.TickSize reduced for both Major and Minor Grid lines. Note that you can win a little more space by setting the TickMark to None We found that we can save a few more pixels when Separation is set to 0, this will be fixed in future hotfixes/service packs. Regards, JuanC Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.