Logarithmic Axis on Visiblox

眉间皱痕 提交于 2019-12-11 22:32:32

问题


I'm having trouble setting the range of an axis so that the minimum is below 1. I understand that no value less than 0 can be plotted by I don't understand why values below 1 cannot be viewed unless I can pan to them. Is there any reason for this? Or a way of resolving it?


回答1:


While this may be as designed, you could still achieve the affect you're looking for by scaling your data up into the valid range for the logarithmic axis. Then you could override the label function to set the labels you want. It's hacky, but it might work for your needs.

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);
    }
}


来源:https://stackoverflow.com/questions/23910366/logarithmic-axis-on-visiblox

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!