@toclocoinc/lattice-grid 1.62.1 → 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 +1 -1
- 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 +786 -67
- package/lattice-grid.min.cjs +786 -67
- package/lattice-grid.min.js +786 -67
- 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 +1 -1
- package/modules/chart-alluvial.min.js +1 -1
- package/modules/chart-arc.d.ts +1 -1
- package/modules/chart-arc.esm.min.js +1 -1
- package/modules/chart-arc.min.cjs +1 -1
- package/modules/chart-arc.min.js +1 -1
- package/modules/chart-bubblemap.d.ts +1 -1
- package/modules/chart-bubblemap.esm.min.js +42 -6
- package/modules/chart-bubblemap.min.cjs +42 -6
- package/modules/chart-bubblemap.min.js +42 -6
- package/modules/chart-bump.d.ts +1 -1
- package/modules/chart-bump.esm.min.js +1 -1
- package/modules/chart-bump.min.cjs +1 -1
- package/modules/chart-bump.min.js +1 -1
- package/modules/chart-calendar.d.ts +1 -1
- package/modules/chart-calendar.esm.min.js +1 -1
- package/modules/chart-calendar.min.cjs +1 -1
- package/modules/chart-calendar.min.js +1 -1
- package/modules/chart-decomposition.d.ts +1 -1
- package/modules/chart-decomposition.esm.min.js +1 -1
- package/modules/chart-decomposition.min.cjs +1 -1
- package/modules/chart-decomposition.min.js +1 -1
- package/modules/chart-diverging.d.ts +1 -1
- package/modules/chart-diverging.esm.min.js +1 -1
- package/modules/chart-diverging.min.cjs +1 -1
- package/modules/chart-diverging.min.js +1 -1
- package/modules/chart-dumbbell.d.ts +1 -1
- package/modules/chart-dumbbell.esm.min.js +1 -1
- package/modules/chart-dumbbell.min.cjs +1 -1
- package/modules/chart-dumbbell.min.js +1 -1
- package/modules/chart-fan.d.ts +1 -1
- package/modules/chart-fan.esm.min.js +1 -1
- package/modules/chart-fan.min.cjs +1 -1
- package/modules/chart-fan.min.js +1 -1
- package/modules/chart-hexbin.d.ts +1 -1
- package/modules/chart-hexbin.esm.min.js +1 -1
- package/modules/chart-hexbin.min.cjs +1 -1
- package/modules/chart-hexbin.min.js +1 -1
- package/modules/chart-hexmap.d.ts +1 -1
- package/modules/chart-hexmap.esm.min.js +46 -6
- package/modules/chart-hexmap.min.cjs +46 -6
- package/modules/chart-hexmap.min.js +46 -6
- package/modules/chart-icicle.d.ts +1 -1
- package/modules/chart-icicle.esm.min.js +1 -1
- package/modules/chart-icicle.min.cjs +1 -1
- package/modules/chart-icicle.min.js +1 -1
- package/modules/chart-parallel.d.ts +1 -1
- package/modules/chart-parallel.esm.min.js +1 -1
- package/modules/chart-parallel.min.cjs +1 -1
- package/modules/chart-parallel.min.js +1 -1
- package/modules/chart-ridgeline.d.ts +1 -1
- package/modules/chart-ridgeline.esm.min.js +1 -1
- package/modules/chart-ridgeline.min.cjs +1 -1
- package/modules/chart-ridgeline.min.js +1 -1
- package/modules/chart-roc.d.ts +1 -1
- package/modules/chart-roc.esm.min.js +1 -1
- package/modules/chart-roc.min.cjs +1 -1
- package/modules/chart-roc.min.js +1 -1
- package/modules/chart-slope.d.ts +1 -1
- package/modules/chart-slope.esm.min.js +1 -1
- package/modules/chart-slope.min.cjs +1 -1
- package/modules/chart-slope.min.js +1 -1
- package/modules/chart-splom.d.ts +1 -1
- package/modules/chart-splom.esm.min.js +1 -1
- package/modules/chart-splom.min.cjs +1 -1
- package/modules/chart-splom.min.js +1 -1
- package/modules/chart-waffle.d.ts +1 -1
- package/modules/chart-waffle.esm.min.js +1 -1
- package/modules/chart-waffle.min.cjs +1 -1
- package/modules/chart-waffle.min.js +1 -1
- 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 +786 -67
- package/modules/htmx.min.cjs +786 -67
- package/modules/htmx.min.js +786 -67
- 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 +786 -67
- package/modules/webcomponent.min.cjs +786 -67
- package/modules/webcomponent.min.js +786 -67
- package/package.json +1 -1
package/modules/chart-arc.d.ts
CHANGED
package/modules/chart-arc.min.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Lattice Grid 1.
|
|
2
|
+
* Lattice Grid 1.63.0, chart-bubblemap module
|
|
3
3
|
* Copyright (c) 2026 TOCLOCO Inc. All rights reserved.
|
|
4
4
|
* https://latticegrid.dev
|
|
5
5
|
*/
|
|
@@ -47,34 +47,70 @@ points.push({lon,lat,size:Number.isFinite(size)?size:0,label:spec.label?grid.row
|
|
|
47
47
|
}
|
|
48
48
|
return{points,empty:points.length===0};
|
|
49
49
|
}
|
|
50
|
+
function packProjection(opts){
|
|
51
|
+
const{spec,plot,helpers}=opts;
|
|
52
|
+
if(!spec||!spec.shapes)return null;
|
|
53
|
+
const{
|
|
54
|
+
resolvePack,packRegions,fitted,resolveProjection,
|
|
55
|
+
}=helpers;
|
|
56
|
+
const resolved=resolvePack(spec.shapes,spec.layer);
|
|
57
|
+
if(!resolved)return null;
|
|
58
|
+
const regions=packRegions(resolved.topology);
|
|
59
|
+
const project=resolveProjection(
|
|
60
|
+
spec.projection||resolved.pack.projection,
|
|
61
|
+
{...(resolved.pack.projectionOptions||{}),...(spec.projectionOptions||{})},
|
|
62
|
+
);
|
|
63
|
+
const fit=fitted({project,rings:regions.flatMap((r)=>r.rings),plot});
|
|
64
|
+
return{to:fit.to,regions};
|
|
65
|
+
}
|
|
50
66
|
function drawBubbleMap(ctx){
|
|
51
67
|
const{
|
|
52
68
|
plot,bound,scheme,groups,spec,helpers,
|
|
53
69
|
}=ctx;
|
|
54
70
|
const{
|
|
55
|
-
extent,linearScale,sqrtScale,Pool,attrs,round,resolveScheme,NS,
|
|
71
|
+
extent,linearScale,sqrtScale,Pool,attrs,round,resolveScheme,NS,projectedPath,
|
|
56
72
|
}=helpers;
|
|
57
73
|
const sch=scheme||resolveScheme();
|
|
58
74
|
const colour=sch.series(0);
|
|
59
75
|
const{points}=bound;
|
|
76
|
+
const marks=new Pool(groups.marks);
|
|
77
|
+
const fit=packProjection({spec,plot,helpers});
|
|
78
|
+
let project;
|
|
79
|
+
if(fit){
|
|
80
|
+
for(const region of fit.regions){
|
|
81
|
+
const d=region.rings.map((ring)=>projectedPath(ring,fit.to)).filter(Boolean).join(' ');
|
|
82
|
+
if(!d)continue;
|
|
83
|
+
attrs(marks.next('path',`${NS}__region`),{
|
|
84
|
+
d,fill:'var(--lattice-chart-empty, #eceff1)',class:`${NS}__region`,
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
project=fit.to;
|
|
88
|
+
}else{
|
|
60
89
|
const lonD=extent(points.map((p)=>p.lon))||{min:0,max:1};
|
|
61
90
|
const latD=extent(points.map((p)=>p.lat))||{min:0,max:1};
|
|
62
91
|
const pad=Math.max(8,spec&&spec.maxRadius>0?spec.maxRadius:20);
|
|
63
92
|
const xScale=linearScale(lonD,[plot.left+pad,plot.right-pad]);
|
|
64
93
|
const yScale=linearScale(latD,[plot.bottom-pad,plot.top+pad]);
|
|
94
|
+
project=(lon,lat)=>[xScale.of(lon),yScale.of(lat)];
|
|
95
|
+
}
|
|
65
96
|
const sizeD=extent(points.map((p)=>p.size))||{min:0,max:1};
|
|
66
97
|
const rScale=sqrtScale({min:0,max:Math.max(1e-9,sizeD.max)},[2,spec&&spec.maxRadius>0?spec.maxRadius:20]);
|
|
67
|
-
const marks=new Pool(groups.marks);
|
|
68
98
|
const ordered=[...points].sort((a,b)=>b.size-a.size);
|
|
69
99
|
for(const p of ordered){
|
|
100
|
+
const[x,y]=project(p.lon,p.lat);
|
|
70
101
|
attrs(marks.next('circle',`${NS}__bubblemap-dot ${NS}__mark`),{
|
|
71
|
-
cx:round(
|
|
102
|
+
cx:round(x),
|
|
103
|
+
cy:round(y),
|
|
72
104
|
r:round(spec&&spec.size?rScale.of(p.size):4),
|
|
73
|
-
fill:colour,
|
|
105
|
+
fill:colour,
|
|
106
|
+
'fill-opacity':0.5,
|
|
107
|
+
stroke:colour,
|
|
108
|
+
'data-size':p.size,
|
|
109
|
+
class:`${NS}__bubblemap-dot ${NS}__mark`,
|
|
74
110
|
});
|
|
75
111
|
}
|
|
76
112
|
marks.finish();
|
|
77
|
-
return{points:points.length,legend:[]};
|
|
113
|
+
return{points:points.length,legend:[],packed:!!fit};
|
|
78
114
|
}
|
|
79
115
|
registerChartType('bubblemap',{draw:drawBubbleMap,bind:bindBubbleMap,freeform:true,labelled:false});
|
|
80
116
|
const __default=drawBubbleMap;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Lattice Grid 1.
|
|
2
|
+
* Lattice Grid 1.63.0, chart-bubblemap module
|
|
3
3
|
* Copyright (c) 2026 TOCLOCO Inc. All rights reserved.
|
|
4
4
|
* https://latticegrid.dev
|
|
5
5
|
*/
|
|
@@ -48,34 +48,70 @@ points.push({lon,lat,size:Number.isFinite(size)?size:0,label:spec.label?grid.row
|
|
|
48
48
|
}
|
|
49
49
|
return{points,empty:points.length===0};
|
|
50
50
|
}
|
|
51
|
+
function packProjection(opts){
|
|
52
|
+
const{spec,plot,helpers}=opts;
|
|
53
|
+
if(!spec||!spec.shapes)return null;
|
|
54
|
+
const{
|
|
55
|
+
resolvePack,packRegions,fitted,resolveProjection,
|
|
56
|
+
}=helpers;
|
|
57
|
+
const resolved=resolvePack(spec.shapes,spec.layer);
|
|
58
|
+
if(!resolved)return null;
|
|
59
|
+
const regions=packRegions(resolved.topology);
|
|
60
|
+
const project=resolveProjection(
|
|
61
|
+
spec.projection||resolved.pack.projection,
|
|
62
|
+
{...(resolved.pack.projectionOptions||{}),...(spec.projectionOptions||{})},
|
|
63
|
+
);
|
|
64
|
+
const fit=fitted({project,rings:regions.flatMap((r)=>r.rings),plot});
|
|
65
|
+
return{to:fit.to,regions};
|
|
66
|
+
}
|
|
51
67
|
function drawBubbleMap(ctx){
|
|
52
68
|
const{
|
|
53
69
|
plot,bound,scheme,groups,spec,helpers,
|
|
54
70
|
}=ctx;
|
|
55
71
|
const{
|
|
56
|
-
extent,linearScale,sqrtScale,Pool,attrs,round,resolveScheme,NS,
|
|
72
|
+
extent,linearScale,sqrtScale,Pool,attrs,round,resolveScheme,NS,projectedPath,
|
|
57
73
|
}=helpers;
|
|
58
74
|
const sch=scheme||resolveScheme();
|
|
59
75
|
const colour=sch.series(0);
|
|
60
76
|
const{points}=bound;
|
|
77
|
+
const marks=new Pool(groups.marks);
|
|
78
|
+
const fit=packProjection({spec,plot,helpers});
|
|
79
|
+
let project;
|
|
80
|
+
if(fit){
|
|
81
|
+
for(const region of fit.regions){
|
|
82
|
+
const d=region.rings.map((ring)=>projectedPath(ring,fit.to)).filter(Boolean).join(' ');
|
|
83
|
+
if(!d)continue;
|
|
84
|
+
attrs(marks.next('path',`${NS}__region`),{
|
|
85
|
+
d,fill:'var(--lattice-chart-empty, #eceff1)',class:`${NS}__region`,
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
project=fit.to;
|
|
89
|
+
}else{
|
|
61
90
|
const lonD=extent(points.map((p)=>p.lon))||{min:0,max:1};
|
|
62
91
|
const latD=extent(points.map((p)=>p.lat))||{min:0,max:1};
|
|
63
92
|
const pad=Math.max(8,spec&&spec.maxRadius>0?spec.maxRadius:20);
|
|
64
93
|
const xScale=linearScale(lonD,[plot.left+pad,plot.right-pad]);
|
|
65
94
|
const yScale=linearScale(latD,[plot.bottom-pad,plot.top+pad]);
|
|
95
|
+
project=(lon,lat)=>[xScale.of(lon),yScale.of(lat)];
|
|
96
|
+
}
|
|
66
97
|
const sizeD=extent(points.map((p)=>p.size))||{min:0,max:1};
|
|
67
98
|
const rScale=sqrtScale({min:0,max:Math.max(1e-9,sizeD.max)},[2,spec&&spec.maxRadius>0?spec.maxRadius:20]);
|
|
68
|
-
const marks=new Pool(groups.marks);
|
|
69
99
|
const ordered=[...points].sort((a,b)=>b.size-a.size);
|
|
70
100
|
for(const p of ordered){
|
|
101
|
+
const[x,y]=project(p.lon,p.lat);
|
|
71
102
|
attrs(marks.next('circle',`${NS}__bubblemap-dot ${NS}__mark`),{
|
|
72
|
-
cx:round(
|
|
103
|
+
cx:round(x),
|
|
104
|
+
cy:round(y),
|
|
73
105
|
r:round(spec&&spec.size?rScale.of(p.size):4),
|
|
74
|
-
fill:colour,
|
|
106
|
+
fill:colour,
|
|
107
|
+
'fill-opacity':0.5,
|
|
108
|
+
stroke:colour,
|
|
109
|
+
'data-size':p.size,
|
|
110
|
+
class:`${NS}__bubblemap-dot ${NS}__mark`,
|
|
75
111
|
});
|
|
76
112
|
}
|
|
77
113
|
marks.finish();
|
|
78
|
-
return{points:points.length,legend:[]};
|
|
114
|
+
return{points:points.length,legend:[],packed:!!fit};
|
|
79
115
|
}
|
|
80
116
|
registerChartType('bubblemap',{draw:drawBubbleMap,bind:bindBubbleMap,freeform:true,labelled:false});
|
|
81
117
|
const __default=drawBubbleMap;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Lattice Grid 1.
|
|
2
|
+
* Lattice Grid 1.63.0, chart-bubblemap module
|
|
3
3
|
* Copyright (c) 2026 TOCLOCO Inc. All rights reserved.
|
|
4
4
|
* https://latticegrid.dev
|
|
5
5
|
*/
|
|
@@ -48,34 +48,70 @@ points.push({lon,lat,size:Number.isFinite(size)?size:0,label:spec.label?grid.row
|
|
|
48
48
|
}
|
|
49
49
|
return{points,empty:points.length===0};
|
|
50
50
|
}
|
|
51
|
+
function packProjection(opts){
|
|
52
|
+
const{spec,plot,helpers}=opts;
|
|
53
|
+
if(!spec||!spec.shapes)return null;
|
|
54
|
+
const{
|
|
55
|
+
resolvePack,packRegions,fitted,resolveProjection,
|
|
56
|
+
}=helpers;
|
|
57
|
+
const resolved=resolvePack(spec.shapes,spec.layer);
|
|
58
|
+
if(!resolved)return null;
|
|
59
|
+
const regions=packRegions(resolved.topology);
|
|
60
|
+
const project=resolveProjection(
|
|
61
|
+
spec.projection||resolved.pack.projection,
|
|
62
|
+
{...(resolved.pack.projectionOptions||{}),...(spec.projectionOptions||{})},
|
|
63
|
+
);
|
|
64
|
+
const fit=fitted({project,rings:regions.flatMap((r)=>r.rings),plot});
|
|
65
|
+
return{to:fit.to,regions};
|
|
66
|
+
}
|
|
51
67
|
function drawBubbleMap(ctx){
|
|
52
68
|
const{
|
|
53
69
|
plot,bound,scheme,groups,spec,helpers,
|
|
54
70
|
}=ctx;
|
|
55
71
|
const{
|
|
56
|
-
extent,linearScale,sqrtScale,Pool,attrs,round,resolveScheme,NS,
|
|
72
|
+
extent,linearScale,sqrtScale,Pool,attrs,round,resolveScheme,NS,projectedPath,
|
|
57
73
|
}=helpers;
|
|
58
74
|
const sch=scheme||resolveScheme();
|
|
59
75
|
const colour=sch.series(0);
|
|
60
76
|
const{points}=bound;
|
|
77
|
+
const marks=new Pool(groups.marks);
|
|
78
|
+
const fit=packProjection({spec,plot,helpers});
|
|
79
|
+
let project;
|
|
80
|
+
if(fit){
|
|
81
|
+
for(const region of fit.regions){
|
|
82
|
+
const d=region.rings.map((ring)=>projectedPath(ring,fit.to)).filter(Boolean).join(' ');
|
|
83
|
+
if(!d)continue;
|
|
84
|
+
attrs(marks.next('path',`${NS}__region`),{
|
|
85
|
+
d,fill:'var(--lattice-chart-empty, #eceff1)',class:`${NS}__region`,
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
project=fit.to;
|
|
89
|
+
}else{
|
|
61
90
|
const lonD=extent(points.map((p)=>p.lon))||{min:0,max:1};
|
|
62
91
|
const latD=extent(points.map((p)=>p.lat))||{min:0,max:1};
|
|
63
92
|
const pad=Math.max(8,spec&&spec.maxRadius>0?spec.maxRadius:20);
|
|
64
93
|
const xScale=linearScale(lonD,[plot.left+pad,plot.right-pad]);
|
|
65
94
|
const yScale=linearScale(latD,[plot.bottom-pad,plot.top+pad]);
|
|
95
|
+
project=(lon,lat)=>[xScale.of(lon),yScale.of(lat)];
|
|
96
|
+
}
|
|
66
97
|
const sizeD=extent(points.map((p)=>p.size))||{min:0,max:1};
|
|
67
98
|
const rScale=sqrtScale({min:0,max:Math.max(1e-9,sizeD.max)},[2,spec&&spec.maxRadius>0?spec.maxRadius:20]);
|
|
68
|
-
const marks=new Pool(groups.marks);
|
|
69
99
|
const ordered=[...points].sort((a,b)=>b.size-a.size);
|
|
70
100
|
for(const p of ordered){
|
|
101
|
+
const[x,y]=project(p.lon,p.lat);
|
|
71
102
|
attrs(marks.next('circle',`${NS}__bubblemap-dot ${NS}__mark`),{
|
|
72
|
-
cx:round(
|
|
103
|
+
cx:round(x),
|
|
104
|
+
cy:round(y),
|
|
73
105
|
r:round(spec&&spec.size?rScale.of(p.size):4),
|
|
74
|
-
fill:colour,
|
|
106
|
+
fill:colour,
|
|
107
|
+
'fill-opacity':0.5,
|
|
108
|
+
stroke:colour,
|
|
109
|
+
'data-size':p.size,
|
|
110
|
+
class:`${NS}__bubblemap-dot ${NS}__mark`,
|
|
75
111
|
});
|
|
76
112
|
}
|
|
77
113
|
marks.finish();
|
|
78
|
-
return{points:points.length,legend:[]};
|
|
114
|
+
return{points:points.length,legend:[],packed:!!fit};
|
|
79
115
|
}
|
|
80
116
|
registerChartType('bubblemap',{draw:drawBubbleMap,bind:bindBubbleMap,freeform:true,labelled:false});
|
|
81
117
|
const __default=drawBubbleMap;
|
package/modules/chart-bump.d.ts
CHANGED
package/modules/chart-fan.d.ts
CHANGED
package/modules/chart-fan.min.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Lattice Grid 1.
|
|
2
|
+
* Lattice Grid 1.63.0, chart-hexmap module
|
|
3
3
|
* Copyright (c) 2026 TOCLOCO Inc. All rights reserved.
|
|
4
4
|
* https://latticegrid.dev
|
|
5
5
|
*/
|
|
@@ -46,6 +46,22 @@ if(Number.isFinite(lon)&&Number.isFinite(lat))points.push({lon,lat});
|
|
|
46
46
|
}
|
|
47
47
|
return{points,empty:points.length===0};
|
|
48
48
|
}
|
|
49
|
+
function packProjection(opts){
|
|
50
|
+
const{spec,plot,helpers}=opts;
|
|
51
|
+
if(!spec||!spec.shapes)return null;
|
|
52
|
+
const{
|
|
53
|
+
resolvePack,packRegions,fitted,resolveProjection,
|
|
54
|
+
}=helpers;
|
|
55
|
+
const resolved=resolvePack(spec.shapes,spec.layer);
|
|
56
|
+
if(!resolved)return null;
|
|
57
|
+
const regions=packRegions(resolved.topology);
|
|
58
|
+
const project=resolveProjection(
|
|
59
|
+
spec.projection||resolved.pack.projection,
|
|
60
|
+
{...(resolved.pack.projectionOptions||{}),...(spec.projectionOptions||{})},
|
|
61
|
+
);
|
|
62
|
+
const fit=fitted({project,rings:regions.flatMap((r)=>r.rings),plot});
|
|
63
|
+
return{to:fit.to,regions};
|
|
64
|
+
}
|
|
49
65
|
function binHex(pts,r){
|
|
50
66
|
const dx=r*2*Math.sin(Math.PI/3);
|
|
51
67
|
const dy=r*1.5;
|
|
@@ -77,25 +93,43 @@ plot,bound,scheme,groups,spec,helpers,
|
|
|
77
93
|
}=ctx;
|
|
78
94
|
const{
|
|
79
95
|
extent,measureDomain,linearScale,colourRamp,Pool,attrs,path,round,resolveScheme,
|
|
96
|
+
projectedPath,
|
|
80
97
|
}=helpers;
|
|
81
98
|
const NS=helpers.NS;
|
|
82
99
|
const sch=scheme||resolveScheme();
|
|
83
100
|
const{points}=bound;
|
|
101
|
+
const marks=new Pool(groups.marks);
|
|
102
|
+
const fit=packProjection({spec,plot,helpers});
|
|
103
|
+
let project;
|
|
104
|
+
if(fit){
|
|
105
|
+
for(const region of fit.regions){
|
|
106
|
+
const d=region.rings.map((ring)=>projectedPath(ring,fit.to)).filter(Boolean).join(' ');
|
|
107
|
+
if(!d)continue;
|
|
108
|
+
attrs(marks.next('path',`${NS}__region`),{
|
|
109
|
+
d,fill:'var(--lattice-chart-empty, #eceff1)',class:`${NS}__region`,
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
project=fit.to;
|
|
113
|
+
}else{
|
|
84
114
|
const lonD=extent(points.map((p)=>p.lon))||{min:0,max:1};
|
|
85
115
|
const latD=extent(points.map((p)=>p.lat))||{min:0,max:1};
|
|
86
116
|
const xScale=linearScale(lonD,[plot.left,plot.right]);
|
|
87
117
|
const yScale=linearScale(latD,[plot.bottom,plot.top]);
|
|
118
|
+
project=(lon,lat)=>[xScale.of(lon),yScale.of(lat)];
|
|
119
|
+
}
|
|
88
120
|
const radius=spec&&Number.isFinite(spec.radius)&&spec.radius>0?spec.radius:DEFAULT_RADIUS;
|
|
89
|
-
const pixels=points.map((p)=>
|
|
121
|
+
const pixels=points.map((p)=>{
|
|
122
|
+
const[x,y]=project(p.lon,p.lat);
|
|
123
|
+
return{px:x,py:y};
|
|
124
|
+
});
|
|
90
125
|
const bins=binHex(pixels,radius);
|
|
91
|
-
if(!bins.length)return{empty:true,legend:[]};
|
|
126
|
+
if(!bins.length)return{empty:true,legend:[],packed:!!fit};
|
|
92
127
|
let maxCount=0;
|
|
93
128
|
for(const b of bins)if(b.count>maxCount)maxCount=b.count;
|
|
94
129
|
const ramp=colourRamp(measureDomain([0,maxCount],{zero:true}),false,sch);
|
|
95
130
|
const third=Math.PI/3;
|
|
96
131
|
const hex=[];
|
|
97
132
|
for(let i=0;i<6;i++)hex.push([Math.sin(i*third)*radius,-Math.cos(i*third)*radius]);
|
|
98
|
-
const marks=new Pool(groups.marks);
|
|
99
133
|
for(const bin of bins){
|
|
100
134
|
const parts=['M'];
|
|
101
135
|
for(let i=0;i<6;i++){
|
|
@@ -104,11 +138,17 @@ if(i<5)parts.push('L');
|
|
|
104
138
|
}
|
|
105
139
|
parts.push('Z');
|
|
106
140
|
attrs(marks.next('path',`${NS}__hexmap-cell ${NS}__mark`),{
|
|
107
|
-
d:path(parts),
|
|
141
|
+
d:path(parts),
|
|
142
|
+
fill:ramp(bin.count),
|
|
143
|
+
stroke:'none',
|
|
144
|
+
'data-count':bin.count,
|
|
145
|
+
class:`${NS}__hexmap-cell ${NS}__mark`,
|
|
108
146
|
});
|
|
109
147
|
}
|
|
110
148
|
marks.finish();
|
|
111
|
-
return{
|
|
149
|
+
return{
|
|
150
|
+
bins:bins.length,maxCount,legend:[],packed:!!fit,
|
|
151
|
+
};
|
|
112
152
|
}
|
|
113
153
|
registerChartType('hexmap',{draw:drawHexMap,bind:bindHexMap,freeform:true,labelled:false});
|
|
114
154
|
const __default=drawHexMap;
|