MMCCPaulEden Posted May 26, 2009 Report Share Posted May 26, 2009 Hi If you have large y-axis labels on a Gantt chart (50+ characters) the label texts have a tendency to not display correctly with either the text justification pushing the labels outside the bounds of the control or overflowing the bounds. Is it possible tomake your lables wrap text instead? Thanks Paul Quote Link to comment Share on other sites More sharing options...
TatianaG Posted May 26, 2009 Report Share Posted May 26, 2009 You can't word-wrap on the axis as you can in a title. As a suggestion - you can use the KeyLeg property (see API reference for details) to assign a short "nick name" to the axis itself and reserve the longer names for the legend box Quote Link to comment Share on other sites More sharing options...
JuanC Posted May 26, 2009 Report Share Posted May 26, 2009 The reason why sometimes you might get a clipped axis is because there is a property (PlotArea.MinSize) that assigns a minimum percentage of the available space to the plotarea. If you would rather have the axis unclipped you can use the following XAML <cfx:Chart.PlotArea> <cfx:PlotAreaAttributes MinSize="0"/></cfx:Chart.PlotArea> Although we have no properties to easily word wrap the labels in an axis, we should be able to support this through templating. There is a small bug preventing this scenario. As soon as it is fixed you will be able to do something like <cfx:Chart.AxisX> <cfx:Axis> <cfx:Axis.Template> <DataTemplate> <TextBlock Width="90" Text="{Binding Path=DataItem.Name}" TextWrapping="Wrap" Foreground="{Binding Path=Foreground}" FontFamily="{Binding Path=FontFamily}" FontSize="{Binding Path=FontSize}"/> </DataTemplate> </cfx:Axis.Template> </cfx:Axis></cfx:Chart.AxisX>Regards, JuanC Quote Link to comment Share on other sites More sharing options...
JuanC Posted June 1, 2009 Report Share Posted June 1, 2009 We have uploaded a hotfix that includes support for this scenario. You can download a hotfix here. Regards, JuanC Quote Link to comment Share on other sites More sharing options...
MMCCPaulEden Posted June 4, 2009 Author Report Share Posted June 4, 2009 Hi We're having trouble making this work. Given the Template of: <Window.Resources> <!-- //' Axis-x label wrapping--> <DataTemplate x:Key="ChartLabel" > <TextBlock Width="50" Text="{Binding Path=DataItem.Name}" TextWrapping="Wrap" Foreground="Black" FontFamily="{Binding Path=FontFamily}" FontSize="{Binding Path=FontSize}"/> </DataTemplate> </Window.Resources> Setting the Axis-x labels manually(for testing): oChart.AxisX.Labels.Items.Add( "really very quite long lbl2");oChart.AxisX.Labels.Items.Add("really very quite long lbl3");oChart.AxisX.Labels.Items.Add( "really very quite long lbl4");Applying template: oChart.AxisX.Template = Resources[ "ChartLabel"] as DataTemplate;When the above compiles the axis-x labels go not appear - I can understand that DataItem.Name doe snot exist (that is the compiler message that get generated) but I can't fathom what the binding should be. Many thanks Paul Quote Link to comment Share on other sites More sharing options...
JuanC Posted June 4, 2009 Report Share Posted June 4, 2009 There is a check in our code that will prevent you from templating axis labels when you are not using Chart.ItemsSource, if this was only for testing wrapping in the current build you will have to create a collection of simple CLR objects with 2 properties (one numeric to be plotted and a string property to use in the X axis) and use Chart.ItemsSource to populate the chart with it. We will support axis labels templating with manual data in future builds and your binding will be to either DataItem or Text, e.g. <TextBlock Text="{Binding Path=DataItem}"/>Regards, JuanC Quote Link to comment Share on other sites More sharing options...
MMCCPaulEden Posted June 4, 2009 Author Report Share Posted June 4, 2009 Hi Pairing axis labels with data is not in our best interests at present due to the potential size of data we deal with - do you have any timescales for the templating update? Many thanks Paul Quote Link to comment Share on other sites More sharing options...
JuanC Posted June 4, 2009 Report Share Posted June 4, 2009 If you are passing data to the chart using Chart.ItemsSource but need to pass labels manually then you will have to bind to Text because DataItem will point to your CLR object. We should have a new hotfix including support for this in a couple of days. Regards, JuanC Quote Link to comment Share on other sites More sharing options...
MMCCPaulEden Posted June 4, 2009 Author Report Share Posted June 4, 2009 Cool - look forward to it ) Paul 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.