date and time on x axis in ios charts by Daniel Gindi
NickName:user3450687 Ask DateTime:2018-01-15T04:31:42

date and time on x axis in ios charts by Daniel Gindi

how can i add both time and date on x axis in ios charts by Daniel Gindi?

Thanks in advance for the answers!

extension ChartXAxisFormatter: IAxisValueFormatter {

func stringForValue(_ value: Double, axis: AxisBase?) -> String {
    if let dateFormatter = dateFormatter {

        let date = Date(timeIntervalSince1970: value)
        return dateFormatter.string(from: date)
    }
    return ""
}}

Copyright Notice:Content Author:「user3450687」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/48253885/date-and-time-on-x-axis-in-ios-charts-by-daniel-gindi

More about “date and time on x axis in ios charts by Daniel Gindi” related questions

date and time on x axis in ios charts by Daniel Gindi

how can i add both time and date on x axis in ios charts by Daniel Gindi? Thanks in advance for the answers! extension ChartXAxisFormatter: IAxisValueFormatter { func stringForValue(_ value: Dou...

Show Detail

Show time on x axis of the chart using Charts library by Daniel Gindi

I am using Charts library by Daniel Gindi: https://github.com/danielgindi/Charts For my project, I need to replace the x axis with time that shows only hours and minutes (HH:mm). I've created the

Show Detail

Using both String and Date on axis charts ios

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 v...

Show Detail

iOS Charts(Daniel Gindi) - how to set dual y axis dual graph lines in Swift

I am using Charts (Git Repo of Daniel Gindi's). Here is my code for single y axis single line chart: When I try to add a second line to the y axis it throws the error 'Cannot convert value of type '

Show Detail

Is it possible to use iOS Charts (Daniel Gindi) to generate graphs in pdf document on iOS

I am using iOS Charts (Daniel Gindi) to generate graphs in an iOS app and I want to be able to generate a PDF report with those graphs included in the body of the report. Can anyone explain how to...

Show Detail

How to shift data on xAxis to right on Daniel Gindi charts?

I have a data chart DataChart would like to shift data of xAxis along with data lines to right by certain value. DataChart Screen Shot Please help me out which property to use from the library t...

Show Detail

How to set a custom x axis 0 label in charts ios

I am using Charts by Daniel Gindi How can I set a String 0 label on x Axis? I want it to show "Now" instead of a Date type. I've seen the function that helps to format one particular labe...

Show Detail

iOS-charts invert the X axis direction

I have a bar chart built using Daniel Gindi iOS-charts. It represents history data over a period of time. The issue I am having is that the data is being plotted from left-to-right (new data -> ol...

Show Detail

Swift Charts with logarithmic axis

I want to draw a plot with a logarithmic X-axis. This is possible with CorePlot. However, the Charts package from Daniel Gindi danielgindi/Charts seems to fit better in a Swift environment. Unfortu...

Show Detail

iOS Charts: reduce height of grids in charts

Hello, I want to reduce height of grids in chart, how can I? I am using iOS-Charts(Daniel Gindi).

Show Detail