【发布时间】:2015-10-06 05:27:35
【问题描述】:
我正在使用启用了缩放功能的 oxyplot android/IOS。我还使用 PlotView 和 DateTimeAxes 来显示实时数据。
默认情况下,实时数据主要步长设置为 1/60。当用户放大时,我将 MajorStep 设置为 1/60/24。到这里为止一切都很好。
当用户缩放时我无法确定:
- 用户正在放大或缩小。
- 我目前处于哪个缩放级别。
代码:
protected override void OnCreate (Bundle bundle)
{
base.OnCreate (bundle);
this.RequestWindowFeature (WindowFeatures.NoTitle);
plotView = new PlotView(this) {
Model = myClass.MyModel
};
(plotView.Model.Axes[0] as DateTimeAxis).AxisChanged += HandleAxisChanged;
this.AddContentView (
plotView,
new ViewGroup.LayoutParams (
ViewGroup.LayoutParams.MatchParent,
ViewGroup.LayoutParams.MatchParent));
LoadGraph();
}
下面的轴改变事件函数
void HandleAxisChanged(object sender, AxisChangedEventArgs e) {
switch (e.ChangeType)
{
case AxisChangeTypes.Zoom:
((OxyPlot.Axes.DateTimeAxis)sender).MajorStep = 1.0 / 60 / 24;
break;
}
}
【问题讨论】: