forked from MapComplete/MapComplete
chore: automated housekeeping...
This commit is contained in:
parent
9cd7ad597d
commit
69ab755f29
520 changed files with 16616 additions and 13483 deletions
|
|
@ -6,29 +6,31 @@
|
|||
import { Lists } from "../../Utils/Lists"
|
||||
|
||||
export let values: Store<string[]>
|
||||
let counts: Store<Map<string, number>> = values.map(
|
||||
(values) => {
|
||||
if (values === undefined) {
|
||||
return undefined
|
||||
}
|
||||
let counts: Store<Map<string, number>> = values.map((values) => {
|
||||
if (values === undefined) {
|
||||
return undefined
|
||||
}
|
||||
|
||||
values = Utils.noNull(values)
|
||||
const counts = new Map<string, number>()
|
||||
for (const value of values) {
|
||||
const c = counts.get(value) ?? 0
|
||||
counts.set(value, c + 1)
|
||||
}
|
||||
values = Utils.noNull(values)
|
||||
const counts = new Map<string, number>()
|
||||
for (const value of values) {
|
||||
const c = counts.get(value) ?? 0
|
||||
counts.set(value, c + 1)
|
||||
}
|
||||
|
||||
return counts
|
||||
})
|
||||
return counts
|
||||
})
|
||||
|
||||
let max: Store<number> = counts.mapD(counts => Math.max(...Array.from(counts.values())))
|
||||
let keys: Store<string> = counts.mapD(counts => {
|
||||
let max: Store<number> = counts.mapD((counts) => Math.max(...Array.from(counts.values())))
|
||||
let keys: Store<string> = counts.mapD((counts) => {
|
||||
const keys = Lists.dedup(counts.keys())
|
||||
keys.sort(/*inplace sort*/)
|
||||
return keys
|
||||
})
|
||||
let config: Store<ChartConfiguration> = keys.mapD(keys => ChartJsUtils.createHistogramConfig(keys, counts.data), [counts])
|
||||
let config: Store<ChartConfiguration> = keys.mapD(
|
||||
(keys) => ChartJsUtils.createHistogramConfig(keys, counts.data),
|
||||
[counts]
|
||||
)
|
||||
</script>
|
||||
|
||||
{#if $config}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue