CChart | R Documentation |
Creates charts
CChart(
chart.type,
x,
small.multiples = FALSE,
multi.color.series = FALSE,
font.units = "px",
annotation.list = NULL,
signif.show = FALSE,
signif.column.comparisons = FALSE,
...,
warn.if.no.match = TRUE,
append.data = FALSE
)
chart.type |
The name of plot to create, e.g |
x |
The data to be plotted. |
small.multiples |
Logical; Whether each series should be shown in its own panel. When this is true, parameters from |
multi.color.series |
Logical; Indicates whether multiple colors will be shown in a Bar or Column chart with a single series. By default this is off and different colors are used to distinguish between different series. However, when chart.type is "Pyramid", then |
font.units |
One of "px" or "pt" |
annotation.list |
a list of annotations to add to the chart, based on statistics in the input data. |
signif.show |
Logical; whether to show significance tests (arrows or column comparisons). |
signif.column.comparisons |
Logical; whether to show comparisons (letters) in data labels. |
... |
Arguments to the function |
warn.if.no.match |
Logical; If TRUE, a warning is shown if any arugments are not matched. |
append.data |
Logical; If TRUE, extra information is appended to the chart object which is used for exporting. These are appended as attributes
|
Parameters passed to the charting functions are listed below:
type
For chart types Area
, Bar
and Column
, this can be set to Stacked
to show cumulative values.
grid.show
Logical; whether to show grid lines.
opacity
Opacity of bars as an alpha value (0 to 1).
colors
Character; a vector containing one or more colors specified as hex codes.
fit.type
Character; type of line of best fit. Can be one of "None", "Linear", "LOESS",
"Friedman's super smoother" or "Cubic spline". This option is only valid for charts Area, Bar, Column, Line, Scatter, Pyramid.
fit.ignore.last
Logical; whether to ignore the last data point in the fit.
fit.line.type
Character; One of "solid", "dot", "dash", "dotdash", or length of dash "2px", "5px".
fit.line.colors
Character; a vector containing one or more colors specified as hex codes.
fit.line.width
Numeric; Line width of line of best fit.
fit.line.name
Character; Name of the line of best fit, which will appear in the hovertext.
fit.line.opacity
Opacity of trend line as an alpha value (0 to 1).
fit.CI.show
Show 95% confidence interval.
fit.CI.opacity
Opacity of confidence interval ribbon as an alpha value (0 to 1).
fit.CI.colors
Character; a vector containing one or more colors specified as hex codes.
title
Character; chart title.
title.font.family
Character; title font family. Can be "Arial Black",
"Arial", "Comic Sans MS", "Courier New", "Georgia", "Impact",
"Lucida Console", "Lucida Sans Unicode", "Marlett", "Symbol", "Tahoma",
"Times New Roman", "Trebuchet MS", "Verdana", "Webdings".
title.font.color
Title font color as a named color in character format (e.g. "black") or hex code.
title.font.size
Integer; Title font size; default = 10.
subtitle
Character.
subtitle.font.color
subtitle font color as a named color in character format (e.g. "black") or hex code.
subtitle.font.family
Character; subtitle font family.
subtitle.font.size
Integer; subtitle font size.
footer
Character to show below the chart.
footer.font.color
footer font color as a named color in character format (e.g. "black") or hex code.
footer.font.family
Character; footer font family.
footer.font.size
Integer; footer font size.
footer.wrap
Logical; whether the footer text should be wrapped.
footer.wrap.nchar
Number of characters (approximately) in each
line of the footer when footer.wrap
TRUE
.
background.fill.color
Background color in character format (e.g. "black").
legend.show
Logical; show the legend.
legend.wrap
Logical; whether the legend text should be wrapped.
legend.wrap.nchar
Number of characters (approximately) in each
line of the legend when legend.wrap
TRUE
.
legend.fill.color
Legend fill color as a named color in character format
(e.g. "black") or an rgb value (e.g. rgb(0, 0, 0, maxColorValue = 255)).
legend.fill.opacity
Legend fill opacity as an alpha value (0 to 1).
legend.ascending
Logical; TRUE for ascending, FALSE for descending.
By default, we set it to to FALSE if the chart is stacked and TRUE otherwise.
legend.border.color
Legend border color as a named color in character
format (e.g. "black") or an rgb value (e.g. rgb(0, 0, 0, maxColorValue = 255)).
legend.border.line.width
Width in pixels of the border
around the legend. 0 = no border.
legend.position.x
A numeric controlling the position of the legend. Values range from -0.5 (left) to 1.5 (right).
legend.position.y
A numeric controlling the position of the legend. Values range from 0 (bottom) to 1 (top).
legend.font.color
Legend font color as a named color in character format (e.g. "black") or hex code.
legend.font.family
Character; legend font family.
legend.font.size
Integer; Legend font size.
legend.width
Only used in a TimeSeries chart. Integer; Width (in pixels) of the textbox containing the legend.
values.title
Character; title of the axis showing the independent values, i.e. y-axis (in a column or area chart) or x-axis (in a bar chart). This will override dim names read from the input table.
values.title.font.color
values-axis title font color as a named color in character format (e.g. "black") or hex code.
values.title.font.family
Character; values-axis title font family.
values.title.font.size
Integer; values-axis title font size.
values.line.width
values-axis line width in pixels (0 = no line).
values.line.color
values-axis line color as a named color in character format.
(e.g. "black") or an rgb value (e.g. rgb(0, 0, 0, maxColorValue = 255)).
values.tick.mark.length
Length of tick marks in pixels. Ticks are only shown when y.line.width > 0
.
values.bounds.minimum
Minimum of range for plotting; NULL = no manual range set.
values.bounds.maximum
Maximum of range for plotting; NULL = no manual range set.
values.tick.distance
Distance between tick marks. Requires that values.bounds.minimum
and values.bounds.maximum
have been set.
values.number.ticks
Only used in Stream. The total number of ticks on the y-axis.
values.zero
Whether the values-axis should include zero. If false, the range will be determined from the input data.
values.zero.line.width
Width in pixels of zero line;.
values.zero.line.color
Color of horizontal zero line as a named.
color in character format (e.g. "black") or an rgb value (e.g. rgb(0, 0, 0, maxColorValue = 255)).
values.data.reversed
Logical; whether to reverse values-axis or not.
values.grid.width
Width of values-grid lines in pixels; 0 = no line.
values.grid.color
Color of values-grid lines as a named color in character.
format (e.g. "black") or an rgb value (e.g. rgb(0, 0, 0, maxColorValue = 255)).
values.tick.show
Whether to display the values-axis tick labels.
values.tick.suffix
values-axis tick label suffix.
values.tick.prefix
values-axis tick label prefix.
values.tick.format
A string representing a d3 formatting code. See https://github.com/d3/d3/blob/master/API.md#number-formats-d3-format.
values.hovertext.format
A string representing a d3 formatting code. See https://github.com/d3/d3/blob/master/API.md#number-formats-d3-format.
values.tick.angle
values-axis tick label angle in degrees 90 = vertical; 0 = horizontal.
values.tick.font.color
values-axis tick label font color as a named color in character format (e.g. "black") or hex code.
values.tick.font.family
Character; values-axis tick label font family.
values.tick.font.size
Integer; values-axis tick label font size.
categories.title
Character; title of the axis showing the dependent values, i.e. x-axis (in a column or area chart) or y-axis (in a bar chart). This will override dim names read from the input table.
categories.title.font.color
categories-axis title font color as a named color in character format (e.g. "black") or hex code.
categories.title.font.family
Character; categories-axis title font family.
categories.title.font.size
Integer; categories-axis title font size.
categories.line.width
categories-axis line in pixels, 0 = no line.
categories.line.color
categories-axis line color as a named color in character format (e.g. "black") or an rgb value (e.g. rgb(0, 0, 0, macategories.olorValue = 255)).
categories.tick.marks
Character; whether and where to show tick marks on the categories.axis. Can be "outside", "inside", "none".
categories.tick.mark.length
Length of tick marks in pixels.
categories.tick.units
Only used in Stream. "Automatic", "Number", "Day", "Month" or "Year".
categories.tick.interval
Only used in Stream. The frequency of ticks on the x-axis. Where the data crosses multiple years, re-starts at each year.
categories.bounds.minimum
Minimum of range for plotting; NULL = no manual range set. Must be less than categories.bounds.maximum.
categories.bounds.maximum
Maximum of range for plotting; NULL = no manual range set. Must be greater than categories.bounds.minimum.
categories.tick.distance
Tick mark distance in categories.axis units between minimum and maximum for plotting; NULL = no manual range set.
categories.zero
Whether the categories-axis should include zero. If false, the range will be determined from the input data.
categories.zero.line.width
Width in pixels of zero line.
categories.zero.line.color
Color of horizontal zero (origin) line as a named color in character format (e.g. "black") or hex code.
categories.data.reversed
Logical; whether to reverse categories-axis or not.
categories.grid.width
Width of y-grid lines in pixels; 0 = no line.
categories.grid.color
Color of y-grid lines as a named color in character format (e.g. "black") or hex code.
categories.tick.show
Whether to display the categories-axis tick labels.
categories.tick.suffix
categories-axis tick label suffix.
categories.tick.prefix
categories-axis tick label prefix.
categories.tick.format
A string representing a d3 formatting code. See https://github.com/mbostock/d3/wiki/Formatting#numbers.
categories.hovertext.format
A string representing a d3 formatting code. See https://github.com/mbostock/d3/wiki/Formatting#numbers.
categories.tick.angle
categories-axis tick label angle in degrees. 90 = vertical; 0 = horizontal.
categories.tick.font.color
categories-axis tick label font color as a named color in character format (e.g. "black") or hex code.
categories.tick.font.family
Character; categories-axis tick label font family.
categories.tick.font.size
Integer; categories-axis tick label font size.
categories.tick.label.wrap
Logical; whether to wrap long labels on the categories-axis.
categories.tick.label.wrap.nchar
Integer; number of characters in each line when label.wrap
is TRUE
.
tooltip.show
Logical; whether to show a tooltip on hover.
modebar.show
Logical; whether to show the zoom menu buttons or not.
global.font.family
Character; font family for all occurrences of any
font attribute for the chart unless specified individually.
global.font.color
Global font color as a named color in character format (e.g. "black") or hex code.
data.label.show
Logical; whether to show data labels.
data.label.font.family
Character; font family for data label.
data.label.font.size
Integer; Font size for data label.px.
data.label.font.color
Font color as a named color in character format (e.g. "black") or hex code.
data.label.format
A string representing a d3 formatting code. See https://github.com/mbostock/d3/wiki/Formatting#numbers.
data.label.prefix
Character; prefix for data values.
data.label.suffix
Character; suffix for data values.
data.label.threshold
The proportion of the total range below which data labels should not be displayed. Only applicable for pie, bar and column charts.
margin.top
Margin between plot area and the top of the graphic in pixels.
margin.bottom
Margin between plot area and the bottom of the graphic in pixels.
margin.left
Margin between plot area and the left of the graphic in pixels.
margin.right
Margin between plot area and the right of the graphic in pixels.
margin.inner.pad
Padding in pixels between plot proper and axis lines.
background.fill.opacity
Background opacity as an alpha value (0 to 1).
charting.area.fill.color
Charting area background color as a named color in character format (e.g. "black") or hex code.
charting.area.fill.opacity
Charting area background opacity as an alpha value (0 to 1).
line.thickness
Only used in Scatter, Line Area or TimeSeries charts. Controls the line thickness in pixels.
line.colors
Character; a vctor containing one or more colors specified as hex codes.
line.thickness
Opacity of series lines as an alpha value (0 to 1).
marker.show
Only used in Scatter, Line or Area charts. Can be "none", "automatic" or a vector referencing the plotly symbol dictionary using either numerics or strings.
marker.colors
Only works if marker.show
is true. Character; a vector containing one or more colors specified as hex codes.
marker.opacity
Only works if marker.show
is true. Controls ppacity for markers as an alpha value (0 to 1).
marker.size
Only works if marker.show
is true. Controls size in pixels of marker.
marker.border.width
Width in pixels of border/line around series bars; 0 is no line.
marker.border.colors
Character; a vector containing one or more colors specified as hex codes.
marker.border.opacity
Opacity of border around bars as an alpha value (0 to 1).
bar.gap
Only used in charts Bar, Column and Pyramid. Chart proportion between each bar or column if using bar or column charts, or between each cluster of bars or columns.
weights
Only used in Bean, Box, Density, Histogram, Violin plots or Venn diagrams. An optional list
, where each element is a vector containing weights corresponding to the values of x
, or, a vector where the weights is assumed applicable for each element in x
.
vertical
Only used in Bean, Box, Density, Histogram or Violin plots Display the densities vertically.
show.mean
Only used in Violin plots. Displays the mean of the data.
mean.color
Defaults to "white".
show.median
Only used in Violin plots. Displays the median of the data.
median.color
Defaults to "black".
show.quartiles
Only used in Violin plots. Displays the quartiles of the data.
quartile.color
Defaults to "black".
show.range
Only used in Violin plots. Displays the range of the data.
range.color
Defaults to "black".
show.values
Only used in Box, Density or Histogram (always true in Bean plots). Produces a rug plot of individual values.
values.color
Defaults to "Green".
show.density
Only used in Violin plots. Show the left or top (if vertical
is FALSE) of the violin plot.
density.color
Only used in Bean, Box, Density, Histogram or Violin plots. Defaults to "Green".
bw
The smoothing bandwidth to be used when creating a Density, Bean, or Violin plot. This defaults to "nrd0"
, whereas "SJ"
may often be superior (see density
). The default is to "nrd0"
as "SJ"
fails with trivial categorical cases.
adjust
A scaling factor for the bandwidth when creating a Density, Bean, or Violin plot. E.g., a value of 0.5 sets the bandwidth to have of that computed using bw
.
kernel
The kernel used when when creating a Density, Bean, or Violin plot. One of "gaussian" (the default), "epanechnikov", "rectangular", "triangular", "biweight", "cosine", "optcosine".
n
The number of equally-spaced points at which the density is to be estimated when creating a Density, Bean, or Violin plot. If greater than 512, it is rounded to a power of 2 (see link{density}
).
from
The left-most point of the grid used when creating a Density, Bean, or Violin plot.
to
The right-most point of the grid used when creating a Density, Bean, or Violin plot.
cut
By default, the values of from
and to
are cut
bandwidths beyond the extremes of the data.
automatic.lower.density
When TRUE
, which is the default, from
is set to the lowest value in the data.
histogram.cumulative
Only used in Histogram plots. Plots the cumulative histogram, if set to TRUE.
histogram.counts
Only used in Histogram plots. Displays the counts in tooltips of a histogram, rather than the proportions.
maximum.bins
Only used in Histograph plots. The maximum number of bins of the histogram. If NULL
, this is generated automatically.
box.points
How outliers are displayed boxplots. "All"
plots all the points. "Suspected outliers"
plots points between 1.5 and 3 IQR from the 1st and 3rd quartile with un-filled circles. "Outliers"
does not plot points between 1.5 and 3 IQR from the 1st and 3rd quartiles.
country
Only used in GeographicMap. Character string optionally stating the country that the states are from, if map.type
is "states"
.
high.resolution
Only used in GeographicMap. Specifically request a high resolution map. Otherwise the resolution of the map is chosen automatically based on the resolution required for the requested countries or regions.
show.missing.regions
Only used in GeographicMap. Logical; Whether to plot regions not included in x
with values of NA
. Used only when mapping.package
is "leaflet"
.
treat.NA.as.0
Only used in GeographicMap. Plots any NA
values in the data and any geographical entities without data as having a zero value.
ocean.color
Only used in GeographicMap. The color used for oceans (or background).
mapping.package
Only used in GeographicMap. Either "leaflet"
(better graphics, wider range of
maps) or "plotly"
(faster).
background
Only used in GeographicMap. If "mapping.package"
is "leaflet"
, add a background
tile from opensteetmaps.
zip.country
Only used in GeographicMap. One of "Automatic"
, "USA"
, "UK"
or "Australia"
. If "Automatic"
an attempt is made to infer the country from the data.
sort.rows
Only used in Heat. Whether to sort rows by their averages or link as a dendrogram. Options are "None"
, "Sort by averages (ascending)"
, "Sort by averages (descending)"
and "Dendrogram"
.
sort.columns
Only used in Heat. Whether to sort columns by their averages or link as a dendrogram. Options are "None"
, "Sort by averages (ascending)"
, "Sort by averages (descending)"
and "Dendrogram"
.
standardization
Only used in Heat. Whether to standardize the shading of rows or columns. Options are "None"
, "Standardize rows"
and "Standardize columns"
.
left.columns
Only used in Heat. An optional list of vectors or matrices to be appended to the left of the heatmap.
left.column.headings
Only used in Heat. An optional comma separated string containing headings for left.columns
. If not supplied, colnames of the items in left.columns
are used.
right.columns
Only used in Heat. An optional list of vectors or matrices to be appended to the right of the heatmap.
right.column.headings
Only used in Heat. An optional comma separated string containing headings for
right.columns
. If not supplied, colnames of the items in right.columns
are used.
pie.subslice.colors
A vector containing hex value colors for the outer ring of the pie chart. If not supplied will default to the same colors as the inner ring.
pie.subslice.colors.repeat
Logical; if, when a grouped pie chart is displayed, the colors of the subslices should repeat by group, or be different throughout; defaults to TRUE.
pie.groups.font.family
Character; font family for group labels.
pie.groups.font.size
Font size for group labels.
pie.groups.font.color
Font color as a named color or hex code.
pie.data.threshold
Labels with values smaller than the theshold are not shown.
pie.border.color
A single color for space around pie and between segments.
pie.inner.radius
The size of the inner radius of pie and donut charts as a proportion out of 100. Defaults to 70.
scatter.x.column
When x
is a dataframe or matrix, the index of the column (1-based) which contains the x-coordinate data in a scatterplot.
scatter.y.column
When x
is a dataframe or matrix, the index of the column (1-based) which contains the y-coordinate data in a scatterplot. This is ignored if scatter.y
is provided instead.
scatter.sizes.column
When x
is a dataframe or matrix, the index of the column (1-based) which contains scatter.sizes
data. This is ignored if scatter.sizes
is provided instead.
scatter.colors.column
When x
is a dataframe or matrix, the index of the column (1-based) which contains scatter.colors
data. This is ignored if scatter.colors
is provided instead.
scatter.groups.column
Only used for small multiples (otherwise use scatter.colors.column
with scatter.colors.as.categorical = TRUE
). The index of the column of x
which is used to aggregate the data for small multiples. By default this is the last column in x
.
scatter.labels
Optional vector for labelling scatter points. This should be the same length as the number of observations in x and y. If not provided, the rownames of x
will be used instead.
scatter.labels.name
Character; Used for labelling subtitles and footers if scatter.labels
is provided.
scatter.sizes
Numeric vector determining of the size of each observation. These can alternatively be provided as a column in x
.
scatter.sizes.name
Character; Used for labelling footers and legends if scatter.sizes
is provided.
scatter.colors
Numeric, character, or categorical vector determining the color of each observation. These can alternatively be provided as a column in x
.
scatter.colors.name
Character; Used for labelling footers if scatter.colors
is provided.
scatter.colors.as.categorical
Logical; Whether to treat colors as a categorical groups, or a numeric scale..
scatter.labels.as.hovertext
Logical; if TRUE, labels are shown has hovers; otherwise, as a labeled scatterplot.
scatter.sizes.as.diameter
Whether to show the points with diameter (instead of area, which is the default) proportional to the sizes variable. Cannot be used if scatter.labels.as.hovertext = FALSE
.
scatter.max.labels
Integer; the maximum number of labels to show on a Labeled Scatterplot, i.e. when scatter.labels.as.hovertext = FALSE
.
trend.lines
Logical; indicating whether to plot trend lines for multiple tables when scatter.labels.as.hovertext = FALSE
.
logos
Optional list of images to be used to label scatterplot instead of the row names. This should be input as a comma-seperated list of URLs. Only used when scatter.labels.as.hovertext = FALSE
.
logo.size
Numeric controlling the size of the logos.
range.bars
Only used in TimeSeries. Logical; whether the data consists of a single series with low, value, high in the columns, or multiple series.
window.start
Only used in TimeSeries. The number of days before the end of the data series to start the range selector window.
nrows
Only used for small multiples. Integer; Number of rows to arrange the charts in.
x.order
Only used for small multiples. A vector containing the list index of the columns in the order which they are to be shown.
share.axes
Only used for small multiples. Force range of the plot to be the same across all panels.
average.show
Only used for small multiples. Logical; whether to show a second series in each panel containing the data averaged across all series.
average.color
Only used for small multiples. The color in which the average series should be displayed.
panel.title.show
Only used for small multiples. Logical; whether to show a title for each panel.
panel.title.font.family
Only used for small multiples. Font family of panel titles.
panel.title.font.color
Only used for small multiples. Font color of panel titles as hex code.
panel.title.font.size
Only used for small multiples. Font size of panel titles.
panel.title.wrap
Only used for small multiples. Logical; whether the panel title should be wrapped.
panel.title.wrap.nchar
Only used for small multiples. Number of characters (approximately) in each line
of the panel title when panel.title.wordwrap
TRUE
.
pad.top
Only used for small multiples. Numeric in [0,1]; Spacing above chart (between panels).
pad.bottom
Only used for small multiples. Numeric in [0,1]; Spacing below chart (between panels).
pad.left
Only used for small multiples. Numeric in [0,1]; Spacing to the left of chart (between panels).
pad.right
Only used for small multiples. Numeric in [0,1]; Spacing to the right chart (between panels).
A chart object that can be printed. Most often, a plotly object.
x <- matrix(1:21, 7, 3, dimnames = list(letters[1:7], LETTERS[1:3]))
CChart("Column", x, colors = c("red", "green", "blue"), categories.title = "Categories")
CChart("Bar", x, type = "Stacked", colors = grey(1:3/3), categories.title = "Categories")
CChart("Area", x, small.multiples = TRUE, colors = rainbow(3), categories.title = "Categories")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.