org.clojars.punit-naik.draw

add-axes

(add-axes vl-spec {:keys [x-fld-name x-fld-type x-agg-op x-fld-opts y-fld-name y-fld-type y-agg-op y-fld-opts], :or {x-fld-opts {}, y-fld-opts {}}})
Adds axes to the plot in the Vega-lite spec

add-dashes

(add-dashes spec fld-name)(add-dashes spec fld-name fld-type)
Adds dashes to the stroke of a line chart

add-opacity

(add-opacity spec fld-name)(add-opacity spec fld-name fld-type)
Adds opacity/transparency to the stroke of a line chart based on `fld-name`

add-rule-for-line

(add-rule-for-line spec chart-type x-fld-name y-fld-name stack-fld-name chart-interpolate)
Adds a rule (vertical line) when hovered over any point, works even when not exactly hovered over a point
Makes clicking on line charts easier

change-axis-color

(change-axis-color spec color)

change-legend-color

(change-legend-color spec color)

custom-stack-colours

(custom-stack-colours vl-spec colours-map)
Adds custom colour to every label/stack field
`colours-map` is a map with field values as keys and colours (hex strings) as values

generate-colour-range

(generate-colour-range data range-mapping-fn)
Generates `vega-lite` spec for colour ranges for field values

get-fld-info

(get-fld-info spec fld)
Gets the info of the field on `fld`-Axis

get-stack-fld-info

(get-stack-fld-info spec)
Gets the info the the field using which the chart is being stacked (coloured)

get-step-size

(get-step-size {:keys [width], :as spec})
Gets the step size for grouped bar charts based on data

grouped-bar->line

(grouped-bar->line spec)
Converts a spec with a grouped bar chart to a multi line series (stacked) chart

header-for-grouped-bar-chart

(header-for-grouped-bar-chart x-fld-info total-records bucket)

line->grouped-bar

(line->grouped-bar spec bucket)
Converts a spec with a multi line series (stacked) chart to a grouped bar chart
Calculates width of each group's bar based on the number of stacks (colours) and current width of the chart

stack

(stack vl-spec {:keys [stack-fld stack-fld-type stack-fld-opts], :or {stack-fld-opts {}}})
Stacks charts based on a particular field on the aggregated field of the chart
NOTE: Only to be used when there is an aggregated field in the chart in `encoding` and not in `transform`