@unovis/ts 1.6.2 → 1.7.0-pre.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/components/area/config.d.ts +2 -0
- package/components/area/config.js +1 -1
- package/components/area/config.js.map +1 -1
- package/components/area/index.js +6 -3
- package/components/area/index.js.map +1 -1
- package/components/crosshair/config.d.ts +1 -1
- package/components/crosshair/config.js.map +1 -1
- package/components/crosshair/index.d.ts +1 -1
- package/components/crosshair/index.js.map +1 -1
- package/components/free-brush/types.js +1 -0
- package/components/free-brush/types.js.map +1 -1
- package/components/graph/index.d.ts +1 -0
- package/components/graph/index.js +35 -14
- package/components/graph/index.js.map +1 -1
- package/components/graph/modules/link/index.js +1 -1
- package/components/graph/modules/link/index.js.map +1 -1
- package/components/leaflet-map/leaflet.css.js +2 -2
- package/components/leaflet-map/modules/map.js +2 -2
- package/components/leaflet-map/modules/map.js.map +1 -1
- package/components/leaflet-map/renderer/mapboxgl-utils.d.ts +0 -1
- package/components/leaflet-map/renderer/mapboxgl-utils.js +1 -2
- package/components/leaflet-map/renderer/mapboxgl-utils.js.map +1 -1
- package/components/sankey/config.d.ts +25 -2
- package/components/sankey/config.js +2 -2
- package/components/sankey/config.js.map +1 -1
- package/components/sankey/index.d.ts +26 -2
- package/components/sankey/index.js +341 -46
- package/components/sankey/index.js.map +1 -1
- package/components/sankey/modules/label.d.ts +8 -5
- package/components/sankey/modules/label.js +70 -32
- package/components/sankey/modules/label.js.map +1 -1
- package/components/sankey/modules/link.d.ts +1 -0
- package/components/sankey/modules/link.js +20 -25
- package/components/sankey/modules/link.js.map +1 -1
- package/components/sankey/modules/node.d.ts +5 -4
- package/components/sankey/modules/node.js +65 -16
- package/components/sankey/modules/node.js.map +1 -1
- package/components/sankey/style.d.ts +67 -1
- package/components/sankey/style.js +77 -77
- package/components/sankey/style.js.map +1 -1
- package/components/sankey/types.d.ts +5 -0
- package/components/sankey/types.js +9 -2
- package/components/sankey/types.js.map +1 -1
- package/components/treemap/index.js +2 -4
- package/components/treemap/index.js.map +1 -1
- package/containers/single-container/config.d.ts +3 -0
- package/containers/single-container/config.js.map +1 -1
- package/containers/single-container/index.js +2 -1
- package/containers/single-container/index.js.map +1 -1
- package/containers/xy-container/config.d.ts +3 -0
- package/containers/xy-container/config.js.map +1 -1
- package/containers/xy-container/index.d.ts +1 -0
- package/containers/xy-container/index.js +13 -9
- package/containers/xy-container/index.js.map +1 -1
- package/index.js +1 -1
- package/package.json +42 -10
- package/types.js +1 -1
|
@@ -21,5 +21,7 @@ export interface AreaConfigInterface<Datum> extends XYComponentConfigInterface<D
|
|
|
21
21
|
* practically invisible, but you want to show that the data behind them exists and they're not just empty segments.
|
|
22
22
|
* Default: `undefined` */
|
|
23
23
|
minHeight?: number;
|
|
24
|
+
/** Whether to stack min height areas or not. Default: `undefined` */
|
|
25
|
+
stackMinHeight?: boolean;
|
|
24
26
|
}
|
|
25
27
|
export declare const AreaDefaultConfig: AreaConfigInterface<unknown>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { XYComponentDefaultConfig } from '../../core/xy-component/config.js';
|
|
2
2
|
import { CurveType } from '../../types/curve.js';
|
|
3
3
|
|
|
4
|
-
const AreaDefaultConfig = Object.assign(Object.assign({}, XYComponentDefaultConfig), { color: undefined, curveType: CurveType.MonotoneX, baseline: () => 0, opacity: 1, cursor: null, minHeight1Px: false, minHeight: undefined });
|
|
4
|
+
const AreaDefaultConfig = Object.assign(Object.assign({}, XYComponentDefaultConfig), { color: undefined, curveType: CurveType.MonotoneX, baseline: () => 0, opacity: 1, cursor: null, minHeight1Px: false, minHeight: undefined, stackMinHeight: false });
|
|
5
5
|
|
|
6
6
|
export { AreaDefaultConfig };
|
|
7
7
|
//# sourceMappingURL=config.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sources":["../../../src/components/area/config.ts"],"sourcesContent":["import { XYComponentConfigInterface, XYComponentDefaultConfig } from 'core/xy-component/config'\n\n// Types\nimport { CurveType } from 'types/curve'\nimport { ColorAccessor, NumericAccessor, StringAccessor } from 'types/accessor'\n\nexport interface AreaConfigInterface<Datum> extends XYComponentConfigInterface<Datum> {\n /** Area color accessor function. The whole data array will be passed as the first argument. Default: `undefined` */\n color?: ColorAccessor<Datum[]>;\n /** Curve type from the CurveType enum. Default: `CurveType.MonotoneX` */\n curveType?: CurveType | string;\n /** Baseline value or accessor function. Default: `undefined` */\n baseline?: NumericAccessor<Datum>;\n /** Opacity value or accessor function. Default: `1` */\n opacity?: NumericAccessor<Datum[]>;\n /** Optional area cursor. String or accessor function. Default: `null` */\n cursor?: StringAccessor<Datum[]>;\n /** If an area is smaller than 1px, extend it to have 1px height. Default: `false`\n * @deprecated Use minHeight instead\n */\n minHeight1Px?: boolean;\n /** Minimum height of the area, use carefully.\n * This setting is useful when some of the area values are zeros or very small so visually they become\n * practically invisible, but you want to show that the data behind them exists and they're not just empty segments.\n * Default: `undefined` */\n minHeight?: number;\n}\n\nexport const AreaDefaultConfig: AreaConfigInterface<unknown> = {\n ...XYComponentDefaultConfig,\n color: undefined,\n curveType: CurveType.MonotoneX,\n baseline: (): number => 0,\n opacity: 1,\n cursor: null,\n minHeight1Px: false,\n minHeight: undefined,\n}\n"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"config.js","sources":["../../../src/components/area/config.ts"],"sourcesContent":["import { XYComponentConfigInterface, XYComponentDefaultConfig } from 'core/xy-component/config'\n\n// Types\nimport { CurveType } from 'types/curve'\nimport { ColorAccessor, NumericAccessor, StringAccessor } from 'types/accessor'\n\nexport interface AreaConfigInterface<Datum> extends XYComponentConfigInterface<Datum> {\n /** Area color accessor function. The whole data array will be passed as the first argument. Default: `undefined` */\n color?: ColorAccessor<Datum[]>;\n /** Curve type from the CurveType enum. Default: `CurveType.MonotoneX` */\n curveType?: CurveType | string;\n /** Baseline value or accessor function. Default: `undefined` */\n baseline?: NumericAccessor<Datum>;\n /** Opacity value or accessor function. Default: `1` */\n opacity?: NumericAccessor<Datum[]>;\n /** Optional area cursor. String or accessor function. Default: `null` */\n cursor?: StringAccessor<Datum[]>;\n /** If an area is smaller than 1px, extend it to have 1px height. Default: `false`\n * @deprecated Use minHeight instead\n */\n minHeight1Px?: boolean;\n /** Minimum height of the area, use carefully.\n * This setting is useful when some of the area values are zeros or very small so visually they become\n * practically invisible, but you want to show that the data behind them exists and they're not just empty segments.\n * Default: `undefined` */\n minHeight?: number;\n /** Whether to stack min height areas or not. Default: `undefined` */\n stackMinHeight?: boolean;\n}\n\nexport const AreaDefaultConfig: AreaConfigInterface<unknown> = {\n ...XYComponentDefaultConfig,\n color: undefined,\n curveType: CurveType.MonotoneX,\n baseline: (): number => 0,\n opacity: 1,\n cursor: null,\n minHeight1Px: false,\n minHeight: undefined,\n stackMinHeight: false,\n}\n"],"names":[],"mappings":";;;AA8Ba,MAAA,iBAAiB,mCACzB,wBAAwB,CAAA,EAAA,EAC3B,KAAK,EAAE,SAAS,EAChB,SAAS,EAAE,SAAS,CAAC,SAAS,EAC9B,QAAQ,EAAE,MAAc,CAAC,EACzB,OAAO,EAAE,CAAC,EACV,MAAM,EAAE,IAAI,EACZ,YAAY,EAAE,KAAK,EACnB,SAAS,EAAE,SAAS,EACpB,cAAc,EAAE,KAAK;;;;"}
|
package/components/area/index.js
CHANGED
|
@@ -47,8 +47,8 @@ class Area extends XYComponentCore {
|
|
|
47
47
|
const y0 = this.yScale(d[0]);
|
|
48
48
|
const y1 = this.yScale(d[1]);
|
|
49
49
|
const isNegativeArea = y1 > y0;
|
|
50
|
-
//
|
|
51
|
-
const cumulative = minHeightCumulativeArray[j] || 0;
|
|
50
|
+
// Only apply cumulative adjustment if `config.stackMinHeight` is true
|
|
51
|
+
const cumulative = config.stackMinHeight ? (minHeightCumulativeArray[j] || 0) : 0;
|
|
52
52
|
const adjustedY0 = isNegativeArea ? y0 + cumulative : y0 - cumulative;
|
|
53
53
|
const adjustedY1 = isNegativeArea ? y1 + cumulative : y1 - cumulative;
|
|
54
54
|
// Calculate height adjustment if needed
|
|
@@ -56,7 +56,10 @@ class Area extends XYComponentCore {
|
|
|
56
56
|
if ((config.minHeight || config.minHeight1Px) &&
|
|
57
57
|
Math.abs(adjustedY1 - adjustedY0) < ((_a = config.minHeight) !== null && _a !== void 0 ? _a : 1)) {
|
|
58
58
|
heightAdjustment = ((_b = config.minHeight) !== null && _b !== void 0 ? _b : 1) - Math.abs(adjustedY1 - adjustedY0);
|
|
59
|
-
|
|
59
|
+
// Only update cumulative array if we're stacking min heights
|
|
60
|
+
if (config.stackMinHeight) {
|
|
61
|
+
minHeightCumulativeArray[j] = cumulative + heightAdjustment;
|
|
62
|
+
}
|
|
60
63
|
}
|
|
61
64
|
return {
|
|
62
65
|
x,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/components/area/index.ts"],"sourcesContent":["import { select } from 'd3-selection'\nimport { Transition } from 'd3-transition'\nimport { area, Area as AreaInterface } from 'd3-shape'\nimport { interpolatePath } from 'd3-interpolate-path'\n\n// Core\nimport { XYComponentCore } from 'core/xy-component'\n\n// Utils\nimport { getNumber, getString, isArray, isNumber, getStackedExtent, getStackedData, filterDataByRange } from 'utils/data'\nimport { smartTransition } from 'utils/d3'\nimport { getColor } from 'utils/color'\n\n// Types\nimport { Curve, CurveType } from 'types/curve'\nimport { NumericAccessor } from 'types/accessor'\n\n// Local Types\nimport { AreaDatum } from './types'\n\n// Config\nimport { AreaDefaultConfig, AreaConfigInterface } from './config'\n\n// Styles\nimport * as s from './style'\n\nexport class Area<Datum> extends XYComponentCore<Datum, AreaConfigInterface<Datum>> {\n static selectors = s\n protected _defaultConfig = AreaDefaultConfig as AreaConfigInterface<Datum>\n public config: AreaConfigInterface<Datum> = this._defaultConfig\n public stacked = true\n private _areaGen: AreaInterface<AreaDatum>\n private _prevNegative: boolean[] | undefined // To help guessing the stack direction when an accessor was set to null or 0\n\n events = {\n [Area.selectors.area]: {},\n }\n\n constructor (config?: AreaConfigInterface<Datum>) {\n super()\n if (config) this.setConfig(config)\n\n // Determine if the provided chart should be stacked\n this.stacked = Array.isArray(this.config.y)\n }\n\n _render (customDuration?: number): void {\n super._render(customDuration)\n const { config, datamodel: { data } } = this\n const duration = isNumber(customDuration) ? customDuration : config.duration\n\n const curveGen = Curve[config.curveType as CurveType]\n this._areaGen = area<AreaDatum>()\n .x(d => d.x)\n .y0(d => d.y0)\n .y1(d => d.y1)\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n .curve(curveGen)\n\n const yAccessors = (isArray(config.y) ? config.y : [config.y]) as NumericAccessor<Datum>[]\n const areaDataX = data.map((d, i) => this.xScale(getNumber(d, config.x, i)))\n\n const stacked = getStackedData(data, config.baseline, yAccessors, this._prevNegative)\n this._prevNegative = stacked.map(s => !!s.isMostlyNegative)\n const minHeightCumulativeArray: number[] = []\n const stackedData: AreaDatum[][] = stacked.map(\n arr => arr.map(\n (d, j) => {\n const x = areaDataX[j]\n const y0 = this.yScale(d[0])\n const y1 = this.yScale(d[1])\n const isNegativeArea = y1 > y0\n\n // Get cumulative adjustment and apply in the correct direction\n const cumulative = minHeightCumulativeArray[j] || 0\n const adjustedY0 = isNegativeArea ? y0 + cumulative : y0 - cumulative\n const adjustedY1 = isNegativeArea ? y1 + cumulative : y1 - cumulative\n\n // Calculate height adjustment if needed\n let heightAdjustment = 0\n if ((config.minHeight || config.minHeight1Px) &&\n Math.abs(adjustedY1 - adjustedY0) < (config.minHeight ?? 1)) {\n heightAdjustment = (config.minHeight ?? 1) - Math.abs(adjustedY1 - adjustedY0)\n minHeightCumulativeArray[j] = cumulative + heightAdjustment\n }\n\n return {\n x,\n y0: adjustedY0,\n y1: isNegativeArea ? adjustedY1 + heightAdjustment : adjustedY1 - heightAdjustment,\n }\n }\n )\n )\n\n // We reverse the data in order to have the first areas to be displayed on top\n // for better visibility when they're close to zero\n const areaMaxIdx = stackedData.length - 1\n const stackedDataReversed = stackedData.reverse()\n const areas = this.g\n .selectAll<SVGPathElement, AreaDatum>(`.${s.area}`)\n .data(stackedDataReversed)\n\n const areasEnter = areas.enter().append('path')\n .attr('class', s.area)\n .attr('d', d => this._areaGen(d) || this._emptyPath())\n .style('opacity', 0)\n .style('fill', (d, i) => getColor(data, config.color, areaMaxIdx - i))\n\n const areasMerged = smartTransition(areasEnter.merge(areas), duration)\n .style('opacity', (d, i) => {\n const isDefined = d.some(p => (p.y0 - p.y1) !== 0)\n return isDefined ? getNumber(data, config.opacity, areaMaxIdx - i) : 0\n })\n .style('fill', (d, i) => getColor(data, config.color, areaMaxIdx - i))\n .style('cursor', (d, i) => getString(data, config.cursor, areaMaxIdx - i))\n\n if (duration) {\n const transition = areasMerged as Transition<SVGPathElement, AreaDatum[], SVGGElement, AreaDatum[]>\n transition.attrTween('d', (d, i, el) => {\n const previous = select(el[i]).attr('d')\n const next = this._areaGen(d) || this._emptyPath()\n return interpolatePath(previous, next)\n })\n } else {\n areasMerged.attr('d', d => this._areaGen(d) || this._emptyPath())\n }\n\n smartTransition(areas.exit(), duration)\n .style('opacity', 0)\n .remove()\n }\n\n getYDataExtent (scaleByVisibleData: boolean): number[] {\n const { config, datamodel } = this\n const yAccessors = (isArray(config.y) ? config.y : [config.y]) as NumericAccessor<Datum>[]\n\n const xDomain = this.xScale.domain() as [number, number]\n const data = scaleByVisibleData ? filterDataByRange(datamodel.data, xDomain, config.x, true) : datamodel.data\n return getStackedExtent(data, config.baseline, ...yAccessors)\n }\n\n _emptyPath (): string {\n const xRange = this.xScale.range()\n const yDomain = this.yScale.domain() as number[]\n\n const y0 = this.yScale((yDomain[0] + yDomain[1]) / 2)\n const y1 = y0\n\n return this._areaGen([\n { y0, y1, x: xRange[0] },\n { y0, y1, x: xRange[1] },\n ])\n }\n}\n"],"names":["s.area","s"],"mappings":";;;;;;;;;;;;AA0BM,MAAO,IAAY,SAAQ,eAAkD,CAAA;AAYjF,IAAA,WAAA,CAAa,MAAmC,EAAA;AAC9C,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AAE,EAAE,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE;YACxB,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE;AACzB,SAAA,CAAC,CAAA;KACH;;AA/HM,IAAS,CAAA,SAAA,GAAGC,KAAC;;;;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/components/area/index.ts"],"sourcesContent":["import { select } from 'd3-selection'\nimport { Transition } from 'd3-transition'\nimport { area, Area as AreaInterface } from 'd3-shape'\nimport { interpolatePath } from 'd3-interpolate-path'\n\n// Core\nimport { XYComponentCore } from 'core/xy-component'\n\n// Utils\nimport { getNumber, getString, isArray, isNumber, getStackedExtent, getStackedData, filterDataByRange } from 'utils/data'\nimport { smartTransition } from 'utils/d3'\nimport { getColor } from 'utils/color'\n\n// Types\nimport { Curve, CurveType } from 'types/curve'\nimport { NumericAccessor } from 'types/accessor'\n\n// Local Types\nimport { AreaDatum } from './types'\n\n// Config\nimport { AreaDefaultConfig, AreaConfigInterface } from './config'\n\n// Styles\nimport * as s from './style'\n\nexport class Area<Datum> extends XYComponentCore<Datum, AreaConfigInterface<Datum>> {\n static selectors = s\n protected _defaultConfig = AreaDefaultConfig as AreaConfigInterface<Datum>\n public config: AreaConfigInterface<Datum> = this._defaultConfig\n public stacked = true\n private _areaGen: AreaInterface<AreaDatum>\n private _prevNegative: boolean[] | undefined // To help guessing the stack direction when an accessor was set to null or 0\n\n events = {\n [Area.selectors.area]: {},\n }\n\n constructor (config?: AreaConfigInterface<Datum>) {\n super()\n if (config) this.setConfig(config)\n\n // Determine if the provided chart should be stacked\n this.stacked = Array.isArray(this.config.y)\n }\n\n _render (customDuration?: number): void {\n super._render(customDuration)\n const { config, datamodel: { data } } = this\n const duration = isNumber(customDuration) ? customDuration : config.duration\n\n const curveGen = Curve[config.curveType as CurveType]\n this._areaGen = area<AreaDatum>()\n .x(d => d.x)\n .y0(d => d.y0)\n .y1(d => d.y1)\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n .curve(curveGen)\n\n const yAccessors = (isArray(config.y) ? config.y : [config.y]) as NumericAccessor<Datum>[]\n const areaDataX = data.map((d, i) => this.xScale(getNumber(d, config.x, i)))\n\n const stacked = getStackedData(data, config.baseline, yAccessors, this._prevNegative)\n this._prevNegative = stacked.map(s => !!s.isMostlyNegative)\n const minHeightCumulativeArray: number[] = []\n const stackedData: AreaDatum[][] = stacked.map(\n arr => arr.map(\n (d, j) => {\n const x = areaDataX[j]\n const y0 = this.yScale(d[0])\n const y1 = this.yScale(d[1])\n const isNegativeArea = y1 > y0\n\n // Only apply cumulative adjustment if `config.stackMinHeight` is true\n const cumulative = config.stackMinHeight ? (minHeightCumulativeArray[j] || 0) : 0\n const adjustedY0 = isNegativeArea ? y0 + cumulative : y0 - cumulative\n const adjustedY1 = isNegativeArea ? y1 + cumulative : y1 - cumulative\n\n // Calculate height adjustment if needed\n let heightAdjustment = 0\n if ((config.minHeight || config.minHeight1Px) &&\n Math.abs(adjustedY1 - adjustedY0) < (config.minHeight ?? 1)) {\n heightAdjustment = (config.minHeight ?? 1) - Math.abs(adjustedY1 - adjustedY0)\n\n // Only update cumulative array if we're stacking min heights\n if (config.stackMinHeight) {\n minHeightCumulativeArray[j] = cumulative + heightAdjustment\n }\n }\n\n return {\n x,\n y0: adjustedY0,\n y1: isNegativeArea ? adjustedY1 + heightAdjustment : adjustedY1 - heightAdjustment,\n }\n }\n )\n )\n\n // We reverse the data in order to have the first areas to be displayed on top\n // for better visibility when they're close to zero\n const areaMaxIdx = stackedData.length - 1\n const stackedDataReversed = stackedData.reverse()\n const areas = this.g\n .selectAll<SVGPathElement, AreaDatum>(`.${s.area}`)\n .data(stackedDataReversed)\n\n const areasEnter = areas.enter().append('path')\n .attr('class', s.area)\n .attr('d', d => this._areaGen(d) || this._emptyPath())\n .style('opacity', 0)\n .style('fill', (d, i) => getColor(data, config.color, areaMaxIdx - i))\n\n const areasMerged = smartTransition(areasEnter.merge(areas), duration)\n .style('opacity', (d, i) => {\n const isDefined = d.some(p => (p.y0 - p.y1) !== 0)\n return isDefined ? getNumber(data, config.opacity, areaMaxIdx - i) : 0\n })\n .style('fill', (d, i) => getColor(data, config.color, areaMaxIdx - i))\n .style('cursor', (d, i) => getString(data, config.cursor, areaMaxIdx - i))\n\n if (duration) {\n const transition = areasMerged as Transition<SVGPathElement, AreaDatum[], SVGGElement, AreaDatum[]>\n transition.attrTween('d', (d, i, el) => {\n const previous = select(el[i]).attr('d')\n const next = this._areaGen(d) || this._emptyPath()\n return interpolatePath(previous, next)\n })\n } else {\n areasMerged.attr('d', d => this._areaGen(d) || this._emptyPath())\n }\n\n smartTransition(areas.exit(), duration)\n .style('opacity', 0)\n .remove()\n }\n\n getYDataExtent (scaleByVisibleData: boolean): number[] {\n const { config, datamodel } = this\n const yAccessors = (isArray(config.y) ? config.y : [config.y]) as NumericAccessor<Datum>[]\n\n const xDomain = this.xScale.domain() as [number, number]\n const data = scaleByVisibleData ? filterDataByRange(datamodel.data, xDomain, config.x, true) : datamodel.data\n return getStackedExtent(data, config.baseline, ...yAccessors)\n }\n\n _emptyPath (): string {\n const xRange = this.xScale.range()\n const yDomain = this.yScale.domain() as number[]\n\n const y0 = this.yScale((yDomain[0] + yDomain[1]) / 2)\n const y1 = y0\n\n return this._areaGen([\n { y0, y1, x: xRange[0] },\n { y0, y1, x: xRange[1] },\n ])\n }\n}\n"],"names":["s.area","s"],"mappings":";;;;;;;;;;;;AA0BM,MAAO,IAAY,SAAQ,eAAkD,CAAA;AAYjF,IAAA,WAAA,CAAa,MAAmC,EAAA;AAC9C,QAAA,KAAK,EAAE,CAAA;QAXC,IAAc,CAAA,cAAA,GAAG,iBAA+C,CAAA;AACnE,QAAA,IAAA,CAAA,MAAM,GAA+B,IAAI,CAAC,cAAc,CAAA;QACxD,IAAO,CAAA,OAAA,GAAG,IAAI,CAAA;AAIrB,QAAA,IAAA,CAAA,MAAM,GAAG;AACP,Y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E;AACzB,SAAA,CAAC,CAAA;KACH;;AAnIM,IAAS,CAAA,SAAA,GAAGC,KAAC;;;;"}
|
|
@@ -24,7 +24,7 @@ export interface CrosshairConfigInterface<Datum> extends WithOptional<XYComponen
|
|
|
24
24
|
/** Tooltip template accessor. The function is supposed to return either a valid HTML string or an HTMLElement.
|
|
25
25
|
* When `snapToData` is `false`, `datum` will be `undefined` but `data` and `leftNearestDatumIndex` will be provided.
|
|
26
26
|
* Default: `d => ''` */
|
|
27
|
-
template?: (datum: Datum, x: number | Date, data
|
|
27
|
+
template?: (datum: Datum, x: number | Date, data: Datum[], leftNearestDatumIndex?: number) => string | HTMLElement;
|
|
28
28
|
/** Hide Crosshair when the corresponding datum element is far from mouse pointer. Default: `true` */
|
|
29
29
|
hideWhenFarFromPointer?: boolean;
|
|
30
30
|
/** Distance in pixels to check in the hideWhenFarFromPointer condition. Default: `100` */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sources":["../../../src/components/crosshair/config.ts"],"sourcesContent":["import { XYComponentConfigInterface, XYComponentDefaultConfig } from 'core/xy-component/config'\nimport { Tooltip } from 'components/tooltip'\n\n// Types\nimport { NumericAccessor, ColorAccessor } from 'types/accessor'\nimport { ContinuousScale } from 'types/scale'\nimport { WithOptional } from 'types/misc'\nimport { CrosshairCircle } from './types'\n\n// We extend partial XY config interface because x and y properties are optional for Crosshair\nexport interface CrosshairConfigInterface<Datum> extends WithOptional<XYComponentConfigInterface<Datum>, 'x' | 'y'> {\n /** Optional accessor function for getting the values along the X axis. Default: `undefined` */\n x?: NumericAccessor<Datum>;\n /** Optional single of multiple accessor functions for getting the values along the Y axis. Default: `undefined` */\n y?: NumericAccessor<Datum> | NumericAccessor<Datum>[];\n /** Optional color array or color accessor function for crosshair circles. Default: `d => d.color` */\n color?: ColorAccessor<Datum>;\n /** Optional stroke color accessor function for crosshair circles. Default: `undefined` */\n strokeColor?: ColorAccessor<Datum>;\n /** Optional stroke width for crosshair circles. Default: `undefined` */\n strokeWidth?: NumericAccessor<Datum>;\n /** Separate array of accessors for stacked components (eg StackedBar, Area). Default: `undefined` */\n yStacked?: NumericAccessor<Datum>[];\n /** Baseline accessor function for stacked values, useful with stacked areas. Default: `null` */\n baseline?: NumericAccessor<Datum>;\n /** An instance of the Tooltip component to be used with Crosshair. Default: `undefined` */\n tooltip?: Tooltip | undefined;\n // TODO: Change `datum` type to `Datum | undefined`. This may break the build for many people, so we might want to do it in version 2.0\n /** Tooltip template accessor. The function is supposed to return either a valid HTML string or an HTMLElement.\n * When `snapToData` is `false`, `datum` will be `undefined` but `data` and `leftNearestDatumIndex` will be provided.\n * Default: `d => ''` */\n template?: (datum: Datum, x: number | Date, data
|
|
1
|
+
{"version":3,"file":"config.js","sources":["../../../src/components/crosshair/config.ts"],"sourcesContent":["import { XYComponentConfigInterface, XYComponentDefaultConfig } from 'core/xy-component/config'\nimport { Tooltip } from 'components/tooltip'\n\n// Types\nimport { NumericAccessor, ColorAccessor } from 'types/accessor'\nimport { ContinuousScale } from 'types/scale'\nimport { WithOptional } from 'types/misc'\nimport { CrosshairCircle } from './types'\n\n// We extend partial XY config interface because x and y properties are optional for Crosshair\nexport interface CrosshairConfigInterface<Datum> extends WithOptional<XYComponentConfigInterface<Datum>, 'x' | 'y'> {\n /** Optional accessor function for getting the values along the X axis. Default: `undefined` */\n x?: NumericAccessor<Datum>;\n /** Optional single of multiple accessor functions for getting the values along the Y axis. Default: `undefined` */\n y?: NumericAccessor<Datum> | NumericAccessor<Datum>[];\n /** Optional color array or color accessor function for crosshair circles. Default: `d => d.color` */\n color?: ColorAccessor<Datum>;\n /** Optional stroke color accessor function for crosshair circles. Default: `undefined` */\n strokeColor?: ColorAccessor<Datum>;\n /** Optional stroke width for crosshair circles. Default: `undefined` */\n strokeWidth?: NumericAccessor<Datum>;\n /** Separate array of accessors for stacked components (eg StackedBar, Area). Default: `undefined` */\n yStacked?: NumericAccessor<Datum>[];\n /** Baseline accessor function for stacked values, useful with stacked areas. Default: `null` */\n baseline?: NumericAccessor<Datum>;\n /** An instance of the Tooltip component to be used with Crosshair. Default: `undefined` */\n tooltip?: Tooltip | undefined;\n // TODO: Change `datum` type to `Datum | undefined`. This may break the build for many people, so we might want to do it in version 2.0\n /** Tooltip template accessor. The function is supposed to return either a valid HTML string or an HTMLElement.\n * When `snapToData` is `false`, `datum` will be `undefined` but `data` and `leftNearestDatumIndex` will be provided.\n * Default: `d => ''` */\n template?: (datum: Datum, x: number | Date, data: Datum[], leftNearestDatumIndex?: number) => string | HTMLElement;\n /** Hide Crosshair when the corresponding datum element is far from mouse pointer. Default: `true` */\n hideWhenFarFromPointer?: boolean;\n /** Distance in pixels to check in the hideWhenFarFromPointer condition. Default: `100` */\n hideWhenFarFromPointerDistance?: number;\n /** Snap to the nearest data point.\n * If disabled, the tooltip template will receive only the horizontal position of the crosshair and you'll be responsible\n * for getting the underlying data records and crosshair circles (see the `getCircles` configuration option).\n * Default: `true`\n */\n snapToData?: boolean;\n /** Custom function for setting up the crosshair circles, usually needed when `snapToData` is set to `false`.\n * The function receives the horizontal position of the crosshair (in the data space, not in pixels), the data array,\n * the `yScale` instance to help you calculate the correct vertical position of the circles, and the nearest datum index.\n * It has to return an array of the `CrosshairCircle` objects: `{ y: number; color: string; opacity?: number }[]`.\n * Default: `undefined`\n */\n getCircles?: (x: number | Date, data: Datum[], yScale: ContinuousScale, leftNearestDatumIndex?: number) => CrosshairCircle[];\n /** Callback function that is called when the crosshair is moved:\n * - `x` is the horizontal position of the crosshair in the data space;\n * - `datum` is the nearest datum to the crosshair;\n * - `datumIndex` is the index of the nearest datum.\n * - `event` is the event that triggered the crosshair move (mouse or wheel).\n *\n * When the mouse goes out of the container and on wheel events, all the arguments are `undefined` except for `event`.\n * Default: `undefined` */\n onCrosshairMove?: (x?: number | Date, datum?: Datum, datumIndex?: number, event?: MouseEvent | WheelEvent) => void;\n /** Force the crosshair to show at a specific position. Default: `undefined` */\n forceShowAt?: number | Date;\n /** Skip range checks for crosshair visibility. When true, crosshair will show regardless of position within chart bounds. Default: `false`\n * This is useful for testing, especially when you only triggers mousemove event but does not have real mouse event.\n */\n skipRangeCheck?: boolean;\n}\n\nexport const CrosshairDefaultConfig: CrosshairConfigInterface<unknown> = {\n ...XYComponentDefaultConfig,\n yStacked: undefined,\n baseline: null,\n duration: 100,\n tooltip: undefined,\n template: <Datum>(d: Datum, x: number | Date, data: Datum[], leftNearestDatumIndex?: number): string => '',\n hideWhenFarFromPointer: true,\n hideWhenFarFromPointerDistance: 100,\n snapToData: true,\n getCircles: undefined,\n color: undefined,\n strokeColor: undefined,\n strokeWidth: undefined,\n onCrosshairMove: undefined,\n forceShowAt: undefined,\n skipRangeCheck: false,\n}\n\n"],"names":[],"mappings":";;AAkEa,MAAA,sBAAsB,GAC9B,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,EAAA,EAAA,wBAAwB,KAC3B,QAAQ,EAAE,SAAS,EACnB,QAAQ,EAAE,IAAI,EACd,QAAQ,EAAE,GAAG,EACb,OAAO,EAAE,SAAS,EAClB,QAAQ,EAAE,CAAQ,CAAQ,EAAE,CAAgB,EAAE,IAAa,EAAE,qBAA8B,KAAa,EAAE,EAC1G,sBAAsB,EAAE,IAAI,EAC5B,8BAA8B,EAAE,GAAG,EACnC,UAAU,EAAE,IAAI,EAChB,UAAU,EAAE,SAAS,EACrB,KAAK,EAAE,SAAS,EAChB,WAAW,EAAE,SAAS,EACtB,WAAW,EAAE,SAAS,EACtB,eAAe,EAAE,SAAS,EAC1B,WAAW,EAAE,SAAS,EACtB,cAAc,EAAE,KAAK;;;;"}
|
|
@@ -30,7 +30,7 @@ export declare class Crosshair<Datum> extends XYComponentCore<Datum, CrosshairCo
|
|
|
30
30
|
_onMouseMove(event: MouseEvent): void;
|
|
31
31
|
_onMouseOut(event?: MouseEvent): void;
|
|
32
32
|
_onWheel(event: WheelEvent): void;
|
|
33
|
-
_showTooltip(datum: Datum, xValue: number, pos: [number, number], nearestDatumIndex: number | undefined): void;
|
|
33
|
+
_showTooltip(datum: Datum | undefined, xValue: number, pos: [number, number], nearestDatumIndex: number | undefined): void;
|
|
34
34
|
_hideTooltip(): void;
|
|
35
35
|
getYDataExtent(): number[];
|
|
36
36
|
private getCircleData;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/components/crosshair/index.ts"],"sourcesContent":["import { Selection, pointer } from 'd3-selection'\nimport { easeLinear } from 'd3-ease'\n\n// Core\nimport { XYComponentCore } from 'core/xy-component'\nimport { Tooltip } from 'components/tooltip'\n\n// Utils\nimport { isNumber, isArray, getNumber, clamp, getStackedValues, getNearest, isFunction } from 'utils/data'\nimport { smartTransition } from 'utils/d3'\nimport { getColor } from 'utils/color'\n\n// Types\nimport { Position } from 'types/position'\nimport { FindNearestDirection } from 'types/data'\n\n// Local Types\nimport { CrosshairAccessors, CrosshairCircle } from './types'\n\n// Config\nimport { CrosshairDefaultConfig, CrosshairConfigInterface } from './config'\n\n// Styles\nimport * as s from './style'\n\n\nexport class Crosshair<Datum> extends XYComponentCore<Datum, CrosshairConfigInterface<Datum>> {\n static selectors = s\n clippable = true // Don't apply clipping path to this component. See XYContainer\n protected _defaultConfig = CrosshairDefaultConfig as CrosshairConfigInterface<Datum>\n public config: CrosshairConfigInterface<Datum> = this._defaultConfig\n container: Selection<SVGSVGElement, any, SVGSVGElement, any>\n line: Selection<SVGLineElement, any, SVGElement, any>\n private _xPx: number | undefined = undefined\n private _yPx: number | undefined = undefined\n private _mouseEvent: MouseEvent | undefined = undefined\n private _animFrameId: number = null\n\n /** Tooltip component to be used by Crosshair if not provided by the config.\n * This property is supposed to be set externally by a container component like XYContainer. */\n public tooltip: Tooltip\n\n /** Accessors passed externally (e.g. from XYContainer) */\n private _accessors: CrosshairAccessors<Datum> = {\n x: undefined,\n y: undefined,\n yStacked: undefined,\n baseline: undefined,\n }\n\n public set accessors (accessors: CrosshairAccessors<Datum>) { this._accessors = accessors }\n public get accessors (): CrosshairAccessors<Datum> {\n const { config } = this\n\n const hasConfig = !!(config.x || config.y || config.yStacked)\n const x = hasConfig ? config.x : this._accessors.x\n const yAcc = hasConfig ? config.y : this._accessors.y\n const y = yAcc ? (isArray(yAcc) ? yAcc : [yAcc]) : undefined\n const yStacked = hasConfig ? config.yStacked : this._accessors.yStacked\n const baseline = config.baseline ?? this._accessors.baseline\n\n return { x, y, yStacked, baseline }\n }\n\n private _isContainerInViewport (): boolean {\n if (!this.container?.node()) return false\n\n const containerRect = this.container.node().getBoundingClientRect()\n const viewportWidth = window.innerWidth || document.documentElement.clientWidth\n const viewportHeight = window.innerHeight || document.documentElement.clientHeight\n\n // Calculate the visible area of the container\n const visibleWidth = Math.max(0, Math.min(containerRect.right, viewportWidth) - Math.max(containerRect.left, 0))\n const visibleHeight = Math.max(0, Math.min(containerRect.bottom, viewportHeight) - Math.max(containerRect.top, 0))\n const containerArea = containerRect.width * containerRect.height\n const visibleArea = visibleWidth * visibleHeight\n\n // Container must be at least 35% visible\n return containerArea > 0 && (visibleArea / containerArea) >= 0.35\n }\n\n constructor (config?: CrosshairConfigInterface<Datum>) {\n super()\n if (config) this.setConfig(config)\n\n this.g.style('opacity', 0)\n this.line = this.g.append('line')\n .attr('class', s.line)\n }\n\n setContainer (containerSvg: Selection<SVGSVGElement, unknown, SVGSVGElement, unknown>): void {\n if (this.container === containerSvg) return\n\n this.container = containerSvg\n this.container.on('mousemove.crosshair', this._onMouseMove.bind(this))\n this.container.on('mouseout.crosshair', this._onMouseOut.bind(this))\n this.container.on('wheel.crosshair', this._onWheel.bind(this))\n }\n\n _render (customDuration?: number): void {\n const { config, datamodel } = this\n const duration = isNumber(customDuration) ? customDuration : config.duration\n const isForceShowAtDefined = config.forceShowAt !== undefined\n const xPx = isForceShowAtDefined ? this.xScale(config.forceShowAt) : this._xPx\n\n const xValue = this.xScale.invert(xPx) as number\n\n const leftNearestDatumIndex = (datamodel.data?.length && this.accessors.x)\n ? datamodel.data.indexOf(\n getNearest(datamodel.data, xValue, this.accessors.x, FindNearestDirection.Left)\n ) : undefined\n\n // If `snapToData` is `true`, we need to find the nearest datum to the crosshair\n // It can be from a mouse interaction or from a `forceShowAt` setting\n let nearestDatum: Datum | undefined\n let nearestDatumIndex: number | undefined\n if (config.snapToData) {\n if (!this.accessors.y && !this.accessors.yStacked && datamodel.data?.length) {\n console.warn('Unovis | Crosshair: Y accessors have not been configured. Please check if they\\'re present in the configuration object')\n }\n\n // Emit a warning if there's no data to snap to.\n // To keep the console clean, only emit the warning when there's mouse interaction.\n if (!datamodel.data?.length && this._mouseEvent) {\n console.warn('Unovis | Crosshair: No data to snap to. Make sure the data has been passed to the container or to the crosshair itself')\n }\n\n nearestDatum = getNearest(datamodel.data, xValue, this.accessors.x)\n nearestDatumIndex = datamodel.data.indexOf(nearestDatum)\n }\n\n const xRange = this.xScale.range()\n const yRange = this.yScale.range()\n const xClamped = config.snapToData && nearestDatum\n ? clamp(Math.round(this.xScale(getNumber(nearestDatum, this.accessors.x, nearestDatumIndex))), 0, this._width)\n : clamp(xPx, xRange[0], xRange[1])\n\n const isCrosshairWithinXRange = (xPx >= xRange[0]) && (xPx <= xRange[1])\n const isCrosshairWithinYRange = (this._yPx >= Math.min(yRange[0], yRange[1])) && (this._yPx <= Math.max(yRange[0], yRange[1]))\n let shouldShow = config.skipRangeCheck ? !!this._xPx : (this._xPx ? isCrosshairWithinXRange && isCrosshairWithinYRange : isCrosshairWithinXRange)\n\n // If the crosshair is far from the mouse pointer (usually when `snapToData` is `true` and data resolution is low), hide it\n if (config.hideWhenFarFromPointer && ((Math.abs(xClamped - (+xPx)) >= config.hideWhenFarFromPointerDistance))) {\n shouldShow = false\n }\n\n const tooltip = config.tooltip ?? this.tooltip\n if (shouldShow && tooltip && this._isContainerInViewport()) {\n const container = tooltip.getContainer() || this.container.node()\n const isContainerBody = tooltip.isContainerBody()\n\n if (isForceShowAtDefined) {\n // Convert SVG coordinates to screen coordinates\n const containerRect = this.container.node().getBoundingClientRect()\n\n // Use the actual left margin from the container\n const screenX = (isContainerBody ? xPx + containerRect.left : xPx) + this._containerMargin.left\n const screenY = this._height / 2 + (isContainerBody ? containerRect.top : 0)\n const pos = [screenX, screenY] as [number, number]\n this._showTooltip(nearestDatum, xValue, pos, leftNearestDatumIndex)\n } else if (this._mouseEvent) {\n const pos = (isContainerBody ? [this._mouseEvent.clientX, this._mouseEvent.clientY] : pointer(this._mouseEvent, container)) as [number, number]\n this._showTooltip(nearestDatum, xValue, pos, leftNearestDatumIndex)\n }\n } else this._hideTooltip()\n\n // Trigger `onCrosshairMove` if the render was triggered by a mouse move event\n if (this._mouseEvent) {\n config.onCrosshairMove?.(shouldShow ? this.xScale.invert(this._xPx) as number : undefined, nearestDatum, nearestDatumIndex, this._mouseEvent)\n this._mouseEvent = undefined\n }\n\n smartTransition(this.g, duration)\n .style('opacity', shouldShow ? 1 : 0)\n\n // When `config.forceShowAt` becomes `undefined`, the crosshair \"jumps\" to the edge of the chart.\n // This looks off, so we stop further rendering when the `xPx` value is not finite.\n if (!isFinite(xPx)) return\n\n this.line\n .attr('y1', 0)\n .attr('y2', this._height)\n\n smartTransition(this.line, duration, easeLinear)\n .attr('x1', xClamped)\n .attr('x2', xClamped)\n\n const circleData = isFunction(config.getCircles)\n ? config.getCircles(xValue, datamodel.data, this.yScale, leftNearestDatumIndex)\n : this.getCircleData(nearestDatum, nearestDatumIndex)\n\n const circles = this.g\n .selectAll<SVGCircleElement, CrosshairCircle>('circle')\n .data(circleData, (d, i) => d.id ?? i)\n\n const circlesEnter = circles.enter()\n .append('circle')\n .attr('class', s.circle)\n .attr('r', 0)\n .attr('cx', xClamped)\n .attr('cy', d => d.y)\n .style('fill', d => d.color)\n .style('stroke', d => d.strokeColor)\n .style('stroke-width', d => d.strokeWidth)\n\n smartTransition(circlesEnter.merge(circles), duration, easeLinear)\n .attr('cx', xClamped)\n .attr('cy', d => d.y)\n .attr('r', 4)\n .style('opacity', d => d.opacity)\n .style('fill', d => d.color)\n .style('stroke', d => d.strokeColor)\n .style('stroke-width', d => d.strokeWidth)\n\n circles.exit().remove()\n }\n\n hide (sourceEvent?: MouseEvent | WheelEvent): void {\n window.cancelAnimationFrame(this._animFrameId)\n this._animFrameId = window.requestAnimationFrame(() => {\n this._xPx = undefined\n this._yPx = undefined\n this._mouseEvent = undefined\n // We call `onCrosshairMove` with all the arguments set to `undefined` because we want\n // the users to be able to hide the crosshair easily when using `forceShowAt`\n this.config.onCrosshairMove?.(undefined, undefined, undefined, sourceEvent)\n this._render()\n })\n }\n\n _onMouseMove (event: MouseEvent): void {\n const { datamodel, element } = this\n if (!this.accessors.x && datamodel.data?.length) {\n console.warn('Unovis | Crosshair: X accessor function has not been configured. Please check if it\\'s present in the configuration object')\n }\n const [x, y] = pointer(event, element)\n this._xPx = x\n this._yPx = y\n this._mouseEvent = event\n\n window.cancelAnimationFrame(this._animFrameId)\n this._animFrameId = window.requestAnimationFrame(() => {\n // We'll call `config.onCrosshairMove` in `_render` with the found `nearestDatum` and `nearestDatumIndex`,\n // which can come from the mouse interaction or from the `forceShowAt` setting\n this._render()\n })\n }\n\n _onMouseOut (event?: MouseEvent): void {\n // Only hide if the mouse actually left the SVG, not just moved to a child\n if (!event || !this.container?.node().contains((event as MouseEvent).relatedTarget as Node)) {\n this.hide(event)\n }\n }\n\n _onWheel (event: WheelEvent): void {\n this.hide(event)\n }\n\n _showTooltip (datum: Datum, xValue: number, pos: [number, number], nearestDatumIndex: number | undefined): void {\n const { config, datamodel } = this\n const tooltip = config.tooltip ?? this.tooltip\n if (!tooltip || !pos) return\n\n const [x, y] = pos\n const content = config.template(datum, xValue, datamodel.data, nearestDatumIndex)\n // Force set `followCursor` to `true` because we don't want Crosshair's tooltip to be hoverable\n tooltip.config.followCursor = true\n\n // Set tooltip placement based on Crosshair's position (left / right)\n if (!tooltip.config.horizontalPlacement || tooltip.config.horizontalPlacement === Position.Auto) {\n const xRelative = tooltip.isContainerBody() ? x - this.container.node().getBoundingClientRect().left : x\n tooltip.overrideHorizontalPlacement(xRelative > this._containerWidth / 2 ? Position.Left : Position.Right)\n }\n\n if (content) tooltip.show(content, { x, y })\n }\n\n _hideTooltip (): void {\n const { config } = this\n const tooltip = config.tooltip ?? this.tooltip\n tooltip?.hide()\n }\n\n // We don't want Crosshair to be be taken in to account in domain calculations\n getYDataExtent (): number[] {\n return [undefined, undefined]\n }\n\n private getCircleData (datum: Datum, datumIndex: number): CrosshairCircle[] {\n const { config } = this\n\n if (config.snapToData && datum) {\n const yAccessors = this.accessors.y ?? []\n const yStackedAccessors = this.accessors.yStacked ?? []\n const baselineValue = getNumber(datum, this.accessors.baseline, datumIndex) || 0\n const stackedValues: CrosshairCircle[] = getStackedValues(datum, datumIndex, ...yStackedAccessors)\n .map((value, index) => ({\n y: this.yScale(value + baselineValue),\n opacity: isNumber(getNumber(datum, yStackedAccessors[index], index)) ? 1 : 0,\n color: getColor(datum, config.color, index),\n strokeColor: config.strokeColor ? getColor(datum, config.strokeColor, index) : undefined,\n strokeWidth: config.strokeWidth ? getNumber(datum, config.strokeWidth, index) : undefined,\n }))\n\n const regularValues: CrosshairCircle[] = yAccessors\n .map((a, index) => {\n const value = getNumber(datum, a, datumIndex)\n return {\n y: this.yScale(value),\n opacity: isNumber(value) ? 1 : 0,\n color: getColor(datum, config.color, stackedValues.length + index),\n strokeColor: config.strokeColor ? getColor(datum, config.strokeColor, index) : undefined,\n strokeWidth: config.strokeWidth ? getNumber(datum, config.strokeWidth, index) : undefined,\n }\n })\n\n return stackedValues.concat(regularValues)\n }\n\n return []\n }\n}\n"],"names":["s.line","s.circle","s"],"mappings":";;;;;;;;;;;;AA0BM,MAAO,SAAiB,SAAQ,eAAuD,CAAA;AAuD3F,IAAA,WAAA,CAAa,MAAwC,EAAA;AACnD,QAAA,KAAK,EAAE,CAAA;AAtDT,QAAA,IAAA,CAAA,SAAS,GAAG,IAAI,CAAA;QACN,IAAc,CAAA,cAAA,GAAG,sBAAyD,CAAA;AAC7E,QAAA,IAAA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AAM,KAAK,GAAG,SAAS,CAAC,KAAK,EAAE,CAAC,EAAE,UAAU,CAAC,CAAA;gBAC7C,OAAO;AACL,oBAAA,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC;AACrB,oBAAA,OAAO,EAAE,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC;AAChC,oBAAA,KAAK,EAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,aAAa,CAAC,MAAM,GAAG,KAAK,CAAC;oBAClE,WAAW,EAAE,MAAM,CAAC,WAAW,GAAG,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,WAAW,EAAE,KAAK,CAAC,GAAG,SAAS;oBACxF,WAAW,EAAE,MAAM,CAAC,WAAW,GAAG,SAAS,CAAC,KAAK,EAAE,MAAM,CAAC,WAAW,EAAE,KAAK,CAAC,GAAG,SAAS;iBAC1F,CAAA;AACH,aAAC,CAAC,CAAA;AAEJ,YAAA,OAAO,aAAa,CAAC,MAAM,CAAC,aAAa,CAAC,CAAA;AAC3C,SAAA;AAED,QAAA,OAAO,EAAE,CAAA;KACV;;AAtSM,SAAS,CAAA,SAAA,GAAGC,KAAC;;;;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/components/crosshair/index.ts"],"sourcesContent":["import { Selection, pointer } from 'd3-selection'\nimport { easeLinear } from 'd3-ease'\n\n// Core\nimport { XYComponentCore } from 'core/xy-component'\nimport { Tooltip } from 'components/tooltip'\n\n// Utils\nimport { isNumber, isArray, getNumber, clamp, getStackedValues, getNearest, isFunction } from 'utils/data'\nimport { smartTransition } from 'utils/d3'\nimport { getColor } from 'utils/color'\n\n// Types\nimport { Position } from 'types/position'\nimport { FindNearestDirection } from 'types/data'\n\n// Local Types\nimport { CrosshairAccessors, CrosshairCircle } from './types'\n\n// Config\nimport { CrosshairDefaultConfig, CrosshairConfigInterface } from './config'\n\n// Styles\nimport * as s from './style'\n\n\nexport class Crosshair<Datum> extends XYComponentCore<Datum, CrosshairConfigInterface<Datum>> {\n static selectors = s\n clippable = true // Don't apply clipping path to this component. See XYContainer\n protected _defaultConfig = CrosshairDefaultConfig as CrosshairConfigInterface<Datum>\n public config: CrosshairConfigInterface<Datum> = this._defaultConfig\n container: Selection<SVGSVGElement, any, SVGSVGElement, any>\n line: Selection<SVGLineElement, any, SVGElement, any>\n private _xPx: number | undefined = undefined\n private _yPx: number | undefined = undefined\n private _mouseEvent: MouseEvent | undefined = undefined\n private _animFrameId: number = null\n\n /** Tooltip component to be used by Crosshair if not provided by the config.\n * This property is supposed to be set externally by a container component like XYContainer. */\n public tooltip: Tooltip\n\n /** Accessors passed externally (e.g. from XYContainer) */\n private _accessors: CrosshairAccessors<Datum> = {\n x: undefined,\n y: undefined,\n yStacked: undefined,\n baseline: undefined,\n }\n\n public set accessors (accessors: CrosshairAccessors<Datum>) { this._accessors = accessors }\n public get accessors (): CrosshairAccessors<Datum> {\n const { config } = this\n\n const hasConfig = !!(config.x || config.y || config.yStacked)\n const x = hasConfig ? config.x : this._accessors.x\n const yAcc = hasConfig ? config.y : this._accessors.y\n const y = yAcc ? (isArray(yAcc) ? yAcc : [yAcc]) : undefined\n const yStacked = hasConfig ? config.yStacked : this._accessors.yStacked\n const baseline = config.baseline ?? this._accessors.baseline\n\n return { x, y, yStacked, baseline }\n }\n\n private _isContainerInViewport (): boolean {\n if (!this.container?.node()) return false\n\n const containerRect = this.container.node().getBoundingClientRect()\n const viewportWidth = window.innerWidth || document.documentElement.clientWidth\n const viewportHeight = window.innerHeight || document.documentElement.clientHeight\n\n // Calculate the visible area of the container\n const visibleWidth = Math.max(0, Math.min(containerRect.right, viewportWidth) - Math.max(containerRect.left, 0))\n const visibleHeight = Math.max(0, Math.min(containerRect.bottom, viewportHeight) - Math.max(containerRect.top, 0))\n const containerArea = containerRect.width * containerRect.height\n const visibleArea = visibleWidth * visibleHeight\n\n // Container must be at least 35% visible\n return containerArea > 0 && (visibleArea / containerArea) >= 0.35\n }\n\n constructor (config?: CrosshairConfigInterface<Datum>) {\n super()\n if (config) this.setConfig(config)\n\n this.g.style('opacity', 0)\n this.line = this.g.append('line')\n .attr('class', s.line)\n }\n\n setContainer (containerSvg: Selection<SVGSVGElement, unknown, SVGSVGElement, unknown>): void {\n if (this.container === containerSvg) return\n\n this.container = containerSvg\n this.container.on('mousemove.crosshair', this._onMouseMove.bind(this))\n this.container.on('mouseout.crosshair', this._onMouseOut.bind(this))\n this.container.on('wheel.crosshair', this._onWheel.bind(this))\n }\n\n _render (customDuration?: number): void {\n const { config, datamodel } = this\n const duration = isNumber(customDuration) ? customDuration : config.duration\n const isForceShowAtDefined = config.forceShowAt !== undefined\n const xPx = isForceShowAtDefined ? this.xScale(config.forceShowAt) : this._xPx\n\n const xValue = this.xScale.invert(xPx) as number\n\n const leftNearestDatumIndex = (datamodel.data?.length && this.accessors.x)\n ? datamodel.data.indexOf(\n getNearest(datamodel.data, xValue, this.accessors.x, FindNearestDirection.Left)\n ) : undefined\n\n // If `snapToData` is `true`, we need to find the nearest datum to the crosshair\n // It can be from a mouse interaction or from a `forceShowAt` setting\n let nearestDatum: Datum | undefined\n let nearestDatumIndex: number | undefined\n if (config.snapToData) {\n if (!this.accessors.y && !this.accessors.yStacked && datamodel.data?.length) {\n console.warn('Unovis | Crosshair: Y accessors have not been configured. Please check if they\\'re present in the configuration object')\n }\n\n // Emit a warning if there's no data to snap to.\n // To keep the console clean, only emit the warning when there's mouse interaction.\n if (!datamodel.data?.length && this._mouseEvent) {\n console.warn('Unovis | Crosshair: No data to snap to. Make sure the data has been passed to the container or to the crosshair itself')\n }\n\n nearestDatum = getNearest(datamodel.data, xValue, this.accessors.x)\n nearestDatumIndex = datamodel.data.indexOf(nearestDatum)\n }\n\n const xRange = this.xScale.range()\n const yRange = this.yScale.range()\n const xClamped = config.snapToData && nearestDatum\n ? clamp(Math.round(this.xScale(getNumber(nearestDatum, this.accessors.x, nearestDatumIndex))), 0, this._width)\n : clamp(xPx, xRange[0], xRange[1])\n\n const isCrosshairWithinXRange = (xPx >= xRange[0]) && (xPx <= xRange[1])\n const isCrosshairWithinYRange = (this._yPx >= Math.min(yRange[0], yRange[1])) && (this._yPx <= Math.max(yRange[0], yRange[1]))\n let shouldShow = config.skipRangeCheck ? !!this._xPx : (this._xPx ? isCrosshairWithinXRange && isCrosshairWithinYRange : isCrosshairWithinXRange)\n\n // If the crosshair is far from the mouse pointer (usually when `snapToData` is `true` and data resolution is low), hide it\n if (config.hideWhenFarFromPointer && ((Math.abs(xClamped - (+xPx)) >= config.hideWhenFarFromPointerDistance))) {\n shouldShow = false\n }\n\n const tooltip = config.tooltip ?? this.tooltip\n if (shouldShow && tooltip && this._isContainerInViewport()) {\n const container = tooltip.getContainer() || this.container.node()\n const isContainerBody = tooltip.isContainerBody()\n\n if (isForceShowAtDefined) {\n // Convert SVG coordinates to screen coordinates\n const containerRect = this.container.node().getBoundingClientRect()\n\n // Use the actual left margin from the container\n const screenX = (isContainerBody ? xPx + containerRect.left : xPx) + this._containerMargin.left\n const screenY = this._height / 2 + (isContainerBody ? containerRect.top : 0)\n const pos = [screenX, screenY] as [number, number]\n this._showTooltip(nearestDatum, xValue, pos, leftNearestDatumIndex)\n } else if (this._mouseEvent) {\n const pos = (isContainerBody ? [this._mouseEvent.clientX, this._mouseEvent.clientY] : pointer(this._mouseEvent, container)) as [number, number]\n this._showTooltip(nearestDatum, xValue, pos, leftNearestDatumIndex)\n }\n } else this._hideTooltip()\n\n // Trigger `onCrosshairMove` if the render was triggered by a mouse move event\n if (this._mouseEvent) {\n config.onCrosshairMove?.(shouldShow ? this.xScale.invert(this._xPx) as number : undefined, nearestDatum, nearestDatumIndex, this._mouseEvent)\n this._mouseEvent = undefined\n }\n\n smartTransition(this.g, duration)\n .style('opacity', shouldShow ? 1 : 0)\n\n // When `config.forceShowAt` becomes `undefined`, the crosshair \"jumps\" to the edge of the chart.\n // This looks off, so we stop further rendering when the `xPx` value is not finite.\n if (!isFinite(xPx)) return\n\n this.line\n .attr('y1', 0)\n .attr('y2', this._height)\n\n smartTransition(this.line, duration, easeLinear)\n .attr('x1', xClamped)\n .attr('x2', xClamped)\n\n const circleData = isFunction(config.getCircles)\n ? config.getCircles(xValue, datamodel.data, this.yScale, leftNearestDatumIndex)\n : this.getCircleData(nearestDatum, nearestDatumIndex)\n\n const circles = this.g\n .selectAll<SVGCircleElement, CrosshairCircle>('circle')\n .data(circleData, (d, i) => d.id ?? i)\n\n const circlesEnter = circles.enter()\n .append('circle')\n .attr('class', s.circle)\n .attr('r', 0)\n .attr('cx', xClamped)\n .attr('cy', d => d.y)\n .style('fill', d => d.color)\n .style('stroke', d => d.strokeColor)\n .style('stroke-width', d => d.strokeWidth)\n\n smartTransition(circlesEnter.merge(circles), duration, easeLinear)\n .attr('cx', xClamped)\n .attr('cy', d => d.y)\n .attr('r', 4)\n .style('opacity', d => d.opacity)\n .style('fill', d => d.color)\n .style('stroke', d => d.strokeColor)\n .style('stroke-width', d => d.strokeWidth)\n\n circles.exit().remove()\n }\n\n hide (sourceEvent?: MouseEvent | WheelEvent): void {\n window.cancelAnimationFrame(this._animFrameId)\n this._animFrameId = window.requestAnimationFrame(() => {\n this._xPx = undefined\n this._yPx = undefined\n this._mouseEvent = undefined\n // We call `onCrosshairMove` with all the arguments set to `undefined` because we want\n // the users to be able to hide the crosshair easily when using `forceShowAt`\n this.config.onCrosshairMove?.(undefined, undefined, undefined, sourceEvent)\n this._render()\n })\n }\n\n _onMouseMove (event: MouseEvent): void {\n const { datamodel, element } = this\n if (!this.accessors.x && datamodel.data?.length) {\n console.warn('Unovis | Crosshair: X accessor function has not been configured. Please check if it\\'s present in the configuration object')\n }\n const [x, y] = pointer(event, element)\n this._xPx = x\n this._yPx = y\n this._mouseEvent = event\n\n window.cancelAnimationFrame(this._animFrameId)\n this._animFrameId = window.requestAnimationFrame(() => {\n // We'll call `config.onCrosshairMove` in `_render` with the found `nearestDatum` and `nearestDatumIndex`,\n // which can come from the mouse interaction or from the `forceShowAt` setting\n this._render()\n })\n }\n\n _onMouseOut (event?: MouseEvent): void {\n // Only hide if the mouse actually left the SVG, not just moved to a child\n if (!event || !this.container?.node().contains((event as MouseEvent).relatedTarget as Node)) {\n this.hide(event)\n }\n }\n\n _onWheel (event: WheelEvent): void {\n this.hide(event)\n }\n\n _showTooltip (datum: Datum | undefined, xValue: number, pos: [number, number], nearestDatumIndex: number | undefined): void {\n const { config, datamodel } = this\n const tooltip = config.tooltip ?? this.tooltip\n if (!tooltip || !pos) return\n\n const [x, y] = pos\n const content = config.template(datum, xValue, datamodel.data, nearestDatumIndex)\n // Force set `followCursor` to `true` because we don't want Crosshair's tooltip to be hoverable\n tooltip.config.followCursor = true\n\n // Set tooltip placement based on Crosshair's position (left / right)\n if (!tooltip.config.horizontalPlacement || tooltip.config.horizontalPlacement === Position.Auto) {\n const xRelative = tooltip.isContainerBody() ? x - this.container.node().getBoundingClientRect().left : x\n tooltip.overrideHorizontalPlacement(xRelative > this._containerWidth / 2 ? Position.Left : Position.Right)\n }\n\n if (content) tooltip.show(content, { x, y })\n }\n\n _hideTooltip (): void {\n const { config } = this\n const tooltip = config.tooltip ?? this.tooltip\n tooltip?.hide()\n }\n\n // We don't want Crosshair to be be taken in to account in domain calculations\n getYDataExtent (): number[] {\n return [undefined, undefined]\n }\n\n private getCircleData (datum: Datum, datumIndex: number): CrosshairCircle[] {\n const { config } = this\n\n if (config.snapToData && datum) {\n const yAccessors = this.accessors.y ?? []\n const yStackedAccessors = this.accessors.yStacked ?? []\n const baselineValue = getNumber(datum, this.accessors.baseline, datumIndex) || 0\n const stackedValues: CrosshairCircle[] = getStackedValues(datum, datumIndex, ...yStackedAccessors)\n .map((value, index) => ({\n y: this.yScale(value + baselineValue),\n opacity: isNumber(getNumber(datum, yStackedAccessors[index], index)) ? 1 : 0,\n color: getColor(datum, config.color, index),\n strokeColor: config.strokeColor ? getColor(datum, config.strokeColor, index) : undefined,\n strokeWidth: config.strokeWidth ? getNumber(datum, config.strokeWidth, index) : undefined,\n }))\n\n const regularValues: CrosshairCircle[] = yAccessors\n .map((a, index) => {\n const value = getNumber(datum, a, datumIndex)\n return {\n y: this.yScale(value),\n opacity: isNumber(value) ? 1 : 0,\n color: getColor(datum, config.color, stackedValues.length + index),\n strokeColor: config.strokeColor ? getColor(datum, config.strokeColor, index) : undefined,\n strokeWidth: config.strokeWidth ? getNumber(datum, config.strokeWidth, index) : undefined,\n }\n })\n\n return stackedValues.concat(regularValues)\n }\n\n return []\n }\n}\n"],"names":["s.line","s.circle","s"],"mappings":";;;;;;;;;;;;AA0BM,MAAO,SAAiB,SAAQ,eAAuD,CAAA;AAuD3F,IAAA,WAAA,CAAa,MAAwC,EAAA;AACnD,QAAA,KAAK,EAAE,CAAA;AAtDT,QAAA,IAAA,CAAA,SAAS,GAAG,IAAI,CAAA;QACN,IAAc,CAAA,cAAA,GAAG,sBAAyD,CAAA;AAC7E,QAAA,IAAA,CAAA,MAAM,GAAoC,IAAI,CAAC,cAAc,CAAA;QAG5D,IAAI,CAAA,IAAA,GAAuB,SAAS,CAAA;QACpC,IAAI,CAAA,IAAA,GAAuB,SAAS,CAAA;QACpC,IAAW,CAAA,WAAA,GAA2B,SAAS,CAAA;QAC/C,IAAY,CAAA,YAAA,GAAW,IAAI,CAAA;;AAO3B,QAAA,IAAA,CAAA,UAAU,GAA8B;AAC9C,YAAA,CAAC,EAAE,SAAS;AACZ,YAAA,CAAC,EAAE,SAAS;AACZ,YAAA,QAAQ,EAAE,SAAS;AACnB,YAAA,QAAQ,EAAE,SAAS;SACpB,CAAA;AAmCC,QAAA,IAAI,MAAM;AAAE,YAAA,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAA;QAElC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,SAAS,EAAE,CAAC,CAAC,CAAA;QAC1B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC;AAC9B,aAAA,IAAI,CAAC,OAAO,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CAAA;AAC3C,SAAA;AAED,QAAA,OAAO,EAAE,CAAA;KACV;;AAtSM,SAAS,CAAA,SAAA,GAAGC,KAAC;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sources":["../../../src/components/free-brush/types.ts"],"sourcesContent":["export type FreeBrushSelection = [number, number] | [[number, number], [number, number]];\nexport type FreeBrushSelectionInPixels = FreeBrushSelection\n\nexport enum FreeBrushMode {\n X = 'x',\n Y = 'y',\n XY = 'xy',\n}\n"],"names":[],"mappings":"IAGY,
|
|
1
|
+
{"version":3,"file":"types.js","sources":["../../../src/components/free-brush/types.ts"],"sourcesContent":["export type FreeBrushSelection = [number, number] | [[number, number], [number, number]];\nexport type FreeBrushSelectionInPixels = FreeBrushSelection\n\nexport enum FreeBrushMode {\n X = 'x',\n Y = 'y',\n // eslint-disable-next-line @typescript-eslint/naming-convention\n XY = 'xy',\n}\n"],"names":[],"mappings":"IAGY,cAKX;AALD,CAAA,UAAY,aAAa,EAAA;AACvB,IAAA,aAAA,CAAA,GAAA,CAAA,GAAA,GAAO,CAAA;AACP,IAAA,aAAA,CAAA,GAAA,CAAA,GAAA,GAAO,CAAA;;AAEP,IAAA,aAAA,CAAA,IAAA,CAAA,GAAA,IAAS,CAAA;AACX,CAAC,EALW,aAAa,KAAb,aAAa,GAKxB,EAAA,CAAA,CAAA;;;;"}
|
|
@@ -126,6 +126,7 @@ export declare class Graph<N extends GraphInputNode, L extends GraphInputLink> e
|
|
|
126
126
|
setZoom(zoomLevel: number): void;
|
|
127
127
|
getZoom(): number;
|
|
128
128
|
fitView(duration?: number, nodeIds?: (string | number)[], alignment?: GraphFitViewAlignment): void;
|
|
129
|
+
fitViewToBounds(xExtent?: [number, number] | undefined, yExtent?: [number, number] | undefined, duration?: number, alignment?: GraphFitViewAlignment): void;
|
|
129
130
|
/** Enable automatic fitting to container if it was disabled due to previous zoom / pan interactions */
|
|
130
131
|
resetAutofitState(): void;
|
|
131
132
|
/** Get current coordinates of the nodes as an array of { id: string; x: number; y: number } objects */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { __awaiter } from 'tslib';
|
|
2
|
-
import { min, max } from 'd3-array';
|
|
2
|
+
import { min, max, extent } from 'd3-array';
|
|
3
3
|
import { select, pointer } from 'd3-selection';
|
|
4
4
|
import { brush as brush$1 } from 'd3-brush';
|
|
5
5
|
import { zoom, zoomIdentity, zoomTransform } from 'd3-zoom';
|
|
@@ -338,19 +338,9 @@ class Graph extends ComponentCore {
|
|
|
338
338
|
}
|
|
339
339
|
}
|
|
340
340
|
_fit(duration = 0, nodeIds, alignment = this.config.fitViewAlign) {
|
|
341
|
-
const { datamodel: {
|
|
342
|
-
const
|
|
343
|
-
const transform = this._getTransform(fitViewNodes, alignment);
|
|
344
|
-
smartTransition(this.g, duration)
|
|
345
|
-
.call(this._zoomBehavior.transform, transform);
|
|
346
|
-
this._onZoom(transform);
|
|
347
|
-
}
|
|
348
|
-
_getTransform(nodes, alignment) {
|
|
349
|
-
const { nodeSize, zoomScaleExtent } = this.config;
|
|
350
|
-
const { left, top, right, bottom } = this.bleed;
|
|
341
|
+
const { datamodel, config: { nodeSize } } = this;
|
|
342
|
+
const nodes = (nodeIds === null || nodeIds === void 0 ? void 0 : nodeIds.length) ? datamodel.nodes.filter(n => nodeIds.includes(n.id)) : datamodel.nodes;
|
|
351
343
|
const maxNodeSize = getMaxNodeSize(nodes, nodeSize);
|
|
352
|
-
const w = this._width;
|
|
353
|
-
const h = this._height;
|
|
354
344
|
const xExtent = [
|
|
355
345
|
min(nodes, d => getX(d) - maxNodeSize / 2 - (max((d._panels || []).map(p => p._padding.left)) || 0)),
|
|
356
346
|
max(nodes, d => getX(d) + maxNodeSize / 2 + (max((d._panels || []).map(p => p._padding.right)) || 0)),
|
|
@@ -361,8 +351,18 @@ class Graph extends ComponentCore {
|
|
|
361
351
|
];
|
|
362
352
|
if (xExtent.some(item => item === undefined) || yExtent.some(item => item === undefined)) {
|
|
363
353
|
console.warn('Unovis | Graph: Some of the node coordinates are undefined. This can happen if you try to fit the graph before the layout has been calculated.');
|
|
364
|
-
return
|
|
354
|
+
return;
|
|
365
355
|
}
|
|
356
|
+
const transform = this._getTransform(xExtent, yExtent, alignment);
|
|
357
|
+
smartTransition(this.g, duration)
|
|
358
|
+
.call(this._zoomBehavior.transform, transform);
|
|
359
|
+
this._onZoom(transform);
|
|
360
|
+
}
|
|
361
|
+
_getTransform(xExtent, yExtent, alignment) {
|
|
362
|
+
const { zoomScaleExtent } = this.config;
|
|
363
|
+
const { left, top, right, bottom } = this.bleed;
|
|
364
|
+
const w = this._width;
|
|
365
|
+
const h = this._height;
|
|
366
366
|
const xScale = w / (xExtent[1] - xExtent[0] + (left || 0) + (right || 0));
|
|
367
367
|
const yScale = h / (yExtent[1] - yExtent[0] + (top || 0) + (bottom || 0));
|
|
368
368
|
const clampedScale = clamp(min([xScale, yScale]), zoomScaleExtent[0], zoomScaleExtent[1]);
|
|
@@ -816,6 +816,27 @@ class Graph extends ComponentCore {
|
|
|
816
816
|
this._fit(duration, nodeIds, alignment);
|
|
817
817
|
});
|
|
818
818
|
}
|
|
819
|
+
fitViewToBounds(xExtent, yExtent, duration = this.config.duration, alignment = this.config.fitViewAlign) {
|
|
820
|
+
const { datamodel: { nodes } } = this;
|
|
821
|
+
// If no extents provided, return identity
|
|
822
|
+
if (!xExtent && !yExtent) {
|
|
823
|
+
console.warn('Unovis | Graph: At least one extent (x or y) must be provided.');
|
|
824
|
+
return;
|
|
825
|
+
}
|
|
826
|
+
const nodesFiltered = nodes.filter(n => {
|
|
827
|
+
const x = getX(n);
|
|
828
|
+
const y = getY(n);
|
|
829
|
+
return (!xExtent || (x !== undefined && x >= xExtent[0] && x <= xExtent[1])) && (!yExtent || (y >= yExtent[0] && y <= yExtent[1]));
|
|
830
|
+
});
|
|
831
|
+
if ((!xExtent || !yExtent) && !nodesFiltered.length) {
|
|
832
|
+
console.warn(`Unovis | Graph: No nodes found within provided extent [${xExtent}], [${yExtent}].`);
|
|
833
|
+
return;
|
|
834
|
+
}
|
|
835
|
+
const transform = this._getTransform(xExtent !== null && xExtent !== void 0 ? xExtent : extent(nodesFiltered, d => getX(d)), yExtent !== null && yExtent !== void 0 ? yExtent : extent(nodesFiltered, d => getY(d)), alignment);
|
|
836
|
+
smartTransition(this.g, duration)
|
|
837
|
+
.call(this._zoomBehavior.transform, transform);
|
|
838
|
+
this._onZoom(transform);
|
|
839
|
+
}
|
|
819
840
|
/** Enable automatic fitting to container if it was disabled due to previous zoom / pan interactions */
|
|
820
841
|
resetAutofitState() {
|
|
821
842
|
this._isAutoFitDisabled = false;
|