Page 1 of 1

Importing of functions does not set datasource

Posted: Tue Nov 14, 2023 5:45 pm
by 15696632
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

Re: Importing of functions does not set datasource

Posted: Mon Nov 20, 2023 10:45 am
by ruben
Hello,

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

Regards.

Re: Importing of functions does not set datasource

Posted: Tue Dec 12, 2023 1:51 pm
by 15696632
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.

Re: Importing of functions does not set datasource

Posted: Fri Dec 15, 2023 4:36 pm
by Pep
Hello,
we're just looking at it, let me back to you as soon as possible with a solution.

Re: Importing of functions does not set datasource

Posted: Mon Dec 18, 2023 5:49 am
by Pep
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 2331 times

Re: Importing of functions does not set datasource

Posted: Mon Dec 18, 2023 6:07 pm
by 15696632
Thanks for the reply. This works for me.