vue-chrts 2.0.0 → 2.1.0-beta-3
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/dist/components/AreaChart/AreaChart.js +141 -112
- package/dist/components/AreaChart/types.d.ts +33 -1
- package/dist/components/BarChart/BarChart.js +76 -65
- package/dist/components/BarChart/types.d.ts +9 -1
- package/dist/components/BubbleChart/BubbleChart.js +55 -45
- package/dist/components/BubbleChart/types.d.ts +9 -1
- package/dist/components/DagreGraph/DagreGraph.js +171 -0
- package/dist/components/DagreGraph/DagreGraph.vue.d.ts +33 -0
- package/dist/components/DagreGraph/DagreGraph2.js +4 -0
- package/dist/components/DagreGraph/types.d.ts +253 -0
- package/dist/components/DonutChart/DonutChart.js +69 -59
- package/dist/components/DonutChart/types.d.ts +14 -2
- package/dist/components/DualChart/DualChart.js +216 -0
- package/dist/components/DualChart/DualChart.vue.d.ts +21 -0
- package/dist/components/DualChart/DualChart2.js +4 -0
- package/dist/components/DualChart/types.d.ts +195 -0
- package/dist/components/GanttChart/GanttChart.js +58 -48
- package/dist/components/GanttChart/types.d.ts +9 -1
- package/dist/components/LineChart/LineChart.js +17 -9
- package/dist/components/Maps/DottedMap/DottedMap.js +170 -0
- package/dist/components/Maps/DottedMap/DottedMap.vue.d.ts +52 -0
- package/dist/components/Maps/DottedMap/DottedMap2.js +4 -0
- package/dist/components/Maps/DottedMap/MapLegend.vue.d.ts +6 -0
- package/dist/components/Maps/DottedMap/MapZoomControls.js +44 -0
- package/dist/components/Maps/DottedMap/MapZoomControls.vue.d.ts +13 -0
- package/dist/components/Maps/DottedMap/MapZoomControls2.js +4 -0
- package/dist/components/Maps/DottedMap/core.js +122 -0
- package/dist/components/Maps/DottedMap/core.vue.d.ts +36 -0
- package/dist/components/Maps/DottedMap/core2.js +4 -0
- package/dist/components/Maps/DottedMap/mapUtils.d.ts +49 -0
- package/dist/components/Maps/DottedMap/mapUtils.js +130 -0
- package/dist/components/Maps/DottedMap/pins.d.ts +9 -0
- package/dist/components/Maps/DottedMap/pins.js +58 -0
- package/dist/components/Maps/DottedMap/regions.d.ts +4 -0
- package/dist/components/Maps/DottedMap/regions.js +66 -0
- package/dist/components/Maps/DottedMap/types.d.ts +127 -0
- package/dist/components/Maps/DottedMap/useMapPanZoom.d.ts +22 -0
- package/dist/components/Maps/DottedMap/useMapPanZoom.js +41 -0
- package/dist/components/Maps/TopoJSONMap/TopoJSONMap.js +170 -0
- package/dist/components/Maps/TopoJSONMap/TopoJSONMap.vue.d.ts +30 -0
- package/dist/components/Maps/TopoJSONMap/TopoJSONMap2.js +4 -0
- package/dist/components/Maps/TopoJSONMap/data.d.ts +13 -0
- package/dist/components/Maps/TopoJSONMap/types.d.ts +40 -0
- package/dist/components/Maps/types.d.ts +48 -0
- package/dist/components/SankeyChart/SankeyChart.js +133 -0
- package/dist/components/SankeyChart/SankeyChart.vue.d.ts +22 -0
- package/dist/components/SankeyChart/SankeyChart2.js +4 -0
- package/dist/components/SankeyChart/types.d.ts +116 -0
- package/dist/components/Tooltip.js +32 -27
- package/dist/data/countries.geo.json.js +9 -0
- package/dist/index.d.ts +8 -2
- package/dist/index.js +25 -12
- package/dist/node_modules/.pnpm/@turf_boolean-point-in-polygon@7.3.1/node_modules/@turf/boolean-point-in-polygon/dist/esm/index.js +28 -0
- package/dist/node_modules/.pnpm/@turf_invariant@7.3.1/node_modules/@turf/invariant/dist/esm/index.js +20 -0
- package/dist/node_modules/.pnpm/mgrs@1.0.0/node_modules/mgrs/mgrs.js +222 -0
- package/dist/node_modules/.pnpm/point-in-polygon-hao@1.2.4/node_modules/point-in-polygon-hao/dist/esm/index.js +25 -0
- package/dist/node_modules/.pnpm/proj4@2.20.2/node_modules/proj4/lib/Point.js +24 -0
- package/dist/node_modules/.pnpm/proj4@2.20.2/node_modules/proj4/lib/Proj.js +46 -0
- package/dist/node_modules/.pnpm/proj4@2.20.2/node_modules/proj4/lib/adjust_axis.js +31 -0
- package/dist/node_modules/.pnpm/proj4@2.20.2/node_modules/proj4/lib/checkSanity.js +15 -0
- package/dist/node_modules/.pnpm/proj4@2.20.2/node_modules/proj4/lib/common/adjust_lat.js +8 -0
- package/dist/node_modules/.pnpm/proj4@2.20.2/node_modules/proj4/lib/common/adjust_lon.js +8 -0
- package/dist/node_modules/.pnpm/proj4@2.20.2/node_modules/proj4/lib/common/adjust_zone.js +13 -0
- package/dist/node_modules/.pnpm/proj4@2.20.2/node_modules/proj4/lib/common/asinhy.js +9 -0
- package/dist/node_modules/.pnpm/proj4@2.20.2/node_modules/proj4/lib/common/asinz.js +6 -0
- package/dist/node_modules/.pnpm/proj4@2.20.2/node_modules/proj4/lib/common/clens.js +8 -0
- package/dist/node_modules/.pnpm/proj4@2.20.2/node_modules/proj4/lib/common/clens_cmplx.js +10 -0
- package/dist/node_modules/.pnpm/proj4@2.20.2/node_modules/proj4/lib/common/cosh.js +7 -0
- package/dist/node_modules/.pnpm/proj4@2.20.2/node_modules/proj4/lib/common/e0fn.js +6 -0
- package/dist/node_modules/.pnpm/proj4@2.20.2/node_modules/proj4/lib/common/e1fn.js +6 -0
- package/dist/node_modules/.pnpm/proj4@2.20.2/node_modules/proj4/lib/common/e2fn.js +6 -0
- package/dist/node_modules/.pnpm/proj4@2.20.2/node_modules/proj4/lib/common/e3fn.js +6 -0
- package/dist/node_modules/.pnpm/proj4@2.20.2/node_modules/proj4/lib/common/gN.js +7 -0
- package/dist/node_modules/.pnpm/proj4@2.20.2/node_modules/proj4/lib/common/gatg.js +8 -0
- package/dist/node_modules/.pnpm/proj4@2.20.2/node_modules/proj4/lib/common/hypot.js +8 -0
- package/dist/node_modules/.pnpm/proj4@2.20.2/node_modules/proj4/lib/common/imlfn.js +11 -0
- package/dist/node_modules/.pnpm/proj4@2.20.2/node_modules/proj4/lib/common/iqsfnz.js +13 -0
- package/dist/node_modules/.pnpm/proj4@2.20.2/node_modules/proj4/lib/common/log1py.js +7 -0
- package/dist/node_modules/.pnpm/proj4@2.20.2/node_modules/proj4/lib/common/mlfn.js +6 -0
- package/dist/node_modules/.pnpm/proj4@2.20.2/node_modules/proj4/lib/common/msfnz.js +7 -0
- package/dist/node_modules/.pnpm/proj4@2.20.2/node_modules/proj4/lib/common/phi2z.js +10 -0
- package/dist/node_modules/.pnpm/proj4@2.20.2/node_modules/proj4/lib/common/pj_enfn.js +10 -0
- package/dist/node_modules/.pnpm/proj4@2.20.2/node_modules/proj4/lib/common/pj_inv_mlfn.js +14 -0
- package/dist/node_modules/.pnpm/proj4@2.20.2/node_modules/proj4/lib/common/pj_mlfn.js +6 -0
- package/dist/node_modules/.pnpm/proj4@2.20.2/node_modules/proj4/lib/common/qsfnz.js +7 -0
- package/dist/node_modules/.pnpm/proj4@2.20.2/node_modules/proj4/lib/common/sign.js +6 -0
- package/dist/node_modules/.pnpm/proj4@2.20.2/node_modules/proj4/lib/common/sinh.js +7 -0
- package/dist/node_modules/.pnpm/proj4@2.20.2/node_modules/proj4/lib/common/srat.js +6 -0
- package/dist/node_modules/.pnpm/proj4@2.20.2/node_modules/proj4/lib/common/toPoint.js +10 -0
- package/dist/node_modules/.pnpm/proj4@2.20.2/node_modules/proj4/lib/common/tsfnz.js +8 -0
- package/dist/node_modules/.pnpm/proj4@2.20.2/node_modules/proj4/lib/common/vincenty.js +33 -0
- package/dist/node_modules/.pnpm/proj4@2.20.2/node_modules/proj4/lib/constants/Datum.js +1278 -0
- package/dist/node_modules/.pnpm/proj4@2.20.2/node_modules/proj4/lib/constants/Ellipsoid.js +226 -0
- package/dist/node_modules/.pnpm/proj4@2.20.2/node_modules/proj4/lib/constants/PrimeMeridian.js +17 -0
- package/dist/node_modules/.pnpm/proj4@2.20.2/node_modules/proj4/lib/constants/units.js +25 -0
- package/dist/node_modules/.pnpm/proj4@2.20.2/node_modules/proj4/lib/constants/values.js +22 -0
- package/dist/node_modules/.pnpm/proj4@2.20.2/node_modules/proj4/lib/core.js +65 -0
- package/dist/node_modules/.pnpm/proj4@2.20.2/node_modules/proj4/lib/datum.js +8 -0
- package/dist/node_modules/.pnpm/proj4@2.20.2/node_modules/proj4/lib/datumUtils.js +82 -0
- package/dist/node_modules/.pnpm/proj4@2.20.2/node_modules/proj4/lib/datum_transform.js +94 -0
- package/dist/node_modules/.pnpm/proj4@2.20.2/node_modules/proj4/lib/defs.js +39 -0
- package/dist/node_modules/.pnpm/proj4@2.20.2/node_modules/proj4/lib/deriveConstants.js +30 -0
- package/dist/node_modules/.pnpm/proj4@2.20.2/node_modules/proj4/lib/extend.js +12 -0
- package/dist/node_modules/.pnpm/proj4@2.20.2/node_modules/proj4/lib/global.js +9 -0
- package/dist/node_modules/.pnpm/proj4@2.20.2/node_modules/proj4/lib/index.js +25 -0
- package/dist/node_modules/.pnpm/proj4@2.20.2/node_modules/proj4/lib/match.js +11 -0
- package/dist/node_modules/.pnpm/proj4@2.20.2/node_modules/proj4/lib/nadgrid.js +128 -0
- package/dist/node_modules/.pnpm/proj4@2.20.2/node_modules/proj4/lib/parseCode.js +47 -0
- package/dist/node_modules/.pnpm/proj4@2.20.2/node_modules/proj4/lib/projString.js +119 -0
- package/dist/node_modules/.pnpm/proj4@2.20.2/node_modules/proj4/lib/projections/aea.js +43 -0
- package/dist/node_modules/.pnpm/proj4@2.20.2/node_modules/proj4/lib/projections/aeqd.js +36 -0
- package/dist/node_modules/.pnpm/proj4@2.20.2/node_modules/proj4/lib/projections/bonne.js +55 -0
- package/dist/node_modules/.pnpm/proj4@2.20.2/node_modules/proj4/lib/projections/cass.js +52 -0
- package/dist/node_modules/.pnpm/proj4@2.20.2/node_modules/proj4/lib/projections/cea.js +36 -0
- package/dist/node_modules/.pnpm/proj4@2.20.2/node_modules/proj4/lib/projections/eqc.js +27 -0
- package/dist/node_modules/.pnpm/proj4@2.20.2/node_modules/proj4/lib/projections/eqdc.js +48 -0
- package/dist/node_modules/.pnpm/proj4@2.20.2/node_modules/proj4/lib/projections/eqearth.js +30 -0
- package/dist/node_modules/.pnpm/proj4@2.20.2/node_modules/proj4/lib/projections/etmerc.js +54 -0
- package/dist/node_modules/.pnpm/proj4@2.20.2/node_modules/proj4/lib/projections/gauss.js +27 -0
- package/dist/node_modules/.pnpm/proj4@2.20.2/node_modules/proj4/lib/projections/geocent.js +26 -0
- package/dist/node_modules/.pnpm/proj4@2.20.2/node_modules/proj4/lib/projections/geos.js +49 -0
- package/dist/node_modules/.pnpm/proj4@2.20.2/node_modules/proj4/lib/projections/gnom.js +28 -0
- package/dist/node_modules/.pnpm/proj4@2.20.2/node_modules/proj4/lib/projections/krovak.js +31 -0
- package/dist/node_modules/.pnpm/proj4@2.20.2/node_modules/proj4/lib/projections/laea.js +134 -0
- package/dist/node_modules/.pnpm/proj4@2.20.2/node_modules/proj4/lib/projections/lcc.js +61 -0
- package/dist/node_modules/.pnpm/proj4@2.20.2/node_modules/proj4/lib/projections/longlat.js +19 -0
- package/dist/node_modules/.pnpm/proj4@2.20.2/node_modules/proj4/lib/projections/merc.js +49 -0
- package/dist/node_modules/.pnpm/proj4@2.20.2/node_modules/proj4/lib/projections/mill.js +26 -0
- package/dist/node_modules/.pnpm/proj4@2.20.2/node_modules/proj4/lib/projections/moll.js +37 -0
- package/dist/node_modules/.pnpm/proj4@2.20.2/node_modules/proj4/lib/projections/nzmg.js +48 -0
- package/dist/node_modules/.pnpm/proj4@2.20.2/node_modules/proj4/lib/projections/ob_tran.js +173 -0
- package/dist/node_modules/.pnpm/proj4@2.20.2/node_modules/proj4/lib/projections/omerc.js +58 -0
- package/dist/node_modules/.pnpm/proj4@2.20.2/node_modules/proj4/lib/projections/ortho.js +28 -0
- package/dist/node_modules/.pnpm/proj4@2.20.2/node_modules/proj4/lib/projections/poly.js +68 -0
- package/dist/node_modules/.pnpm/proj4@2.20.2/node_modules/proj4/lib/projections/qsc.js +67 -0
- package/dist/node_modules/.pnpm/proj4@2.20.2/node_modules/proj4/lib/projections/robin.js +104 -0
- package/dist/node_modules/.pnpm/proj4@2.20.2/node_modules/proj4/lib/projections/sinu.js +47 -0
- package/dist/node_modules/.pnpm/proj4@2.20.2/node_modules/proj4/lib/projections/somerc.js +34 -0
- package/dist/node_modules/.pnpm/proj4@2.20.2/node_modules/proj4/lib/projections/stere.js +46 -0
- package/dist/node_modules/.pnpm/proj4@2.20.2/node_modules/proj4/lib/projections/sterea.js +33 -0
- package/dist/node_modules/.pnpm/proj4@2.20.2/node_modules/proj4/lib/projections/tmerc.js +60 -0
- package/dist/node_modules/.pnpm/proj4@2.20.2/node_modules/proj4/lib/projections/tpers.js +110 -0
- package/dist/node_modules/.pnpm/proj4@2.20.2/node_modules/proj4/lib/projections/utm.js +22 -0
- package/dist/node_modules/.pnpm/proj4@2.20.2/node_modules/proj4/lib/projections/vandg.js +34 -0
- package/dist/node_modules/.pnpm/proj4@2.20.2/node_modules/proj4/lib/projections.js +34 -0
- package/dist/node_modules/.pnpm/proj4@2.20.2/node_modules/proj4/lib/transform.js +49 -0
- package/dist/node_modules/.pnpm/proj4@2.20.2/node_modules/proj4/projs.js +38 -0
- package/dist/node_modules/.pnpm/robust-predicates@3.0.2/node_modules/robust-predicates/esm/orient2d.js +23 -0
- package/dist/node_modules/.pnpm/robust-predicates@3.0.2/node_modules/robust-predicates/esm/util.js +30 -0
- package/dist/node_modules/.pnpm/wkt-parser@1.5.2/node_modules/wkt-parser/PROJJSONBuilder2015.js +9 -0
- package/dist/node_modules/.pnpm/wkt-parser@1.5.2/node_modules/wkt-parser/PROJJSONBuilder2019.js +20 -0
- package/dist/node_modules/.pnpm/wkt-parser@1.5.2/node_modules/wkt-parser/PROJJSONBuilderBase.js +171 -0
- package/dist/node_modules/.pnpm/wkt-parser@1.5.2/node_modules/wkt-parser/buildPROJJSON.js +11 -0
- package/dist/node_modules/.pnpm/wkt-parser@1.5.2/node_modules/wkt-parser/detectWKTVersion.js +7 -0
- package/dist/node_modules/.pnpm/wkt-parser@1.5.2/node_modules/wkt-parser/index.js +104 -0
- package/dist/node_modules/.pnpm/wkt-parser@1.5.2/node_modules/wkt-parser/parser.js +117 -0
- package/dist/node_modules/.pnpm/wkt-parser@1.5.2/node_modules/wkt-parser/process.js +89 -0
- package/dist/node_modules/.pnpm/wkt-parser@1.5.2/node_modules/wkt-parser/transformPROJJSON.js +73 -0
- package/dist/node_modules/.pnpm/wkt-parser@1.5.2/node_modules/wkt-parser/util.js +12 -0
- package/dist/types.d.ts +21 -1
- package/dist/utils/geoJsonToGrid.d.ts +14 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils.d.ts +3 -0
- package/dist/utils.js +35 -31
- package/package.json +15 -9
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { GeoProjection } from 'd3-geo';
|
|
2
|
+
import { axisFormatter, BulletLegendItemInterface, LegendPosition } from '../../../types';
|
|
3
|
+
import { MapData, MapPoint } from '../types';
|
|
4
|
+
export type MapsData<T extends Record<string, any>> = {
|
|
5
|
+
mapFeatureKey: keyof T;
|
|
6
|
+
data: MapData;
|
|
7
|
+
topojson: any;
|
|
8
|
+
zoomFactor?: number;
|
|
9
|
+
zoomExtent?: [number, number];
|
|
10
|
+
projection?: GeoProjection;
|
|
11
|
+
areaColor?: string | ((d: any) => string);
|
|
12
|
+
areaCursor?: string | ((d: any) => string);
|
|
13
|
+
pointColor?: string | ((d: MapPoint) => string);
|
|
14
|
+
pointSize?: number | ((d: MapPoint) => number);
|
|
15
|
+
pointLabel?: (d: MapPoint) => string;
|
|
16
|
+
pointCursor?: string | ((d: MapPoint) => string);
|
|
17
|
+
linkColor?: string | ((d: any) => string);
|
|
18
|
+
linkWidth?: number | ((d: any) => number);
|
|
19
|
+
linkCursor?: string | ((d: any) => string);
|
|
20
|
+
height?: string | number;
|
|
21
|
+
width?: string | number;
|
|
22
|
+
fitView?: boolean;
|
|
23
|
+
fitViewPadding?: number;
|
|
24
|
+
hideTooltip?: boolean;
|
|
25
|
+
tooltipTitleFormatter?: (data: T) => string | number;
|
|
26
|
+
yFormatter?: axisFormatter;
|
|
27
|
+
categories?: Record<string, BulletLegendItemInterface>;
|
|
28
|
+
legendPosition?: LegendPosition;
|
|
29
|
+
legendStyle?: any;
|
|
30
|
+
hideLegend?: boolean;
|
|
31
|
+
duration?: number;
|
|
32
|
+
pointStrokeWidth?: number | ((d: MapPoint) => number);
|
|
33
|
+
mapFitToPoints?: boolean;
|
|
34
|
+
padding?: {
|
|
35
|
+
top: number;
|
|
36
|
+
right: number;
|
|
37
|
+
bottom: number;
|
|
38
|
+
left: number;
|
|
39
|
+
};
|
|
40
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
export type MapPoint = {
|
|
2
|
+
id: string;
|
|
3
|
+
latitude: number;
|
|
4
|
+
longitude: number;
|
|
5
|
+
color?: string;
|
|
6
|
+
[key: string]: any;
|
|
7
|
+
};
|
|
8
|
+
export type MapLink = {
|
|
9
|
+
source: string | number | MapPoint;
|
|
10
|
+
target: string | number | MapPoint;
|
|
11
|
+
color?: string;
|
|
12
|
+
width?: number;
|
|
13
|
+
};
|
|
14
|
+
export type MapArea = {
|
|
15
|
+
id: string;
|
|
16
|
+
color?: string;
|
|
17
|
+
[key: string]: any;
|
|
18
|
+
};
|
|
19
|
+
export type MapData = {
|
|
20
|
+
points?: MapPoint[];
|
|
21
|
+
links?: MapLink[];
|
|
22
|
+
areas?: MapArea[];
|
|
23
|
+
};
|
|
24
|
+
export interface TopoJSONMapProps {
|
|
25
|
+
mapType: 'uk' | 'france' | 'usa';
|
|
26
|
+
data: MapData;
|
|
27
|
+
width?: number;
|
|
28
|
+
height?: number;
|
|
29
|
+
disableZoom?: boolean;
|
|
30
|
+
zoomFactor?: number;
|
|
31
|
+
zoomExtent?: [number, number];
|
|
32
|
+
zoomDuration?: number;
|
|
33
|
+
mapFitToPoints?: boolean;
|
|
34
|
+
pointColor?: string | ((d: MapPoint) => string);
|
|
35
|
+
pointRadius?: number | ((d: MapPoint) => number);
|
|
36
|
+
pointStrokeWidth?: number | ((d: MapPoint) => number);
|
|
37
|
+
pointCursor?: string | ((d: MapPoint) => string);
|
|
38
|
+
pointLabel?: (d: MapPoint) => string;
|
|
39
|
+
linkColor?: string | ((d: MapLink) => string);
|
|
40
|
+
linkWidth?: number | ((d: MapLink) => number);
|
|
41
|
+
linkCursor?: string | ((d: MapLink) => string);
|
|
42
|
+
areaColor?: string | ((d: MapArea) => string);
|
|
43
|
+
areaCursor?: string | ((d: MapArea) => string);
|
|
44
|
+
heatmapMode?: boolean;
|
|
45
|
+
heatmapModeBlurStdDeviation?: number;
|
|
46
|
+
heatmapModeZoomLevelThreshold?: number;
|
|
47
|
+
projection?: any;
|
|
48
|
+
}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { defineComponent as W, useSlots as x, useTemplateRef as V, ref as L, computed as f, createElementBlock as c, openBlock as d, normalizeStyle as r, createVNode as a, createCommentVNode as s, createElementVNode as p, unref as o, withCtx as P, createBlock as w, renderSlot as h } from "vue";
|
|
2
|
+
import { SankeyNodeAlign as A, Sankey as B } from "@unovis/ts";
|
|
3
|
+
import { VisSingleContainer as N, VisTooltip as H, VisSankey as T, VisBulletLegend as z } from "@unovis/vue";
|
|
4
|
+
import M from "../Tooltip.js";
|
|
5
|
+
import { LegendPosition as O } from "../../types.js";
|
|
6
|
+
const F = {
|
|
7
|
+
ref: "slotWrapper",
|
|
8
|
+
style: { display: "none" }
|
|
9
|
+
}, J = /* @__PURE__ */ W({
|
|
10
|
+
__name: "SankeyChart",
|
|
11
|
+
props: {
|
|
12
|
+
data: {},
|
|
13
|
+
height: {},
|
|
14
|
+
padding: { default: () => ({
|
|
15
|
+
top: 5,
|
|
16
|
+
right: 5,
|
|
17
|
+
bottom: 5,
|
|
18
|
+
left: 5
|
|
19
|
+
}) },
|
|
20
|
+
categories: {},
|
|
21
|
+
hideLegend: { type: Boolean, default: !1 },
|
|
22
|
+
legendPosition: { default: O.BottomCenter },
|
|
23
|
+
legendStyle: { default: void 0 },
|
|
24
|
+
label: {},
|
|
25
|
+
subLabel: {},
|
|
26
|
+
nodeColor: {},
|
|
27
|
+
linkColor: {},
|
|
28
|
+
linkValue: {},
|
|
29
|
+
nodeWidth: { default: 10 },
|
|
30
|
+
nodeAlign: { default: A.Justify },
|
|
31
|
+
nodePadding: { default: 10 },
|
|
32
|
+
nodeSort: {},
|
|
33
|
+
linkSort: {},
|
|
34
|
+
iterations: { default: 32 },
|
|
35
|
+
hideTooltip: { type: Boolean },
|
|
36
|
+
tooltip: { default: () => ({
|
|
37
|
+
followCursor: !0
|
|
38
|
+
}) },
|
|
39
|
+
highlightSubtreeOnHover: { type: Boolean, default: !1 },
|
|
40
|
+
labelFontSize: {},
|
|
41
|
+
labelColor: {},
|
|
42
|
+
labelMaxWidth: { default: 70 },
|
|
43
|
+
duration: { default: 600 }
|
|
44
|
+
},
|
|
45
|
+
emits: ["click"],
|
|
46
|
+
setup(e, { emit: y }) {
|
|
47
|
+
const b = y, t = e, m = x(), k = V("slotWrapper"), i = L(), S = f(() => t.legendPosition.startsWith("top")), C = f(() => t.legendPosition.includes("left") ? "flex-start" : t.legendPosition.includes("right") ? "flex-end" : "center");
|
|
48
|
+
function v(n) {
|
|
49
|
+
i.value = n;
|
|
50
|
+
}
|
|
51
|
+
return (n, u) => (d(), c("div", {
|
|
52
|
+
style: r({
|
|
53
|
+
display: "flex",
|
|
54
|
+
flexDirection: S.value ? "column-reverse" : "column",
|
|
55
|
+
gap: "var(--vis-legend-spacing)"
|
|
56
|
+
}),
|
|
57
|
+
onClick: u[0] || (u[0] = (l) => b("click", l))
|
|
58
|
+
}, [
|
|
59
|
+
a(o(N), {
|
|
60
|
+
padding: e.padding,
|
|
61
|
+
height: e.height,
|
|
62
|
+
duration: e.duration
|
|
63
|
+
}, {
|
|
64
|
+
default: P(() => [
|
|
65
|
+
e.hideTooltip ? s("", !0) : (d(), w(o(H), {
|
|
66
|
+
key: 0,
|
|
67
|
+
followCursor: t.tooltip.followCursor,
|
|
68
|
+
"show-delay": t.tooltip.showDelay,
|
|
69
|
+
"hide-delay": t.tooltip.hideDelay,
|
|
70
|
+
triggers: {
|
|
71
|
+
[o(B).selectors.node]: (l) => {
|
|
72
|
+
var g;
|
|
73
|
+
return v(l), l ? (g = k.value) == null ? void 0 : g.innerHTML : "";
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}, null, 8, ["followCursor", "show-delay", "hide-delay", "triggers"])),
|
|
77
|
+
a(o(T), {
|
|
78
|
+
data: e.data,
|
|
79
|
+
label: e.label,
|
|
80
|
+
subLabel: e.subLabel,
|
|
81
|
+
nodeColor: e.nodeColor,
|
|
82
|
+
linkColor: e.linkColor,
|
|
83
|
+
linkValue: e.linkValue,
|
|
84
|
+
nodeWidth: e.nodeWidth,
|
|
85
|
+
nodeAlign: e.nodeAlign,
|
|
86
|
+
nodePadding: e.nodePadding,
|
|
87
|
+
nodeSort: e.nodeSort,
|
|
88
|
+
linkSort: e.linkSort,
|
|
89
|
+
iterations: e.iterations,
|
|
90
|
+
highlightSubtreeOnHover: e.highlightSubtreeOnHover,
|
|
91
|
+
labelFontSize: e.labelFontSize,
|
|
92
|
+
labelColor: e.labelColor,
|
|
93
|
+
labelMaxWidth: e.labelMaxWidth
|
|
94
|
+
}, null, 8, ["data", "label", "subLabel", "nodeColor", "linkColor", "linkValue", "nodeWidth", "nodeAlign", "nodePadding", "nodeSort", "linkSort", "iterations", "highlightSubtreeOnHover", "labelFontSize", "labelColor", "labelMaxWidth"])
|
|
95
|
+
]),
|
|
96
|
+
_: 1
|
|
97
|
+
}, 8, ["padding", "height", "duration"]),
|
|
98
|
+
!t.hideLegend && t.categories ? (d(), c("div", {
|
|
99
|
+
key: 0,
|
|
100
|
+
style: r({
|
|
101
|
+
display: "flex",
|
|
102
|
+
justifyContent: C.value
|
|
103
|
+
})
|
|
104
|
+
}, [
|
|
105
|
+
a(o(z), {
|
|
106
|
+
style: r([
|
|
107
|
+
t.legendStyle,
|
|
108
|
+
"display: flex; gap: var(--vis-legend-spacing);"
|
|
109
|
+
]),
|
|
110
|
+
items: Object.values(t.categories).map((l) => ({
|
|
111
|
+
...l,
|
|
112
|
+
color: Array.isArray(l.color) ? l.color[0] : l.color
|
|
113
|
+
}))
|
|
114
|
+
}, null, 8, ["style", "items"])
|
|
115
|
+
], 4)) : s("", !0),
|
|
116
|
+
p("div", F, [
|
|
117
|
+
o(m).tooltip ? h(n.$slots, "tooltip", {
|
|
118
|
+
key: 0,
|
|
119
|
+
node: i.value
|
|
120
|
+
}) : i.value ? h(n.$slots, "fallback", { key: 1 }, () => [
|
|
121
|
+
a(M, {
|
|
122
|
+
data: i.value,
|
|
123
|
+
categories: t.categories ?? {},
|
|
124
|
+
"title-formatter": (l) => l.label || l.id || "Node"
|
|
125
|
+
}, null, 8, ["data", "categories", "title-formatter"])
|
|
126
|
+
]) : s("", !0)
|
|
127
|
+
], 512)
|
|
128
|
+
], 4));
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
export {
|
|
132
|
+
J as default
|
|
133
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { SankeyInputNode, SankeyInputLink } from '@unovis/ts';
|
|
2
|
+
import { SankeyChartProps } from './types';
|
|
3
|
+
declare const _default: <N extends SankeyInputNode, L extends SankeyInputLink>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
4
|
+
props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{
|
|
5
|
+
readonly onClick?: ((event: MouseEvent) => any) | undefined;
|
|
6
|
+
} & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>, "onClick"> & SankeyChartProps<N, L> & Partial<{}>> & import('vue').PublicProps;
|
|
7
|
+
expose(exposed: import('vue').ShallowUnwrapRef<{}>): void;
|
|
8
|
+
attrs: any;
|
|
9
|
+
slots: {
|
|
10
|
+
tooltip?(_: {
|
|
11
|
+
node: any;
|
|
12
|
+
}): any;
|
|
13
|
+
fallback?(_: {}): any;
|
|
14
|
+
};
|
|
15
|
+
emit: (e: "click", event: MouseEvent) => void;
|
|
16
|
+
}>) => import('vue').VNode & {
|
|
17
|
+
__ctx?: Awaited<typeof __VLS_setup>;
|
|
18
|
+
};
|
|
19
|
+
export default _default;
|
|
20
|
+
type __VLS_PrettifyLocal<T> = {
|
|
21
|
+
[K in keyof T]: T[K];
|
|
22
|
+
} & {};
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { BulletLegendItemInterface, LegendPosition, TooltipConfig } from '../../types';
|
|
2
|
+
import { SankeyInputNode, SankeyInputLink, SankeyNodeAlign } from '@unovis/ts';
|
|
3
|
+
export type SankeyChartProps<N extends SankeyInputNode, L extends SankeyInputLink> = {
|
|
4
|
+
/**
|
|
5
|
+
* The data to be displayed in the Sankey diagram.
|
|
6
|
+
* Contains nodes and links representing the flow between entities.
|
|
7
|
+
*/
|
|
8
|
+
data: {
|
|
9
|
+
nodes: N[];
|
|
10
|
+
links: L[];
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* The height of the chart in pixels.
|
|
14
|
+
*/
|
|
15
|
+
height: number;
|
|
16
|
+
/**
|
|
17
|
+
* Optional padding applied to the chart.
|
|
18
|
+
* Allows specifying individual padding values for the top, right, bottom, and left sides.
|
|
19
|
+
*/
|
|
20
|
+
padding?: {
|
|
21
|
+
top: number;
|
|
22
|
+
right: number;
|
|
23
|
+
bottom: number;
|
|
24
|
+
left: number;
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* A record mapping category keys to `BulletLegendItemInterface` objects.
|
|
28
|
+
* This defines the visual representation and labels for each category in the chart's legend.
|
|
29
|
+
*/
|
|
30
|
+
categories?: Record<string, BulletLegendItemInterface>;
|
|
31
|
+
/**
|
|
32
|
+
* If `true`, hides the chart legend.
|
|
33
|
+
*/
|
|
34
|
+
hideLegend?: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Optional position for the legend, if applicable.
|
|
37
|
+
* See `LegendPosition` for available options.
|
|
38
|
+
*/
|
|
39
|
+
legendPosition?: LegendPosition;
|
|
40
|
+
/**
|
|
41
|
+
* Optional style object for the legend container. Allows custom CSS styling.
|
|
42
|
+
*/
|
|
43
|
+
legendStyle?: string | Record<string, string>;
|
|
44
|
+
/**
|
|
45
|
+
* Node label accessor function or value.
|
|
46
|
+
*/
|
|
47
|
+
label?: (node: N) => string;
|
|
48
|
+
/**
|
|
49
|
+
* Node sub-label accessor function or value.
|
|
50
|
+
*/
|
|
51
|
+
subLabel?: (node: N) => string;
|
|
52
|
+
/**
|
|
53
|
+
* Node color accessor function or value.
|
|
54
|
+
*/
|
|
55
|
+
nodeColor?: (node: N) => string;
|
|
56
|
+
/**
|
|
57
|
+
* Link color accessor function or value.
|
|
58
|
+
*/
|
|
59
|
+
linkColor?: (link: L) => string;
|
|
60
|
+
/**
|
|
61
|
+
* Link value accessor function or value.
|
|
62
|
+
*/
|
|
63
|
+
linkValue?: (link: L) => number;
|
|
64
|
+
/**
|
|
65
|
+
* Sankey node width in pixels. Default: 10
|
|
66
|
+
*/
|
|
67
|
+
nodeWidth?: number;
|
|
68
|
+
/**
|
|
69
|
+
* Sankey node alignment method. Default: 'justify'
|
|
70
|
+
*/
|
|
71
|
+
nodeAlign?: SankeyNodeAlign;
|
|
72
|
+
/**
|
|
73
|
+
* Sankey vertical separation between nodes in pixels. Default: 10
|
|
74
|
+
*/
|
|
75
|
+
nodePadding?: number;
|
|
76
|
+
/**
|
|
77
|
+
* Node sorting function.
|
|
78
|
+
*/
|
|
79
|
+
nodeSort?: (node1: any, node2: any) => number;
|
|
80
|
+
/**
|
|
81
|
+
* Link sorting function.
|
|
82
|
+
*/
|
|
83
|
+
linkSort?: (link1: any, link2: any) => number;
|
|
84
|
+
/**
|
|
85
|
+
* Sankey algorithm iterations. Default: 32
|
|
86
|
+
*/
|
|
87
|
+
iterations?: number;
|
|
88
|
+
/**
|
|
89
|
+
* If `true`, hides the chart tooltip.
|
|
90
|
+
*/
|
|
91
|
+
hideTooltip?: boolean;
|
|
92
|
+
/**
|
|
93
|
+
* Configuration object for the chart tooltip.
|
|
94
|
+
*/
|
|
95
|
+
tooltip?: TooltipConfig;
|
|
96
|
+
/**
|
|
97
|
+
* Highlight the corresponding subtree on node / link hover. Default: false
|
|
98
|
+
*/
|
|
99
|
+
highlightSubtreeOnHover?: boolean;
|
|
100
|
+
/**
|
|
101
|
+
* Label font size in pixels.
|
|
102
|
+
*/
|
|
103
|
+
labelFontSize?: number;
|
|
104
|
+
/**
|
|
105
|
+
* Label color accessor function or value.
|
|
106
|
+
*/
|
|
107
|
+
labelColor?: (node: N) => string;
|
|
108
|
+
/**
|
|
109
|
+
* Maximum label width in pixels. Default: 70
|
|
110
|
+
*/
|
|
111
|
+
labelMaxWidth?: number;
|
|
112
|
+
/**
|
|
113
|
+
* Animation duration in milliseconds.
|
|
114
|
+
*/
|
|
115
|
+
duration?: number;
|
|
116
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { getFirstPropertyValue as
|
|
3
|
-
const
|
|
1
|
+
import { defineComponent as w, computed as l, createElementBlock as a, openBlock as n, createElementVNode as s, createCommentVNode as k, normalizeStyle as d, toDisplayString as m, Fragment as g, renderList as B } from "vue";
|
|
2
|
+
import { getFirstPropertyValue as C } from "../utils.js";
|
|
3
|
+
const _ = /* @__PURE__ */ w({
|
|
4
4
|
__name: "Tooltip",
|
|
5
5
|
props: {
|
|
6
6
|
data: {},
|
|
@@ -8,42 +8,42 @@ const C = /* @__PURE__ */ F({
|
|
|
8
8
|
titleFormatter: { type: Function },
|
|
9
9
|
yFormatter: { type: Function }
|
|
10
10
|
},
|
|
11
|
-
setup(
|
|
12
|
-
const t =
|
|
13
|
-
() => t.titleFormatter ? t.titleFormatter(t.data) :
|
|
14
|
-
),
|
|
15
|
-
([e,
|
|
16
|
-
)),
|
|
11
|
+
setup(r) {
|
|
12
|
+
const t = r, u = l(
|
|
13
|
+
() => t.titleFormatter ? t.titleFormatter(t.data) : C(t.data)
|
|
14
|
+
), f = ["_index", "_stacked", "_ending"], p = l(() => Object.entries(t.data ?? []).filter(
|
|
15
|
+
([e, v]) => !f.includes(e) && Object.keys(t.categories).includes(e)
|
|
16
|
+
)), c = l(() => p.value.length > 0), y = {
|
|
17
17
|
display: "flex",
|
|
18
18
|
flexDirection: "column"
|
|
19
|
-
},
|
|
19
|
+
}, h = l(() => ({
|
|
20
20
|
color: "var(--vis-tooltip-title-color, #000)",
|
|
21
21
|
textTransform: "var(--vis-tooltip-title-text-transform, capitalize)",
|
|
22
|
-
borderBottom: "var(--vis-tooltip-title-border-bottom, 1px solid #e5e7eb)",
|
|
22
|
+
borderBottom: c.value ? "var(--vis-tooltip-title-border-bottom, 1px solid #e5e7eb)" : "none",
|
|
23
23
|
padding: "var(--vis-tooltip-title-padding, 0.75rem 0.75rem 0.5rem 0.75rem)",
|
|
24
|
-
margin: "var(--vis-tooltip-title-margin, 0 0 0.25rem 0)",
|
|
24
|
+
margin: c.value ? "var(--vis-tooltip-title-margin, 0 0 0.25rem 0)" : "0",
|
|
25
25
|
fontSize: "var(--vis-tooltip-title-font-size, 0.875rem)",
|
|
26
26
|
lineHeight: "var(--vis-tooltip-title-line-height, 100%)",
|
|
27
27
|
fontWeight: "var(--vis-tooltip-title-font-weight, 600)"
|
|
28
|
-
},
|
|
28
|
+
})), b = {
|
|
29
29
|
display: "grid",
|
|
30
30
|
gridTemplateColumns: "auto 1fr auto",
|
|
31
31
|
alignItems: "center",
|
|
32
32
|
gap: "var(--vis-tooltip-content-gap, 0.25rem 0.5rem)",
|
|
33
33
|
padding: "var(--vis-tooltip-content-padding, 0 0.75rem 0.5rem 0.75rem)"
|
|
34
|
-
},
|
|
34
|
+
}, x = {
|
|
35
35
|
fontWeight: "var(--vis-tooltip-label-font-weight, 400)",
|
|
36
36
|
fontSize: "var(--vis-tooltip-label-font-size, 0.875rem)",
|
|
37
37
|
color: "var(--vis-tooltip-label-color, inherit)",
|
|
38
38
|
margin: "var(--vis-tooltip-label-margin, 0 1rem 0 0)",
|
|
39
39
|
whiteSpace: "nowrap"
|
|
40
|
-
},
|
|
40
|
+
}, S = {
|
|
41
41
|
fontSize: "var(--vis-tooltip-value-font-size, 0.875rem)",
|
|
42
42
|
fontWeight: "var(--vis-tooltip-value-font-weight, 600)",
|
|
43
43
|
color: "var(--vis-tooltip-value-color, inherit)",
|
|
44
44
|
textAlign: "right",
|
|
45
45
|
fontVariantNumeric: "tabular-nums"
|
|
46
|
-
},
|
|
46
|
+
}, F = (e, v) => {
|
|
47
47
|
var o, i;
|
|
48
48
|
return {
|
|
49
49
|
width: "8px",
|
|
@@ -52,23 +52,28 @@ const C = /* @__PURE__ */ F({
|
|
|
52
52
|
borderRadius: "var(--vis-tooltip-dot-border-radius, 4px)",
|
|
53
53
|
margin: "var(--vis-tooltip-dot-margin, 0)",
|
|
54
54
|
flexShrink: "0",
|
|
55
|
-
backgroundColor: typeof ((o = t.categories[e]) == null ? void 0 : o.color) == "string" && ((i = t.categories[e]) != null && i.color) ? t.categories[e].color : `var(--vis-color${
|
|
55
|
+
backgroundColor: typeof ((o = t.categories[e]) == null ? void 0 : o.color) == "string" && ((i = t.categories[e]) != null && i.color) ? t.categories[e].color : `var(--vis-color${v})`
|
|
56
56
|
};
|
|
57
57
|
};
|
|
58
|
-
return (e,
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
58
|
+
return (e, v) => (n(), a("div", { style: y }, [
|
|
59
|
+
s("div", {
|
|
60
|
+
style: d(h.value)
|
|
61
|
+
}, m(u.value), 5),
|
|
62
|
+
c.value ? (n(), a("div", {
|
|
63
|
+
key: 0,
|
|
64
|
+
style: b
|
|
65
|
+
}, [
|
|
66
|
+
(n(!0), a(g, null, B(p.value, ([o, i], z) => (n(), a(g, { key: o }, [
|
|
67
|
+
s("span", {
|
|
68
|
+
style: d(F(o, z))
|
|
64
69
|
}, null, 4),
|
|
65
|
-
|
|
66
|
-
|
|
70
|
+
s("span", { style: x }, m(r.categories[o].name), 1),
|
|
71
|
+
s("span", { style: S }, m(r.yFormatter ? r.yFormatter(i) : i), 1)
|
|
67
72
|
], 64))), 128))
|
|
68
|
-
])
|
|
73
|
+
])) : k("", !0)
|
|
69
74
|
]));
|
|
70
75
|
}
|
|
71
76
|
});
|
|
72
77
|
export {
|
|
73
|
-
|
|
78
|
+
_ as default
|
|
74
79
|
};
|