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

Welcome to the SciChart Community Forums!

Please use the forums below to ask questions about SciChart. Take a moment to read our Question asking guidelines on how to ask a good question and our support policy. We also have a tag=SciChart on Stackoverflow.com where you can earn rep for your questions!

Please note: SciChart team will only answer questions from customers with active support subscriptions. Expired support questions will be ignored. If your support status shows incorrectly, contact us and we will be glad to help.

0
0

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

Question.

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.

Images
  • You must to post comments
0
0

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,
Andrew

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

Please first to submit.