D3xter.js
- Simple and powerful syntax to make common charts with minimal code.
- Highly flexible plotting for deep customization.
- Sensible defaults but easy to configure as needed.
- Easily extendable via familiar D3.js syntax.
Contents
Plot
- labels: (optional) array of strings specifying the label for each dataset applied to the legend.
- datasets: array of objects specifying the data associated with each label. Each dataset is configured with
x
values,y
values, and (optional)z
values (size of the points). Each dataset can also take an array oflabels
(to represent points with words), acolor
, and a boolean parameterline
(to indicate if a line should be drawn through the points).
Timeline
events: timeline
takes an array of objects specifying events to be included in the timeline. Each object is configred with a date
string and a label
string.
Bar Chart
- labels: array of strings specifying the label for each dataset applied to the legend.
- groups: array of strings specifying the groups for the x-axis.
- datasets array of objects specifying the data associated with each label. Each dataset is configured with numeric
values
and (optionally) acolor
.
Histogram
data: hist
takes an array of numeric values for which to create the histogram.
Pie Chart
values: array of numeric values which define the size of the slices of the pie chart.
labels: (optional) array of string labels used for the legend.
Configuration
Charts can be optionally configured. xLab
and yLab
take string values for the x and y axis labels. title
takes a string for a chart title. height
and width
are used to define the dimensions of the SVG. selector
is used to determine which DOM element the SVG will be attached to. legend
is a boolean value which can be used to exclude the default legend (where applicable).
Extension
Charts can easily be extended with D3 syntax. Each D3xter chart has a canvas
attribute which returns the SVG on which the chart is drawn. D3 syntax can be applied to this canvas
as it would be to any SVG. Charts also have xMap
and yMap
attributes. These are functions which map values from the data domain/range to the appropriate x/y values.
Use with Python
Want to use this syntax to generate charts in Python? Check out PyDexter!