3

Need your advice!

I use TickCreationFunc and LabelTransformFunc to show timeline on XAxis

Something like this:

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

The result is quite good however I could not find a way to remove the scale label

Timeline axis

Two side questions:

1) VS shows warning 'ILNumerics.Drawing.Plotting.ILTickCollection.TickCreationFunc' is obsolete: '"Use TickCreationFuncEx instead!"'. However TickCreationFuncEx is never called.

2) Is there a way to tell ILNumerics not to abbreviate tick numbers?

Appreciate your help!

xsami
  • 1,312
  • 16
  • 31
irriss
  • 742
  • 2
  • 11
  • 22

1 Answers1

2
  1. This warning is important. The scale label should go away if you use the new TickCreationFuncEx. The interface is very similar. But your function must return 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. One cannot disable abbreviation completely. But you can specify the number of digits to show. Until 4.7 (due to a bug) you will have to use this:

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

    From version 4.8 you will not need SceneSyncRoot anymore and can go more straight:

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

Note: used XAxis in the code and not YAxis acc. to your example

Mogsdad
  • 44,709
  • 21
  • 151
  • 275
Haymo Kutschbach
  • 3,322
  • 1
  • 17
  • 25