@toclocoinc/lattice-grid 1.62.0 → 1.63.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/README.md +23 -8
- package/docs/API.html +526 -16
- package/docs/CHART-CODES.md +141 -2
- package/docs/api-detail.html +194 -5
- package/lattice-grid.d.ts +235 -5
- package/lattice-grid.esm.min.js +856 -78
- package/lattice-grid.min.cjs +856 -78
- package/lattice-grid.min.js +856 -78
- package/modules/ai.d.ts +1 -1
- package/modules/ai.esm.min.js +13 -16
- package/modules/ai.min.cjs +13 -16
- package/modules/ai.min.js +13 -16
- package/modules/angular.d.ts +1 -1
- package/modules/angular.esm.min.js +2 -2
- package/modules/angular.min.cjs +2 -2
- package/modules/angular.min.js +2 -2
- package/modules/chart-alluvial.d.ts +1 -1
- package/modules/chart-alluvial.esm.min.js +1 -1
- package/modules/chart-alluvial.min.cjs +147 -0
- package/modules/chart-alluvial.min.js +147 -0
- package/modules/chart-arc.d.ts +1 -1
- package/modules/chart-arc.esm.min.js +1 -1
- package/modules/chart-arc.min.cjs +106 -0
- package/modules/chart-arc.min.js +106 -0
- package/modules/chart-bubblemap.d.ts +1 -1
- package/modules/chart-bubblemap.esm.min.js +42 -6
- package/modules/chart-bubblemap.min.cjs +126 -0
- package/modules/chart-bubblemap.min.js +126 -0
- package/modules/chart-bump.d.ts +1 -1
- package/modules/chart-bump.esm.min.js +1 -1
- package/modules/chart-bump.min.cjs +110 -0
- package/modules/chart-bump.min.js +110 -0
- package/modules/chart-calendar.d.ts +1 -1
- package/modules/chart-calendar.esm.min.js +1 -1
- package/modules/chart-calendar.min.cjs +129 -0
- package/modules/chart-calendar.min.js +129 -0
- package/modules/chart-decomposition.d.ts +1 -1
- package/modules/chart-decomposition.esm.min.js +1 -1
- package/modules/chart-decomposition.min.cjs +131 -0
- package/modules/chart-decomposition.min.js +131 -0
- package/modules/chart-diverging.d.ts +1 -1
- package/modules/chart-diverging.esm.min.js +1 -1
- package/modules/chart-diverging.min.cjs +104 -0
- package/modules/chart-diverging.min.js +104 -0
- package/modules/chart-dumbbell.d.ts +1 -1
- package/modules/chart-dumbbell.esm.min.js +1 -1
- package/modules/chart-dumbbell.min.cjs +114 -0
- package/modules/chart-dumbbell.min.js +114 -0
- package/modules/chart-fan.d.ts +1 -1
- package/modules/chart-fan.esm.min.js +1 -1
- package/modules/chart-fan.min.cjs +139 -0
- package/modules/chart-fan.min.js +139 -0
- package/modules/chart-hexbin.d.ts +1 -1
- package/modules/chart-hexbin.esm.min.js +1 -1
- package/modules/chart-hexbin.min.cjs +148 -0
- package/modules/chart-hexbin.min.js +148 -0
- package/modules/chart-hexmap.d.ts +1 -1
- package/modules/chart-hexmap.esm.min.js +46 -6
- package/modules/chart-hexmap.min.cjs +164 -0
- package/modules/chart-hexmap.min.js +164 -0
- package/modules/chart-icicle.d.ts +1 -1
- package/modules/chart-icicle.esm.min.js +1 -1
- package/modules/chart-icicle.min.cjs +97 -0
- package/modules/chart-icicle.min.js +97 -0
- package/modules/chart-parallel.d.ts +1 -1
- package/modules/chart-parallel.esm.min.js +1 -1
- package/modules/chart-parallel.min.cjs +123 -0
- package/modules/chart-parallel.min.js +123 -0
- package/modules/chart-ridgeline.d.ts +1 -1
- package/modules/chart-ridgeline.esm.min.js +1 -1
- package/modules/chart-ridgeline.min.cjs +119 -0
- package/modules/chart-ridgeline.min.js +119 -0
- package/modules/chart-roc.d.ts +1 -1
- package/modules/chart-roc.esm.min.js +1 -1
- package/modules/chart-roc.min.cjs +181 -0
- package/modules/chart-roc.min.js +181 -0
- package/modules/chart-slope.d.ts +1 -1
- package/modules/chart-slope.esm.min.js +1 -1
- package/modules/chart-slope.min.cjs +100 -0
- package/modules/chart-slope.min.js +100 -0
- package/modules/chart-splom.d.ts +1 -1
- package/modules/chart-splom.esm.min.js +1 -1
- package/modules/chart-splom.min.cjs +124 -0
- package/modules/chart-splom.min.js +124 -0
- package/modules/chart-waffle.d.ts +1 -1
- package/modules/chart-waffle.esm.min.js +1 -1
- package/modules/chart-waffle.min.cjs +97 -0
- package/modules/chart-waffle.min.js +97 -0
- package/modules/charts.d.ts +1 -1
- package/modules/charts.esm.min.js +1917 -662
- package/modules/charts.min.cjs +1917 -662
- package/modules/charts.min.js +1917 -662
- package/modules/data-router.d.ts +1 -1
- package/modules/data-router.esm.min.js +129 -20
- package/modules/data-router.min.cjs +129 -20
- package/modules/data-router.min.js +129 -20
- package/modules/devtools.d.ts +1 -1
- package/modules/devtools.esm.min.js +2 -2
- package/modules/devtools.min.cjs +2 -2
- package/modules/devtools.min.js +2 -2
- package/modules/dhtmlx-compat.d.ts +1 -1
- package/modules/dhtmlx-compat.esm.min.js +4 -16
- package/modules/dhtmlx-compat.min.cjs +4 -16
- package/modules/dhtmlx-compat.min.js +4 -16
- package/modules/gantt.d.ts +1 -1
- package/modules/gantt.esm.min.js +187 -82
- package/modules/gantt.min.cjs +187 -82
- package/modules/gantt.min.js +187 -82
- package/modules/geo-europe-nuts.d.ts +16 -0
- package/modules/geo-europe-nuts.esm.min.js +29 -0
- package/modules/geo-uk.d.ts +18 -0
- package/modules/geo-uk.esm.min.js +29 -0
- package/modules/geo-us-states.d.ts +16 -0
- package/modules/geo-us-states.esm.min.js +29 -0
- package/modules/geo-world-110m.d.ts +17 -0
- package/modules/geo-world-110m.esm.min.js +29 -0
- package/modules/geo-world-50m.d.ts +16 -0
- package/modules/geo-world-50m.esm.min.js +29 -0
- package/modules/htmx.d.ts +1 -1
- package/modules/htmx.esm.min.js +856 -78
- package/modules/htmx.min.cjs +856 -78
- package/modules/htmx.min.js +856 -78
- package/modules/kanban.d.ts +1 -1
- package/modules/kanban.esm.min.js +4 -16
- package/modules/kanban.min.cjs +4 -16
- package/modules/kanban.min.js +4 -16
- package/modules/kpi.d.ts +1 -1
- package/modules/kpi.esm.min.js +29 -24
- package/modules/kpi.min.cjs +29 -24
- package/modules/kpi.min.js +29 -24
- package/modules/layout.d.ts +1 -1
- package/modules/layout.esm.min.js +4 -16
- package/modules/layout.min.cjs +4 -16
- package/modules/layout.min.js +4 -16
- package/modules/mock-socket.d.ts +1 -1
- package/modules/mock-socket.esm.min.js +2 -2
- package/modules/mock-socket.min.cjs +2 -2
- package/modules/mock-socket.min.js +2 -2
- package/modules/react.d.ts +308 -3
- package/modules/react.esm.min.js +1072 -22
- package/modules/react.min.cjs +1056 -21
- package/modules/react.min.js +1056 -21
- package/modules/svelte.d.ts +1 -1
- package/modules/svelte.esm.min.js +2 -2
- package/modules/svelte.min.cjs +2 -2
- package/modules/svelte.min.js +2 -2
- package/modules/tabs.d.ts +1 -1
- package/modules/tabs.esm.min.js +4 -16
- package/modules/tabs.min.cjs +4 -16
- package/modules/tabs.min.js +4 -16
- package/modules/vue.d.ts +1 -1
- package/modules/vue.esm.min.js +2 -2
- package/modules/vue.min.cjs +2 -2
- package/modules/vue.min.js +2 -2
- package/modules/webcomponent.d.ts +1 -1
- package/modules/webcomponent.esm.min.js +856 -78
- package/modules/webcomponent.min.cjs +856 -78
- package/modules/webcomponent.min.js +856 -78
- package/package.json +1 -1
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Lattice Grid 1.63.0, chart-splom module
|
|
3
|
+
* Copyright (c) 2026 TOCLOCO Inc. All rights reserved.
|
|
4
|
+
* https://latticegrid.dev
|
|
5
|
+
*/
|
|
6
|
+
(function(root){
|
|
7
|
+
'use strict';
|
|
8
|
+
var __mods=Object.create(null);
|
|
9
|
+
var __cache=Object.create(null);
|
|
10
|
+
function __def(id,fn){__mods[id]=fn;}
|
|
11
|
+
function __req(id){
|
|
12
|
+
var hit=__cache[id];
|
|
13
|
+
if(hit)return hit;
|
|
14
|
+
var exports=Object.create(null);
|
|
15
|
+
__cache[id]=exports;
|
|
16
|
+
var fn=__mods[id];
|
|
17
|
+
if(!fn)throw new Error('[lattice] missing module: '+id);
|
|
18
|
+
fn(exports,__req);
|
|
19
|
+
return exports;
|
|
20
|
+
}
|
|
21
|
+
var __extmods=Object.create(null);
|
|
22
|
+
__extmods["@toclocoinc/lattice-grid/modules/charts"]=(root["LatticeGrid"]||null);
|
|
23
|
+
function __ext(spec){
|
|
24
|
+
var mod=__extmods[spec];
|
|
25
|
+
var g=typeof globalThis!=='undefined'?globalThis:(typeof self!=='undefined'?self:null);
|
|
26
|
+
if(mod)return mod;
|
|
27
|
+
if(spec==="@toclocoinc/lattice-grid/modules/charts"&&g&&g["LatticeGrid"])return g["LatticeGrid"];
|
|
28
|
+
throw new Error('[lattice] this module shares the Lattice core with the page, but it was not found. Load lattice-grid (or its script build) before this module. Missing: '+spec);
|
|
29
|
+
}
|
|
30
|
+
__def("packages/modules/chart-splom/index.js",function(__exports,__req){
|
|
31
|
+
'use strict';
|
|
32
|
+
Object.defineProperty(__exports,"bindSplom",{enumerable:true,get:function(){return bindSplom;}});
|
|
33
|
+
Object.defineProperty(__exports,"drawSplom",{enumerable:true,get:function(){return drawSplom;}});
|
|
34
|
+
Object.defineProperty(__exports,"default",{enumerable:true,get:function(){return __default;}});
|
|
35
|
+
const __m0=__ext("@toclocoinc/lattice-grid/modules/charts");
|
|
36
|
+
const registerChartType=__m0["registerChartType"];
|
|
37
|
+
const MAX_COLUMNS=6;
|
|
38
|
+
function bindSplom(grid,spec){
|
|
39
|
+
const columns=(Array.isArray(spec.columns)?spec.columns:[]).slice(0,MAX_COLUMNS);
|
|
40
|
+
const rows=[];
|
|
41
|
+
const n=grid.rows.count();
|
|
42
|
+
for(let i=0;i<n;i++){
|
|
43
|
+
const row=grid.rows.get(i);
|
|
44
|
+
if(!row||row.group)continue;
|
|
45
|
+
const record={__key:row.key};
|
|
46
|
+
let any=false;
|
|
47
|
+
for(const col of columns){
|
|
48
|
+
const value=Number(grid.rows.value(row.key,col));
|
|
49
|
+
record[col]=Number.isFinite(value)?value:null;
|
|
50
|
+
if(record[col]!==null)any=true;
|
|
51
|
+
}
|
|
52
|
+
if(any)rows.push(record);
|
|
53
|
+
}
|
|
54
|
+
return{rows,columns,empty:rows.length===0||columns.length<2};
|
|
55
|
+
}
|
|
56
|
+
function drawSplom(ctx){
|
|
57
|
+
const{
|
|
58
|
+
plot,bound,scheme,fontSize,groups,helpers,
|
|
59
|
+
}=ctx;
|
|
60
|
+
const{
|
|
61
|
+
extent,linearScale,Pool,attrs,round,setText,resolveScheme,NS,
|
|
62
|
+
}=helpers;
|
|
63
|
+
const sch=scheme||resolveScheme();
|
|
64
|
+
const{rows,columns}=bound;
|
|
65
|
+
const size=columns.length;
|
|
66
|
+
const colour=sch.series(0);
|
|
67
|
+
const domains={};
|
|
68
|
+
for(const col of columns){
|
|
69
|
+
domains[col]=extent(rows.map((r)=>r[col]).filter((v)=>v!==null))||{min:0,max:1};
|
|
70
|
+
}
|
|
71
|
+
const cellW=(plot.right-plot.left)/size;
|
|
72
|
+
const cellH=(plot.bottom-plot.top)/size;
|
|
73
|
+
const pad=Math.max(4,Math.round(Math.min(cellW,cellH)*0.08));
|
|
74
|
+
const radius=Math.max(1,Math.min(2.5,cellW/60));
|
|
75
|
+
const framePool=new Pool(groups.grid);
|
|
76
|
+
const dotPool=new Pool(groups.marks);
|
|
77
|
+
const labelPool=new Pool(groups.overlay);
|
|
78
|
+
for(let r=0;r<size;r++){
|
|
79
|
+
for(let c=0;c<size;c++){
|
|
80
|
+
const left=plot.left+c*cellW;
|
|
81
|
+
const top=plot.top+r*cellH;
|
|
82
|
+
attrs(framePool.next('rect',`${NS}__splom-cell`),{
|
|
83
|
+
x:round(left+pad),y:round(top+pad),
|
|
84
|
+
width:round(cellW-pad*2),height:round(cellH-pad*2),
|
|
85
|
+
fill:'none',stroke:'currentColor','stroke-opacity':0.15,
|
|
86
|
+
});
|
|
87
|
+
if(r===c){
|
|
88
|
+
const label=labelPool.next('text',`${NS}__splom-diag`);
|
|
89
|
+
setText(label,String(columns[r]));
|
|
90
|
+
attrs(label,{
|
|
91
|
+
x:round(left+cellW/2),y:round(top+cellH/2),
|
|
92
|
+
'text-anchor':'middle','font-size':fontSize,
|
|
93
|
+
});
|
|
94
|
+
continue;
|
|
95
|
+
}
|
|
96
|
+
const xCol=columns[c];
|
|
97
|
+
const yCol=columns[r];
|
|
98
|
+
const xScale=linearScale(domains[xCol],[left+pad,left+cellW-pad]);
|
|
99
|
+
const yScale=linearScale(domains[yCol],[top+cellH-pad,top+pad]);
|
|
100
|
+
for(const row of rows){
|
|
101
|
+
if(row[xCol]===null||row[yCol]===null)continue;
|
|
102
|
+
attrs(dotPool.next('circle',`${NS}__splom-dot ${NS}__mark`),{
|
|
103
|
+
cx:round(xScale.of(row[xCol])),cy:round(yScale.of(row[yCol])),
|
|
104
|
+
r:radius,fill:colour,'fill-opacity':0.5,
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
framePool.finish();
|
|
110
|
+
dotPool.finish();
|
|
111
|
+
labelPool.finish();
|
|
112
|
+
return{columns,cells:size*size,legend:[]};
|
|
113
|
+
}
|
|
114
|
+
registerChartType('splom',{draw:drawSplom,bind:bindSplom,freeform:true,labelled:false});
|
|
115
|
+
const __default=drawSplom;
|
|
116
|
+
});
|
|
117
|
+
var __entry=__req("packages/modules/chart-splom/index.js");
|
|
118
|
+
if(typeof module==='object'&&module.exports){module.exports=__entry;}
|
|
119
|
+
else if(typeof define==='function'&&define.amd){define(function(){return __entry;});}
|
|
120
|
+
else{
|
|
121
|
+
var __t=root["LatticeGrid"]||(root["LatticeGrid"]={});
|
|
122
|
+
for(var __k in __entry){if(__k!=='default')__t[__k]=__entry[__k];}
|
|
123
|
+
}
|
|
124
|
+
})(typeof globalThis!=='undefined'?globalThis:this);
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Lattice Grid 1.63.0, chart-splom module
|
|
3
|
+
* Copyright (c) 2026 TOCLOCO Inc. All rights reserved.
|
|
4
|
+
* https://latticegrid.dev
|
|
5
|
+
*/
|
|
6
|
+
(function(root){
|
|
7
|
+
'use strict';
|
|
8
|
+
var __mods=Object.create(null);
|
|
9
|
+
var __cache=Object.create(null);
|
|
10
|
+
function __def(id,fn){__mods[id]=fn;}
|
|
11
|
+
function __req(id){
|
|
12
|
+
var hit=__cache[id];
|
|
13
|
+
if(hit)return hit;
|
|
14
|
+
var exports=Object.create(null);
|
|
15
|
+
__cache[id]=exports;
|
|
16
|
+
var fn=__mods[id];
|
|
17
|
+
if(!fn)throw new Error('[lattice] missing module: '+id);
|
|
18
|
+
fn(exports,__req);
|
|
19
|
+
return exports;
|
|
20
|
+
}
|
|
21
|
+
var __extmods=Object.create(null);
|
|
22
|
+
__extmods["@toclocoinc/lattice-grid/modules/charts"]=(root["LatticeGrid"]||null);
|
|
23
|
+
function __ext(spec){
|
|
24
|
+
var mod=__extmods[spec];
|
|
25
|
+
var g=typeof globalThis!=='undefined'?globalThis:(typeof self!=='undefined'?self:null);
|
|
26
|
+
if(mod)return mod;
|
|
27
|
+
if(spec==="@toclocoinc/lattice-grid/modules/charts"&&g&&g["LatticeGrid"])return g["LatticeGrid"];
|
|
28
|
+
throw new Error('[lattice] this module shares the Lattice core with the page, but it was not found. Load lattice-grid (or its script build) before this module. Missing: '+spec);
|
|
29
|
+
}
|
|
30
|
+
__def("packages/modules/chart-splom/index.js",function(__exports,__req){
|
|
31
|
+
'use strict';
|
|
32
|
+
Object.defineProperty(__exports,"bindSplom",{enumerable:true,get:function(){return bindSplom;}});
|
|
33
|
+
Object.defineProperty(__exports,"drawSplom",{enumerable:true,get:function(){return drawSplom;}});
|
|
34
|
+
Object.defineProperty(__exports,"default",{enumerable:true,get:function(){return __default;}});
|
|
35
|
+
const __m0=__ext("@toclocoinc/lattice-grid/modules/charts");
|
|
36
|
+
const registerChartType=__m0["registerChartType"];
|
|
37
|
+
const MAX_COLUMNS=6;
|
|
38
|
+
function bindSplom(grid,spec){
|
|
39
|
+
const columns=(Array.isArray(spec.columns)?spec.columns:[]).slice(0,MAX_COLUMNS);
|
|
40
|
+
const rows=[];
|
|
41
|
+
const n=grid.rows.count();
|
|
42
|
+
for(let i=0;i<n;i++){
|
|
43
|
+
const row=grid.rows.get(i);
|
|
44
|
+
if(!row||row.group)continue;
|
|
45
|
+
const record={__key:row.key};
|
|
46
|
+
let any=false;
|
|
47
|
+
for(const col of columns){
|
|
48
|
+
const value=Number(grid.rows.value(row.key,col));
|
|
49
|
+
record[col]=Number.isFinite(value)?value:null;
|
|
50
|
+
if(record[col]!==null)any=true;
|
|
51
|
+
}
|
|
52
|
+
if(any)rows.push(record);
|
|
53
|
+
}
|
|
54
|
+
return{rows,columns,empty:rows.length===0||columns.length<2};
|
|
55
|
+
}
|
|
56
|
+
function drawSplom(ctx){
|
|
57
|
+
const{
|
|
58
|
+
plot,bound,scheme,fontSize,groups,helpers,
|
|
59
|
+
}=ctx;
|
|
60
|
+
const{
|
|
61
|
+
extent,linearScale,Pool,attrs,round,setText,resolveScheme,NS,
|
|
62
|
+
}=helpers;
|
|
63
|
+
const sch=scheme||resolveScheme();
|
|
64
|
+
const{rows,columns}=bound;
|
|
65
|
+
const size=columns.length;
|
|
66
|
+
const colour=sch.series(0);
|
|
67
|
+
const domains={};
|
|
68
|
+
for(const col of columns){
|
|
69
|
+
domains[col]=extent(rows.map((r)=>r[col]).filter((v)=>v!==null))||{min:0,max:1};
|
|
70
|
+
}
|
|
71
|
+
const cellW=(plot.right-plot.left)/size;
|
|
72
|
+
const cellH=(plot.bottom-plot.top)/size;
|
|
73
|
+
const pad=Math.max(4,Math.round(Math.min(cellW,cellH)*0.08));
|
|
74
|
+
const radius=Math.max(1,Math.min(2.5,cellW/60));
|
|
75
|
+
const framePool=new Pool(groups.grid);
|
|
76
|
+
const dotPool=new Pool(groups.marks);
|
|
77
|
+
const labelPool=new Pool(groups.overlay);
|
|
78
|
+
for(let r=0;r<size;r++){
|
|
79
|
+
for(let c=0;c<size;c++){
|
|
80
|
+
const left=plot.left+c*cellW;
|
|
81
|
+
const top=plot.top+r*cellH;
|
|
82
|
+
attrs(framePool.next('rect',`${NS}__splom-cell`),{
|
|
83
|
+
x:round(left+pad),y:round(top+pad),
|
|
84
|
+
width:round(cellW-pad*2),height:round(cellH-pad*2),
|
|
85
|
+
fill:'none',stroke:'currentColor','stroke-opacity':0.15,
|
|
86
|
+
});
|
|
87
|
+
if(r===c){
|
|
88
|
+
const label=labelPool.next('text',`${NS}__splom-diag`);
|
|
89
|
+
setText(label,String(columns[r]));
|
|
90
|
+
attrs(label,{
|
|
91
|
+
x:round(left+cellW/2),y:round(top+cellH/2),
|
|
92
|
+
'text-anchor':'middle','font-size':fontSize,
|
|
93
|
+
});
|
|
94
|
+
continue;
|
|
95
|
+
}
|
|
96
|
+
const xCol=columns[c];
|
|
97
|
+
const yCol=columns[r];
|
|
98
|
+
const xScale=linearScale(domains[xCol],[left+pad,left+cellW-pad]);
|
|
99
|
+
const yScale=linearScale(domains[yCol],[top+cellH-pad,top+pad]);
|
|
100
|
+
for(const row of rows){
|
|
101
|
+
if(row[xCol]===null||row[yCol]===null)continue;
|
|
102
|
+
attrs(dotPool.next('circle',`${NS}__splom-dot ${NS}__mark`),{
|
|
103
|
+
cx:round(xScale.of(row[xCol])),cy:round(yScale.of(row[yCol])),
|
|
104
|
+
r:radius,fill:colour,'fill-opacity':0.5,
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
framePool.finish();
|
|
110
|
+
dotPool.finish();
|
|
111
|
+
labelPool.finish();
|
|
112
|
+
return{columns,cells:size*size,legend:[]};
|
|
113
|
+
}
|
|
114
|
+
registerChartType('splom',{draw:drawSplom,bind:bindSplom,freeform:true,labelled:false});
|
|
115
|
+
const __default=drawSplom;
|
|
116
|
+
});
|
|
117
|
+
var __entry=__req("packages/modules/chart-splom/index.js");
|
|
118
|
+
if(typeof module==='object'&&module.exports){module.exports=__entry;}
|
|
119
|
+
else if(typeof define==='function'&&define.amd){define(function(){return __entry;});}
|
|
120
|
+
else{
|
|
121
|
+
var __t=root["LatticeGrid"]||(root["LatticeGrid"]={});
|
|
122
|
+
for(var __k in __entry){if(__k!=='default')__t[__k]=__entry[__k];}
|
|
123
|
+
}
|
|
124
|
+
})(typeof globalThis!=='undefined'?globalThis:this);
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Lattice Grid 1.63.0, chart-waffle module
|
|
3
|
+
* Copyright (c) 2026 TOCLOCO Inc. All rights reserved.
|
|
4
|
+
* https://latticegrid.dev
|
|
5
|
+
*/
|
|
6
|
+
(function(root){
|
|
7
|
+
'use strict';
|
|
8
|
+
var __mods=Object.create(null);
|
|
9
|
+
var __cache=Object.create(null);
|
|
10
|
+
function __def(id,fn){__mods[id]=fn;}
|
|
11
|
+
function __req(id){
|
|
12
|
+
var hit=__cache[id];
|
|
13
|
+
if(hit)return hit;
|
|
14
|
+
var exports=Object.create(null);
|
|
15
|
+
__cache[id]=exports;
|
|
16
|
+
var fn=__mods[id];
|
|
17
|
+
if(!fn)throw new Error('[lattice] missing module: '+id);
|
|
18
|
+
fn(exports,__req);
|
|
19
|
+
return exports;
|
|
20
|
+
}
|
|
21
|
+
var __extmods=Object.create(null);
|
|
22
|
+
__extmods["@toclocoinc/lattice-grid/modules/charts"]=(root["LatticeGrid"]||null);
|
|
23
|
+
function __ext(spec){
|
|
24
|
+
var mod=__extmods[spec];
|
|
25
|
+
var g=typeof globalThis!=='undefined'?globalThis:(typeof self!=='undefined'?self:null);
|
|
26
|
+
if(mod)return mod;
|
|
27
|
+
if(spec==="@toclocoinc/lattice-grid/modules/charts"&&g&&g["LatticeGrid"])return g["LatticeGrid"];
|
|
28
|
+
throw new Error('[lattice] this module shares the Lattice core with the page, but it was not found. Load lattice-grid (or its script build) before this module. Missing: '+spec);
|
|
29
|
+
}
|
|
30
|
+
__def("packages/modules/chart-waffle/index.js",function(__exports,__req){
|
|
31
|
+
'use strict';
|
|
32
|
+
Object.defineProperty(__exports,"drawWaffle",{enumerable:true,get:function(){return drawWaffle;}});
|
|
33
|
+
Object.defineProperty(__exports,"default",{enumerable:true,get:function(){return __default;}});
|
|
34
|
+
const __m0=__ext("@toclocoinc/lattice-grid/modules/charts");
|
|
35
|
+
const registerChartType=__m0["registerChartType"];
|
|
36
|
+
const DEFAULT_CELLS=100;
|
|
37
|
+
function allocate(values,cells){
|
|
38
|
+
const total=values.reduce((t,v)=>t+v,0)||1;
|
|
39
|
+
const exact=values.map((v)=>(v/total)*cells);
|
|
40
|
+
const floors=exact.map((e)=>Math.floor(e));
|
|
41
|
+
let used=floors.reduce((t,v)=>t+v,0);
|
|
42
|
+
const order=exact
|
|
43
|
+
.map((e,i)=>({i,frac:e-Math.floor(e)}))
|
|
44
|
+
.sort((a,b)=>b.frac-a.frac);
|
|
45
|
+
let k=0;
|
|
46
|
+
while(used<cells&&k<order.length){floors[order[k].i]+=1;used+=1;k+=1;}
|
|
47
|
+
return floors;
|
|
48
|
+
}
|
|
49
|
+
function drawWaffle(ctx){
|
|
50
|
+
const{
|
|
51
|
+
plot,bound,scheme,groups,spec,helpers,
|
|
52
|
+
}=ctx;
|
|
53
|
+
const{
|
|
54
|
+
Pool,attrs,round,resolveScheme,NS,
|
|
55
|
+
}=helpers;
|
|
56
|
+
const sch=scheme||resolveScheme();
|
|
57
|
+
const series=bound.series&&bound.series[0];
|
|
58
|
+
const points=((series&&series.points)||[]).filter((p)=>p.y!==null&&p.y>0);
|
|
59
|
+
if(!points.length)return{empty:true,legend:[]};
|
|
60
|
+
const cells=spec&&spec.cells>0?Math.floor(spec.cells):DEFAULT_CELLS;
|
|
61
|
+
const cols=spec&&spec.columns>0?Math.floor(spec.columns):Math.ceil(Math.sqrt(cells));
|
|
62
|
+
const rows=Math.ceil(cells/cols);
|
|
63
|
+
const counts=allocate(points.map((p)=>p.y),cells);
|
|
64
|
+
const size=Math.max(2,Math.floor(Math.min(
|
|
65
|
+
(plot.right-plot.left)/cols,
|
|
66
|
+
(plot.bottom-plot.top)/rows,
|
|
67
|
+
)));
|
|
68
|
+
const gap=Math.max(1,Math.round(size*0.12));
|
|
69
|
+
const step=size+gap;
|
|
70
|
+
const cellCat=[];
|
|
71
|
+
counts.forEach((n,cat)=>{for(let i=0;i<n;i++)cellCat.push(cat);});
|
|
72
|
+
const marks=new Pool(groups.marks);
|
|
73
|
+
cellCat.forEach((cat,idx)=>{
|
|
74
|
+
const col=idx%cols;
|
|
75
|
+
const rowFromBottom=Math.floor(idx/cols);
|
|
76
|
+
const x=plot.left+col*step;
|
|
77
|
+
const y=plot.top+(rows-1-rowFromBottom)*step;
|
|
78
|
+
attrs(marks.next('rect',`${NS}__waffle-cell ${NS}__mark`),{
|
|
79
|
+
x:round(x),y:round(y),width:size,height:size,rx:1,
|
|
80
|
+
fill:sch.series(cat),'data-cat':cat,
|
|
81
|
+
});
|
|
82
|
+
});
|
|
83
|
+
marks.finish();
|
|
84
|
+
const legend=points.map((p,i)=>({key:p.label,label:`${p.label} (${counts[i]})`,index:i}));
|
|
85
|
+
return{cells:cellCat.length,counts,legend};
|
|
86
|
+
}
|
|
87
|
+
registerChartType('waffle',{draw:drawWaffle,freeform:true,labelled:false});
|
|
88
|
+
const __default=drawWaffle;
|
|
89
|
+
});
|
|
90
|
+
var __entry=__req("packages/modules/chart-waffle/index.js");
|
|
91
|
+
if(typeof module==='object'&&module.exports){module.exports=__entry;}
|
|
92
|
+
else if(typeof define==='function'&&define.amd){define(function(){return __entry;});}
|
|
93
|
+
else{
|
|
94
|
+
var __t=root["LatticeGrid"]||(root["LatticeGrid"]={});
|
|
95
|
+
for(var __k in __entry){if(__k!=='default')__t[__k]=__entry[__k];}
|
|
96
|
+
}
|
|
97
|
+
})(typeof globalThis!=='undefined'?globalThis:this);
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Lattice Grid 1.63.0, chart-waffle module
|
|
3
|
+
* Copyright (c) 2026 TOCLOCO Inc. All rights reserved.
|
|
4
|
+
* https://latticegrid.dev
|
|
5
|
+
*/
|
|
6
|
+
(function(root){
|
|
7
|
+
'use strict';
|
|
8
|
+
var __mods=Object.create(null);
|
|
9
|
+
var __cache=Object.create(null);
|
|
10
|
+
function __def(id,fn){__mods[id]=fn;}
|
|
11
|
+
function __req(id){
|
|
12
|
+
var hit=__cache[id];
|
|
13
|
+
if(hit)return hit;
|
|
14
|
+
var exports=Object.create(null);
|
|
15
|
+
__cache[id]=exports;
|
|
16
|
+
var fn=__mods[id];
|
|
17
|
+
if(!fn)throw new Error('[lattice] missing module: '+id);
|
|
18
|
+
fn(exports,__req);
|
|
19
|
+
return exports;
|
|
20
|
+
}
|
|
21
|
+
var __extmods=Object.create(null);
|
|
22
|
+
__extmods["@toclocoinc/lattice-grid/modules/charts"]=(root["LatticeGrid"]||null);
|
|
23
|
+
function __ext(spec){
|
|
24
|
+
var mod=__extmods[spec];
|
|
25
|
+
var g=typeof globalThis!=='undefined'?globalThis:(typeof self!=='undefined'?self:null);
|
|
26
|
+
if(mod)return mod;
|
|
27
|
+
if(spec==="@toclocoinc/lattice-grid/modules/charts"&&g&&g["LatticeGrid"])return g["LatticeGrid"];
|
|
28
|
+
throw new Error('[lattice] this module shares the Lattice core with the page, but it was not found. Load lattice-grid (or its script build) before this module. Missing: '+spec);
|
|
29
|
+
}
|
|
30
|
+
__def("packages/modules/chart-waffle/index.js",function(__exports,__req){
|
|
31
|
+
'use strict';
|
|
32
|
+
Object.defineProperty(__exports,"drawWaffle",{enumerable:true,get:function(){return drawWaffle;}});
|
|
33
|
+
Object.defineProperty(__exports,"default",{enumerable:true,get:function(){return __default;}});
|
|
34
|
+
const __m0=__ext("@toclocoinc/lattice-grid/modules/charts");
|
|
35
|
+
const registerChartType=__m0["registerChartType"];
|
|
36
|
+
const DEFAULT_CELLS=100;
|
|
37
|
+
function allocate(values,cells){
|
|
38
|
+
const total=values.reduce((t,v)=>t+v,0)||1;
|
|
39
|
+
const exact=values.map((v)=>(v/total)*cells);
|
|
40
|
+
const floors=exact.map((e)=>Math.floor(e));
|
|
41
|
+
let used=floors.reduce((t,v)=>t+v,0);
|
|
42
|
+
const order=exact
|
|
43
|
+
.map((e,i)=>({i,frac:e-Math.floor(e)}))
|
|
44
|
+
.sort((a,b)=>b.frac-a.frac);
|
|
45
|
+
let k=0;
|
|
46
|
+
while(used<cells&&k<order.length){floors[order[k].i]+=1;used+=1;k+=1;}
|
|
47
|
+
return floors;
|
|
48
|
+
}
|
|
49
|
+
function drawWaffle(ctx){
|
|
50
|
+
const{
|
|
51
|
+
plot,bound,scheme,groups,spec,helpers,
|
|
52
|
+
}=ctx;
|
|
53
|
+
const{
|
|
54
|
+
Pool,attrs,round,resolveScheme,NS,
|
|
55
|
+
}=helpers;
|
|
56
|
+
const sch=scheme||resolveScheme();
|
|
57
|
+
const series=bound.series&&bound.series[0];
|
|
58
|
+
const points=((series&&series.points)||[]).filter((p)=>p.y!==null&&p.y>0);
|
|
59
|
+
if(!points.length)return{empty:true,legend:[]};
|
|
60
|
+
const cells=spec&&spec.cells>0?Math.floor(spec.cells):DEFAULT_CELLS;
|
|
61
|
+
const cols=spec&&spec.columns>0?Math.floor(spec.columns):Math.ceil(Math.sqrt(cells));
|
|
62
|
+
const rows=Math.ceil(cells/cols);
|
|
63
|
+
const counts=allocate(points.map((p)=>p.y),cells);
|
|
64
|
+
const size=Math.max(2,Math.floor(Math.min(
|
|
65
|
+
(plot.right-plot.left)/cols,
|
|
66
|
+
(plot.bottom-plot.top)/rows,
|
|
67
|
+
)));
|
|
68
|
+
const gap=Math.max(1,Math.round(size*0.12));
|
|
69
|
+
const step=size+gap;
|
|
70
|
+
const cellCat=[];
|
|
71
|
+
counts.forEach((n,cat)=>{for(let i=0;i<n;i++)cellCat.push(cat);});
|
|
72
|
+
const marks=new Pool(groups.marks);
|
|
73
|
+
cellCat.forEach((cat,idx)=>{
|
|
74
|
+
const col=idx%cols;
|
|
75
|
+
const rowFromBottom=Math.floor(idx/cols);
|
|
76
|
+
const x=plot.left+col*step;
|
|
77
|
+
const y=plot.top+(rows-1-rowFromBottom)*step;
|
|
78
|
+
attrs(marks.next('rect',`${NS}__waffle-cell ${NS}__mark`),{
|
|
79
|
+
x:round(x),y:round(y),width:size,height:size,rx:1,
|
|
80
|
+
fill:sch.series(cat),'data-cat':cat,
|
|
81
|
+
});
|
|
82
|
+
});
|
|
83
|
+
marks.finish();
|
|
84
|
+
const legend=points.map((p,i)=>({key:p.label,label:`${p.label} (${counts[i]})`,index:i}));
|
|
85
|
+
return{cells:cellCat.length,counts,legend};
|
|
86
|
+
}
|
|
87
|
+
registerChartType('waffle',{draw:drawWaffle,freeform:true,labelled:false});
|
|
88
|
+
const __default=drawWaffle;
|
|
89
|
+
});
|
|
90
|
+
var __entry=__req("packages/modules/chart-waffle/index.js");
|
|
91
|
+
if(typeof module==='object'&&module.exports){module.exports=__entry;}
|
|
92
|
+
else if(typeof define==='function'&&define.amd){define(function(){return __entry;});}
|
|
93
|
+
else{
|
|
94
|
+
var __t=root["LatticeGrid"]||(root["LatticeGrid"]={});
|
|
95
|
+
for(var __k in __entry){if(__k!=='default')__t[__k]=__entry[__k];}
|
|
96
|
+
}
|
|
97
|
+
})(typeof globalThis!=='undefined'?globalThis:this);
|
package/modules/charts.d.ts
CHANGED