Chart not showing

Mar 16, 2015 at 9:58 PM
Hi to all,
I am developing an app for windows phone 8.1 with the chart control
I have a list that I want to be the source of an BarSeries Chart.
my c# code is like this:
List<int> myLst = new List<int>();
 for (int i = 0; i < myKinoObject.draws.draw.Count(); i++)
{
  myLst.AddRange(myKinoObject.draws.draw[i].results);
 }
var counts = myLst.GroupBy(x => x).ToDictionary(x => x.Key, x => x.Count());
and my xaml is that:
<Charting:Chart Name="BarChart1" Title="Department" Width="300" Height="500" >
    <Charting:BarSeries  DependentValuePath="Value" IndependentValuePath="Key" 
                         DataContext="{Binding}" 
                        IsSelectionEnabled="True"
                         />
</Charting:Chart>
What I am not doing ?
Coordinator
Mar 16, 2015 at 10:27 PM
You're not setting the ItemsSource of the series to your myLst. Check the sample:
http://winrtxamltoolkit.codeplex.com/SourceControl/latest#WinRTXamlToolkit.Sample/WinRTXamlToolkit.Sample.Windows/Views/Controls/ChartTestView.xaml.cs
and XAML:
http://winrtxamltoolkit.codeplex.com/SourceControl/latest#WinRTXamlToolkit.Sample/WinRTXamlToolkit.Sample.Windows/Views/Controls/ChartTestView.xaml

This is how the sample is doing the binding:
            <charting:BarSeries
                Title="Population"
                IndependentValueBinding="{Binding Name}"
                DependentValueBinding="{Binding Value}"
                IsSelectionEnabled="True" />
((BarSeries)this.BarChart.Series[0]).ItemsSource = items;
Mar 17, 2015 at 12:29 AM
ok, now I can see everything, but I have many values to show (80) and my Chart is very stretched and I cannot see and understand anything.

Is possible to make it my chart scrollable to the right and the left so I can see the values?
I have set the DisplayOrientations to Landscape only

Thanks a lot
Coordinator
Mar 17, 2015 at 1:14 AM
You could put the Chart in a ScrollViewer configured for horizontal scrolling and manually set the chart's width to let it scroll. Note though that you won't get virtualization anyway, so you should tread carefully when adding more values to the chart. At some point it might be worth switching to D2D or DirectX in general for rendering the graph.
Mar 17, 2015 at 9:17 PM
ok I put it in a ScrollViewer and now it seams ok.

And another one question please.
Can I see the values of the Bars?
Coordinator
Mar 17, 2015 at 9:48 PM
You could probably restyle the data points to show the values. On PC they actually show up when you hove over the data point/bar, so it might be fairly straightforward style update.

If you look up BarDataPoint you can see that it has a tooltip:
                    <ToolTipService.ToolTip>
                        <ContentControl
                            Content="{TemplateBinding FormattedDependentValue}" />
                    </ToolTipService.ToolTip>
Just (copy&paste) derive your style from that, put the ContentControl that is normally in the tool tip to be always visible or show on tap or whatever you wish and set the series' DataPointStyle to your style.