Visiblox V 2.1 DateTime轴格式问题

时间:2013-06-20 10:15:21

标签: wpf charts visiblox

我正在使用Visiblox Chart V 2.1控件进行WPF。

我有一个基于毫秒值的数据。

如何格式化visiblox DateTime轴,以便在图表轴上显示毫秒值?

提前感谢。

1 个答案:

答案 0 :(得分:0)

我使用LinearAxis做了类似的事情。您必须创建从DateTimeAxis继承的自己的轴。我不知道你的情况会有多么不同,但这就是我为LinearAxis做的事情:

chart.XAxis = new IRLinearAxis()
        {
            ...
            ShowLabels = true,
            LabelFormatString = "feet",//This only works because I overrode the format function in the IRLinearAxis class

        };

上课:

class IRLinearAxis : LinearAxis
{
    protected override string GetFormattedDataValueInternal(double dataValue, string formatString)
    {
        return String.Format("{0} " + formatString, base.GetFormattedDataValueInternal(dataValue, ""));//ignore the formatString and just use the units that were passed as the formatString
    }

}

我确信有更优雅的方式传递你的单位并保持格式化,但这对我有用。