Click here to Skip to main content
15,887,923 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I trying to create line chart using WinRT XAML Toolkit[^] which is a port of SilverlightToolkit. The problem is values are displayed but I have no line(nothing is draw) in my LineChart. I followed the method used in this site[^]

The result I get is http://i.imgur.com/IK3suOZ.jpg[^]

Xaml I used for drawing chart is:
HTML
<Charting:Chart x:Name="lineChart" HorizontalAlignment="Left" Height="460" Margin="422,53,0,0" Grid.Row="1" VerticalAlignment="Top" Width="793" Loaded="Chart_Loaded">
    <Charting:LineSeries Height="100" Width="100" IndependentValuePath="ValueCode" DependentValuePath="ExchangeRate" IsSelectionEnabled="True"/>
</Charting:Chart>


And C# code behind:
C#
private void Chart_Loaded(object sender, RoutedEventArgs e)
{
    List<testClass> test2 = new List<testClass>();
    test2.Add(new testClass() { ValueCode = "USD", ExchangeRate =2});
    test2.Add(new testClass() { ValueCode = "USD", ExchangeRate = 4 });
    test2.Add(new testClass() { ValueCode = "USD", ExchangeRate = 6 });

    (lineChart.Series[0] as LineSeries).ItemsSource = test2;
}

testClass code:
C#
public class testClass
{

    string value_code;
    int exchange_rate;
       
    public int ExchangeRate
    {
        get { return exchange_rate; }
        set { exchange_rate = value; }
    }

    public string ValueCode
    {
        get { return value_code; }
        set { value_code = value; }
    }
}


I've tested LineChart, ColumnChart and PieChart - PieChart is the only one working as there are no lines,columns to draw.

(I am using latest version of WinRT XAML Toolkit)
Posted
Updated 28-Dec-14 15:59pm
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900