Skip to content

Commit

Permalink
Merge pull request #92 from psrc/dev-breaks
Browse files Browse the repository at this point in the history
fix using breaks with continuous scale
  • Loading branch information
jensenmj authored Aug 12, 2024
2 parents fe69fab + d611c6f commit 59d5a7a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions R/psrc_line_charts.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ NULL
#' @param y The name of the variable you want plotted on the Y-Axis
#' @param text name of the variable to use as tooltip
#' @param dform Format for Date values
#' @param breaks Break points for a continuous scale or date break description for date scale; default NULL
#' @param breaks Break points for a continuous/discrete scale or date break description for date scale; default NULL
#' @param lwidth Width of lines, defaults to 1
#' @param alt Text to be used for alt-text, if desired - defaults to "NULL"
#' @param xlabel category-axis title to be used for chart, if desired - defaults to "NULL"
Expand Down Expand Up @@ -64,7 +64,10 @@ generic_line <- function(t, x, y, fill,
}else{
c <- c + ggplot2::geom_point(ggplot2::aes(color=.data[[fill]]))
if(!is.null(breaks)){
c <- c + ggplot2::scale_x_discrete(breaks=breaks)
if(xtype %in% c("numeric", "integer"))
c <- c + ggplot2::scale_x_continuous(breaks=breaks)
else
c <- c + ggplot2::scale_x_discrete(breaks=breaks)
}
}

Expand Down
2 changes: 1 addition & 1 deletion man/generic_line.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 59d5a7a

Please sign in to comment.