Page 1 of 1
Databinding in TeeChart for WPF?
Posted: Tue Jan 18, 2011 10:34 am
by 15656622
Hello,
I've been using TeeChart for a WPF application, but noticed too late that Databinding wasn't implemented in the current version.
So I had to develop the graphs in the "Windows Forms" way (with code behind and control events), instead of using MVVM like the rest of the application.
Later this year, we will have to develop a much bigger application which requires a powerful Charting library.
TeeChart should meet the requirements, except for that Databinding problem which would really be a problem for an application of this size.
So I was wondering if/when an update will be released with the ability to use Databinding in the WPF version of TeeChart?
Thanks in advance!
Re: Databinding in TeeChart for WPF?
Posted: Tue Jan 18, 2011 12:34 pm
by 10050769
Hello Mithrandir,
I have made for you a simple code using a type of DataBinding in TeeChart.WPF and works fine for me. Below you can find the code I am using:
Code: Select all
public partial class Window1 : Window
{
public Window1()
{
InitializeComponent();
InitializeChart();
}
private Steema.TeeChart.WPF.Styles.Bar Series1;
private NameList observable;
private void InitializeChart()
{
tChart1.Aspect.View3D = false;
tChart1.Series.Add(Series1 = new Steema.TeeChart.WPF.Styles.Bar());
Series1.XValues.DataMember = "DateOfBirth";
Series1.YValues.DataMember = "Height";
Series1.LabelMember = "LastName";
Series1.ColorMember = "FavoriteColor";
observable = new NameList();
Series1.DataSource = observable;
}
}
public class NameList : System.Collections.ObjectModel.ObservableCollection<Person>
{
public NameList()
: base()
{
Add(new Person("Willa", "Cather", DateTime.Parse("09/22/1941"), Colors.Red, 171));
Add(new Person("Isak", "Dinesen", DateTime.Parse("07/01/1964"), Colors.Green, 189));
Add(new Person("Victor", "Hugo", DateTime.Parse("03/30/1987"), Colors.Blue, 196));
Add(new Person("Jules", "Verne", DateTime.Parse("10/30/1995"), Colors.Orange, 175));
}
}
public class Person
{
private string firstName;
private string lastName;
private DateTime dob;
private Color favorite;
private int height;
public Person(string first, string last, DateTime dob, Color favorite, int height)
{
this.firstName = first;
this.lastName = last;
this.dob = dob;
this.favorite = favorite;
this.height = height;
}
public string FirstName
{
get { return firstName; }
set { firstName = value; }
}
public string LastName
{
get { return lastName; }
set { lastName = value; }
}
public DateTime DateOfBirth
{
get { return dob; }
set { dob = value; }
}
public Color FavoriteColor
{
get { return favorite; }
set { favorite = value; }
}
public int Height
{
get { return height; }
set { height = value; }
}
Could you tell us if this type of DataBinding is you want? If it don't like please explain exactly which type of dataBinding do you want achieve?
I hope will helps.
Thanks,
Re: Databinding in TeeChart for WPF?
Posted: Tue Jan 18, 2011 1:29 pm
by 15656622
Hello Sandra,
Unfortunately, this is not the type of databinding I need, I should have added more details.
Here is an example of WPF binding I would like to use :
In the View (ChartView.xaml file) :
Code: Select all
<AChart:TChart Series={Binding Path=SeriesList, Mode=OneWay, UpdateSourceTrigger=PropertyChanged} />
In the ViewModel (ChartViewModel.vb in a separate project, not in the code behind) :
Code: Select all
private Series _seriesList;
public Series SeriesList
{
get { return _seriesList; }
set
{
_seriesList = value;
OnPropertyChanged("SeriesList");
}
}
...
public void LoadSeries()
{
foreach (...)
{
//Fill SeriesList
}
I hope this helps understanding what I would like to do.
Thank you,
Sébastien
Re: Databinding in TeeChart for WPF?
Posted: Tue Jan 18, 2011 3:52 pm
by 10050769
Hello Mithrandir,
Thanks for your example; I haven’t finished understanding which kind of DataBinding do you exactly need? Can you explain exactly how should be your DataBinding?
Thanks,
Re: Databinding in TeeChart for WPF?
Posted: Tue Jan 18, 2011 4:03 pm
by 15656622
Hello Sandra,
Thank you for your quick answer.
I think that the best way I can describe what I mean by WPF Databinding is by sending you an example (a small tutorial) :
http://www.wpftutorial.net/DataBindingOverview.html
It allows you to separate completely the "xaml" layer and the "code" layer.
For example, in my ViewModel (code), I can create a property containing a list of Customers.
This list will be exposed and the View (xaml) can do whatever it wants with it.
It can be bound to a ListView, to a Combobox, or to any list type control.
Each control can display any number of properties of the Customer class. The ViewModel doesn't have to know what the View will do with the List, it just exposes it.
That's the goal of my approach (I'm using the MVVM pattern when developing in WPF, if you don't know what it is, here is an blog explaining the basics of it :
http://msdn.microsoft.com/en-us/magazine/dd419663.aspx ).
Thanks.
Best regards,
Sébastien
Re: Databinding in TeeChart for WPF?
Posted: Wed Jan 19, 2011 3:54 pm
by 10050769
Hello Sébastien,
I am afraid that is not possible for now. I have added your request in wish-list with number [TW16015359] to be considered inclusion in next maintenance releases.
Thanks,
Re: Databinding in TeeChart for WPF?
Posted: Thu Jan 20, 2011 9:54 am
by 15656622
Hello Sandra,
Thank you for the information.
Best regards,
Sébastien
Re: Databinding in TeeChart for WPF?
Posted: Wed Jul 20, 2011 10:37 am
by 15657376
Any updates on how can we achieve the above mentioned databinding?
Re: Databinding in TeeChart for WPF?
Posted: Wed Jul 20, 2011 10:37 am
by 15657376
Any updates on how can we achieve the above mentioned databinding?
Re: Databinding in TeeChart for WPF?
Posted: Wed Jul 20, 2011 12:32 pm
by 10050769
Hello PCCUser,
The feature request with number (TW16015359) isn't still fixed. I have increased its severity to be consider its inclusion in future versions of TeeChart.Net. On the other hand, I recommend you to be aware at this forum, our RSS news feed, twitter and facebook accounts for new release announcements and what's implemented on them.
Thanks,
Re: Databinding in TeeChart for WPF?
Posted: Tue Jun 05, 2012 9:32 am
by 15660791
Hi,
I also need this data binding feature urgently. Is it implemented now with the latest updates or still in the not
thanks
Ahmed
Re: Databinding in TeeChart for WPF?
Posted: Tue Jun 05, 2012 3:36 pm
by 10050769
Hello Ahmed,
I inform you it isn't implemented in last version of TeeChartFor.Net, because TeeChart.WPF and TeeChart.Silverlight do not support XAML designtime surfaces. You can place a TChart in a XAML page at designtime, but you cannot do any editing on the TChart objects or properties using XAML. I think you can try to use Winforms in WPF as explain in this
link, and use the funcionalities of Winforms in wpf.
Thanks,
Re: Databinding in TeeChart for WPF?
Posted: Tue Jun 03, 2014 2:19 pm
by 16666295
Hi Ahmed,
The last post to this was 2012, it is now 2014, has data binding been implemented in TeeChart for WPF?
Cheers,
Nick
Re: Databinding in TeeChart for WPF?
Posted: Wed Jun 04, 2014 8:09 am
by Christopher
rsharma wrote:
The last post to this was 2012, it is now 2014, has data binding been implemented in TeeChart for WPF?
Databinding in TeeChart for WPF is perfectly possible at runtime using code, but is not possible at designtime using XAML.