【问题标题】:Visiblox V 2.1 DateTime axis format issueVisiblox V 2.1 DateTime 轴格式问题
【发布时间】:2013-06-20 10:15:20
【问题描述】:

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

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

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

提前致谢。

【问题讨论】:

    标签: wpf charts visiblox


    【解决方案1】:

    我对 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
        }
    
    }
    

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

    【讨论】:

    • 我可以告诉你是新来的。如果这对您有用,请选择此作为接受的答案,如果有用,请点赞。
    猜你喜欢
    • 2013-07-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-10-22
    • 2017-09-07
    • 1970-01-01
    • 1970-01-01
    • 2020-08-01
    相关资源
    最近更新 更多