I am using the trial version of Silverlight DataVisualization chart and I would like to use data from a web service as the input to this chart. Another thing that I would like to do is add the date from the data retrieved to the X-axis. Following is the code I am using
A few things:
Hope this helps!
-Graham
Thank you Graham. But that did not do anything other than showing the way it was. Is there something I am missing ? Could you check on your end to see if it shows any values? As you can see from the code I havent really used any external source for data so it may be easier for you to check and may be send me a screenshot if it works for you.
Thanks,
Subrato Mukherjee
Hi,
Could you share how you have defined the chart also? A small sample application would help.
<UserControl x:Class="Charting.MainPage" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" Loaded="UserControl_Loaded" mc:Ignorable="d" d:DesignHeight="633" d:DesignWidth="778" xmlns:igWebChart="http://schemas.infragistics.com/xamWebChart" xmlns:ig="http://schemas.infragistics.com/xaml" xmlns:Resources="clr-namespace:Charting.Resources"> <UserControl.Resources> <Resources:ChartStrings x:Key="Strings" /> </UserControl.Resources> <Border x:Name="LayoutRoot" Margin="2,2,2,2" Background="{x:Null}" CornerRadius="10,10,10,10"> <Grid Width="800" Height="600" MaxWidth="1000"> <Grid.ColumnDefinitions> <ColumnDefinition Width="*" /> </Grid.ColumnDefinitions> <Grid.RowDefinitions> <RowDefinition Height="15" /> <RowDefinition Height="*" /> </Grid.RowDefinitions> <Border Height="Auto" Grid.ColumnSpan="1" Grid.Row="1" HorizontalAlignment="Stretch" Margin="10,0,10,10" VerticalAlignment="Top" Background="{x:Null}" BorderBrush="#FFEAEAEA" BorderThickness="1,1,1,1" Padding="0,0,0,0"> <Grid Width="Auto" Background="#FFFAFAFA"> <Grid.RowDefinitions> <RowDefinition Height="Auto" /> <RowDefinition Height="*" /> </Grid.RowDefinitions> <StackPanel> <TextBlock Margin="5,0,0,0" VerticalAlignment="Center" Text="{Binding Path=XWC_ChartZooming_Chart_TitleLabel, Source={StaticResource Strings}}" TextWrapping="Wrap" /> <Rectangle Height="1" Margin="0,0,0,0" Fill="#FFEAEAEA" Stroke="{x:Null}" /> </StackPanel> <!--#BEGIN SNIPPET#--> <igWebChart:XamWebChart x:Name="theChart" Grid.Row="1" Margin="5,5,5,0" EndPaletteBrush="#E5F81865" StartPaletteBrush="#E5C4FF0A" > <igWebChart:XamWebChart.Scene> <igWebChart:Scene> <igWebChart:Scene.GridArea> <igWebChart:GridArea BorderThickness="1,1,1,1" /> </igWebChart:Scene.GridArea> </igWebChart:Scene> </igWebChart:XamWebChart.Scene> <igWebChart:XamWebChart.Axes> <igWebChart:Axis AutoRange="True" AxisType="PrimaryX" ScrollEnabled="True" Stroke="#FFFFFFFF" StrokeThickness="1" Unit="100"> <igWebChart:Axis.MajorTickMark> <igWebChart:TickMarkGroup Stroke="#59666666" StrokeThickness="0.5" /> </igWebChart:Axis.MajorTickMark> <igWebChart:Axis.Label> <igWebChart:LabelGroup FontSize="10" Foreground="#FF666666" /> </igWebChart:Axis.Label> <igWebChart:Axis.MajorGridline> <igWebChart:GridlineGroup Stroke="#59CCCCCC" StrokeThickness="0.5" /> </igWebChart:Axis.MajorGridline> </igWebChart:Axis> <igWebChart:Axis AutoRange="True" AxisType="PrimaryY" Maximum="1000" Minimum="1" RangeFromZero="True" ScrollEnabled="True" Stroke="#FFFFFFFF" StrokeThickness="1" Unit="10"> <igWebChart:Axis.MajorTickMark> <igWebChart:TickMarkGroup Stroke="#59666666" StrokeThickness="0.5" /> </igWebChart:Axis.MajorTickMark> <igWebChart:Axis.Label> <igWebChart:LabelGroup FontSize="10" Foreground="#FF666666" /> </igWebChart:Axis.Label> <igWebChart:Axis.MajorGridline> <igWebChart:GridlineGroup Stroke="#59CCCCCC" StrokeThickness="0.5" /> </igWebChart:Axis.MajorGridline> </igWebChart:Axis> </igWebChart:XamWebChart.Axes> <igWebChart:XamWebChart.Legend> <igWebChart:Legend Visibility="Visible" /> </igWebChart:XamWebChart.Legend> <igWebChart:XamWebChart.ZoomRectangle> <igWebChart:ZoomRectangle Enabled="True" /> </igWebChart:XamWebChart.ZoomRectangle> </igWebChart:XamWebChart> <!--#END SNIPPET#--> </Grid> </Border> </Grid> </Border></UserControl>
This is the whole code from my xaml file. As this is a sample app I am trying I am pasting all the code without any section removals or anything like that.
Did you comment out these two lines?
//series.AxisX = "Date";//series.AxisY = "Views";
Try adding the following lines to your XAML, inside the X Axis tag:
<igChart:Axis.Label>
<igChart:LabelGroup Format="" />
</igChart:Axis.Label>
It looks like this issue has come back with 2011.2.
Any ideas?
I am running into exactly the same thing with 2011.1 Silverlight XamWebChart when doing a StackedColumn chart.
Strangely enough, when I do a ScatterLine chart, it works fine. Too bad I actually need a StackedColumn chart in this case.
Has there been any progress on this issue?
Mike
Are you running the latest service release of the product? I believe this should no longer be an issue.
I am also facing the same issue...my XamWebChart doesn't show up the date in the x-axis rather it shows 1,2....10
I am using wcf ria service to pull the data from database and binding IEnumerable collection to the chart data source.
Thanks
-Sajin