I'm trying to get the WPF sfchart two column series from the sfChart Getting Started working.
It builds, axes, headings etc display, using VS2017 I can see the observablecollection populated with data but the two columns aren't showing. I've successfully built other Syncfusion sample charts etc so I think the sfChart column series problem is either operator error on my part or there's something missing from the Syncfusion Getting Started xaml/c# code.
x:Class="SampleChart.MainWindow"
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"
xmlns:syncfusion="clr-namespace:Syncfusion.UI.Xaml.Charts;assembly=Syncfusion.SfChart.WPF"
xmlns:local="clr-namespace:SampleChart"
mc:Ignorable="d"
Title="MainWindow" Height="350" Width="525">
Header="Demands Comparison" Height="300" Width="500" HorizontalAlignment="Center" Margin="10" VerticalAlignment="Center">
FontSize="10" Header="Demands" ShowGridLines="False"/>
FontSize="10" Header="Values" ShowGridLines="False"/>
Visibility="Visible" />
Label="2010" ItemsSource="{Binding Demands}" XBindingPath="Demand" YBindingPath="Year2010" />
Label="2011" ItemsSource="{Binding Demands}" XBindingPath="Demand" YBindingPath="Year2011" />
MainWindow c#
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace SampleChart
{
///
/// Interaction logic for MainWindow.xaml
///
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
this.Demands = new ObservableCollection()
{
new GoldDemand()
{
Demand = "Jewelry", Year2010 = 1998.0, Year2011 = 2361.2
},
new GoldDemand()
{
Demand = "Electronics",Year2010 = 1284.0, Year2011 = 1328.0
},
new GoldDemand()
{
Demand = "Research",Year2010 = 1090.5, Year2011 = 1032.0
},
new GoldDemand()
{
Demand = "Investment",Year2010 = 1643.0, Year2011 = 1898.0
},
new GoldDemand()
{
Demand = "Bank Purchases", Year2010 = 987.0, Year2011 = 887.0
}
};
}
public ObservableCollection Demands { get; set; }
}
}
GoldDemand c#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SampleChart
{
public class GoldDemand
{
public string Demand { get; set; }
public double Year2010 { get; set; }
public double Year2011 { get; set; }
}
}