@soffits/dsh-card-board 0.3.0 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.3.1
4
+
5
+ - Line charts: a goal drawn as points, and markers, no longer run past the plot when they reach beyond the series; x labels that would repeat or overlap are left out.
6
+
3
7
  ## 0.3.0
4
8
 
5
9
  - Remove `ownerPerson` again. Who a request is, including one that reaches DSH without passing the sign-in, is for the `requestIdentity` provider to say; the board only maps the id it gets.
package/client.js CHANGED
@@ -195,7 +195,8 @@ window.__ModuleLoader__.load({
195
195
  function LineChart({ data, locale, height }) {
196
196
  const [ref, width] = useWidth()
197
197
  const model = useMemo(() => {
198
- const allX = data.series.flatMap(s => s.points.map(p => p.x))
198
+ // The x range covers the series, a goal drawn as points and the markers, so none of them runs off the plot.
199
+ const allX = [...data.series.flatMap(s => s.points.map(p => p.x)), ...(data.goal?.points ?? []).map(p => p.x), ...(data.markers ?? []).map(m => m.x)]
199
200
  const times = allX.map(toTime)
200
201
  const timeAxis = times.every(Number.isFinite)
201
202
  const numberAxis = !timeAxis && allX.every(x => typeof x === 'number')
@@ -227,7 +228,13 @@ window.__ModuleLoader__.load({
227
228
 
228
229
  const longest = data.series.reduce((best, s) => (s.points.length > best.points.length ? s : best), data.series[0])
229
230
  const labelCount = Math.max(2, Math.floor(plotW / 44))
230
- const xTicks = spread(longest.points.length, labelCount).map(i => longest.points[i].x)
231
+ // Evenly spaced labels, minus any that would print the same text or sit on top of the one before.
232
+ const xTicks = []
233
+ for (const x of spread(longest.points.length, labelCount).map(i => longest.points[i].x)) {
234
+ const last = xTicks[xTicks.length - 1]
235
+ if (last !== undefined && (xLabel(last) === xLabel(x) || sx(x) - sx(last) < 36)) continue
236
+ xTicks.push(x)
237
+ }
231
238
 
232
239
  const path = points => {
233
240
  let d = ''
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@soffits/dsh-card-board",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "A data-driven card board for DeepSeek Harness: scripts write small JSON cards, the Web UI shows each person the boards they may see.",
5
5
  "type": "module",
6
6
  "license": "MIT",