(chart-data-of v)The chart data of v: v itself, or what a JSON text holds. Nil for anything else.
The chart data of `v`: `v` itself, or what a JSON text holds. Nil for anything else.
(chart-data? v)True when v has a shape the chart reads: an array of series, or one series with a data array.
True when `v` has a shape the chart reads: an array of series, or one series with a `data` array.
(compute-series-pts s series-idx kind x-dom {:keys [x0 y0 x1 y1]} y-domain)Annotate every point in series s with its rendered pixel coords
(:px, :py), the series index (:si), and its position in the
series (:i). kind is "category" or "numeric"; bounds is
the plot rect map (:x0 :y0 :x1 :y1).
Annotate every point in series `s` with its rendered pixel coords (`:px`, `:py`), the series index (`:si`), and its position in the series (`:i`). `kind` is "category" or "numeric"; `bounds` is the plot rect map (`:x0 :y0 :x1 :y1`).
(data-value s)The chart data that the JSON text s holds, or nil when s is absent, invalid or of another
shape.
The chart data that the JSON text `s` holds, or nil when `s` is absent, invalid or of another shape.
(domain-x series)Returns [min-x max-x] for numeric x, or category count for category x.
Returns [min-x max-x] for numeric x, or category count for category x.
(domain-y series)Returns [min-y max-y] across all series data points, or [0 1] if empty.
Returns [min-y max-y] across all series data points, or [0 1] if empty.
(find-pts-at-x all-pts mx)For cursor='x': find one point per series closest to mx. all-pts is a flat seq of points with :id and :px keys.
For cursor='x': find one point per series closest to mx. all-pts is a flat seq of points with :id and :px keys.
(format-value v fmt-str)Format a numeric value v using fmt-str spec. fmt-str: nil | "int" | "pct" | "abbr" | "fixed:N" | "raw"
Format a numeric value v using fmt-str spec. fmt-str: nil | "int" | "pct" | "abbr" | "fixed:N" | "raw"
(nice-step span n)Compute a "nice" step size for approximately n ticks over span.
Compute a "nice" step size for approximately n ticks over span.
(normalize {:keys [type-raw data-raw height-raw padding-raw grid-raw axes-raw
tooltip-present? cursor-raw disabled-present?
loading-present? selected-raw x-format-raw y-format-raw]})(parse-int-pos s default-val)Parse a positive integer string, returning default-val on failure.
Parse a positive integer string, returning default-val on failure.
(parse-selected s)Parse selected attr string "seriesId:index" into map, or nil.
Parse selected attr string "seriesId:index" into map, or nil.
(parse-series-data json-str)The series that the JSON text json-str holds, as a vector of maps, or [] when it holds no
chart data.
The series that the JSON text `json-str` holds, as a vector of maps, or [] when it holds no chart data.
(scale-x-category i n x0 x1)Map a category index i of n evenly-spaced bins to a pixel x.
When n <= 1 returns the rect midpoint.
Map a category index `i` of `n` evenly-spaced bins to a pixel x. When n <= 1 returns the rect midpoint.
(scale-x-numeric x [mn mx] x0 x1)Map a numeric x-value to a pixel x inside the plot rect [x0, x1].
Map a numeric x-value to a pixel x inside the plot rect [x0, x1].
(scale-y y [mn mx] y0 y1)Map a y-value to a pixel y inside the plot rect [y0, y1]. y0 is the top edge (low pixel), y1 the bottom edge (high pixel). Inverts the axis so larger values render higher on the screen. When the domain has zero span, returns the rect midpoint.
Map a y-value to a pixel y inside the plot rect [y0, y1]. y0 is the top edge (low pixel), y1 the bottom edge (high pixel). Inverts the axis so larger values render higher on the screen. When the domain has zero span, returns the rect midpoint.
(ticks-y mn mx n)Returns a vector of ~n nice tick values between mn and mx.
Returns a vector of ~n nice tick values between mn and mx.
(tooltip-position px py tw th W H edge-pad offset)Compute tooltip position with edge-safe flip logic. px/py = cursor position; tw/th = tooltip size; W/H = container size. Returns {:left l :top t}.
Compute tooltip position with edge-safe flip logic.
px/py = cursor position; tw/th = tooltip size; W/H = container size.
Returns {:left l :top t}.(x-kind series)Returns "category" when x values are strings, otherwise "numeric".
Returns "category" when x values are strings, otherwise "numeric".
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |