我在设置轴的范围以至于最小值小于1时遇到麻烦。我知道不能绘制小于0的值,因为我不理解为什么无法查看小于1的值,除非我可以平移它们。有什么理由吗?还是解决它的方法?
尽管这可能是设计的,但仍可以通过将数据放大到对数轴的有效范围内来达到所需的效果。然后,您可以覆盖标签功能来设置所需的标签。它很hacky,但可以满足您的需求。
class MyLogarithmicAxis : LogarithmicAxis
{
protected override string GetFormattedDataValueInternal(double dataValue, string formatString)
{
if (dataValue == 1)
{
dataValue = .1;
}
if (dataValue == 100)
{
dataValue = 10;
}
if (dataValue == 1000)
{
dataValue = 100;
}
return base.GetFormattedDataValueInternal(dataValue, formatString);
}
}
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句