Importing of functions does not set datasource

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
akshobrao
Newbie
Newbie
Posts: 12
Joined: Fri Aug 25, 2023 12:00 am

Importing of functions does not set datasource

Post by akshobrao » Tue Nov 14, 2023 5:45 pm

Visual Studio 2022
.NET Framework 4.8
Steema.TeeChart.net Version 4.2023.11.6

When importing a function, the data source is set to null, therefore no data is found. In the tchart version 4.2023.4.18 the importing of a function was working correctly as it was setting the data source to the correct series. Has this behavior changed? Also when importing the chart the legend does not come up correctly as seen by screenshot, it is aligned to the left. Once clicked inside thee chart area the legend moves to the bottom.

Code: Select all

        Steema.TeeChart.TChart tChart1;
        public Form1()
        {
            InitializeComponent();
            tChart1 = new Steema.TeeChart.TChart();
            this.Controls.Add(tChart1);
            tChart1.Dock = DockStyle.Fill;
            tChart1.Axes.Bottom.Visible = true;
            tChart1.Axes.Left.Visible = true;
            tChart1.Axes.Right.Visible = false;

            LoadData();
            tChart1.Export.Template.Save("template.json");


            tChart1.Import.Template.Load("template.json");
            ReLoadData();
        }

        private void LoadData()
        {
            tChart1.Legend.Alignment = Steema.TeeChart.LegendAlignments.Bottom;
            Series line = new Line();
            tChart1.Chart.Series.Add(line);

            for (int i = 0; i < 1000; i++)
            {
                line.Add(i, i);
            }

            Line functionLine = new Line
            {
                Title = $"Average",
                DataSource = new object[] { line },
                Function = new Average
                {
                    PeriodStyle = PeriodStyles.NumPoints,
                    Period = 20,
                    PeriodAlign = PeriodAligns.Last
                }
            };
            tChart1.Chart.Series.Add(functionLine);
        }

        private void ReLoadData()
        {
            for (int i = 0; i < 1000; i++)
            {
                tChart1.Chart.Series[0].Add(i, i);
            }
            tChart1.Chart.Series[1].Function.Recalculate();
        }
Thanks,
Akshob
Attachments
SteemaTChart.PNG
SteemaTChart.PNG (8.24 KiB) Viewed 17317 times

Rubén
Newbie
Newbie
Posts: 20
Joined: Fri Nov 19, 2010 12:00 am

Re: Importing of functions does not set datasource

Post by Rubén » Mon Nov 20, 2023 10:45 am

Hello,

Thank you for giving us an example. We're going to check it.

Regards.

akshobrao
Newbie
Newbie
Posts: 12
Joined: Fri Aug 25, 2023 12:00 am

Re: Importing of functions does not set datasource

Post by akshobrao » Tue Dec 12, 2023 1:51 pm

Any update on the legend not coming up properly. The legend comes up on the left and does not show all items correctly until zooming in or something.

Pep
Site Admin
Site Admin
Posts: 3295
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Re: Importing of functions does not set datasource

Post by Pep » Fri Dec 15, 2023 4:36 pm

Hello,
we're just looking at it, let me back to you as soon as possible with a solution.

Pep
Site Admin
Site Admin
Posts: 3295
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Re: Importing of functions does not set datasource

Post by Pep » Mon Dec 18, 2023 5:49 am

Hello,
please, find the attached example code. Here it's working fine using the latest TeeChart NET nuget version.
Does it work fine for you ?
TeeChart.WinForm.TEST.zip
(11.9 KiB) Downloaded 2268 times

akshobrao
Newbie
Newbie
Posts: 12
Joined: Fri Aug 25, 2023 12:00 am

Re: Importing of functions does not set datasource

Post by akshobrao » Mon Dec 18, 2023 6:07 pm

Thanks for the reply. This works for me.

Post Reply