Databinding in TeeChart for WPF?

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
Mithrandir
Newbie
Newbie
Posts: 4
Joined: Tue Jul 20, 2010 12:00 am

Databinding in TeeChart for WPF?

Post by Mithrandir » Tue Jan 18, 2011 10:34 am

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!

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: Databinding in TeeChart for WPF?

Post by Sandra » Tue Jan 18, 2011 12:34 pm

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,
Best Regards,
Sandra Pazos / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Mithrandir
Newbie
Newbie
Posts: 4
Joined: Tue Jul 20, 2010 12:00 am

Re: Databinding in TeeChart for WPF?

Post by Mithrandir » Tue Jan 18, 2011 1:29 pm

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

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: Databinding in TeeChart for WPF?

Post by Sandra » Tue Jan 18, 2011 3:52 pm

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,
Best Regards,
Sandra Pazos / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Mithrandir
Newbie
Newbie
Posts: 4
Joined: Tue Jul 20, 2010 12:00 am

Re: Databinding in TeeChart for WPF?

Post by Mithrandir » Tue Jan 18, 2011 4:03 pm

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

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: Databinding in TeeChart for WPF?

Post by Sandra » Wed Jan 19, 2011 3:54 pm

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,
Best Regards,
Sandra Pazos / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Mithrandir
Newbie
Newbie
Posts: 4
Joined: Tue Jul 20, 2010 12:00 am

Re: Databinding in TeeChart for WPF?

Post by Mithrandir » Thu Jan 20, 2011 9:54 am

Hello Sandra,

Thank you for the information.

Best regards,
Sébastien

PCCUser
Newbie
Newbie
Posts: 4
Joined: Mon Oct 04, 2010 12:00 am

Re: Databinding in TeeChart for WPF?

Post by PCCUser » Wed Jul 20, 2011 10:37 am

Any updates on how can we achieve the above mentioned databinding?

PCCUser
Newbie
Newbie
Posts: 4
Joined: Mon Oct 04, 2010 12:00 am

Re: Databinding in TeeChart for WPF?

Post by PCCUser » Wed Jul 20, 2011 10:37 am

Any updates on how can we achieve the above mentioned databinding?

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: Databinding in TeeChart for WPF?

Post by Sandra » Wed Jul 20, 2011 12:32 pm

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,
Best Regards,
Sandra Pazos / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

asayed
Newbie
Newbie
Posts: 3
Joined: Fri Nov 18, 2011 12:00 am

Re: Databinding in TeeChart for WPF?

Post by asayed » Tue Jun 05, 2012 9:32 am

Hi,
I also need this data binding feature urgently. Is it implemented now with the latest updates or still in the not
thanks
Ahmed

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: Databinding in TeeChart for WPF?

Post by Sandra » Tue Jun 05, 2012 3:36 pm

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,
Best Regards,
Sandra Pazos / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

rsharma
Newbie
Newbie
Posts: 4
Joined: Thu Jun 20, 2013 12:00 am

Re: Databinding in TeeChart for WPF?

Post by rsharma » Tue Jun 03, 2014 2:19 pm

Hi Ahmed,

The last post to this was 2012, it is now 2014, has data binding been implemented in TeeChart for WPF?

Cheers,
Nick

Christopher
Guru
Posts: 1603
Joined: Fri Nov 15, 2002 12:00 am

Re: Databinding in TeeChart for WPF?

Post by Christopher » Wed Jun 04, 2014 8:09 am

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.
Best Regards,
Christopher Ireland / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Instructions - How to post in this forum

Post Reply