c# - ILNumerics轴配置

标签 c# .net ilnumerics

需要您的建议!

我使用 TickCreationFunc 和 LabelTransformFunc 在 XAxis 上显示时间轴

像这样:

var plotCube = new ILPlotCube(tag, true);

List<Tuple<double, string>> ticks = null;

plotCube.Axes.XAxis.Ticks.TickCreationFunc = (min, max, qty) =>
{
    ticks = AxisHelper.CreateUnixDateTicks(min, max, qty).ToList();

    return ticks.Select(x => (float)x.Item1).ToList();
};

plotCube.Axes.XAxis.Ticks.LabelTransformFunc = (ind, val) =>
{
    if (ticks != null)
        return ticks[ind].Item2;
    else
        return null;
};

plotCube.Axes.XAxis.ScaleLabel.Visible = false; //does not help

结果很好,但是我找不到去除刻度标签的方法

Timeline axis

两个问题:

1) VS 显示警告'ILNumerics.Drawing.Plotting.ILTickCollection.TickCreationFunc' is obsolete: '"Use TickCreationFuncEx instead!"。然而 TickCreationFuncEx 从未被调用。

2) 有没有办法告诉 ILNumerics 不要缩写刻度数?

感谢您的帮助!

最佳答案

  1. 这个警告很重要。如果您使用新的 TickCreationFuncEx,刻度标签应该消失.界面非常相似。但是你的函数必须返回 IEnumerable<ILTick> :

    var plotCube = ilPanel1.Scene.First<ILPlotCube>();
    
    List<Tuple<double, string>> ticks = null;
    
    plotCube.Axes.XAxis.Ticks.TickCreationFuncEx = 
        (float min, float max, int qty, ILAxis axis, AxisScale scale) => {
            ticks = CreateUnixDateTicks(min, max, qty).ToList();
    
            return // return IEnumerable<ILTick> here!
    };
    // you should not need this
    //plotCube.Axes.XAxis.ScaleLabel.Visible = false; 
    
  2. 不能完全禁用缩写。但是您可以指定要显示的位数。直到 4.7(由于错误)你将不得不使用这个:

    ilPanel1.SceneSyncRoot.First<ILPlotCube>().Axes.XAxis.Ticks.MaxNumberDigitsShowFull = 10; 
    

    从 4.8 版开始,您将不再需要 SceneSyncRoot可以走得更直:

    ilPanel1.Scene.First<ILPlotCube>().Axes.XAxis.Ticks.MaxNumberDigitsShowFull = 10; 
    // or in your case just 
    plotcube.Axes.XAxis.Ticks.MaxNumberDigitsShowFull = 10;
    

注意:在代码中使用了 XAxis 而不是 YAxis acc。以你的例子

关于c# - ILNumerics轴配置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29505149/

相关文章:

c# - Relaycommand ICommand.CanExecute 不触发

c# - 无法将值 NULL 插入列 'EmpId'

c# - 类不继承自对象?

c# - ILnumerics C# 画线

c# - c#中的bsxfun类型函数

c# - 将字符串从 AJAX 传递到后面的 ASP.NET C# 代码

.net - Powershell - 在应用程序配置文件中找不到程序集绑定(bind)重定向

.net - Microsoft Research 的 Sho dll 与开源 Math.NET 数字项目相比如何

c# - 异步调用时 ILNumerics 内存损坏

c# - 泛型方法返回值的类型