I do not work normally when I move to the y-axis scroll mouse drag.
The value below is suspected. (In the example, the Rangechange function of scroll provided was modified. )
m_chart.VerticalScrollBars[0].Value = ???
Can you explain the rules?
I implemented as follows.
private void AxisYRangeChanged(object sender, RangeChangedEventArgs e)
{
if (e.NewMin < yMin)
{
double newRange = e.NewMax - e.NewMin;
if ((newRange + yMin) <= yMax)
m_chart.ViewXY.YAxes[0].SetRange(yMin, yMin + newRange);
}
else
{
m_chart.ViewXY.YAxes[0].SetRange(yMin, yMax);
}
}
else if (e.NewMax > m_yMax)
{
double newRange = e.NewMax - e.NewMin;
if (newRange <= m_yMax)
{
m_chart.ViewXY.YAxes[0].SetRange(yMax - newRange, yMax);
else
{
m_chart.ViewXY.YAxes[0].SetRange(m_yMin, m_yMax);
}
}
else
{
double newRange = e.NewMax - e.NewMin;
m_chart.BeginUpdate();
m_chart.VerticalScrollBars[0].LargeChange = (ulong)(newRange);
m_chart.VerticalScrollBars[0].Value = (ulong) (m_yMax - e.NewMax ); // ????
m_chart.EndUpdate();
m_сurrentYRange = (ulong)(newRange);
}
}
setrange in another way and scroll ratio and position move normally.
But I scroll mouse drag and it works strangely.
y-axis scroll mouse drag movement failure.
Moderator: Queue Moderators
-
- Posts: 557
- Joined: Mon Mar 14, 2016 9:22 am
Re: y-axis scroll mouse drag movement failure.
Hi,
ScrollBars.Value defines position of scrollbar-thumb. It should be between ScrollBars.Minimum and ScrollBars.Maximum. Relative position is calculated by ratio of those properties.
Usaully on the Chart we want ScrollBars and AxisRange being synchronized. Therefore, LightningChart uses event handlers to achieve that: ScrollBar.Scroll and Axis.RangeChanged.
You have been looking at YAxis.RangeChanged event handler. The question marks is where we use new Axis.Maximum to set new relative position of ScrollBar,
Hope this helps.
ScrollBars.Value defines position of scrollbar-thumb. It should be between ScrollBars.Minimum and ScrollBars.Maximum. Relative position is calculated by ratio of those properties.
Usaully on the Chart we want ScrollBars and AxisRange being synchronized. Therefore, LightningChart uses event handlers to achieve that: ScrollBar.Scroll and Axis.RangeChanged.
You have been looking at YAxis.RangeChanged event handler. The question marks is where we use new Axis.Maximum to set new relative position of ScrollBar,
Hope this helps.