giocomai / ganttrify

Create beautiful Gantt charts with ggplot2
https://ganttrify.europeandatajournalism.eu/
GNU General Public License v3.0
658 stars 62 forks source link

Is it possible to sort the order that wp and activities appear on the left side? #49

Closed mtthwborg closed 7 months ago

mtthwborg commented 7 months ago

Currently ganttrify sorts by wp in alphabetical order, and activities in the order they are given. This order is maintained even if the order is changed beforehand such as by factor(). Is it possible to change this order?

giocomai commented 7 months ago

This is a regression and did not happen in previous versions. Expected behaviour is that they are kept in the order in which they first appear. This will be fixed.

Reprex confirming bug:

library("ganttrify")

project <- tibble::tribble(
  ~wp, ~activity, ~start_date, ~end_date, 
  "b", "bb", 1, 5, 
  "b", "aa", 3, 6,
  "a", "cc", 2, 4, 
  "a", "dd", 5,6
  )

ganttrify(
  project = project,
  project_start_date = "2023-04"
)

Created on 2024-03-10 with reprex v2.1.0

giocomai commented 7 months ago

fixed in the latest version:

library("ganttrify")

project <- tibble::tribble(
  ~wp, ~activity, ~start_date, ~end_date, 
  "b", "bb", 1, 5, 
  "b", "aa", 3, 6,
  "a", "cc", 2, 4, 
  "a", "dd", 5,6
  )

ganttrify(
  project = project,
  project_start_date = "2024-04"
)

Created on 2024-03-10 with reprex v2.1.0