Skip to content

Question: How to use Datetime for Axis #14

Closed
@dikkadev

Description

I want to make a graph that shows a cumulative count over time.
The closet thing I could figure out is a cumulative count over the days since the first datetime. But that is not really suitable.

#let data = csv("data/cypress-release.csv").slice(1)
#let dates = data.map(row => str_to_datetime(row.at(0).trim("Z"))).rev()
#let first_date = dates.at(0)
#let day_differences = dates.map(date => int(datetime_day_difference(first_date, date)))
#let x_axis = axis(min: 0, max: day_differences.last(), step: 250, location: "bottom", title: "Days since first release")
#let y_axis = axis(min:0, max: day_differences.len(), step: 10, location: "left", title: "Cumulative release count")
#let enum = day_differences.enumerate()
#let enumT = enum.map(row => (row.at(1), row.at(0)))
#let pl = plot(data: enumT, axes: (x_axis, y_axis))
#graph_plot(pl, (100%, 25%))
// this could probably also be a lot cleaner

Screenshot

I know about the value field on the axis, but I don't know how I could get the spacing correct with this.
Is this possible with the current version of this?

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions