最近在研究DevExpress WPF Chart 3D控件,修改示例代码生成如下图表[![图表图片][1]][1]
我的代码片段是
var points = new List<TestPoint>();
for (int i = 0; i < 90; i++)
{
for (int j = 0; j < 360; j++)
{
points.Add(new TestPoint()
{
X = i,
Y = j,
Z = new Random(i * j % 10).NextDouble() * 10 + 100
});
}
}
...
DoubleCollection mapX = new DoubleCollection(xArray.Length);
DoubleCollection mapY = new DoubleCollection(yArray.Length);
DoubleCollection values = new DoubleCollection(xArray.Length * yArray.Length);
for (int i = 0; i < xArray.Length; i++)
{
mapX.Add(xStart + i * xStep);
for (int j = 0; j < yArray.Length; j++)
{
mapY.Add(yStart + j * yStep);
double value = array[i, j];
values.Add(value);
}
}
MapY = mapX;
MapX = mapY;
MapValues = values;
我找到了解决方案。将 Chart3DControl 的 AspectRatio 设置为“1 1 1”效果很好。