(counts->lengths data
max-length
&
{:keys [total-as-max? datamin-as-min?]
:or [total-as-max? false datamin-as-min? false]})
Produces a linear mapping [0,max-count] -> [0, max-length], for data which is a vector, each element a map with key :count. If total-asmax?, then linear map is [0,total-count] -> [0, max-length].
Produces a linear mapping [0,max-count] -> [0, max-length], for data which is a vector, each element a map with key :count. If total-asmax?, then linear map is [0,total-count] -> [0, max-length].
(evenly-spaced-bins answers bins type*)
Given a list of answers, returns each one as a bin, in string form. nil is mapped to nil. The bins, in order, are returned as metadata. eg. (evenly-spaced-bins [1 2 10] 5 'int') => ['1 to 2' '1 to 2' '9 to 10'] metadata of this above value would be: {:bins ['1 to 2', '3 to 4', '5 to 6', '7 to 8', '9 to 10']}
Given a list of answers, returns each one as a bin, in string form. nil is mapped to nil. The bins, in order, are returned as metadata. eg. (evenly-spaced-bins [1 2 10] 5 'int') => ['1 to 2' '1 to 2' '9 to 10'] metadata of this above value would be: {:bins ['1 to 2', '3 to 4', '5 to 6', '7 to 8', '9 to 10']}
(extract-nil chart-data)
Removes nil from Ona API chart data; adds nil- and non-nil-count metadata. ex. Input: {:field_xpath 'D' :data [{:D nil :count 5} {:D 1 :count 10}]} Output: {:field_xpath 'D' :data [{:D 1 :count 10}]} w/ metadata: {:nil-count 5 :non-nil-count 10}
Removes nil from Ona API chart data; adds nil- and non-nil-count metadata. ex. Input: {:field_xpath 'D' :data [{:D nil :count 5} {:D 1 :count 10}]} Output: {:field_xpath 'D' :data [{:D 1 :count 10}]} w/ metadata: {:nil-count 5 :non-nil-count 10}
(int->str typ & {:keys [digits] :or {digits 1}})
Converts integers to strings, for type (int|date). Optional digits parameter = number of digits after decimal, default is 1.
Converts integers to strings, for type (int|date). Optional digits parameter = number of digits after decimal, default is 1.
(label-count-pairs chart-data)
(label-count-pairs chart-data language)
Take chart-data from the ona API, returns label->count map. eg. Input: {:field_xpath 'D' :data [{:count 2 :D ['Option_1']}]} Output: {:Option_1 2} eg. Input: {:field_xpath 'D' :data [{:count 1 :D ['O1' 'O_2'] :count 2 :D ['O1']}]} Output: {:Option_1 3 :O_2 1}
Take chart-data from the ona API, returns label->count map. eg. Input: {:field_xpath 'D' :data [{:count 2 :D ['Option_1']}]} Output: {:Option_1 2} eg. Input: {:field_xpath 'D' :data [{:count 1 :D ['O1' 'O_2'] :count 2 :D ['O1']}]} Output: {:Option_1 3 :O_2 1}
(make-chart chart-data)
(make-chart chart-data language)
Make chart depending on datatype.
Make chart depending on datatype.
(numeric-chart chart-data & {:keys [data-type] :or {data-type "int"}})
Create numeric (or date) chart out of some chart-data from ona API.
Create numeric (or date) chart out of some chart-data from ona API.
(parse-int st)
Parse an integer from a string.
Parse an integer from a string.
(parse-time time-string)
Remove the colon in a time string String -> String
Remove the colon in a time string String -> String
(range->str [minimum maximum] typ)
Converts a range of typ (int|date) to a string.
Converts a range of typ (int|date) to a string.
(str->int typ)
Converts string to integer, for typ (int|date).
Converts string to integer, for typ (int|date).
(table-chart-h data nil-count non-nil-count field_type)
Create category bar chart out of some data + count data. Data of form: {'Label1' 1 'Label2' 2}, etc. where the numbers are counts.
Create category bar chart out of some data + count data. Data of form: {'Label1' 1 'Label2' 2}, etc. where the numbers are counts.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close