简体   繁体   中英

Scichart chart did not display xaxis label value

I am starting working with scichart and i try to display on XAxis using CategoryDateTimeAxis the date of some result. I want to display only the date for the first result if are more from the same date. My problem is that when i load the first time the results the first date is not displayed. But when i reselect the results the first date appear.

I tried to re-render the chart, but nothing.

This is how the chart looks when i load first time the results在此处输入图像描述

This is how it looks chart after press day check box or reselect the results. 在此处输入图像描述

The difference is that date under the first result which no appear first time and i don't understand why. Can someone help me with this?

The code for custom label.

 /// <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;

}

In the above question image, it appears that the SciChartSurface has some kind of customisation to the axis labels, possibly via a template.

In SciChart WPF you can customise the Axis Labels and styling as follows:

You can also show/hide labels or adjust label positioning with the following properties:

It's worth checking if you are using any of these APIs that may be causing XAxis labels not to show.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM