prographs 0.12.0 → 0.13.0
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 +9 -1
- package/README.md +6 -4
- package/dist/AutoGraph-PDPEAIXL.cjs +145 -0
- package/dist/GraphType.js +19 -0
- package/dist/autograph/chartIndex.js +521 -0
- package/dist/autograph/chartModules.js +2 -1
- package/dist/autograph/index.cjs +98 -93
- package/dist/catalog-DI4XZ46L.cjs +142 -0
- package/dist/catalog.js +2 -1
- package/dist/charts/biologycharts/BiologySamples.js +59 -0
- package/dist/charts/biologycharts/PunnettSquare.js +342 -0
- package/dist/charts/biologycharts/biologyEnums.js +22 -1
- package/dist/charts/biologycharts/index.js +5 -3
- package/dist/charts/doecharts/DoeSamples.js +78 -0
- package/dist/charts/doecharts/SipocDiagram.js +453 -0
- package/dist/charts/doecharts/index.js +4 -2
- package/dist/charts/fieldcharts/SpeciesAccumulationCurve.js +350 -0
- package/dist/charts/fieldcharts/fieldEnums.js +8 -1
- package/dist/charts/fieldcharts/index.js +5 -3
- package/dist/charts/signals/AntennaPatternChart.js +492 -0
- package/dist/charts/signals/SignalSamples.js +17 -0
- package/dist/charts/signals/index.js +5 -3
- package/dist/charts/softwarediagrams/ComponentDiagram.js +504 -0
- package/dist/charts/softwarediagrams/DeploymentDiagram.js +419 -0
- package/dist/charts/softwarediagrams/SoftwareSamples.js +283 -1
- package/dist/charts/softwarediagrams/index.js +7 -3
- package/dist/charts/softwarediagrams/softwareEnums.js +45 -1
- package/dist/charts/sportscharts/PowerDurationCurve.js +301 -0
- package/dist/charts/sportscharts/SportsSamples.js +102 -0
- package/dist/charts/sportscharts/TrainingLoadChart.js +325 -0
- package/dist/charts/sportscharts/index.js +6 -2
- package/dist/charts/strategycharts/BassDiffusionChart.js +362 -0
- package/dist/charts/strategycharts/BassModel.js +96 -0
- package/dist/charts/strategycharts/BurnRunwayChart.js +284 -0
- package/dist/charts/strategycharts/CapTableChart.js +366 -0
- package/dist/charts/strategycharts/KanbanBoard.js +324 -0
- package/dist/charts/strategycharts/OkrTree.js +339 -0
- package/dist/charts/strategycharts/StrategyPane.js +27 -0
- package/dist/charts/strategycharts/StrategySamples.js +251 -0
- package/dist/charts/strategycharts/index.js +15 -3
- package/dist/charts/threefields/BsfcMap3DChart.js +231 -0
- package/dist/charts/threefields/CompressorMap3DChart.js +217 -0
- package/dist/charts/threefields/FieldGrid.js +50 -0
- package/dist/charts/threefields/LossLandscape3DChart.js +201 -0
- package/dist/charts/threefields/MapSheet.js +77 -0
- package/dist/charts/threefields/TerrainRoute3DChart.js +201 -0
- package/dist/charts/threefields/TerrainRouteMath.js +40 -0
- package/dist/charts/threefields/ThreeFieldBase.js +117 -0
- package/dist/charts/threefields/ThreeFieldsSamples.js +80 -0
- package/dist/charts/threefields/WaferMap3DChart.js +218 -0
- package/dist/charts/threefields/index.js +19 -0
- package/dist/charts/threesurfaces/index.js +2 -2
- package/dist/charts/tradingcharts/KeltnerChannelChart.js +171 -0
- package/dist/charts/tradingcharts/TradingMath.js +20 -0
- package/dist/charts/tradingcharts/index.js +4 -2
- package/dist/{chunk-ZL6XDXMK.cjs → chunk-26PSLEP4.cjs} +8 -8
- package/dist/{chunk-W3US6EFP.cjs → chunk-2BO5DZUP.cjs} +12 -12
- package/dist/{chunk-5DP7OUSE.cjs → chunk-2GG5YYSC.cjs} +6 -6
- package/dist/{chunk-7FG4JSVO.cjs → chunk-2GL2VNJU.cjs} +253 -33
- package/dist/{chunk-LCWMRCLF.cjs → chunk-2PYOI7OY.cjs} +21 -21
- package/dist/{chunk-JFWJAEBD.cjs → chunk-3U4MCSKI.cjs} +4 -4
- package/dist/{chunk-CUPLHZRR.cjs → chunk-3ZMM3FSK.cjs} +4 -4
- package/dist/{chunk-L2AV62DP.cjs → chunk-4767WQJ7.cjs} +6 -6
- package/dist/{chunk-DA2EYIIP.cjs → chunk-4E7FSSBF.cjs} +1210 -168
- package/dist/{chunk-VS5LQEZB.cjs → chunk-526STI2S.cjs} +5 -5
- package/dist/{chunk-RXIMEK6C.cjs → chunk-55767YPI.cjs} +20 -20
- package/dist/{chunk-JXLSKIUV.cjs → chunk-5FBQOMMT.cjs} +26 -26
- package/dist/{chunk-27PZV5BR.cjs → chunk-5N4Z7MTS.cjs} +4 -4
- package/dist/{chunk-KEWCUIQA.cjs → chunk-5WEV6YWA.cjs} +22 -22
- package/dist/chunk-5XOVVC5X.cjs +3281 -0
- package/dist/{chunk-HK5J7Q2W.cjs → chunk-6HLXVWXU.cjs} +9 -9
- package/dist/{chunk-7JG47RW4.cjs → chunk-6LQT4WJ5.cjs} +25 -25
- package/dist/{chunk-OCVTI6X4.cjs → chunk-6YTWOUFD.cjs} +329 -36
- package/dist/{chunk-W7IQCAVN.cjs → chunk-7F6W6HKL.cjs} +11 -11
- package/dist/{chunk-F2DCJXDM.cjs → chunk-7L6KYU5A.cjs} +21 -21
- package/dist/{chunk-GTGR6LPR.cjs → chunk-A4GIN4FE.cjs} +17 -17
- package/dist/{chunk-B2CETSR6.cjs → chunk-A4US7SA7.cjs} +5 -5
- package/dist/{chunk-3DIF2YYW.cjs → chunk-AOXPBLPW.cjs} +10 -10
- package/dist/{chunk-7TTR4UF5.cjs → chunk-ATI45Z4M.cjs} +2 -2
- package/dist/{chunk-5BFCIX2V.cjs → chunk-CPPMO4IQ.cjs} +434 -148
- package/dist/{chunk-AYZZQ6AC.cjs → chunk-CZ5KGF6Q.cjs} +9 -9
- package/dist/{chunk-7THJ3ZBK.cjs → chunk-D4I35MCE.cjs} +2 -2
- package/dist/{chunk-MCPPFRLN.cjs → chunk-DCGAAN3Z.cjs} +2 -2
- package/dist/{chunk-VABL6CVX.cjs → chunk-DEY36N37.cjs} +21 -21
- package/dist/{chunk-RNCKGJCC.cjs → chunk-DXHXD3DK.cjs} +3 -3
- package/dist/{chunk-A56ZGMVZ.cjs → chunk-E7B45DBZ.cjs} +11 -11
- package/dist/{chunk-DOR6L4MT.cjs → chunk-EJC6EAC5.cjs} +18 -18
- package/dist/{chunk-UPGNM7MA.cjs → chunk-EULJOOMA.cjs} +11 -11
- package/dist/{chunk-G4AZL4GO.cjs → chunk-EYM6LEIF.cjs} +474 -70
- package/dist/{chunk-NJ4X6XGV.cjs → chunk-EZTYX2GH.cjs} +5 -5
- package/dist/chunk-FDD4UP73.cjs +521 -0
- package/dist/{chunk-WJ3VH2Q4.cjs → chunk-GEAIGM3J.cjs} +110 -615
- package/dist/{chunk-P3SBHF43.cjs → chunk-GRUYVXTS.cjs} +2 -2
- package/dist/{chunk-NX4Z5LMS.cjs → chunk-H3SZXND5.cjs} +5 -5
- package/dist/{chunk-EE4S4TOE.cjs → chunk-HS45TOFJ.cjs} +21 -21
- package/dist/chunk-INGOG6OV.cjs +899 -0
- package/dist/{chunk-UDKA6DGT.cjs → chunk-J3CDXZHF.cjs} +4 -4
- package/dist/{chunk-YO6G7TKI.cjs → chunk-JAU5ADEU.cjs} +11 -11
- package/dist/{chunk-22LBK4GA.cjs → chunk-JQEBSHX3.cjs} +4 -4
- package/dist/{chunk-RXX3U7VQ.cjs → chunk-KLXGLMFU.cjs} +10 -10
- package/dist/chunk-KVOX36J3.cjs +327 -0
- package/dist/chunk-L6BGNHFL.cjs +139 -0
- package/dist/{chunk-GMER35L3.cjs → chunk-L7TB7PU5.cjs} +20 -20
- package/dist/{chunk-AFXYNBL2.cjs → chunk-LBTRYEM2.cjs} +4 -4
- package/dist/{chunk-WYYCKIOD.cjs → chunk-LLULNJSP.cjs} +11 -11
- package/dist/{chunk-J27XOSLP.cjs → chunk-LSO46AFV.cjs} +8 -8
- package/dist/{chunk-5XJO45ES.cjs → chunk-LZ2KJ7ZX.cjs} +11 -11
- package/dist/chunk-M4IQ5LIZ.cjs +422 -0
- package/dist/{chunk-Y2KIUKJF.cjs → chunk-MPDHDKYZ.cjs} +11 -11
- package/dist/{chunk-4EMPKRZU.cjs → chunk-MRQ42ZJE.cjs} +3 -3
- package/dist/{chunk-EU5D2MF4.cjs → chunk-MYV4KZWP.cjs} +9 -9
- package/dist/{chunk-XD7KN4UN.cjs → chunk-MZXVLC24.cjs} +6 -6
- package/dist/{chunk-PPSONARU.cjs → chunk-NLBVDFIR.cjs} +41 -2
- package/dist/{chunk-L3PEGMGM.cjs → chunk-NY3TBZY4.cjs} +33 -33
- package/dist/{chunk-6YNYXXB6.cjs → chunk-OGVVSFAR.cjs} +3 -3
- package/dist/{chunk-MLV7QLB6.cjs → chunk-OMTQIQMN.cjs} +6 -6
- package/dist/{chunk-BEEOSNK7.cjs → chunk-PEJJ6TXJ.cjs} +15 -144
- package/dist/{chunk-SOKOWUF5.cjs → chunk-PPGWHIU7.cjs} +2 -2
- package/dist/{chunk-IELWOM2J.cjs → chunk-PPO6SDAN.cjs} +6 -6
- package/dist/{chunk-6JTZZCSL.cjs → chunk-PUMKX5F2.cjs} +3 -3
- package/dist/{chunk-RFOXFY2U.cjs → chunk-PXBYWCNB.cjs} +190 -799
- package/dist/{chunk-3BYXOISI.cjs → chunk-Q3HB3IX6.cjs} +4 -4
- package/dist/{chunk-RXCOVONX.cjs → chunk-RBMUOIXE.cjs} +289 -34
- package/dist/{chunk-MSBNHCSE.cjs → chunk-RJHGCUUD.cjs} +6 -6
- package/dist/{chunk-I6VG7F6Z.cjs → chunk-RSONDMYW.cjs} +708 -141
- package/dist/{chunk-GZDNPHMT.cjs → chunk-SHMPFCUE.cjs} +19 -19
- package/dist/{chunk-ZIBVCOW6.cjs → chunk-SN4FCXFC.cjs} +19 -19
- package/dist/{chunk-7KM52NMN.cjs → chunk-SN5T7WYO.cjs} +2 -2
- package/dist/{chunk-7MSZR65Z.cjs → chunk-SQJZGVDR.cjs} +7 -7
- package/dist/chunk-SYABFMD7.cjs +633 -0
- package/dist/{chunk-2RRFEYFH.cjs → chunk-TICB3MAC.cjs} +16 -16
- package/dist/{chunk-AOOKHUV5.cjs → chunk-U7Z7XYR2.cjs} +5 -5
- package/dist/{chunk-JEWQAXVG.cjs → chunk-UA2THQFV.cjs} +6 -6
- package/dist/{chunk-LHZPAHU3.cjs → chunk-VIK4L2YF.cjs} +112 -521
- package/dist/{chunk-4YWMAQ4J.cjs → chunk-VM2Y6BDY.cjs} +4 -4
- package/dist/{chunk-IRRKE2ZE.cjs → chunk-VMS3KWYI.cjs} +21 -21
- package/dist/{chunk-4SLARW6F.cjs → chunk-VU5NUD46.cjs} +17 -17
- package/dist/{chunk-XHY6TVYG.cjs → chunk-VV5CVOF7.cjs} +13 -13
- package/dist/{chunk-CCIBPGPZ.cjs → chunk-VYSAWPSS.cjs} +57 -57
- package/dist/{chunk-TTNEMQ2A.cjs → chunk-W7YRWEWQ.cjs} +22 -22
- package/dist/{chunk-C7MUOGEW.cjs → chunk-X7R5SY62.cjs} +6 -6
- package/dist/{chunk-ILR5KBMB.cjs → chunk-XOK3KTSS.cjs} +6 -6
- package/dist/{chunk-2CZM2I3T.cjs → chunk-XUIX45VU.cjs} +19 -19
- package/dist/{chunk-TGRMPS3A.cjs → chunk-XWH46PVJ.cjs} +165 -43
- package/dist/{chunk-WQYXXECR.cjs → chunk-Y5XVMK3K.cjs} +6 -6
- package/dist/{chunk-AK4TX2WG.cjs → chunk-YCNKEDTG.cjs} +13 -13
- package/dist/{chunk-PJJB24DU.cjs → chunk-YEF7SE3X.cjs} +20 -20
- package/dist/{chunk-RVLV4XW6.cjs → chunk-YMTVPMU3.cjs} +22 -22
- package/dist/data/index.cjs +2 -2
- package/dist/entries/autograph-lazy.cjs +2 -2
- package/dist/entries/charts/acoustictransport.cjs +3 -3
- package/dist/entries/charts/analysischarts.cjs +3 -3
- package/dist/entries/charts/astrocharts.cjs +3 -3
- package/dist/entries/charts/bars.cjs +3 -3
- package/dist/entries/charts/bayesiancharts.cjs +3 -3
- package/dist/entries/charts/biocharts.cjs +3 -3
- package/dist/entries/charts/biologycharts.cjs +11 -3
- package/dist/entries/charts/biologycharts.d.ts +1 -1
- package/dist/entries/charts/biologycharts.js +3 -2
- package/dist/entries/charts/business.cjs +3 -3
- package/dist/entries/charts/carecharts.cjs +3 -3
- package/dist/entries/charts/chemistrycharts.cjs +3 -3
- package/dist/entries/charts/civicscharts.cjs +3 -3
- package/dist/entries/charts/clinicalcharts.cjs +3 -3
- package/dist/entries/charts/comparison.cjs +3 -3
- package/dist/entries/charts/demography.cjs +3 -3
- package/dist/entries/charts/density.cjs +3 -3
- package/dist/entries/charts/diagrams.cjs +3 -3
- package/dist/entries/charts/distribution.cjs +3 -3
- package/dist/entries/charts/doecharts.cjs +13 -3
- package/dist/entries/charts/doecharts.d.ts +1 -1
- package/dist/entries/charts/doecharts.js +2 -1
- package/dist/entries/charts/earthscience.cjs +3 -3
- package/dist/entries/charts/economicscharts.cjs +3 -3
- package/dist/entries/charts/energycharts.cjs +3 -3
- package/dist/entries/charts/engineering.cjs +3 -3
- package/dist/entries/charts/fieldcharts.cjs +7 -3
- package/dist/entries/charts/fieldcharts.d.ts +1 -1
- package/dist/entries/charts/fieldcharts.js +3 -2
- package/dist/entries/charts/financial.cjs +3 -3
- package/dist/entries/charts/flow.cjs +3 -3
- package/dist/entries/charts/frameworks.cjs +3 -3
- package/dist/entries/charts/genomics.cjs +3 -3
- package/dist/entries/charts/geoflows.cjs +3 -3
- package/dist/entries/charts/geomaps.cjs +3 -3
- package/dist/entries/charts/geosciencecharts.cjs +3 -3
- package/dist/entries/charts/hierarchy.cjs +3 -3
- package/dist/entries/charts/indicators.cjs +3 -3
- package/dist/entries/charts/inferencecharts.cjs +3 -3
- package/dist/entries/charts/layoutcharts.cjs +3 -3
- package/dist/entries/charts/lifescience.cjs +4 -4
- package/dist/entries/charts/linesareas.cjs +3 -3
- package/dist/entries/charts/logisticscharts.cjs +3 -3
- package/dist/entries/charts/machinecharts.cjs +7 -3
- package/dist/entries/charts/machinecharts.d.ts +1 -1
- package/dist/entries/charts/machinecharts.js +2 -1
- package/dist/entries/charts/massive.cjs +3 -3
- package/dist/entries/charts/mathematical.cjs +3 -3
- package/dist/entries/charts/matrix.cjs +3 -3
- package/dist/entries/charts/medicalcharts.cjs +4 -4
- package/dist/entries/charts/mlcharts.cjs +4 -4
- package/dist/entries/charts/modelcharts.cjs +6 -5
- package/dist/entries/charts/multivariate.cjs +3 -3
- package/dist/entries/charts/musiccharts.cjs +3 -3
- package/dist/entries/charts/network.cjs +3 -3
- package/dist/entries/charts/physicscharts.cjs +3 -3
- package/dist/entries/charts/pictorial.cjs +4 -4
- package/dist/entries/charts/portfoliocharts.cjs +3 -3
- package/dist/entries/charts/productcharts.cjs +3 -3
- package/dist/entries/charts/proportion.cjs +3 -3
- package/dist/entries/charts/qualitycharts.cjs +3 -3
- package/dist/entries/charts/radial.cjs +3 -3
- package/dist/entries/charts/reliabilitycharts.cjs +5 -3
- package/dist/entries/charts/scatter.cjs +3 -3
- package/dist/entries/charts/scientific.cjs +3 -3
- package/dist/entries/charts/seriescharts.cjs +3 -3
- package/dist/entries/charts/signals.cjs +7 -3
- package/dist/entries/charts/signals.d.ts +1 -1
- package/dist/entries/charts/signals.js +2 -1
- package/dist/entries/charts/softwarediagrams.cjs +21 -3
- package/dist/entries/charts/softwarediagrams.d.ts +1 -1
- package/dist/entries/charts/softwarediagrams.js +4 -2
- package/dist/entries/charts/sportscharts.cjs +13 -3
- package/dist/entries/charts/sportscharts.d.ts +1 -1
- package/dist/entries/charts/sportscharts.js +3 -1
- package/dist/entries/charts/statistics.cjs +6 -6
- package/dist/entries/charts/strategycharts.cjs +30 -3
- package/dist/entries/charts/strategycharts.d.ts +1 -1
- package/dist/entries/charts/strategycharts.js +6 -1
- package/dist/entries/charts/structure.cjs +3 -3
- package/dist/entries/charts/surveycharts.cjs +3 -3
- package/dist/entries/charts/systemscharts.cjs +3 -3
- package/dist/entries/charts/textcharts.cjs +5 -5
- package/dist/entries/charts/thematicmaps.cjs +4 -4
- package/dist/entries/charts/threebars.cjs +3 -3
- package/dist/entries/charts/threefields.cjs +53 -0
- package/dist/entries/charts/threefields.d.ts +1 -0
- package/dist/entries/charts/threefields.js +6 -0
- package/dist/entries/charts/threeglobe.cjs +3 -3
- package/dist/entries/charts/threenetwork.cjs +3 -3
- package/dist/entries/charts/threestrata.cjs +3 -3
- package/dist/entries/charts/threesurfaces.cjs +7 -3
- package/dist/entries/charts/threesurfaces.d.ts +1 -1
- package/dist/entries/charts/threesurfaces.js +2 -1
- package/dist/entries/charts/threevolume.cjs +4 -4
- package/dist/entries/charts/timeline.cjs +3 -3
- package/dist/entries/charts/tracecharts.cjs +3 -3
- package/dist/entries/charts/trackscharts.cjs +3 -3
- package/dist/entries/charts/tradingcharts.cjs +6 -4
- package/dist/entries/charts/tradingcharts.d.ts +1 -1
- package/dist/entries/charts/tradingcharts.js +2 -1
- package/dist/entries/three.cjs +60 -20
- package/dist/entries/three.d.ts +1 -1
- package/dist/entries/three.js +7 -1
- package/dist/index.cjs +258 -97
- package/dist/index.d.cts +1953 -10
- package/dist/index.d.ts +1953 -10
- package/dist/index.js +26 -5
- package/dist/page/index.cjs +2 -2
- package/dist/react/components.js +58 -1
- package/dist/react/index.cjs +135 -92
- package/dist/react/index.d.ts +1 -1
- package/dist/react/index.js +2 -2
- package/package.json +1 -1
- package/dist/AutoGraph-XLBJQDRB.cjs +0 -140
- package/dist/catalog-O7XGDD2H.cjs +0 -137
- package/dist/chunk-77K2HTRC.cjs +0 -3220
- package/dist/chunk-XEK47TVD.cjs +0 -323
- /package/dist/{chunk-UMEKIIHJ.cjs → chunk-LNWTC72Y.cjs} +0 -0
|
@@ -0,0 +1,324 @@
|
|
|
1
|
+
import { Chart2D } from "../../core/Chart2D.js";
|
|
2
|
+
import { ChartFamily, DataShape, Dimension } from "../../core/enums.js";
|
|
3
|
+
import { FrameworkText } from "../frameworks/FrameworkText.js";
|
|
4
|
+
import { StrategyRows } from "./StrategyRows.js";
|
|
5
|
+
import { StrategySamples } from "./StrategySamples.js";
|
|
6
|
+
import { StrategyWords } from "./StrategyWords.js";
|
|
7
|
+
import { max, sum, symbol, symbolTriangle } from "d3";
|
|
8
|
+
// src/charts/strategycharts/KanbanBoard.ts
|
|
9
|
+
/** Cards showing their title alone, or the title over who holds the card. */
|
|
10
|
+
var KanbanCardDetail = /* @__PURE__ */ function(KanbanCardDetail) {
|
|
11
|
+
KanbanCardDetail["Title"] = "title";
|
|
12
|
+
KanbanCardDetail["Full"] = "full";
|
|
13
|
+
return KanbanCardDetail;
|
|
14
|
+
}({});
|
|
15
|
+
var GAP = 6;
|
|
16
|
+
var HEAD = 20;
|
|
17
|
+
var HEAD_LIMITS = 42;
|
|
18
|
+
var METER = 21;
|
|
19
|
+
var OVER = 33;
|
|
20
|
+
var RAIL = 18;
|
|
21
|
+
var PAD = 4;
|
|
22
|
+
var CARD_GAP = 3;
|
|
23
|
+
var INSET = 5;
|
|
24
|
+
var EDGE = 4;
|
|
25
|
+
var LEAD = 12;
|
|
26
|
+
var SIZE = 10.5;
|
|
27
|
+
/** Least height of a cell that can say how many cards it could not show. */
|
|
28
|
+
var MORE = 11;
|
|
29
|
+
var NARROWEST = 28;
|
|
30
|
+
/**
|
|
31
|
+
* A kanban board: a column for each stage of a workflow holding its task cards, with the work-in-progress limit of
|
|
32
|
+
* each stage and a mark on the stages that hold more than their limit. Use it to show where work sits and where it
|
|
33
|
+
* is piling up. Cards are one size across the board, so a fuller column is a taller stack.
|
|
34
|
+
*/
|
|
35
|
+
var KanbanBoard = class KanbanBoard extends Chart2D {
|
|
36
|
+
static meta = {
|
|
37
|
+
id: "kanban-board",
|
|
38
|
+
name: "Kanban board",
|
|
39
|
+
family: ChartFamily.Project,
|
|
40
|
+
dimension: Dimension.Two,
|
|
41
|
+
shape: DataShape.Table,
|
|
42
|
+
description: "Sets task cards in a column per workflow stage, with each stage's work-in-progress limit on a meter and breached stages marked.",
|
|
43
|
+
tags: [
|
|
44
|
+
"kanban",
|
|
45
|
+
"workflow",
|
|
46
|
+
"wip limit",
|
|
47
|
+
"task board",
|
|
48
|
+
"swimlanes",
|
|
49
|
+
"agile"
|
|
50
|
+
],
|
|
51
|
+
sample: (seed) => StrategySamples.kanban(seed),
|
|
52
|
+
variants: {
|
|
53
|
+
swimlanes: [false, true],
|
|
54
|
+
cardDetail: ["title", "full"],
|
|
55
|
+
limits: [true, false]
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
/** How many of `count` cards, each `card` px tall, stack in `room` px. */
|
|
59
|
+
static capacity(room, card, count) {
|
|
60
|
+
return Math.max(0, Math.min(count, Math.floor((room + CARD_GAP) / (card + CARD_GAP))));
|
|
61
|
+
}
|
|
62
|
+
defaults() {
|
|
63
|
+
return {
|
|
64
|
+
task: "task",
|
|
65
|
+
stage: "stage",
|
|
66
|
+
limit: "limit",
|
|
67
|
+
lane: "lane",
|
|
68
|
+
group: "kind",
|
|
69
|
+
owner: "owner",
|
|
70
|
+
swimlanes: false,
|
|
71
|
+
cardDetail: "title",
|
|
72
|
+
limits: true
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
plotMargin() {
|
|
76
|
+
return {
|
|
77
|
+
top: 8,
|
|
78
|
+
right: 12,
|
|
79
|
+
bottom: 8,
|
|
80
|
+
left: 12
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
/** The stages in workflow order with their cards and limits, and the lanes in the order first seen. */
|
|
84
|
+
get board() {
|
|
85
|
+
const { task, stage, limit, lane, group, owner } = this.options;
|
|
86
|
+
const stages = /* @__PURE__ */ new Map(), lanes = /* @__PURE__ */ new Set();
|
|
87
|
+
for (const row of StrategyRows.of(this.options.data)) {
|
|
88
|
+
const name = FrameworkText.clean(row[stage]), title = FrameworkText.clean(row[task]), cap = StrategyRows.number(row[limit]);
|
|
89
|
+
if (!name) continue;
|
|
90
|
+
const held = stages.get(name) ?? {
|
|
91
|
+
name,
|
|
92
|
+
limit: null,
|
|
93
|
+
cards: [],
|
|
94
|
+
over: 0
|
|
95
|
+
};
|
|
96
|
+
stages.set(name, held);
|
|
97
|
+
if (held.limit === null && cap !== null && cap >= 0) held.limit = cap;
|
|
98
|
+
if (!title) continue;
|
|
99
|
+
const card = {
|
|
100
|
+
task: title,
|
|
101
|
+
stage: name,
|
|
102
|
+
lane: FrameworkText.clean(row[lane]) || "No lane",
|
|
103
|
+
group: FrameworkText.clean(row[group]) || "Card",
|
|
104
|
+
owner: FrameworkText.clean(row[owner])
|
|
105
|
+
};
|
|
106
|
+
lanes.add(card.lane);
|
|
107
|
+
held.cards.push(card);
|
|
108
|
+
}
|
|
109
|
+
for (const held of stages.values()) held.over = held.limit === null ? 0 : Math.max(0, held.cards.length - held.limit);
|
|
110
|
+
return {
|
|
111
|
+
stages: [...stages.values()],
|
|
112
|
+
lanes: [...lanes]
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* The card height in use and the height of each lane. Cards take the tallest of `sizes` at which every lane holds its
|
|
117
|
+
* fullest stack, and lanes grow with their stacks. When no size fits, each lane is first given room for one card.
|
|
118
|
+
*/
|
|
119
|
+
static lanes(stacks, sizes, free) {
|
|
120
|
+
const need = (card) => stacks.map((stack) => Math.max(1, stack) * (card + CARD_GAP) - CARD_GAP + 8);
|
|
121
|
+
const card = sizes.find((size) => sum(need(size)) <= free) ?? sizes.at(-1) ?? 0, wanted = need(card), all = sum(wanted);
|
|
122
|
+
if (all <= free) return {
|
|
123
|
+
card,
|
|
124
|
+
heights: wanted.map((height) => free * height / all)
|
|
125
|
+
};
|
|
126
|
+
const least = Math.min(card + 8, free / Math.max(1, stacks.length)), spare = free - least * stacks.length, short = all - least * stacks.length;
|
|
127
|
+
return {
|
|
128
|
+
card,
|
|
129
|
+
heights: wanted.map((height) => least + (short > 0 ? spare * (height - least) / short : 0))
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
draw(ctx) {
|
|
133
|
+
const { swimlanes, cardDetail, limits } = this.options, { plot, theme, palette } = ctx;
|
|
134
|
+
const { stages, lanes } = this.board;
|
|
135
|
+
const rows = swimlanes && lanes.length ? lanes : [null];
|
|
136
|
+
const rail = rows[0] === null ? 0 : RAIL, head = limits ? HEAD_LIMITS : HEAD, full = cardDetail === "full";
|
|
137
|
+
const wide = Math.max(0, plot.width - rail - GAP * (stages.length - 1)) / Math.max(1, stages.length);
|
|
138
|
+
const held = (stage, lane) => stage.cards.filter((card) => lane === null || card.lane === lane);
|
|
139
|
+
const size = (lines) => 10 + lines * LEAD + (full ? LEAD : 0);
|
|
140
|
+
const { card: height, heights } = KanbanBoard.lanes(rows.map((lane) => max(stages, (stage) => held(stage, lane).length) ?? 0), [size(2), size(1)], Math.max(0, plot.height - head - GAP * (rows.length - 1)));
|
|
141
|
+
const tops = heights.map((_, j) => head + sum(heights.slice(0, j)) + GAP * j), lines = height === size(2) ? 2 : 1;
|
|
142
|
+
const cells = stages.flatMap((stage, i) => rows.map((lane, j) => ({
|
|
143
|
+
key: `${i}/${j}`,
|
|
144
|
+
stage,
|
|
145
|
+
lane,
|
|
146
|
+
x: rail + i * (wide + GAP),
|
|
147
|
+
y: tops[j],
|
|
148
|
+
width: wide,
|
|
149
|
+
height: heights[j],
|
|
150
|
+
cards: held(stage, lane)
|
|
151
|
+
})));
|
|
152
|
+
for (const stage of stages) for (const card of stage.cards) palette.color(card.group);
|
|
153
|
+
const breached = (stage) => !!limits && stage.over > 0;
|
|
154
|
+
const panels = ctx.marks("columns", "rect", cells, (cell) => cell.key).attr("rx", 4).attr("fill", (cell) => breached(cell.stage) ? theme.critical : theme.grid).attr("fill-opacity", (cell) => breached(cell.stage) ? .12 : .6);
|
|
155
|
+
ctx.set(panels, {
|
|
156
|
+
x: (cell) => cell.x,
|
|
157
|
+
y: (cell) => cell.y,
|
|
158
|
+
width: (cell) => cell.width,
|
|
159
|
+
height: (cell) => cell.height
|
|
160
|
+
});
|
|
161
|
+
ctx.hover(panels, ({ stage, lane, cards }) => ({
|
|
162
|
+
title: lane === null ? stage.name : `${stage.name}, ${lane}`,
|
|
163
|
+
rows: [
|
|
164
|
+
["Cards here", cards.length],
|
|
165
|
+
["Cards in stage", stage.cards.length],
|
|
166
|
+
["Limit", stage.limit ?? "None"],
|
|
167
|
+
...stage.over ? [["Over the limit by", stage.over]] : []
|
|
168
|
+
]
|
|
169
|
+
}));
|
|
170
|
+
const tally = (stage) => limits && stage.limit !== null ? `${stage.cards.length} / ${stage.limit}` : `${stage.cards.length}`;
|
|
171
|
+
const metered = limits ? stages.map((stage, i) => ({
|
|
172
|
+
stage,
|
|
173
|
+
x: rail + i * (wide + GAP) + 4,
|
|
174
|
+
width: Math.max(0, wide - 14 - FrameworkText.width(tally(stage), SIZE))
|
|
175
|
+
})).filter((meter) => meter.stage.limit !== null && meter.width >= 12) : [];
|
|
176
|
+
const tracks = ctx.marks("axis-limits", "rect", metered, (meter) => meter.stage.name).attr("rx", 2.5).attr("fill", theme.grid);
|
|
177
|
+
ctx.set(tracks, {
|
|
178
|
+
x: (meter) => meter.x,
|
|
179
|
+
y: 18.5,
|
|
180
|
+
width: (meter) => meter.width,
|
|
181
|
+
height: 5
|
|
182
|
+
});
|
|
183
|
+
const filled = ctx.marks("load", "rect", metered, (meter) => meter.stage.name).attr("rx", 2.5).attr("fill", (meter) => meter.stage.over ? theme.critical : theme.inkSecondary);
|
|
184
|
+
const load = ({ stage, width }) => width * (stage.limit ? Math.min(1, stage.cards.length / stage.limit) : stage.cards.length ? 1 : 0);
|
|
185
|
+
ctx.set(filled, {
|
|
186
|
+
x: (meter) => meter.x,
|
|
187
|
+
y: 18.5,
|
|
188
|
+
width: load,
|
|
189
|
+
height: 5
|
|
190
|
+
}, { width: 0 }, 30);
|
|
191
|
+
const flagged = limits ? stages.map((stage, i) => ({
|
|
192
|
+
stage,
|
|
193
|
+
x: rail + i * (wide + GAP) + 8
|
|
194
|
+
})).filter((flag) => flag.stage.over && wide >= 16) : [];
|
|
195
|
+
const flags = ctx.marks("breaches", "path", flagged, (flag) => flag.stage.name).attr("fill", theme.critical);
|
|
196
|
+
ctx.set(flags, {
|
|
197
|
+
d: symbol(symbolTriangle, 40)() ?? "",
|
|
198
|
+
transform: (flag) => `translate(${flag.x},${OVER})`
|
|
199
|
+
});
|
|
200
|
+
const across = wide - 8, room = across - EDGE - 9;
|
|
201
|
+
const words = [], more = [], hidden = /* @__PURE__ */ new Map();
|
|
202
|
+
const placed = across < NARROWEST ? [] : cells.flatMap((cell) => {
|
|
203
|
+
const inner = cell.height - 8, shown = KanbanBoard.capacity(inner, height, cell.cards.length), left = cell.x + PAD, rest = cell.cards.slice(shown);
|
|
204
|
+
const tag = rest.length ? `+${rest.length}` : "", taken = tag ? FrameworkText.width(tag, 9.5) + 5 : 0;
|
|
205
|
+
if (rest.length) hidden.set(cell.key, rest);
|
|
206
|
+
if (rest.length && !shown && inner >= MORE) more.push({
|
|
207
|
+
key: cell.key,
|
|
208
|
+
text: FrameworkText.fit(`${tag} more`, across, 9.5),
|
|
209
|
+
x: left + 2,
|
|
210
|
+
y: cell.y + cell.height / 2,
|
|
211
|
+
size: 9.5
|
|
212
|
+
});
|
|
213
|
+
return cell.cards.slice(0, shown).map((card, k) => {
|
|
214
|
+
const top = cell.y + PAD + k * (height + CARD_GAP), last = k === shown - 1 && !!tag, span = room - (last && !full ? taken : 0);
|
|
215
|
+
const text = lines > 1 ? FrameworkText.clamp(FrameworkText.wrap(card.task, span, SIZE), lines, span, SIZE) : [FrameworkText.fit(card.task, span, SIZE)];
|
|
216
|
+
if (full && card.owner) words.push({
|
|
217
|
+
key: `owner/${cell.key}/${k}`,
|
|
218
|
+
text: FrameworkText.fit(card.owner, room - (last ? taken : 0), 9.5),
|
|
219
|
+
full: card.owner,
|
|
220
|
+
x: left + EDGE + 5,
|
|
221
|
+
y: top + height - INSET - 5,
|
|
222
|
+
size: 9.5
|
|
223
|
+
});
|
|
224
|
+
if (last) more.push({
|
|
225
|
+
key: cell.key,
|
|
226
|
+
text: tag,
|
|
227
|
+
x: left + across - 4,
|
|
228
|
+
y: full ? top + height - INSET - 5 : top + INSET + (lines - 1) * LEAD + 5.5,
|
|
229
|
+
anchor: "end",
|
|
230
|
+
size: 9.5,
|
|
231
|
+
weight: 600
|
|
232
|
+
});
|
|
233
|
+
return {
|
|
234
|
+
key: `${cell.key}/${k}`,
|
|
235
|
+
card,
|
|
236
|
+
left,
|
|
237
|
+
top,
|
|
238
|
+
width: across,
|
|
239
|
+
height,
|
|
240
|
+
color: palette.color(card.group),
|
|
241
|
+
lines: text,
|
|
242
|
+
x: left + EDGE + 5,
|
|
243
|
+
y: top + INSET + 9,
|
|
244
|
+
lead: LEAD
|
|
245
|
+
};
|
|
246
|
+
});
|
|
247
|
+
});
|
|
248
|
+
const cards = ctx.marks("cards", "g", placed, (card) => card.key);
|
|
249
|
+
ctx.hover(cards, ({ card }) => FrameworkText.tip(card.task, [
|
|
250
|
+
["Stage", card.stage],
|
|
251
|
+
["Lane", card.lane],
|
|
252
|
+
["Kind", card.group],
|
|
253
|
+
...card.owner ? [["Owner", card.owner]] : []
|
|
254
|
+
], palette.color(card.group)));
|
|
255
|
+
const faces = cards.selectAll("rect.face").data((card) => [card]).join("rect").attr("class", "face").attr("rx", 3).attr("fill", theme.surface);
|
|
256
|
+
ctx.set(faces, {
|
|
257
|
+
x: (card) => card.left,
|
|
258
|
+
y: (card) => card.top,
|
|
259
|
+
width: (card) => card.width,
|
|
260
|
+
height: (card) => card.height
|
|
261
|
+
});
|
|
262
|
+
const edges = cards.selectAll("rect.kind").data((card) => [card]).join("rect").attr("class", "kind").attr("rx", 2).attr("fill", (card) => card.color);
|
|
263
|
+
ctx.set(edges, {
|
|
264
|
+
x: (card) => card.left,
|
|
265
|
+
y: (card) => card.top,
|
|
266
|
+
width: EDGE,
|
|
267
|
+
height: (card) => card.height
|
|
268
|
+
});
|
|
269
|
+
const titles = ctx.text(cards.selectAll("text").data((card) => [card]).join("text"), SIZE, "ink").attr("pointer-events", "none");
|
|
270
|
+
FrameworkText.write(ctx, titles);
|
|
271
|
+
const beside = (stage) => FrameworkText.width(tally(stage), SIZE) + 8;
|
|
272
|
+
const counted = stages.every((stage) => limits ? wide >= beside(stage) : FrameworkText.width(stage.name, 11) + beside(stage) + 8 <= wide);
|
|
273
|
+
for (const [i, stage] of stages.entries()) {
|
|
274
|
+
const left = rail + i * (wide + GAP), count = tally(stage);
|
|
275
|
+
if (counted) words.push({
|
|
276
|
+
key: `count/${i}`,
|
|
277
|
+
text: count,
|
|
278
|
+
x: left + wide - 4,
|
|
279
|
+
y: limits ? METER : 8,
|
|
280
|
+
anchor: "end",
|
|
281
|
+
size: SIZE,
|
|
282
|
+
weight: breached(stage) ? 600 : 400,
|
|
283
|
+
tone: breached(stage) ? "ink" : "secondary"
|
|
284
|
+
});
|
|
285
|
+
words.push({
|
|
286
|
+
key: `stage/${i}`,
|
|
287
|
+
text: FrameworkText.fit(stage.name, wide - 8, 11),
|
|
288
|
+
full: stage.name,
|
|
289
|
+
x: left + 4,
|
|
290
|
+
y: 8,
|
|
291
|
+
size: 11,
|
|
292
|
+
weight: 600,
|
|
293
|
+
tone: "ink"
|
|
294
|
+
});
|
|
295
|
+
const over = [`Over by ${stage.over}`, `+${stage.over}`].find((text) => FrameworkText.width(text, 10) <= wide - 18);
|
|
296
|
+
if (breached(stage) && over) words.push({
|
|
297
|
+
key: `over/${i}`,
|
|
298
|
+
text: over,
|
|
299
|
+
x: left + 15,
|
|
300
|
+
y: OVER,
|
|
301
|
+
size: 10,
|
|
302
|
+
weight: 600,
|
|
303
|
+
tone: "ink"
|
|
304
|
+
});
|
|
305
|
+
}
|
|
306
|
+
words.push(...rows.flatMap((lane, j) => lane === null ? [] : [{
|
|
307
|
+
key: `lane/${j}`,
|
|
308
|
+
text: FrameworkText.fit(lane, heights[j], SIZE),
|
|
309
|
+
full: lane,
|
|
310
|
+
x: RAIL / 2 - 3,
|
|
311
|
+
y: tops[j] + heights[j] / 2,
|
|
312
|
+
anchor: "middle",
|
|
313
|
+
size: SIZE,
|
|
314
|
+
weight: 600,
|
|
315
|
+
turned: true
|
|
316
|
+
}]));
|
|
317
|
+
StrategyWords.draw(ctx, "words", words);
|
|
318
|
+
ctx.hover(StrategyWords.draw(ctx, "more", more), (word) => ({
|
|
319
|
+
title: `${hidden.get(word.key)?.length ?? 0} more cards`,
|
|
320
|
+
rows: (hidden.get(word.key) ?? []).map((card) => [FrameworkText.fit(card.task, 260, 12), card.owner])
|
|
321
|
+
}));
|
|
322
|
+
}
|
|
323
|
+
};
|
|
324
|
+
export { KanbanBoard, KanbanCardDetail };
|
|
@@ -0,0 +1,339 @@
|
|
|
1
|
+
import { Chart2D } from "../../core/Chart2D.js";
|
|
2
|
+
import { ChartFamily, DataShape, Dimension } from "../../core/enums.js";
|
|
3
|
+
import { FrameworkText } from "../frameworks/FrameworkText.js";
|
|
4
|
+
import { StrategyRows } from "./StrategyRows.js";
|
|
5
|
+
import { StrategySamples } from "./StrategySamples.js";
|
|
6
|
+
import { StrategyWords } from "./StrategyWords.js";
|
|
7
|
+
import { max, mean, min, sum } from "d3";
|
|
8
|
+
// src/charts/strategycharts/OkrTree.ts
|
|
9
|
+
/** Objectives as nodes linked to their key results, or as an indented list with the bars in one column. */
|
|
10
|
+
var OkrTreeLayout = /* @__PURE__ */ function(OkrTreeLayout) {
|
|
11
|
+
OkrTreeLayout["Tree"] = "tree";
|
|
12
|
+
OkrTreeLayout["List"] = "list";
|
|
13
|
+
return OkrTreeLayout;
|
|
14
|
+
}({});
|
|
15
|
+
/** How an objective is scored from its key results: their mean, or the weakest of them. */
|
|
16
|
+
var OkrTreeRollup = /* @__PURE__ */ function(OkrTreeRollup) {
|
|
17
|
+
OkrTreeRollup["Mean"] = "mean";
|
|
18
|
+
OkrTreeRollup["Weakest"] = "weakest";
|
|
19
|
+
return OkrTreeRollup;
|
|
20
|
+
}({});
|
|
21
|
+
var BAR = 6;
|
|
22
|
+
var GROUP = 10;
|
|
23
|
+
var INDENT = 18;
|
|
24
|
+
var SIZE = 10.5;
|
|
25
|
+
var FIGURE = 30;
|
|
26
|
+
var PIP = 34;
|
|
27
|
+
var LEVELS = [
|
|
28
|
+
[
|
|
29
|
+
.7,
|
|
30
|
+
"On track",
|
|
31
|
+
"good"
|
|
32
|
+
],
|
|
33
|
+
[
|
|
34
|
+
.4,
|
|
35
|
+
"At risk",
|
|
36
|
+
"warning"
|
|
37
|
+
],
|
|
38
|
+
[
|
|
39
|
+
-Infinity,
|
|
40
|
+
"Off track",
|
|
41
|
+
"critical"
|
|
42
|
+
]
|
|
43
|
+
];
|
|
44
|
+
/**
|
|
45
|
+
* Objectives and key results: each objective with its key results beneath, a progress bar on every key result, and
|
|
46
|
+
* the objective scored by rolling its key results up. Use it to show how a quarter's goals stand and which key result
|
|
47
|
+
* is holding an objective back.
|
|
48
|
+
*/
|
|
49
|
+
var OkrTree = class OkrTree extends Chart2D {
|
|
50
|
+
static meta = {
|
|
51
|
+
id: "okr-tree",
|
|
52
|
+
name: "OKR tree",
|
|
53
|
+
family: ChartFamily.Hierarchy,
|
|
54
|
+
dimension: Dimension.Two,
|
|
55
|
+
shape: DataShape.Table,
|
|
56
|
+
description: "Lists objectives over their key results with a progress bar and confidence on each, and scores every objective from its key results.",
|
|
57
|
+
tags: [
|
|
58
|
+
"okr",
|
|
59
|
+
"objectives",
|
|
60
|
+
"key results",
|
|
61
|
+
"goals",
|
|
62
|
+
"progress",
|
|
63
|
+
"planning"
|
|
64
|
+
],
|
|
65
|
+
sample: (seed) => StrategySamples.okr(seed),
|
|
66
|
+
variants: {
|
|
67
|
+
layout: ["tree", "list"],
|
|
68
|
+
rollup: ["mean", "weakest"],
|
|
69
|
+
confidenceMarks: [true, false]
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
/** One score for several: their mean, or the lowest. Null when there are none. */
|
|
73
|
+
static rollup(values, how = "mean") {
|
|
74
|
+
return (how === "weakest" ? min(values) : mean(values)) ?? null;
|
|
75
|
+
}
|
|
76
|
+
/** What a confidence from 0 to 1 is called: on track from 0.7, at risk from 0.4, off track below. */
|
|
77
|
+
static status(confidence) {
|
|
78
|
+
return LEVELS.find(([floor]) => confidence >= floor)[1];
|
|
79
|
+
}
|
|
80
|
+
defaults() {
|
|
81
|
+
return {
|
|
82
|
+
objective: "objective",
|
|
83
|
+
keyResult: "keyResult",
|
|
84
|
+
progress: "progress",
|
|
85
|
+
confidence: "confidence",
|
|
86
|
+
layout: "tree",
|
|
87
|
+
rollup: "mean",
|
|
88
|
+
confidenceMarks: true
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
plotMargin() {
|
|
92
|
+
return {
|
|
93
|
+
top: 8,
|
|
94
|
+
right: 12,
|
|
95
|
+
bottom: 8,
|
|
96
|
+
left: 12
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
/** Every objective is named where it is drawn. */
|
|
100
|
+
legendItems() {
|
|
101
|
+
return [];
|
|
102
|
+
}
|
|
103
|
+
/** The objectives in order, each scored from its key results. */
|
|
104
|
+
get objectives() {
|
|
105
|
+
const { objective, keyResult, progress, confidence, rollup } = this.options, rows = StrategyRows.of(this.options.data);
|
|
106
|
+
const most = max(rows, (row) => StrategyRows.number(row[confidence]) ?? 0) ?? 0, unit = most <= 1 ? 1 : most <= 10 ? 10 : 100;
|
|
107
|
+
const held = /* @__PURE__ */ new Map();
|
|
108
|
+
for (const row of rows) {
|
|
109
|
+
const name = FrameworkText.clean(row[objective]), done = StrategyRows.number(row[progress]), sure = StrategyRows.number(row[confidence]);
|
|
110
|
+
if (!name || done === null) continue;
|
|
111
|
+
held.set(name, [...held.get(name) ?? [], {
|
|
112
|
+
name: FrameworkText.clean(row[keyResult]) || "Unnamed",
|
|
113
|
+
progress: StrategyRows.clamp(done, 0, 100),
|
|
114
|
+
confidence: sure === null ? null : StrategyRows.clamp(sure / unit, 0, 1)
|
|
115
|
+
}]);
|
|
116
|
+
}
|
|
117
|
+
return [...held].map(([name, keyResults]) => ({
|
|
118
|
+
name,
|
|
119
|
+
keyResults,
|
|
120
|
+
progress: OkrTree.rollup(keyResults.map((result) => result.progress), rollup) ?? 0,
|
|
121
|
+
confidence: OkrTree.rollup(keyResults.flatMap((result) => result.confidence ?? []), rollup)
|
|
122
|
+
}));
|
|
123
|
+
}
|
|
124
|
+
draw(ctx) {
|
|
125
|
+
const { theme } = ctx, parts = this.options.layout === "list" ? this.#list(ctx) : this.#tree(ctx);
|
|
126
|
+
const cards = ctx.marks("objectives", "rect", parts.cards, (card) => card.key).attr("rx", 4).attr("fill", (card) => card.color).attr("fill-opacity", .14);
|
|
127
|
+
ctx.set(cards, {
|
|
128
|
+
x: (card) => card.x,
|
|
129
|
+
y: (card) => card.y,
|
|
130
|
+
width: (card) => card.width,
|
|
131
|
+
height: (card) => card.height
|
|
132
|
+
});
|
|
133
|
+
const links = ctx.marks("links", "path", parts.links, (link) => link.key).attr("fill", "none").attr("stroke", theme.axis).attr("stroke-width", 1.5);
|
|
134
|
+
ctx.set(links, { d: (link) => link.d });
|
|
135
|
+
const guides = ctx.marks("axis-guides", "path", parts.guides, (guide) => guide.key).attr("fill", "none").attr("stroke", theme.axis);
|
|
136
|
+
ctx.set(guides, { d: (guide) => guide.d });
|
|
137
|
+
const meters = ctx.marks("meters", "g", parts.meters, (meter) => meter.key);
|
|
138
|
+
ctx.hover(meters, (meter) => meter.tip);
|
|
139
|
+
const tracks = meters.selectAll("rect.track").data((meter) => [meter]).join("rect").attr("class", "track").attr("rx", BAR / 2).attr("fill", theme.grid);
|
|
140
|
+
ctx.set(tracks, {
|
|
141
|
+
x: (meter) => meter.x,
|
|
142
|
+
y: (meter) => meter.y,
|
|
143
|
+
width: (meter) => meter.width,
|
|
144
|
+
height: BAR
|
|
145
|
+
});
|
|
146
|
+
const fills = meters.selectAll("rect.done").data((meter) => [meter]).join("rect").attr("class", "done").attr("rx", BAR / 2).attr("fill", (meter) => meter.color);
|
|
147
|
+
ctx.set(fills, {
|
|
148
|
+
x: (meter) => meter.x,
|
|
149
|
+
y: (meter) => meter.y,
|
|
150
|
+
width: (meter) => meter.width * meter.share,
|
|
151
|
+
height: BAR
|
|
152
|
+
}, { width: 0 }, 25);
|
|
153
|
+
const pips = ctx.marks("confidence", "circle", parts.pips, (pip) => pip.key).attr("fill", (pip) => pip.color).attr("stroke", theme.surface).attr("stroke-width", 2);
|
|
154
|
+
ctx.set(pips, {
|
|
155
|
+
cx: (pip) => pip.x,
|
|
156
|
+
cy: (pip) => pip.y,
|
|
157
|
+
r: 4.5
|
|
158
|
+
}, { r: 0 }, 15);
|
|
159
|
+
StrategyWords.draw(ctx, "words", parts.words);
|
|
160
|
+
}
|
|
161
|
+
/** Room after a bar for its percentage and, with confidence shown, its dot and figure. */
|
|
162
|
+
get #trail() {
|
|
163
|
+
return FIGURE + (this.options.confidenceMarks ? PIP : 0);
|
|
164
|
+
}
|
|
165
|
+
/** A bar from `x` across `width`, centred on `y`, with what follows it. */
|
|
166
|
+
#meter(ctx, parts, key, item, color, x, y, width, tip, bold) {
|
|
167
|
+
const { theme } = ctx, after = x + width + 6;
|
|
168
|
+
parts.meters.push({
|
|
169
|
+
key,
|
|
170
|
+
x,
|
|
171
|
+
y: y - BAR / 2,
|
|
172
|
+
width,
|
|
173
|
+
height: BAR,
|
|
174
|
+
share: item.progress / 100,
|
|
175
|
+
color,
|
|
176
|
+
tip
|
|
177
|
+
});
|
|
178
|
+
parts.words.push({
|
|
179
|
+
key: `done/${key}`,
|
|
180
|
+
text: `${Math.round(item.progress)}%`,
|
|
181
|
+
x: after,
|
|
182
|
+
y,
|
|
183
|
+
size: SIZE,
|
|
184
|
+
weight: bold ? 600 : 400,
|
|
185
|
+
tone: "ink"
|
|
186
|
+
});
|
|
187
|
+
if (!this.options.confidenceMarks || item.confidence === null) return;
|
|
188
|
+
const level = LEVELS.find(([floor]) => item.confidence >= floor);
|
|
189
|
+
parts.pips.push({
|
|
190
|
+
key,
|
|
191
|
+
x: after + FIGURE + 3,
|
|
192
|
+
y,
|
|
193
|
+
color: theme[level[2]]
|
|
194
|
+
});
|
|
195
|
+
parts.words.push({
|
|
196
|
+
key: `sure/${key}`,
|
|
197
|
+
text: item.confidence.toFixed(1),
|
|
198
|
+
x: after + FIGURE + 11,
|
|
199
|
+
y,
|
|
200
|
+
size: SIZE
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
#tips(objective, color) {
|
|
204
|
+
const sure = (item) => item.confidence === null ? [] : [["Confidence", `${item.confidence.toFixed(2)}, ${OkrTree.status(item.confidence).toLowerCase()}`]];
|
|
205
|
+
const how = this.options.rollup === "weakest" ? "weakest key result" : "mean of key results";
|
|
206
|
+
return {
|
|
207
|
+
own: FrameworkText.tip(objective.name, [
|
|
208
|
+
["Key results", objective.keyResults.length],
|
|
209
|
+
[`Progress, ${how}`, `${Math.round(objective.progress)}%`],
|
|
210
|
+
...sure(objective)
|
|
211
|
+
], color),
|
|
212
|
+
of: (result) => FrameworkText.tip(result.name, [["Progress", `${Math.round(result.progress)}%`], ...sure(result)], color)
|
|
213
|
+
};
|
|
214
|
+
}
|
|
215
|
+
/** The objectives and the height of a row: with their key results while a row gets `least` px, and alone, as a list, in a plot too short for that. */
|
|
216
|
+
#fitted(least, height) {
|
|
217
|
+
const all = this.objectives, bare = all.map((objective) => ({
|
|
218
|
+
...objective,
|
|
219
|
+
keyResults: []
|
|
220
|
+
}));
|
|
221
|
+
const rowOf = (list, units) => Math.max(0, height - GROUP * (list.length - 1)) / Math.max(1, sum(list, units));
|
|
222
|
+
const units = this.options.layout === "list" ? (objective) => objective.keyResults.length + 1 : (objective) => Math.max(1.4, objective.keyResults.length);
|
|
223
|
+
const row = rowOf(all, units);
|
|
224
|
+
return row >= least ? {
|
|
225
|
+
shown: all,
|
|
226
|
+
row
|
|
227
|
+
} : {
|
|
228
|
+
shown: bare,
|
|
229
|
+
row: rowOf(bare, units)
|
|
230
|
+
};
|
|
231
|
+
}
|
|
232
|
+
#tree(ctx) {
|
|
233
|
+
const { plot, palette } = ctx, parts = {
|
|
234
|
+
cards: [],
|
|
235
|
+
links: [],
|
|
236
|
+
guides: [],
|
|
237
|
+
meters: [],
|
|
238
|
+
pips: [],
|
|
239
|
+
words: []
|
|
240
|
+
};
|
|
241
|
+
const { shown, row: free } = this.#fitted(12, plot.height), row = Math.min(46, free), trail = this.#trail;
|
|
242
|
+
if (!shown.some((objective) => objective.keyResults.length)) return this.#list(ctx);
|
|
243
|
+
const left = Math.min(250, plot.width * .37), reach = Math.max(18, plot.width * .06), start = left + reach, across = Math.max(0, plot.width - start - trail - 6);
|
|
244
|
+
let top = 0;
|
|
245
|
+
shown.forEach((objective, i) => {
|
|
246
|
+
const color = palette.color(objective.name), tips = this.#tips(objective, color), tall = Math.max(1.4, objective.keyResults.length) * row;
|
|
247
|
+
const card = {
|
|
248
|
+
key: `${i}`,
|
|
249
|
+
color,
|
|
250
|
+
x: 0,
|
|
251
|
+
y: top + 2,
|
|
252
|
+
width: left,
|
|
253
|
+
height: Math.max(0, tall - 4)
|
|
254
|
+
}, middle = top + tall / 2, room = left - 16;
|
|
255
|
+
parts.cards.push(card);
|
|
256
|
+
const barred = card.height >= 20 && room - trail >= 24, lines = Math.floor((card.height - 8 - (barred ? 14 : 0)) / 13);
|
|
257
|
+
const name = FrameworkText.clamp(FrameworkText.wrap(objective.name, room, 11), Math.max(0, lines), room, 11), from = middle - (name.length * 13 + (barred ? 14 : 0)) / 2 + 6;
|
|
258
|
+
parts.words.push(...name.map((text, line) => ({
|
|
259
|
+
key: `objective/${i}/${line}`,
|
|
260
|
+
text,
|
|
261
|
+
full: objective.name,
|
|
262
|
+
x: 8,
|
|
263
|
+
y: from + line * 13,
|
|
264
|
+
size: 11,
|
|
265
|
+
weight: 600,
|
|
266
|
+
tone: "ink"
|
|
267
|
+
})));
|
|
268
|
+
if (barred) this.#meter(ctx, parts, `${i}`, objective, color, 8, from + name.length * 13 + 2, room - trail, tips.own, true);
|
|
269
|
+
const first = top + (tall - objective.keyResults.length * row) / 2;
|
|
270
|
+
objective.keyResults.forEach((result, k) => {
|
|
271
|
+
const centre = first + (k + .5) * row, over = row >= 25, beside = over ? 0 : Math.round(across * .5), key = `${i}/${k}`;
|
|
272
|
+
parts.links.push({
|
|
273
|
+
key,
|
|
274
|
+
d: `M${left},${middle}C${left + reach * .55},${middle} ${left + reach * .45},${centre} ${start - 4},${centre}`
|
|
275
|
+
});
|
|
276
|
+
parts.words.push({
|
|
277
|
+
key: `result/${key}`,
|
|
278
|
+
text: FrameworkText.fit(result.name, over ? plot.width - start : beside - 6, SIZE),
|
|
279
|
+
full: result.name,
|
|
280
|
+
x: start,
|
|
281
|
+
y: centre - (over ? 7 : 0),
|
|
282
|
+
size: SIZE,
|
|
283
|
+
tone: "ink"
|
|
284
|
+
});
|
|
285
|
+
this.#meter(ctx, parts, key, result, color, start + beside, centre + (over ? 7 : 0), across - beside, tips.of(result), false);
|
|
286
|
+
});
|
|
287
|
+
top += tall + GROUP;
|
|
288
|
+
});
|
|
289
|
+
return parts;
|
|
290
|
+
}
|
|
291
|
+
#list(ctx) {
|
|
292
|
+
const { plot, palette } = ctx, parts = {
|
|
293
|
+
cards: [],
|
|
294
|
+
links: [],
|
|
295
|
+
guides: [],
|
|
296
|
+
meters: [],
|
|
297
|
+
pips: [],
|
|
298
|
+
words: []
|
|
299
|
+
};
|
|
300
|
+
const { shown, row: free } = this.#fitted(13, plot.height), row = Math.min(32, free), trail = this.#trail;
|
|
301
|
+
const bar = Math.max(40, Math.min(220, plot.width * .3)), at = Math.max(0, plot.width - trail - 6 - bar), named = row >= 12;
|
|
302
|
+
let top = 0;
|
|
303
|
+
shown.forEach((objective, i) => {
|
|
304
|
+
const color = palette.color(objective.name), tips = this.#tips(objective, color), head = top + row / 2;
|
|
305
|
+
if (named) parts.words.push({
|
|
306
|
+
key: `objective/${i}`,
|
|
307
|
+
text: FrameworkText.fit(objective.name, at - 10, 11.5),
|
|
308
|
+
full: objective.name,
|
|
309
|
+
x: 0,
|
|
310
|
+
y: head,
|
|
311
|
+
size: 11.5,
|
|
312
|
+
weight: 600,
|
|
313
|
+
tone: "ink"
|
|
314
|
+
});
|
|
315
|
+
this.#meter(ctx, parts, `${i}`, objective, color, at, head, bar, tips.own, true);
|
|
316
|
+
const centres = objective.keyResults.map((_, k) => top + (k + 1.5) * row);
|
|
317
|
+
if (centres.length) parts.guides.push({
|
|
318
|
+
key: `${i}`,
|
|
319
|
+
d: `M6,${head + Math.min(9, row / 2)}V${centres.at(-1)}${centres.map((centre) => `M6,${centre}H13`).join("")}`
|
|
320
|
+
});
|
|
321
|
+
objective.keyResults.forEach((result, k) => {
|
|
322
|
+
const key = `${i}/${k}`;
|
|
323
|
+
parts.words.push({
|
|
324
|
+
key: `result/${key}`,
|
|
325
|
+
text: FrameworkText.fit(result.name, at - INDENT - 10, SIZE),
|
|
326
|
+
full: result.name,
|
|
327
|
+
x: INDENT,
|
|
328
|
+
y: centres[k],
|
|
329
|
+
size: SIZE,
|
|
330
|
+
tone: "ink"
|
|
331
|
+
});
|
|
332
|
+
this.#meter(ctx, parts, key, result, color, at, centres[k], bar, tips.of(result), false);
|
|
333
|
+
});
|
|
334
|
+
top += (objective.keyResults.length + 1) * row + GROUP;
|
|
335
|
+
});
|
|
336
|
+
return parts;
|
|
337
|
+
}
|
|
338
|
+
};
|
|
339
|
+
export { OkrTree, OkrTreeLayout, OkrTreeRollup };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// src/charts/strategycharts/StrategyPane.ts
|
|
2
|
+
/** A second value axis inside a cartesian plot, for a pane with a scale of its own: grid lines across and tick labels at the left. */
|
|
3
|
+
var StrategyPane = class {
|
|
4
|
+
static axis(ctx, name, scale, count, format) {
|
|
5
|
+
const ticks = scale.ticks(count);
|
|
6
|
+
const grid = ctx.marks(`axis-${name}-grid`, "line", ticks, (tick) => tick).attr("stroke", (tick) => tick === 0 ? ctx.theme.axis : ctx.theme.grid).attr("stroke-width", 1);
|
|
7
|
+
ctx.set(grid, {
|
|
8
|
+
x1: 0,
|
|
9
|
+
x2: ctx.plot.width,
|
|
10
|
+
y1: (tick) => scale(tick),
|
|
11
|
+
y2: (tick) => scale(tick)
|
|
12
|
+
});
|
|
13
|
+
const labels = ctx.text(ctx.marks(`axis-${name}-ticks`, "text", ticks, (tick) => tick)).attr("dy", "0.32em").attr("text-anchor", "end").text(format);
|
|
14
|
+
ctx.set(labels, {
|
|
15
|
+
x: -3,
|
|
16
|
+
y: (tick) => scale(tick)
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
/** Short figures for pane ticks and notes: 261K, 2.1M. */
|
|
20
|
+
static compact(value) {
|
|
21
|
+
return Intl.NumberFormat("en", {
|
|
22
|
+
notation: "compact",
|
|
23
|
+
maximumFractionDigits: 1
|
|
24
|
+
}).format(value);
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
export { StrategyPane };
|