如何防止氧气图表在一个轴上放大?

问题描述 投票:0回答:1

开始时的图表:

enter image description here

缩放后的图形:

enter image description here

问题:如何保持图表的完整垂直数据可见,而不必上下翻看试图看到它?

我想图形需要水平伸展才能做到这一点。我已经尝试设置最小/最大范围来实现这一点,但它们似乎没有达到预期的效果。我在文档中找不到任何设置来禁用一个缩放轴。

c# .net oxyplot
1个回答
1
投票

在图形图模型中,添加所需的轴并禁用轴缩放:

var pm = new PlotModel { Title = "My Plot" };

//Define the x axis
DateTimeAxis xAxis = new DateTimeAxis();            
xAxis.Position = AxisPosition.Bottom;

//Define the y axis
LinearAxis yAxis = new LinearAxis();
yAxis.Position = AxisPosition.Left;
//Disable the axis zoom
yAxis.IsZoomEnabled = false;

//Add the Axes to the graph
pm.Axes.Add(xAxis);
pm.Axes.Add(yAxis);

此外,如果您不想禁用缩放,如果使用光标在一个轴上滚动鼠标滚轮,则缩放将仅应用于该轴。

© www.soinside.com 2019 - 2024. All rights reserved.