Page 1 of 1

ScrollPager too long

Posted: Thu Aug 08, 2019 2:28 pm
by 15686059
Hi Team,

I've got a problem with the width of the ScrollPager and I don't know how to fix it.

When I activate the ScrollPager the Chart is longer than my WinForm. But when I check the width within the Debugger it says that it is the same as before. Take a look at the pictures below.

Do you have a clue?

Thanks in advance!

Re: ScrollPager too long

Posted: Thu Aug 08, 2019 3:23 pm
by Christopher
Hello,

I've tried to recreate your project using the following code:

Code: Select all

    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
            InitializeChart();
        }

        private void InitializeChart()
        {
            var line = new Line(tChart1.Chart);
            line.FillSampleValues();
        }

        bool active = false;
        ScrollPager _scrollPager = new ScrollPager();

        private void ToolStripSplitButton1_ButtonClick(object sender, EventArgs e)
        {
            active = !active;
            if(active)
            {
                tChart1.Tools.Add(_scrollPager);
                _scrollPager.Series = tChart1[0];

            }
            else 
            {
                tChart1.Tools.Remove(_scrollPager);
            }
        }
    }
Using this code I obtain the following:

Image

The only difference in Chart size I can appreciate here is that the Legend appears in the first Chart but doesn't appear when the ScrollPager is removed - this does affect the Chart width. Is this the issue you are referring to? If not, could you please modify my code above so I can reproduce your issue here?

Re: ScrollPager too long

Posted: Mon Aug 12, 2019 7:02 am
by 15686059
Hi Christopher,

thats right, the legend doesn't appear when the ScrollPager is removed. But this problem I already solved!

I just use TChart1.Legend.Visible = True when the ScrollPager is removed.

But that is not my problem now. There has to be an option that extend my TChart as soon as I activate the ScrollPager.
So I think I just have to check my Code and try to find the cause.

Thank you very much and if you got an idea, just let me now.

Best regards!

Re: ScrollPager too long

Posted: Mon Aug 12, 2019 8:12 am
by Christopher
LebbingUser wrote:
Mon Aug 12, 2019 7:02 am
But that is not my problem now. There has to be an option that extend my TChart as soon as I activate the ScrollPager.
So I think I just have to check my Code and try to find the cause.

Thank you very much and if you got an idea, just let me now.
I'm afraid I'm still not entirely sure what your problem is - in the example I sent you above, can you see the problem occurring? If you can, could you please describe it to me - if you can't, could you please modify the example code so I can reproduce the problem here.

Re: ScrollPager too long

Posted: Mon Aug 12, 2019 1:06 pm
by 15686059
Hi Christopher,

sorry for the opaque description of my problem.
But I got good news, I solved the problem!

Somehow the chart width increased by activating the ScrollPager. So the TChart was wider than my WinForm.
Now I've reduced the chart width and everything seems to be okay.

Thank you very much for your help!
Best regards!

Re: ScrollPager too long

Posted: Tue Aug 13, 2019 6:40 am
by Christopher
LebbingUser wrote:
Mon Aug 12, 2019 1:06 pm
But I got good news, I solved the problem!
That's excellent, I'm pleased to hear it!
LebbingUser wrote:
Mon Aug 12, 2019 1:06 pm
Thank you very much for your help!
If only helping other people was as simple as that :D