自定义控件系列,基于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]);