-
Notifications
You must be signed in to change notification settings - Fork 6
Webcharts API
Everything in this library is scoped under the webCharts namespace:
object
the webCharts namespace represented as an object whose properties and methods provide access to the functions needed to create and modify charts, tables, and controls
a factory to create chart objects.
returns: chart
Param | Type | Description |
---|---|---|
element | string |
CSS selector identifying the element in which to create the chart; defaults to "body"
|
config | object |
config object specifying all options for how the chart is to appear and behave; see Chart Configuration |
controls | controls |
controls instance that will be linked to this chart instance |
a factory to create controls objects
returns: controls
Param | Type | Description |
---|---|---|
element | string |
CSS selector identifying the element in which to create the controls; defaults to "body"
|
config | object |
configuration object describing the inputs to be rendered |
a factory to create table objects
returns: table
Param | Type | Description |
---|---|---|
element | string |
CSS selector identifying the element in which to create the table |
config | object |
simple configuration object specifying all options for how the table is to appear and behave |
controls | controls |
controls instance that will be linked to this chart instance |
a shortcut for creating many charts at once
given a chart object and a variable from its dataset, a new chart is created for each unique value of that variable; each new chart is rendered using a filtered version of the original dataset
Param | Type | Description |
---|---|---|
chart | chart |
the chart object used as a template |
data | array |
dataset used to draw the charts |
split_by | string |
a header from the chart's dataset, the values of which are used to panel the resulting charts |
order | array |
an array of the values defined by split_by, the order of which defines the order of the charts |
object
an object containing references to the three main objects that Webcharts can create
points to the base chart object
allows access to the object for extending it with new methods, such as:
Object.defineProperties(webCharts.objects.chart, {
'myFunction': {
value: function(){
console.log("hello!");
}
}
//more properties
});
points to the base table object
points to the base controls object
object
an object containing several utility functions for working with data
determines what type of data is contained in a given column from a given dataset
returns: string
- "continuous"
or "categorical"
Param | Type | Description |
---|---|---|
data | array |
a dataset to evaluate |
variable | string |
a column from the dataset |
expands a dataset to include one record per each column in the given array of columns
returns: array
- a new, "longer" dataset
Param | Type | Description |
---|---|---|
data | array |
the dataset to be transformed, in the form of an array of object, such as the one returned by d3.csv |
columns | array |
an array of column names |
an alphanumeric sort function that can be passed to the native Array.sort() method http://www.davekoelle.com/files/alphanum.js
Param | Type | Description |
---|---|---|
a |
String | Number
|
the first of a couplet of items to compare |
b |
String | Number
|
the second of a couplet of items to compare |
performs a mathematic operation on a set of values
returns: number
Param | Type | Description |
---|---|---|
vals | array |
the values to be evaluated |
operation | string |
the type of evaluation to perform |