Powered by AppSignal & Oban Pro

Date Strings

20_date_strings.livemd

Date Strings

Mix.install([
  {:plotly_ex, "~> 0.3"},
  {:kino, "~> 0.18"}
])

Section

Plotly accepts ISO 8601 date strings directly in x:. No special parsing needed — pass them as plain Elixir strings. xaxis.type: "date" is usually auto-detected but can be set explicitly. Date format: "YYYY-MM-DD" or "YYYY-MM-DD HH:MM:SS".

alias Plotly.{Figure, Scatter}

Figure.new()
|> Figure.add_trace(
  Scatter.new(
    x: ["2013-10-04 22:23:00", "2013-11-04 22:23:00", "2013-12-04 22:23:00"],
    y: [1, 3, 6]
  )
)
|> Figure.update_layout(title: "Date Strings in Plotly")
|> Plotly.show()