csv file data on teechart wpf 4.1.2012.1312 version

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
gilbert
Newbie
Newbie
Posts: 21
Joined: Fri Sep 28, 2012 12:00 am

csv file data on teechart wpf 4.1.2012.1312 version

Post by gilbert » Mon May 27, 2013 11:19 am

Hi,


I am using teechart wpf 4.1.2012.1312 version.
I need to bind the csv file data into teechart where csv file can contain time(on teechart x axis) and pressure(on teechart y axis) values.

I have problem in binding csv file data.
Please help me to show csv file data on teechart.


Thanks in advance.

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

Re: csv file data on teechart wpf 4.1.2012.1312 version

Post by Sandra » Mon May 27, 2013 3:12 pm

Hello gilbert,

You can use TextSource and do something as do in next lines of code to import the .csv file I have attached:

Code: Select all

        public MainWindow()
        {
            InitializeComponent();
            InitializeChart();
        }


        private Steema.TeeChart.WPF.Styles.Line Series1;
        private void InitializeChart()
        {
            tChart1.Aspect.View3D = false;
            //Auxiliar series. 
            Series1 = new Steema.TeeChart.WPF.Styles.Line(tChart1.Chart);

            //Read Text File
            Steema.TeeChart.WPF.Data.TextSource ts = new Steema.TeeChart.WPF.Data.TextSource(@"C:\Test.csv");
            ts.HeaderLines = 1;
            ts.DecimalSeparator = '.';
            ts.Separator = ' ';
            ts.Fields.Add(0, "Y");
            //Assign Text File to Series1;
            Series1.DataSource = ts;
            Series1.XValues.DataMember = "X";
            Series1.YValues.DataMember = "Y";
        }
Test.zip
(167 Bytes) Downloaded 622 times
Could you tell us if previous code works in your end?

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

gilbert
Newbie
Newbie
Posts: 21
Joined: Fri Sep 28, 2012 12:00 am

Re: csv file data on teechart wpf 4.1.2012.1312 version

Post by gilbert » Tue May 28, 2013 11:56 am

Thank you Sandra.

how can we show multiple series on teechart at a time from different csv files.
Also please let me know how can I customize the values on x axis and y axis.

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

Re: csv file data on teechart wpf 4.1.2012.1312 version

Post by Sandra » Wed May 29, 2013 12:04 pm

Hello gilbert,

If you want use multiple series and import its values from different .csv files I recommend you use multiple TextSource to import the .csv files, you can do something as next:

Code: Select all

 private Steema.TeeChart.WPF.Styles.Line Series1,Series2;
        private void InitializeChart()
        {
            tChart1.Aspect.View3D = false;
            //Auxiliar series. 
            Series1 = new Steema.TeeChart.WPF.Styles.Line(tChart1.Chart);
            Series2 = new Steema.TeeChart.WPF.Styles.Line(tChart1.Chart);
            //Read Text Files
            Steema.TeeChart.WPF.Data.TextSource ts = new Steema.TeeChart.WPF.Data.TextSource(@"C:\Test.csv");
            Steema.TeeChart.WPF.Data.TextSource ts1 = new Steema.TeeChart.WPF.Data.TextSource(@"C:\Test1.csv"); 
            ts.HeaderLines = 1;
            ts.DecimalSeparator = '.';
            ts.Separator = ' ';
            ts.Fields.Add(0, "Y");
            
            ts1.HeaderLines = 1;
            ts1.DecimalSeparator = '.';
            ts1.Separator = ' ';
            ts1.Fields.Add(0, "Y");

            //Assign Text File to Series1;
            Series1.DataSource = ts;
            Series1.XValues.DataMember = "X";
            Series1.YValues.DataMember = "Y";
 
            //Assign Text File to Series2;
            Series2.DataSource = ts1;
            Series2.XValues.DataMember = "X";
            Series2.YValues.DataMember = "Y";
        }
I have attached other file data .csv, because you can make the test with my code.
Test1.zip
(168 Bytes) Downloaded 602 times
Also please let me know how can I customize the values on x axis and y axis.
If you want use custom values to axis x and y you can use SetMinMax() method, for each axis. On the other hand, I recommend taking a look in the TeeChartFor.Net Demo project, concretely in All Features\Welcome !\Axes. The examples, were made in Winforms but all funcionalities should work fine in the wpf projects

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

gilbert
Newbie
Newbie
Posts: 21
Joined: Fri Sep 28, 2012 12:00 am

Re: csv file data on teechart wpf 4.1.2012.1312 version

Post by gilbert » Thu May 30, 2013 12:00 pm

Thank you Sandra.

Post Reply