0
votes

I am using Charts library by Daniel Gindi

On the X axis of the line chart, I want to show 3 values (string, date, date). 1) Is it possible to format only one particular label into a string type value? 2) Is it possible at all to show different value types on one axis?

I've tried using a function getFormattedLabel(index: Int) but I haven't seen any examples of this function being used. Also, I can't find anything in documentation (it's for Android since there is no documentation for iOS): https://weeklycoding.com/mpandroidchart-documentation/

I want the axis to look like this: Click here for the example of X axis

Thanks!

1
Here is a related question I asked with a solution: stackoverflow.com/a/61009607/11219710 - Lilya

1 Answers

0
votes

I've asked one more question here: https://stackoverflow.com/a/62038981/11219710

It turned out, I needed to use this code in my XAxisValueFormatter:

if let index = axis?.entries.firstIndex(of: value), let count = axis?.entries.count  , index == count - 2 {
   return "Now"
}

It takes the index before the last one and returns a String type.