需要你的建议!
我使用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
结果非常好但是我找不到删除比例标签的方法
两个问题:
1)VS显示警告&#39; ILNumerics.Drawing.Plotting.ILTickCollection.TickCreationFunc&#39;已经过时了:&#39;&#34;而是使用TickCreationFuncEx!&#34;&#39; 。但是从不调用TickCreationFuncEx。
2)有没有办法告诉ILNumerics不要缩写刻度数?
感谢您的帮助!
答案 0 :(得分:2)
此警告很重要。如果您使用新的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;
无法完全禁用缩写。但您可以指定要显示的位数。直到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。举你的例子