We're currently trailing the charts in WPF and we have a problem where the label settings don't work for the Y Axis on any of our charts.
Below is the code for one of our charts, the LabelSettings for the X Axis work, can you tell us what we're doing wrong for the Y Axis?
<ig:XamDataChart Background="Transparent" PlotAreaBackground="Transparent" HorizontalAlignment="Stretch" Height="200"> <ig:XamDataChart.Axes> <ig:CategoryDateTimeXAxis DateTimeMemberPath="EffectiveFrom" Interval="30" ItemsSource="{Binding Path=Prices}" x:Name="LineXAxis" Label="{}{EffectiveFrom:MMM}" Background="White" Foreground="#777777"> <ig:CategoryDateTimeXAxis.LabelSettings> <ig:AxisLabelSettings Padding="0,7,0,0"></ig:AxisLabelSettings> </ig:CategoryDateTimeXAxis.LabelSettings> </ig:CategoryDateTimeXAxis> <ig:NumericYAxis x:Name="LineYAxis" Interval="1" Label="{}{}" Background="White" Foreground="#777777" > <ig:NumericYAxis.LabelSettings> <ig:AxisLabelSettings Padding="5,0,0,0"></ig:AxisLabelSettings> </ig:NumericYAxis.LabelSettings> </ig:NumericYAxis> </ig:XamDataChart.Axes> <ig:XamDataChart.Series> <ig:LineSeries MarkerType="None" ItemsSource="{Binding Path=Prices}" ValueMemberPath="Amount.FormattedPrice" XAxis="{Binding ElementName=LineXAxis}" Brush="{DynamicResource Accent}" Thickness="1" YAxis="{Binding ElementName=LineYAxis}"> </ig:LineSeries> </ig:XamDataChart.Series> </ig:XamDataChart>
Hello,
I have been looking into the reported issue and I have not managed to reproduce it on my side. It seems that all setting are applied. I am attaching my sample application(DataChart.zip) that I have used for my tests.
Let me know, if I miss something.
Thanks, to be more specific, the Text Alignment doesn't work, replace your XAML grid with this:
<ig:XamDataChart x:Name="chart" Background="Transparent" PlotAreaBackground="Transparent" HorizontalAlignment="Stretch" Height="200" > <ig:XamDataChart.Axes> <ig:CategoryYAxis x:Name="yAxis" Interval="4" Label="{}{Time:dddd}" ItemsSource="{StaticResource datapoints}" Background="White"> <ig:CategoryYAxis.LabelSettings> <ig:AxisLabelSettings Foreground="Red" Padding="0,0,0,0" TextAlignment="Right"></ig:AxisLabelSettings> </ig:CategoryYAxis.LabelSettings> </ig:CategoryYAxis>
<ig:NumericXAxis x:Name="xAxis" Interval="1" Label="{}{}" Background="White"> <ig:NumericXAxis.LabelSettings> <ig:AxisLabelSettings Foreground="Red" Padding="0,0,0,0" TextAlignment="Right" ></ig:AxisLabelSettings> </ig:NumericXAxis.LabelSettings> </ig:NumericXAxis> </ig:XamDataChart.Axes> <ig:XamDataChart.Series> <ig:BarSeries ItemsSource="{StaticResource datapoints}" ValueMemberPath="Value" XAxis="{Binding ElementName=xAxis}" YAxis="{Binding ElementName=yAxis}"></ig:BarSeries> </ig:XamDataChart.Series> </ig:XamDataChart>
After consulting with our development team I found out that this setting is not intended to work in this context. If you would like to use left/right alignment settings for horizontal axis labels, I can suggest submitting a new product idea at <http://ideas.infragistics.com>.
There are many benefits to submitting an product idea:
- Direct communication with our product management team regarding your product idea.
- Notifications whenever new information regarding your idea becomes available.
- Ability to vote on your favorite product ideas to let us know which ones are the most important to you. You will have ten votes for this and can change which ideas you are voting for at any time.
- Allow you to shape the future of our products by requesting new controls and products altogether.
- You and other developers can discuss existing product ideas with members of our Product Management team.
Steps to create your idea:
The Product Idea site puts you in the driver’s seat and allows you to track the progress of your ideas at any time, see how many votes it got, read comments from other developers in the community, and see if someone from the product team has additional questions for you.
Thank you for contacting Infragistics.
I'm finding that none of the label settings are being applied on a CategoryYAxis. The documentation is pretty clear that there are a whole bunch of properties that can be set on each axis. My senses are telling me that this is a bug rather than by design.
I agree that they aren't an easy fit for MVVM. Having spent quite some time studying the DataChart codebase, I can tell you that it's more than likely by design.
Having overseen multiple full scale multi million pound (GBP) applications, it's clear that you've got to tread carefully to avoid performance problems in WPF generally. My educated guess is that the DataChart has been optimised for performance and some of the data binding has been scaled back to this end.
I simply extend the Infragistics charts, add the desired functionality in the derived class, and then use them in MVVM in exactly the same way. It doesn't break the pattern, it's just another control that exists in the view and binds to a view model.
It would be my advice to anyone looking to use these controls in a purely MVVM manor to avoid them. Too many of the answers from Infragistics point back to code behind which to my mind suggest a hastily put together Windows Forms solution for XAML.
It's working if I do it in the xaml, but not when I'm trying to apply it in a style. Only thing I can assume is its some sort of bug.
Gary,
I did manage to access the settings by using code behind (yuck) but the results were not satisfactory. The combination of text alignment and extents gave pretty poor results.
Pete
I'm having a very similar issue, except I can't access it from code behind. I think there might be a bug involved. Attached is a sample project showing whats happening. It seems like if the CategoryYAxis LabelSettings are done in a style, they're not applied. I created two tiles, one that has the same exact code except the content is done explicitly, and the other is done in a style. You can however change the NumericXAxis labelsettings and those changes do get applied.
Any ideas of a work around or solution?
Thanks in advance.