Common options to all cartesian axes. Namespace: options.scales[scaleId]. Datetimes require an addition plugin for chartjs, and chartjs-adapter-date-fns is included in this package (https://github.com/chartjs/chartjs-adapter-date-fns), which comes from https://date-fns.org/ https://date-fns.org/v2.29.3/docs/format

cjs_scale_datetime(
  p,
  id,
  type = "time",
  alignToPixels = FALSE,
  backgroundColor = NULL,
  border = cjs_border(),
  display = TRUE,
  grid = cjs_grid(),
  min = NULL,
  max = NULL,
  reverse = FALSE,
  stacked = FALSE,
  suggestedMax = NULL,
  suggestedMin = NULL,
  ticks = cjs_ticks(),
  weight = 0,
  bounds = "ticks",
  position = NULL,
  stack = NULL,
  stackWeight = 1,
  axis = NULL,
  offset = TRUE,
  title.text = "",
  title.display = FALSE,
  title.align = "center",
  title.color = htmlwidgets::JS("Chart.defaults.color"),
  title.font = htmlwidgets::JS("Chart.defaults.font"),
  title.padding = 4,
  adapters.date = NULL,
  offsetAfterAutoskip = FALSE,
  ticks.source = "auto",
  time.displayFormats = NULL,
  time.isoWeekday = FALSE,
  time.parser = NULL,
  time.round = FALSE,
  time.tooltipFormat = NULL,
  time.unit = FALSE,
  time.minUnit = "millisecond"
)

Arguments

p

plot

id

axis id

type

string Type of scale being employed. Custom scales can be created and registered with a string key. This allows changing the type of an axis for a chart.

alignToPixels

boolean FALSE Align pixel values to device pixels.

backgroundColor

Color Background color of the scale area.

border

object Border configuration. See cjs_border()

display

boolean|string TRUE Controls the axis global visibility (visible when true, hidden when false). When display: 'auto', the axis is visible only if at least one associated dataset is visible.

grid

object Grid line configuration. See cjs_grid()

min

number User defined minimum number for the scale, overrides minimum value from data. more...

max

number User defined maximum number for the scale, overrides maximum value from data. more...

reverse

boolean FALSE Reverse the scale.

stacked

boolean|string FALSE Should the data be stacked. more...

suggestedMax

number Adjustment used when calculating the maximum data value. more...

suggestedMin

number Adjustment used when calculating the minimum data value. more...

ticks

object Tick configuration. See cjs_ticks()

weight

number 0 The weight used to sort the axis. Higher weights are further away from the chart area.

bounds

string 'data' Determines the scale bounds. more...

position

string | object Position of the axis. more...

stack

string Stack group. Axes at the same position with same stack are stacked.

stackWeight

number 1 Weight of the scale in stack group. Used to determine the amount of allocated space for the scale within the group.

axis

string Which type of axis this is. Possible values are: 'x', 'y'. If not set, this is inferred from the first character of the ID which should be 'x' or 'y'.

offset

boolean FALSE If true, extra space is added to the both edges and the axis is scaled to fit into the chart area. This is set to true for a bar chart by default.

title.text

The text for the title. (i.e. "# of People" or "Response Choices").

title.display

boolean, if title.text is something other than "" then this will be automatically set to TRUE

title.align

Alignment of the axis title. Possible options are 'start', 'center' and 'end'

title.color

color of label, defaults to htmlwidgets::JS('Chart.defaults.color'),

title.font

color of the font, defaults to htmlwidgets::JS('Chart.defaults.font'),

title.padding

Padding to apply around scale labels. Only top, bottom and y are implemented.

adapters.date

object Options for adapter for external date library if that adapter needs or supports options

offsetAfterAutoskip

boolean FALSE If true, bar chart offsets are computed with auto skipped ticks.

ticks.source

string 'auto' How ticks are generated. more...

time.displayFormats

object Sets how different time units are displayed. more...

time.isoWeekday

boolean|number FALSE If boolean and true and the unit is set to 'week', then the first day of the week will be Monday. Otherwise, it will be Sunday. If number, the index of the first day of the week (0 - Sunday, 6 - Saturday)

time.parser

string|function Custom parser for dates. more...

time.round

string FALSE If defined, dates will be rounded to the start of this unit. See Time Units below for the allowed units.

time.tooltipFormat

string The format string to use for the tooltip.

time.unit

string FALSE If defined, will force the unit to be a certain type. See Time Units section below for details.

time.minUnit

string 'millisecond' The minimum display format to be used for a time unit.