dimple/rCharts API¶
In most cases the rCharts/dimple plugin has attempted to map the dimple API on a one-to-one basis while keeping rCharts reference class methods consistent.
dPlot¶
You can create an interactive plot making use of the dimple library using the dPlot() function. The minimal parameters are listed in the table below. The primary difference with dimple and other rCharts libraries is that arrays can be provided for x, y, and groups for pivot like functionality.
Argument | Type | Description |
---|---|---|
x | formula or string | formula y ~ x or string x = “” or x=c(“”,””,..) with column names from the data frame |
y | string or strings | y = “” or y = c(“”,””,...) with column names from the data frame |
data | data frame | A data frame containing the data to be plotted |
type | string | The type of chart to plot “line” , “bubble” , “bar” , “area” |
z (optional) | string | z = “” with column names from the data frame |
groups (optional) | string or strings | groups = “” or groups = c(“”,””,...) |
Beyond this basic specification, there are numerous opportunities for customization as shown with the methods and parameters below.
xAxis, yAxis, zAxis¶
dimple API: dimple.axis
xAxis, yAxis, and zAxis will gets passed in the JSON spec as opts.xAxis, ... By default rCharts will assign the x axis as addCategoryAxis (categorical/discrete) and y axis as addMeasureAxis (continuous/numeric).
Arguments¶
Argument | Type | Description |
---|---|---|
type | string | “addMeasureAxis”, “addCategoryAxis”, “addTimeAxis”, “addPctAxis” . |
orderRule | string or array | add a rule by which the values in a category axis will be ordered |
grouporderRule | string or array | add a rule by which the values in a group on a category axis will be ordered |
overrideMin | generally numeric | manually override minimum for the axis |
overrideMax | generally numeric | manually override maximum for the axis |
inputFormat only for “addTimeAxis” | string | d3 time parse format using d3 time formatting |
outputFormat | string | formatting for the axis using the d3 time formatting or d3 formatting style |
Usage¶
Axis specifications can be provided in 3 ways.
d1 <- dPlot(...)
d1$[x,y,z]Axis(...)
d1 <- dPlot(
[x,y,z]Axis = list(...)
)
Details¶
Provide sample usages and an example similar to the gallery/create sections.
legend¶
dimple API: dimple.chart.legends
Arguments¶
Argument | Type | Description |
---|---|---|
x | number or string % | x coordinate of the left corner of the legend |
y | number or string % | y coordinate of the top of the legend |
width | number or string % | width of the legend |
height | number or string % | height of the legend |
horizontalAlign (optional) | string “left” or “right”; “left” is default | horizontal positioning of legend elements within the bounds defined |
Usage¶
Legends can be provided in 3 ways.
dPlot(...,legend = list(x=,y=,height=,width=,horizontalAlign=))
d1 <- dPlot(...)
d1$legend(x=,y=,height=,width=,horizontalAlign=)
d1 <- dPlot(...)
d1$set(legend = list(x=,y=,height=,width=,horizontalAlign=))
Details¶
storyboard¶
dimple API: dimple.chart.storyboard
Arguments¶
Argument | Type | Description |
---|---|---|
series | string | series for which we want dimple to use to animate the chart |
Usage¶
Storyboards can be provided in 2 ways. Currently, storyboards do not have a method specifically assigned.
dPlot(...,storyboard = "series_for_storyboard")
d1 <- dPlot(...)
d1$set(storyboard = "series_for_storyboard")
Details¶
lineWeight¶
dimple API: dimple.series.lineWeight
Arguments¶
Argument | Type | Description |
---|---|---|
width | number (default = 2) | numeric value used to determine the weight of the line in a line chart or area chart in pixels |
Usage¶
lineWidth can be provided in 2 ways. Currently, lineWidth does not have a method specifically assigned.
dPlot(...,lineWidth = width)
d1 <- dPlot(...)
d1$set(lineWidth = width)
Details¶
barGap¶
dimple API: dimple.series.barGap
Arguments¶
Argument | Type | Description |
---|---|---|
width | number (default = 0.4) | numeric value used to determine the weight of the line in a line chart or area chart in pixels |
Usage¶
barGap can be provided in 2 ways. Currently, barGap does not have a method specifically assigned.
dPlot(...,barGap = gap)
d1 <- dPlot(...)
d1$set(barGap = gap)
Details¶
aggregate¶
dimple API: dimple.series.aggregate
Arguments¶
Argument | Type | Description |
---|---|---|
aggregate function | string (avg, count, max, min, sum) see dimple code | aggregate function provided by dimple to specify how values are aggregated in a series |
Usage¶
aggregate can be provided in 2 ways. Currently, aggregate does not have a method specifically assigned.
dPlot(...,aggregate = aggregatefunction)
d1 <- dPlot(...)
d1$set(aggregate = aggregatefunction)