1

我正在尝试缩放 LinePlot 的 xaxis。x的每个值都必须除以 50,因为数据来自 50hz 的测量值。

xRange 约为 [0,ca.7000],并且应为 [0,1/50,2/50,...,7000/50] 作为缩放的 x 轴。可悲的是,我不能发布图片,需要更多的声誉......

C#代码是:

private void ilPanel1_Load(object sender, EventArgs e)
    {
        Windpark windpark = new Windpark(quelldatei,hz,anzFreq);            
        float[] a = windpark.readData();
        float[] b = windpark.mittelwertAbzug(a);
        ILArray<float> B = ILMath.array(b);
        ILArray<float> Fit = ILMath.convert<double, float>(windpark.findeFit(B)); 

        var scene = new ILScene {
        new ILPlotCube {                 
            new ILLinePlot(Fit.T, lineColor: Color.Blue,lineWidth:2),
            new ILLinePlot(B.T, lineColor: Color.Yellow)
                        }
            };
        ilPanel1.Scene = scene;            
    }

我尝试使用 CrateTicksAuto() 方法,但不知道如何使用

public static List<float> CreateTicksAuto(
float min,
float max,
int numberTicks

)

我会非常感谢任何帮助!

此致

基督教


解决了问题...我按照此处的描述制作了刻度线。它以 (array.length/10) 为步长进行十个刻度。我的解决方案如下所示:

private void ilPanel1_Load(object sender, EventArgs e)
    {
        Windpark windpark = new Windpark(quelldatei,hz,anzFreq);            
        float[] a = windpark.readData();
        float[] b = windpark.mittelwertAbzug(a);
        ILArray<float> B = ILMath.array(b);
        ILArray<float> Fit = ILMath.convert<double, float>(windpark.findeFit(B));     
                var scene = new ILScene() ;
                var plotCube =scene.Add(new ILPlotCube {                    
                    new ILLinePlot(B.T, lineColor: Color.Yellow),
                    new ILLinePlot(Fit.T, lineColor: Color.Black,lineWidth:3)
                });
                for (int i = 0; i < Fit.Length; i =i+(int)ILMath.round((double)Fit.Length/  10.0))
                {
                    var tick = plotCube.Axes.XAxis.Ticks.Add(i, (i/hz).ToString());
                }
                    ilPanel1.Scene = scene;


    }
}
4

0 回答 0