Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Vertical drag scroll on LineChart (Read 425 times)
NymoBasePro
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 2
Joined: Jul 27th, 2021
Vertical drag scroll on LineChart
Jul 27th, 2021 at 5:33pm
Print Post  
Hi,

When I drag the LineChart grid from left to right and right to left, it works beautifully.

I would like the same functionality if I drag the LineChart grid from up to down and down to up.

But now when I drag, nothing happens. I didn't find the setting for this. Also not sure if there is a setting for this.

Do I need to write the code myself? Can someone tell me how to solve this?

With kind regards,
Nymo
  
Back to top
 
IP Logged
 
Slavcho
God Member
*****
Offline


tech.support

Posts: 2532
Joined: Oct 19th, 2005
Re: Vertical drag scroll on LineChart
Reply #1 - Jul 27th, 2021 at 7:12pm
Print Post  
Hi,

There's some built-in support implemented for plot's VerticalScroll property. That's used internally for scrolling horizontal barcharts, but should work for any kind of chart that includes a Plot2D. So you can't change both X and Y offsets with a single mouse drag, but you could toggle direction using a modifier key, e.g. -

Code
Select All
void lineChart_KeyDown(object sender, KeyEventArgs e)
{
    var plot = (Plot2D)lineChart.Plot;
    plot.VerticalScroll = e.Shift;
}

void lineChart_KeyUp(object sender, KeyEventArgs e)
{
    var plot = (Plot2D)lineChart.Plot;
    plot.VerticalScroll = false;
} 



Alternatively, enable ShowXRangeSelector and ShowYRangeSelector to let users scroll using the range scrollbars shown beside respective axes.

Kind regards,
Slavcho
Mindfusion
  
Back to top
 
IP Logged
 
NymoBasePro
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 2
Joined: Jul 27th, 2021
Re: Vertical drag scroll on LineChart
Reply #2 - Jul 27th, 2021 at 7:48pm
Print Post  
Hi, thanks for the fast reply.

The KeyDown event doesn't trigger in my version but I got it to work with the mouse events:

private void lineChart_MouseDown(object sender, MouseEventArgs e)
{
    if (e.Button == MouseButtons.Right)
    {
        var plot = (Plot2D)lineChart.Plot;
        plot.VerticalScroll = true;
    }
}

private void lineChart_MouseUp(object sender, MouseEventArgs e)
{
    var plot = (Plot2D)lineChart.Plot;
    plot.VerticalScroll = false;
}

Do you know if there are plans to add a solution for both horizontal and vertical?
  
Back to top
 
IP Logged
 
Slavcho
God Member
*****
Offline


tech.support

Posts: 2532
Joined: Oct 19th, 2005
Re: Vertical drag scroll on LineChart
Reply #3 - Jul 28th, 2021 at 6:12am
Print Post  
Hi,

We'll have it in mind for next release.

Regards,
Slavcho
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint