Skip to content

Commit 61dcf5e

Browse files
committed
widen histogram slider room
1 parent 80b2a38 commit 61dcf5e

2 files changed

Lines changed: 9 additions & 4 deletions

File tree

observablehq.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export default {
1717
// ],
1818

1919
// Content to add to the head of the page, e.g. for a favicon:
20-
head: '<link rel="icon" href="observable.png" type="image/png" sizes="32x32">',
20+
head: '<link rel="icon" href="observable.png" type="image/png" sizes="32x32"><script id="counterscale-script" data-site-id="scratchpad" src="https://counterscale.tilers.workers.dev/tracker.js" defer></script>',
2121

2222
// The path to the source root.
2323
root: "src",

src/histojam.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,9 @@ const histBinMax = histData.bands[band].histogram.max
4242
const histBinCount = histData.bands[band].histogram.count
4343
const histBuckets = histData.bands[band].histogram.buckets
4444
const minMax = [Math.floor(dataMin), Math.ceil(dataMax)]
45-
45+
const maxAbs = Math.max(...minMax.map(Math.abs));
46+
const absMinMax = [-maxAbs,maxAbs]
47+
// const wideMinMax = [-absMinMax,absMinMax]
4648
```
4749
```js
4850
const cIn = Inputs.textarea({label: "Colors", rows: 2, value: 'purple,#ED2A24'});
@@ -118,8 +120,11 @@ const selection = dicopalFile.filter(d => cmapFilter.includes(d.type))
118120
const colorScheme = colorVals
119121
```
120122
```js
121-
const colorMin = view(Inputs.range(minMax, {label: "Color min", value: minMax[0], step: 0.01}));
122-
const colorMax = view(Inputs.range(minMax, {label: "Color max", value: minMax[1], step: 0.01}));
123+
display(absMinMax)
124+
```
125+
```js
126+
const colorMin = view(Inputs.range(absMinMax, {label: "Color min", value: minMax[0], step: 0.01}));
127+
const colorMax = view(Inputs.range(absMinMax, {label: "Color max", value: minMax[1], step: 0.01}));
123128

124129
const interpolator = view(Inputs.select(
125130
new Map([

0 commit comments

Comments
 (0)