y-axis scroll mouse drag movement failure.
Posted: Thu Apr 09, 2020 11:22 am
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.
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.