bug non ascii

This commit is contained in:
pvictor 2020-02-14 18:13:24 +01:00
parent 8d5cfa631e
commit 279ca36946
8 changed files with 32 additions and 19 deletions

View File

@ -15,7 +15,7 @@
#' @param legendClick Fires when user clicks on legend. #' @param legendClick Fires when user clicks on legend.
#' @param selection Fires when user selects rect using the selection tool. #' @param selection Fires when user selects rect using the selection tool.
#' @param dataPointSelection Fires when user clicks on a datapoint (bar/column/marker/bubble/donut-slice). #' @param dataPointSelection Fires when user clicks on a datapoint (bar/column/marker/bubble/donut-slice).
#' @param dataPointMouseEnter Fires when users mouse enter on a datapoint (bar/column/marker/bubble/donut-slice). #' @param dataPointMouseEnter Fires when user's mouse enter on a datapoint (bar/column/marker/bubble/donut-slice).
#' @param dataPointMouseLeave MouseLeave event for a datapoint (bar/column/marker/bubble/donut-slice). #' @param dataPointMouseLeave MouseLeave event for a datapoint (bar/column/marker/bubble/donut-slice).
#' @param beforeZoom This function, if defined, runs just before zooming in/out of the chart allowing you to set a custom range for zooming in/out. #' @param beforeZoom This function, if defined, runs just before zooming in/out of the chart allowing you to set a custom range for zooming in/out.
#' @param zoomed Fires when user zooms in/out the chart using either the selection zooming tool or zoom in/out buttons. #' @param zoomed Fires when user zooms in/out the chart using either the selection zooming tool or zoom in/out buttons.

View File

@ -245,7 +245,7 @@ ax_plotOptions <- function(ax,
#' Colors #' Colors
#' #'
#' @param ax A \code{apexcharts} \code{htmlwidget} object. #' @param ax A \code{apexcharts} \code{htmlwidget} object.
#' @param ... Colors for the charts series. When all colors are used, it starts from the beginning. #' @param ... Colors for the chart's series. When all colors are used, it starts from the beginning.
#' #'
#' @return A \code{apexcharts} \code{htmlwidget} object. #' @return A \code{apexcharts} \code{htmlwidget} object.
#' @export #' @export
@ -284,7 +284,7 @@ ax_colors <- function(ax, ...) {
#' #'
#' @param ax A \code{apexcharts} \code{htmlwidget} object. #' @param ax A \code{apexcharts} \code{htmlwidget} object.
#' @param enabled To determine whether to show dataLabels or not. #' @param enabled To determine whether to show dataLabels or not.
#' @param textAnchor The alignment of text relative to dataLabels drawing position. #' @param textAnchor The alignment of text relative to dataLabel's drawing position.
#' Accepted values \code{"start"}, \code{"middle"} or \code{"end"}. #' Accepted values \code{"start"}, \code{"middle"} or \code{"end"}.
#' @param offsetX Sets the left offset for dataLabels. #' @param offsetX Sets the left offset for dataLabels.
#' @param offsetY Sets the top offset for dataLabels. #' @param offsetY Sets the top offset for dataLabels.
@ -493,11 +493,11 @@ ax_labels2 <- function(ax, labels) {
#' @param show Logical. Whether to show or hide the legend container. #' @param show Logical. Whether to show or hide the legend container.
#' @param position Available position options for legend: \code{"top"}, \code{"right"}, \code{"bottom"}, \code{"left"}. #' @param position Available position options for legend: \code{"top"}, \code{"right"}, \code{"bottom"}, \code{"left"}.
#' @param showForSingleSeries Show legend even if there is just 1 series. #' @param showForSingleSeries Show legend even if there is just 1 series.
#' @param showForNullSeries Allows you to hide a particular legend if its series contains all null values. #' @param showForNullSeries Allows you to hide a particular legend if it's series contains all null values.
#' @param showForZeroSeries Allows you to hide a particular legend if its series contains all 0 values. #' @param showForZeroSeries Allows you to hide a particular legend if it's series contains all 0 values.
#' @param horizontalAlign Available options for horizontal alignment: \code{"right"}, \code{"center"}, \code{"left"}. #' @param horizontalAlign Available options for horizontal alignment: \code{"right"}, \code{"center"}, \code{"left"}.
#' @param fontSize Sets the fontSize of legend text elements #' @param fontSize Sets the fontSize of legend text elements
#' @param textAnchor The alignment of text relative to legends drawing position #' @param textAnchor The alignment of text relative to legend's drawing position
#' @param offsetY Sets the top offset for legend container. #' @param offsetY Sets the top offset for legend container.
#' @param offsetX Sets the left offset for legend container. #' @param offsetX Sets the left offset for legend container.
#' @param formatter JS function. A custom formatter function to append additional text to the legend series names. #' @param formatter JS function. A custom formatter function to append additional text to the legend series names.
@ -908,7 +908,7 @@ ax_stroke <- function(ax,
#' @param ax A \code{apexcharts} \code{htmlwidget} object. #' @param ax A \code{apexcharts} \code{htmlwidget} object.
#' @param enabled Logical. Show tooltip when user hovers over chart area. #' @param enabled Logical. Show tooltip when user hovers over chart area.
#' @param shared Logical. When having multiple series, show a shared tooltip. #' @param shared Logical. When having multiple series, show a shared tooltip.
#' @param followCursor Logical. Follow users cursor position instead of putting tooltip on actual data points. #' @param followCursor Logical. Follow user's cursor position instead of putting tooltip on actual data points.
#' @param intersect Logical. Show tooltip only when user hovers exactly over datapoint. #' @param intersect Logical. Show tooltip only when user hovers exactly over datapoint.
#' @param inverseOrder Logical. In multiple series, when having shared tooltip, inverse the order of series (for better comparison in stacked charts). #' @param inverseOrder Logical. In multiple series, when having shared tooltip, inverse the order of series (for better comparison in stacked charts).
#' @param custom JS function. Draw a custom html tooltip instead of the default one based on the values provided in the function arguments. #' @param custom JS function. Draw a custom html tooltip instead of the default one based on the values provided in the function arguments.

View File

@ -16,12 +16,12 @@
#' tmin = c(3, 3, 5, 7, 11, 14, 16, 16, 13, 10, 6, 3) #' tmin = c(3, 3, 5, 7, 11, 14, 16, 16, 13, 10, 6, 3)
#' ) #' )
#' #'
#' apex(meteo_paris, type = "column", aes(x = month, y = tmin)) %>% #' apex(meteo_paris, type = "column", aes(x = month, y = tmin)) %>%
#' ax_labs( #' ax_labs(
#' title = "Average minimal temperature in Paris", #' title = "Average minimal temperature in Paris",
#' subtitle = "Data from NOAA", #' subtitle = "Data from NOAA",
#' x = "Month", #' x = "Month",
#' y = "Temperature (°C)" #' y = "Temperature (\u00b0C)"
#' ) #' )
ax_labs <- function(ax, title = NULL, subtitle = NULL, x = NULL, y = NULL) { ax_labs <- function(ax, title = NULL, subtitle = NULL, x = NULL, y = NULL) {
if (!is.null(title)) { if (!is.null(title)) {

View File

@ -98,7 +98,7 @@ apexchart() %>%
Pass a list of parameters to the function: Pass a list of parameters to the function:
``` r ```r
apexchart(ax_opts = list( apexchart(ax_opts = list(
chart = list( chart = list(
type = "line" type = "line"
@ -137,11 +137,11 @@ apexchart(ax_opts = list(
yaxis = list( yaxis = list(
title = list(text = "Temperature"), title = list(text = "Temperature"),
labels = list( labels = list(
formatter = htmlwidgets::JS("function(value) {return value + '°C';}") formatter = htmlwidgets::JS("function(value) {return value + '\u00b0CC';}")
) )
) )
)) ))
``` ```
![alt text](man/figures/raw-api.png) ![](man/figures/raw-api.png)

View File

@ -171,6 +171,13 @@ unhcr_ts <- unhcr_popstats[!is.na(continent_origin), list(
), by = list(year, population_type, continent_origin)] ), by = list(year, population_type, continent_origin)]
setorder(unhcr_ts, continent_origin, population_type, year) setorder(unhcr_ts, continent_origin, population_type, year)
unhcr_ts[, population_type := stringi::stri_trans_general(str = population_type, id = "ASCII-Latin")]
unhcr_ts[, continent_origin := stringi::stri_trans_general(str = continent_origin, id = "ASCII-Latin")]
unhcr_ts <- as.data.frame(unhcr_ts) unhcr_ts <- as.data.frame(unhcr_ts)
usethis::use_data(unhcr_ts, overwrite = TRUE) usethis::use_data(unhcr_ts, overwrite = TRUE)
@ -190,12 +197,18 @@ unhcr_popstats[, country_origin := stringi::stri_trans_general(str = country_ori
unhcr_popstats_2017 <- unhcr_popstats[year == 2017, -c("year")] unhcr_popstats_2017 <- unhcr_popstats[year == 2017, -c("year")]
# head(unhcr_popstats_2017)
# utils::promptData(object = unhcr_popstats_2017, filename = "tmp.Rd")
unhcr_popstats_2017[, country_origin := stringi::stri_trans_general(str = country_origin, id = "ASCII-Latin")]
unhcr_popstats_2017[, country_residence := stringi::stri_trans_general(str = country_residence, id = "ASCII-Latin")]
unhcr_popstats_2017[, population_type := stringi::stri_trans_general(str = population_type, id = "ASCII-Latin")]
unhcr_popstats_2017[, continent_residence := stringi::stri_trans_general(str = continent_residence, id = "ASCII-Latin")]
unhcr_popstats_2017[, continent_origin := stringi::stri_trans_general(str = continent_origin, id = "ASCII-Latin")]
unhcr_popstats_2017 <- as.data.frame(unhcr_popstats_2017) unhcr_popstats_2017 <- as.data.frame(unhcr_popstats_2017)
head(unhcr_popstats_2017)
utils::promptData(object = unhcr_popstats_2017, filename = "tmp.Rd")
usethis::use_data(unhcr_popstats_2017, overwrite = TRUE) usethis::use_data(unhcr_popstats_2017, overwrite = TRUE)

Binary file not shown.

Binary file not shown.

View File

@ -81,7 +81,7 @@ apexchart(ax_opts = list(
yaxis = list( yaxis = list(
title = list(text = "Temperature"), title = list(text = "Temperature"),
labels = list( labels = list(
formatter = htmlwidgets::JS("function(value) {return value + '°C';}") formatter = htmlwidgets::JS("function(value) {return value + \'\u00b0C\';}")
) )
) )
)) ))