SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, iOS Chart, Android Chart and JavaScript Chart Components


Now I have done through mvvm:

  • XyDataSeries<double, double> + <s:NumericAxis/>
  • XyDataSeries<DateTime, double> + <s:DateTimeAxis/>

That is to change the format title of axis-X I have to reload the data.

When this database is x:long y:double


If the input for the axis-X long, can somehow format the title? For example long/100 or convert long in DateTime?

That is, the output format set after loading data.

  • You must to post comments

Ok, I still don’t understand 100% what you are asking, but I think you wish to know:

  • How to format the XAxis labels to show either DateTime or Numeric values when X-Data is type Int64

Is this correct?

If so, please take a look at our article on Specifying Text Labels with LabelProvider.

I suggest creating a LabelFormatter than can output both DateTime or Numeric values, e.g. try this:

public class DateOrNumericLabelProvider : LabelProviderBase
        public bool DisplayAsDateTime { get; set; }        

        public override string FormatLabel(IComparable dataValue)
            if (DisplayAsDateTime)
                // Format axis label as a DateTime
                return new DateTime((long) dataValue).ToString("dd-MMM-yyyy");

            // Format axis label as a numeric value
            return ((long) dataValue).ToString();

        public override string FormatCursorLabel(IComparable dataValue)
            // TODO: You can do a cursor-specific implementation here
            return FormatLabel(dataValue);

Then apply to the XAxis.LabelProvider and set the DisplayAsDateTime property to True or False.

Best regards,

  • Nicholas
    Yes it is what I need Thank
  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.