Oxyplot Wpf (How to Pan to Value of X Axis)

[亡魂溺海] 提交于 2019-12-25 03:37:24

问题


If my graph shows values of 0-100 on x axis, how can I pan x axis to value of 115 from code behind?


回答1:


Since the Maximum Value (assuming Max is 100, from the description is the OP) of your X Axis is already set (at the point when you want to pan from behind), the first step required would be to change the Maximum of the Axis.

 var axis = Model.Axes.First(x => x.Position == OxyPlot.Axes.AxisPosition.Bottom);
 axis.Maximum = 120;
 Model.InvalidatePlot(false);
 axis.Pan(115);
 Model.InvalidatePlot(false);

Once the Maximum has been reset, you can use Axis.Pan Method to pan to desired point .

In case, Maximum of your X Axis is already more than the desired value, you can skip the first step.

 var axis = Model.Axes.First(x => x.Position == OxyPlot.Axes.AxisPosition.Bottom);
 axis.Pan(115);
 Model.InvalidatePlot(false);


来源:https://stackoverflow.com/questions/53937019/oxyplot-wpf-how-to-pan-to-value-of-x-axis

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!