Page 1 of 1

csv file data on teechart wpf 4.1.2012.1312 version

Posted: Mon May 27, 2013 11:19 am
by 16063571
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.

Re: csv file data on teechart wpf 4.1.2012.1312 version

Posted: Mon May 27, 2013 3:12 pm
by 10050769
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,

Re: csv file data on teechart wpf 4.1.2012.1312 version

Posted: Tue May 28, 2013 11:56 am
by 16063571
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.

Re: csv file data on teechart wpf 4.1.2012.1312 version

Posted: Wed May 29, 2013 12:04 pm
by 10050769
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 601 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,

Re: csv file data on teechart wpf 4.1.2012.1312 version

Posted: Thu May 30, 2013 12:00 pm
by 16063571
Thank you Sandra.