This gives an overview of the common coding patterns used across many chart types
The arguments each chart type accepts are slightly different reflecting the nature of each plot. However, there are some common elements found across many plot types:
Filters allow users to subset the data that is used to display the chart. The logic is that a datapoint is included if it satisfies ALL of the various filter conditions.
Filters can be specified with either a Dict or a Vector:
filters = [:product_line, :country] creates multi-select dropdown filters
with all unique values selected by default. So if you have [:product_line, :country] then you will end up with two dropdown boxes allowing you to subset the data by country and by the product_line.filters = Dict(:country => ["Australia", "United Kingdom"], :product_line => nothing) where each key
is a column name and each value specifies the default selected values. This is a bit more flexible than the above as you can specify what filters are applied by default. In this case you will end up with the same filters being possible as in the above case but by default when a user first opens a page there will be filters applied for Australia and the UK.
color_cols are the options that affect the grouping and color of objects in the chart.
For instance in a KernelDensity plot, different colors can be used to show the distribution of different groups.
In a ScatterPlot, different colors can be used to show points from different groups.
facet_cols specify which columns can be used for faceting (creating small aligned multiples of the same plot).
Note that if only one facet_col is specified there will be one dropdown list for applying this faceting or not. If two or more are provided there will be two dropdown lists for the x and y dimensions of the facet_grid.
nothing, no faceting will appear initially (but users can enable it if facet_cols is provided)Many chart types accept value_cols which specify the columns containing the data to visualize.
For plots that can display multiple value columns (like DistPlot or KernelDensity), you can provide a vector
of column names and use dropdown controls to switch between them.
Some chart types allow you to specify several columns that are used for x, y and z. In these cases you can swap them on the fly.
Several chart types have their own interactive controls that are quite specific to them. Some examples are:
This page was created using JSPlots.jl.