【WPF学习手记】OxyPlot绘制Surf图和Contour图

自定义控件系列,基于OxyPlot开发的。

效果图

 二维数组显示控件,支持修改标题、设置X和Y范围、设置X和Y数值、设置对数或线性刻度、设置等高线数量、设置Colorbar。

xmlns:surf="clr-namespace:SurfMaps;assembly=SurfMaps"

<surf:MySurf Grid.Row="1" Name="mySurf"/>


private string[] colorFlag = new string[17] { "Parula", "Jet", "Bone", "Gray", "Cool", "Copper", "Hot", "Hsv", "Pink", "Spring",
                                                      "Summer", "Autumn", "Winter", "Hue", "Rainbow", "BlackWhiteRed", "BlueWhiteRed" };
private int flag = 0;
private double[] bottomValue;
private double[] leftValue;
private double[,] dist2DArray;
private double leftMin = 1e-12;
private double leftMax = 1e-6;
private double bottomMin = 0.01;
private double bottomMax = 10000;
private string leftTitle = "D(m^{2}/s)";
private string bottomTitle = "T2(ms)";
private string accumTitle = "Accum";
private double contourMin = 0.1;
private double contourMax = 0.9;
private int contourNum = 5;

// 传入二维数组
mySurf.Set2DArray(dist2DArray);
// 设置X和Y数值、范围
mySurf.SetLeftValue(leftValue);
mySurf.SetLeftMinMax(leftMin, leftMax);
mySurf.SetBottomValue(bottomValue);
mySurf.SetBottomMinMax(bottomMin, bottomMax);
// 设置线性、对数刻度
mySurf.SetLeftAxisLogarithmic();
mySurf.SetBottomAxisLogarithmic();
mySurf.SetLeftAxisLinear();
mySurf.SetBottomAxisLinear();
// 设置标题
mySurf.SetBottomTitle(bottomTitle);
mySurf.SetLeftTitle(leftTitle);
mySurf.SetAccumTitle(accumTitle);
// 设置等高线数量
mySurf.SetContourProperty(contourMin, contourMax, contourNum);
// 设置Colorbar
mySurf.SetColormap(colorFlag[flag++ % colorFlag.Length]);

 

  • 2
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 8
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 8
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值