Scichart图表未显示xaxis标签值

时间:2019-11-11 09:28:52

标签: c# scichart

我开始使用scichart,我尝试使用CategoryDateTimeAxis在XAxis上显示某些结果的日期。如果距离同一日期更多,我只想显示第一个结果的日期。我的问题是,当我第一次加载结果时,不会显示第一个日期。但是当我重新选择结果时,第一个日期就会出现。

我试图重新绘制图表,但是什么也没有。

这是我第一次加载结果时图表的外观 enter image description here

这是按日后复选框或重新选择结果的外观。 enter image description here

不同之处在于第一个结果下的日期没有第一次出现,我不明白为什么。有人可以帮我吗?

自定义标签的代码。

 /// <summary>
    /// Formats the label.
    /// </summary>
    /// <param name="dataValue">The data value.</param>
    /// <returns>Returns the format label.</returns>
    public override string FormatLabel(IComparable dataValue)
    {
        var time = (DateTime)dataValue;
        var labelValue = string.Empty;
        if (time.Date == lastValue.Date)
        {
            labelValue = string.Empty;
        }
        else
        {
            switch (Settings.DateFormat)
            {
                case DateFormat.DayMonthYear:
                    {
                        labelValue = time.Day.ToString().PadLeft(2, Convert.ToChar("0")) + "." +
                               time.Month.ToString().PadLeft(2, Convert.ToChar("0")) + "." + time.Year;
                        break;
                    }

                case DateFormat.YearMonthDay:
                    {
                        labelValue = time.Year + "-" + time.Month.ToString().PadLeft(
                                   2, Convert.ToChar("0")) + "-" +
                               time.Day.ToString().PadLeft(2, Convert.ToChar("0"));
                        break;
                    }

                default:
                    {
                        labelValue = time.Month.ToString().PadLeft(
                                   2, Convert.ToChar("0")) + "/" +
                               time.Day.ToString().PadLeft(2, Convert.ToChar("0")) +
                               "/" + time.Year;
                        break;
                    }
            }
        }

        lastValue = time;
        return labelValue;

}

1 个答案:

答案 0 :(得分:0)

在上面的问题图像中,似乎SciChartSurface可能通过模板对轴标签进行了某种自定义。

在SciChart WPF中,您可以按以下方式自定义轴标签和样式:

您还可以使用以下属性显示/隐藏标签或调整标签位置:

值得检查是否正在使用任何可能导致XAxis标签不显示的API。

相关问题