@unovis/ts 1.2.1-beta.1 → 1.2.1-beta.25
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/axis/config.d.ts +6 -0
- package/components/axis/config.js +2 -0
- package/components/axis/config.js.map +1 -1
- package/components/axis/index.js +5 -3
- package/components/axis/index.js.map +1 -1
- package/components/axis/style.js +3 -2
- package/components/axis/style.js.map +1 -1
- package/components/bullet-legend/config.d.ts +5 -2
- package/components/bullet-legend/config.js +2 -0
- package/components/bullet-legend/config.js.map +1 -1
- package/components/bullet-legend/index.js +6 -16
- package/components/bullet-legend/index.js.map +1 -1
- package/components/bullet-legend/modules/shape.d.ts +6 -0
- package/components/bullet-legend/modules/shape.js +58 -0
- package/components/bullet-legend/modules/shape.js.map +1 -0
- package/components/bullet-legend/style.js +6 -9
- package/components/bullet-legend/style.js.map +1 -1
- package/components/bullet-legend/types.d.ts +5 -0
- package/components/bullet-legend/types.js +7 -0
- package/components/bullet-legend/types.js.map +1 -1
- package/components/chord-diagram/config.d.ts +6 -0
- package/components/chord-diagram/config.js +2 -0
- package/components/chord-diagram/config.js.map +1 -1
- package/components/chord-diagram/index.d.ts +1 -0
- package/components/chord-diagram/index.js +22 -12
- package/components/chord-diagram/index.js.map +1 -1
- package/components/chord-diagram/modules/link.js +6 -5
- package/components/chord-diagram/modules/link.js.map +1 -1
- package/components/chord-diagram/style.d.ts +2 -2
- package/components/chord-diagram/style.js +21 -18
- package/components/chord-diagram/style.js.map +1 -1
- package/components/chord-diagram/types.d.ts +2 -2
- package/components/chord-diagram/types.js.map +1 -1
- package/components/nested-donut/index.js +15 -10
- package/components/nested-donut/index.js.map +1 -1
- package/components/nested-donut/modules/arc.js +2 -1
- package/components/nested-donut/modules/arc.js.map +1 -1
- package/components/nested-donut/modules/label.js +9 -6
- package/components/nested-donut/modules/label.js.map +1 -1
- package/components/nested-donut/types.d.ts +1 -0
- package/components/nested-donut/types.js.map +1 -1
- package/components/scatter/config.d.ts +3 -0
- package/components/scatter/config.js +1 -0
- package/components/scatter/config.js.map +1 -1
- package/components/scatter/index.d.ts +1 -1
- package/components/scatter/index.js +9 -4
- package/components/scatter/index.js.map +1 -1
- package/containers/single-container/index.d.ts +3 -2
- package/containers/single-container/index.js +6 -2
- package/containers/single-container/index.js.map +1 -1
- package/containers/xy-container/config.d.ts +7 -5
- package/containers/xy-container/config.js +1 -1
- package/containers/xy-container/config.js.map +1 -1
- package/containers/xy-container/index.d.ts +8 -7
- package/containers/xy-container/index.js +20 -13
- package/containers/xy-container/index.js.map +1 -1
- package/core/container/index.d.ts +5 -4
- package/core/container/index.js +7 -1
- package/core/container/index.js.map +1 -1
- package/index.js +2 -1
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/types/text.d.ts +3 -3
- package/types/text.js.map +1 -1
- package/types.js +1 -1
- package/utils/color.d.ts +7 -3
- package/utils/color.js +18 -2
- package/utils/color.js.map +1 -1
- package/utils/text.d.ts +1 -0
- package/utils/text.js +22 -10
- package/utils/text.js.map +1 -1
|
@@ -15,6 +15,8 @@ export interface AxisConfigInterface<Datum> extends Partial<XYComponentConfigInt
|
|
|
15
15
|
labelFontSize?: string | null;
|
|
16
16
|
/** Distance between the axis and the label in pixels. Default: `8` */
|
|
17
17
|
labelMargin?: number;
|
|
18
|
+
/** Font color of the axis label as CSS string. Default: `null` */
|
|
19
|
+
labelColor?: string | null;
|
|
18
20
|
/** Sets whether to draw the grid lines or not. Default: `true` */
|
|
19
21
|
gridLine?: boolean;
|
|
20
22
|
/** Sets whether to draw the tick lines or not. Default: `true` */
|
|
@@ -43,6 +45,8 @@ export interface AxisConfigInterface<Datum> extends Partial<XYComponentConfigInt
|
|
|
43
45
|
tickTextFontSize?: string | null;
|
|
44
46
|
/** Text alignment for ticks: `TextAlign.Left`, `TextAlign.Center` or `TextAlign.Right`. Default: `undefined` */
|
|
45
47
|
tickTextAlign?: TextAlign | string;
|
|
48
|
+
/** Font color of the tick text as CSS string. Default: `null` */
|
|
49
|
+
tickTextColor?: string | null;
|
|
46
50
|
/** The spacing in pixels between the tick and it's label. Default: `8` */
|
|
47
51
|
tickPadding?: number;
|
|
48
52
|
}
|
|
@@ -63,7 +67,9 @@ export declare class AxisConfig<Datum> extends XYComponentConfig<Datum> implemen
|
|
|
63
67
|
tickTextFitMode: FitMode;
|
|
64
68
|
tickTextFontSize: any;
|
|
65
69
|
tickTextAlign: any;
|
|
70
|
+
tickTextColor: any;
|
|
66
71
|
labelMargin: number;
|
|
72
|
+
labelColor: any;
|
|
67
73
|
tickFormat: any;
|
|
68
74
|
tickValues: any;
|
|
69
75
|
fullSize: boolean;
|
|
@@ -20,7 +20,9 @@ class AxisConfig extends XYComponentConfig {
|
|
|
20
20
|
this.tickTextFitMode = FitMode.Wrap;
|
|
21
21
|
this.tickTextFontSize = null;
|
|
22
22
|
this.tickTextAlign = undefined;
|
|
23
|
+
this.tickTextColor = null;
|
|
23
24
|
this.labelMargin = 8;
|
|
25
|
+
this.labelColor = null;
|
|
24
26
|
this.tickFormat = undefined;
|
|
25
27
|
this.tickValues = undefined;
|
|
26
28
|
this.fullSize = true;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sources":["../../../src/components/axis/config.ts"],"sourcesContent":["import { XYComponentConfigInterface, XYComponentConfig } from 'core/xy-component/config'\n\n// Types\nimport { AxisType } from 'components/axis/types'\nimport { Position } from 'types/position'\nimport { FitMode, TrimMode, TextAlign } from 'types/text'\n\n// We extend partial XY config interface because x and y properties are optional for Axis\nexport interface AxisConfigInterface<Datum> extends Partial<XYComponentConfigInterface<Datum>> {\n /** Axis position: `Position.Top`, `Position.Bottom`, `Position.Right` or `Position.Left`. Default: `undefined` */\n position?: Position | string;\n /** Axis type: `AxisType.X` or `AxisType.Y` */\n type?: AxisType | string;\n /** Extend the axis domain line to be full width or full height. Default: `true` */\n fullSize?: boolean;\n /** Axis label. Default: `undefined` */\n label?: string;\n /** Font size of the axis label as CSS string. Default: `null` */\n labelFontSize?: string | null;\n /** Distance between the axis and the label in pixels. Default: `8` */\n labelMargin?: number;\n /** Sets whether to draw the grid lines or not. Default: `true` */\n gridLine?: boolean;\n /** Sets whether to draw the tick lines or not. Default: `true` */\n tickLine?: boolean;\n /** Sets whether to draw the domain line or not. Default: `true` */\n domainLine?: boolean;\n /** Draw the min and max axis ticks only. Default: `false` */\n minMaxTicksOnly?: boolean;\n /** Tick label formatter function. Default: `undefined` */\n tickFormat?: ((tick: number, i: number, ticks: number[]) => string) | ((tick: Date, i: number, ticks: Date[]) => string);\n /** Explicitly set tick values. Default: `undefined` */\n tickValues?: number[];\n /** Set the approximate number of axis ticks (will be passed to D3's axis constructor). Default: `undefined` */\n numTicks?: number;\n /** Tick text fit mode: `FitMode.Wrap` or `FitMode.Trim`. Default: `FitMode.Wrap`. */\n tickTextFitMode?: FitMode | string;\n /** Maximum width in pixels for the tick text to be wrapped or trimmed. Default: `undefined` */\n tickTextWidth?: number;\n /** Tick text wrapping separator. String or array of strings. Default: `undefined` */\n tickTextSeparator?: string | string[];\n /** Force word break for ticks when they don't fit. Default: `false` */\n tickTextForceWordBreak?: boolean;\n /** Tick text trim mode: `TrimMode.Start`, `TrimMode.Middle` or `TrimMode.End`. Default: `TrimMode.Middle` */\n tickTextTrimType?: TrimMode | string;\n /** Font size of the tick text as CSS string. Default: `null` */\n tickTextFontSize?: string | null;\n /** Text alignment for ticks: `TextAlign.Left`, `TextAlign.Center` or `TextAlign.Right`. Default: `undefined` */\n tickTextAlign?: TextAlign | string;\n /** The spacing in pixels between the tick and it's label. Default: `8` */\n tickPadding?: number;\n}\n\nexport class AxisConfig<Datum> extends XYComponentConfig<Datum> implements AxisConfigInterface<Datum> {\n position = undefined\n type = undefined\n label = undefined\n labelFontSize = null\n gridLine = true\n tickLine = true\n domainLine = true\n numTicks = undefined\n minMaxTicksOnly = false\n tickTextWidth = undefined\n tickTextSeparator = undefined\n tickTextForceWordBreak = false\n tickTextTrimType = TrimMode.Middle\n tickTextFitMode = FitMode.Wrap\n tickTextFontSize = null\n tickTextAlign = undefined\n labelMargin = 8\n tickFormat = undefined\n tickValues = undefined\n fullSize = true\n tickPadding = 8\n}\n"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"config.js","sources":["../../../src/components/axis/config.ts"],"sourcesContent":["import { XYComponentConfigInterface, XYComponentConfig } from 'core/xy-component/config'\n\n// Types\nimport { AxisType } from 'components/axis/types'\nimport { Position } from 'types/position'\nimport { FitMode, TrimMode, TextAlign } from 'types/text'\n\n// We extend partial XY config interface because x and y properties are optional for Axis\nexport interface AxisConfigInterface<Datum> extends Partial<XYComponentConfigInterface<Datum>> {\n /** Axis position: `Position.Top`, `Position.Bottom`, `Position.Right` or `Position.Left`. Default: `undefined` */\n position?: Position | string;\n /** Axis type: `AxisType.X` or `AxisType.Y` */\n type?: AxisType | string;\n /** Extend the axis domain line to be full width or full height. Default: `true` */\n fullSize?: boolean;\n /** Axis label. Default: `undefined` */\n label?: string;\n /** Font size of the axis label as CSS string. Default: `null` */\n labelFontSize?: string | null;\n /** Distance between the axis and the label in pixels. Default: `8` */\n labelMargin?: number;\n /** Font color of the axis label as CSS string. Default: `null` */\n labelColor?: string | null;\n /** Sets whether to draw the grid lines or not. Default: `true` */\n gridLine?: boolean;\n /** Sets whether to draw the tick lines or not. Default: `true` */\n tickLine?: boolean;\n /** Sets whether to draw the domain line or not. Default: `true` */\n domainLine?: boolean;\n /** Draw the min and max axis ticks only. Default: `false` */\n minMaxTicksOnly?: boolean;\n /** Tick label formatter function. Default: `undefined` */\n tickFormat?: ((tick: number, i: number, ticks: number[]) => string) | ((tick: Date, i: number, ticks: Date[]) => string);\n /** Explicitly set tick values. Default: `undefined` */\n tickValues?: number[];\n /** Set the approximate number of axis ticks (will be passed to D3's axis constructor). Default: `undefined` */\n numTicks?: number;\n /** Tick text fit mode: `FitMode.Wrap` or `FitMode.Trim`. Default: `FitMode.Wrap`. */\n tickTextFitMode?: FitMode | string;\n /** Maximum width in pixels for the tick text to be wrapped or trimmed. Default: `undefined` */\n tickTextWidth?: number;\n /** Tick text wrapping separator. String or array of strings. Default: `undefined` */\n tickTextSeparator?: string | string[];\n /** Force word break for ticks when they don't fit. Default: `false` */\n tickTextForceWordBreak?: boolean;\n /** Tick text trim mode: `TrimMode.Start`, `TrimMode.Middle` or `TrimMode.End`. Default: `TrimMode.Middle` */\n tickTextTrimType?: TrimMode | string;\n /** Font size of the tick text as CSS string. Default: `null` */\n tickTextFontSize?: string | null;\n /** Text alignment for ticks: `TextAlign.Left`, `TextAlign.Center` or `TextAlign.Right`. Default: `undefined` */\n tickTextAlign?: TextAlign | string;\n /** Font color of the tick text as CSS string. Default: `null` */\n tickTextColor?: string | null;\n /** The spacing in pixels between the tick and it's label. Default: `8` */\n tickPadding?: number;\n}\n\nexport class AxisConfig<Datum> extends XYComponentConfig<Datum> implements AxisConfigInterface<Datum> {\n position = undefined\n type = undefined\n label = undefined\n labelFontSize = null\n gridLine = true\n tickLine = true\n domainLine = true\n numTicks = undefined\n minMaxTicksOnly = false\n tickTextWidth = undefined\n tickTextSeparator = undefined\n tickTextForceWordBreak = false\n tickTextTrimType = TrimMode.Middle\n tickTextFitMode = FitMode.Wrap\n tickTextFontSize = null\n tickTextAlign = undefined\n tickTextColor = null\n labelMargin = 8\n labelColor = null\n tickFormat = undefined\n tickValues = undefined\n fullSize = true\n tickPadding = 8\n}\n"],"names":[],"mappings":";;;AAyDM,MAAO,UAAkB,SAAQ,iBAAwB,CAAA;AAA/D,IAAA,WAAA,GAAA;;QACE,IAAQ,CAAA,QAAA,GAAG,SAAS,CAAA;QACpB,IAAI,CAAA,IAAA,GAAG,SAAS,CAAA;QAChB,IAAK,CAAA,KAAA,GAAG,SAAS,CAAA;QACjB,IAAa,CAAA,aAAA,GAAG,IAAI,CAAA;QACpB,IAAQ,CAAA,QAAA,GAAG,IAAI,CAAA;QACf,IAAQ,CAAA,QAAA,GAAG,IAAI,CAAA;QACf,IAAU,CAAA,UAAA,GAAG,IAAI,CAAA;QACjB,IAAQ,CAAA,QAAA,GAAG,SAAS,CAAA;QACpB,IAAe,CAAA,eAAA,GAAG,KAAK,CAAA;QACvB,IAAa,CAAA,aAAA,GAAG,SAAS,CAAA;QACzB,IAAiB,CAAA,iBAAA,GAAG,SAAS,CAAA;QAC7B,IAAsB,CAAA,sBAAA,GAAG,KAAK,CAAA;AAC9B,QAAA,IAAA,CAAA,gBAAgB,GAAG,QAAQ,CAAC,MAAM,CAAA;AAClC,QAAA,IAAA,CAAA,eAAe,GAAG,OAAO,CAAC,IAAI,CAAA;QAC9B,IAAgB,CAAA,gBAAA,GAAG,IAAI,CAAA;QACvB,IAAa,CAAA,aAAA,GAAG,SAAS,CAAA;QACzB,IAAa,CAAA,aAAA,GAAG,IAAI,CAAA;QACpB,IAAW,CAAA,WAAA,GAAG,CAAC,CAAA;QACf,IAAU,CAAA,UAAA,GAAG,IAAI,CAAA;QACjB,IAAU,CAAA,UAAA,GAAG,SAAS,CAAA;QACtB,IAAU,CAAA,UAAA,GAAG,SAAS,CAAA;QACtB,IAAQ,CAAA,QAAA,GAAG,IAAI,CAAA;QACf,IAAW,CAAA,WAAA,GAAG,CAAC,CAAA;KAChB;AAAA;;;;"}
|
package/components/axis/index.js
CHANGED
|
@@ -167,7 +167,8 @@ class Axis extends XYComponentCore {
|
|
|
167
167
|
// will include exiting elements, so we're filtering them out.
|
|
168
168
|
const tickText = selection.selectAll('g.tick > text')
|
|
169
169
|
.filter(tickValue => tickValues.some(t => isEqual(tickValue, t))) // We use isEqual to compare Dates
|
|
170
|
-
.classed(tickLabel, true)
|
|
170
|
+
.classed(tickLabel, true)
|
|
171
|
+
.style('fill', config.tickTextColor);
|
|
171
172
|
// We interrupt the transition on tick's <text> to make it 'wrappable'
|
|
172
173
|
tickText.nodes().forEach(node => interrupt(node));
|
|
173
174
|
tickText.each((value, i, elements) => {
|
|
@@ -257,9 +258,10 @@ class Axis extends XYComponentCore {
|
|
|
257
258
|
.append('text')
|
|
258
259
|
.attr('class', label)
|
|
259
260
|
.text(label$1)
|
|
260
|
-
.style('font-size', labelFontSize)
|
|
261
261
|
.attr('dy', `${this._getLabelDY()}em`)
|
|
262
|
-
.attr('transform', `translate(${offsetX + marginX},${offsetY + marginY}) rotate(${rotation})`)
|
|
262
|
+
.attr('transform', `translate(${offsetX + marginX},${offsetY + marginY}) rotate(${rotation})`)
|
|
263
|
+
.style('font-size', labelFontSize)
|
|
264
|
+
.style('fill', this.config.labelColor);
|
|
263
265
|
}
|
|
264
266
|
_getLabelDY() {
|
|
265
267
|
const { type, position } = this.config;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/components/axis/index.ts"],"sourcesContent":["import { select, Selection } from 'd3-selection'\nimport { interrupt } from 'd3-transition'\nimport { Axis as D3Axis, axisBottom, axisLeft, axisRight, axisTop } from 'd3-axis'\n\n// Core\nimport { XYComponentCore } from 'core/xy-component'\n\n// Types\nimport { Position } from 'types/position'\nimport { ContinuousScale } from 'types/scale'\nimport { Spacing } from 'types/spacing'\nimport { FitMode, TextAlign, UnovisText, UnovisTextOptions, VerticalAlign } from 'types/text'\n\n// Utils\nimport { smartTransition } from 'utils/d3'\nimport { renderTextToSvgTextElement, trimSVGText } from 'utils/text'\nimport { isEqual } from 'utils/data'\n\n// Local Types\nimport { AxisType } from './types'\n\n// Config\nimport { AxisConfig, AxisConfigInterface } from './config'\n\n// Styles\nimport * as s from './style'\n\nexport class Axis<Datum> extends XYComponentCore<Datum, AxisConfig<Datum>, AxisConfigInterface<Datum>> {\n static selectors = s\n config: AxisConfig<Datum> = new AxisConfig<Datum>()\n axisGroup: Selection<SVGGElement, unknown, SVGGElement, unknown>\n gridGroup: Selection<SVGGElement, unknown, SVGGElement, unknown>\n\n private _axisRawBBox: DOMRect\n private _axisSizeBBox: SVGRect\n private _requiredMargin: Spacing\n private _defaultNumTicks = 3\n private _minMaxTicksOnlyEnforceWidth = 250\n\n events = {}\n\n constructor (config?: AxisConfigInterface<Datum>) {\n super()\n if (config) this.config.init(config)\n\n this.axisGroup = this.g.append('g')\n this.gridGroup = this.g.append('g')\n .attr('class', s.grid)\n }\n\n /** Renders axis to an invisible grouped to calculate automatic chart margins */\n preRender (): void {\n const { config } = this\n const axisRenderHelperGroup = this.g.append('g').attr('opacity', 0)\n\n this._renderAxis(axisRenderHelperGroup, 0)\n\n // Store axis raw BBox (without the label) for further label positioning (see _renderAxisLabel)\n this._axisRawBBox = axisRenderHelperGroup.node().getBBox()\n\n // Align tick text\n if (config.tickTextAlign) this._alignTickLabels()\n\n // Render label and store total axis size and required margins\n this._renderAxisLabel(axisRenderHelperGroup)\n this._axisSizeBBox = this._getAxisSize(axisRenderHelperGroup)\n this._requiredMargin = this._getRequiredMargin(this._axisSizeBBox)\n\n axisRenderHelperGroup.remove()\n }\n\n getPosition (): Position {\n const { config: { type, position } } = this\n return (position ?? ((type === AxisType.X) ? Position.Bottom : Position.Left)) as Position\n }\n\n _getAxisSize (selection: Selection<SVGGElement, unknown, SVGGElement, undefined>): SVGRect {\n const bBox = selection.node().getBBox()\n return bBox\n }\n\n _getRequiredMargin (axisSize = this._axisSizeBBox): Spacing {\n const { config: { type, position } } = this\n\n switch (type) {\n case AxisType.X: {\n const tolerancePx = 1\n const xEnd = this._axisSizeBBox.x + this._axisSizeBBox.width\n\n const left = this._axisSizeBBox.x < 0 ? Math.abs(this._axisSizeBBox.x) : 0\n const right = (xEnd - this._width) > tolerancePx ? xEnd - this._width : 0\n\n switch (position) {\n case Position.Top: return { top: axisSize.height, left, right }\n case Position.Bottom: default: return { bottom: axisSize.height, left, right }\n }\n }\n case AxisType.Y: {\n const bleedY = axisSize.height > this._height ? (axisSize.height - this._height) / 2 : 0\n const top = bleedY\n const bottom = bleedY\n\n switch (position) {\n case Position.Right: return { right: axisSize.width, top, bottom }\n case Position.Left: default: return { left: axisSize.width, top, bottom }\n }\n }\n }\n }\n\n getRequiredMargin (): Spacing {\n return this._requiredMargin\n }\n\n /** Calculates axis transform:translate offset based on passed container margins */\n getOffset (containerMargin: Spacing): {left: number; top: number} {\n const { config: { type, position } } = this\n\n switch (type) {\n case AxisType.X:\n switch (position) {\n case Position.Top: return { top: containerMargin.top, left: containerMargin.left }\n case Position.Bottom: default: return { top: containerMargin.top + this._height, left: containerMargin.left }\n }\n case AxisType.Y:\n switch (position) {\n case Position.Right: return { top: containerMargin.top, left: containerMargin.left + this._width }\n case Position.Left: default: return { top: containerMargin.top, left: containerMargin.left }\n }\n }\n }\n\n _render (duration = this.config.duration, selection = this.axisGroup): void {\n const { config } = this\n\n this._renderAxis(selection, duration)\n this._renderAxisLabel(selection)\n\n if (config.gridLine) {\n const gridGen = this._buildGrid().tickFormat(() => '')\n gridGen.tickValues(this._getConfiguredTickValues())\n // Interrupting all active transitions first to prevent them from being stuck.\n // Somehow we see it happening in Angular apps.\n this.gridGroup.selectAll('*').interrupt()\n smartTransition(this.gridGroup, duration).call(gridGen).style('opacity', 1)\n } else {\n smartTransition(this.gridGroup, duration).style('opacity', 0)\n }\n\n if (config.tickTextAlign) this._alignTickLabels()\n }\n\n _buildAxis (): D3Axis<any> {\n const { config: { type, position, tickPadding } } = this\n\n const ticks = this._getNumTicks()\n switch (type) {\n case AxisType.X:\n switch (position) {\n case Position.Top: return axisTop(this.xScale).ticks(ticks).tickPadding(tickPadding)\n case Position.Bottom: default: return axisBottom(this.xScale).ticks(ticks).tickPadding(tickPadding)\n }\n case AxisType.Y:\n switch (position) {\n case Position.Right: return axisRight(this.yScale).ticks(ticks).tickPadding(tickPadding)\n case Position.Left: default: return axisLeft(this.yScale).ticks(ticks).tickPadding(tickPadding)\n }\n }\n }\n\n _buildGrid (): D3Axis<any> {\n const { config: { type, position } } = this\n\n const ticks = this._getNumTicks()\n switch (type) {\n case AxisType.X:\n switch (position) {\n case Position.Top: return axisTop(this.xScale).ticks(ticks * 2).tickSize(-this._height).tickSizeOuter(0)\n case Position.Bottom: default: return axisBottom(this.xScale).ticks(ticks * 2).tickSize(-this._height).tickSizeOuter(0)\n }\n case AxisType.Y:\n switch (position) {\n case Position.Right: return axisRight(this.yScale).ticks(ticks * 2).tickSize(-this._width).tickSizeOuter(0)\n case Position.Left: default: return axisLeft(this.yScale).ticks(ticks * 2).tickSize(-this._width).tickSizeOuter(0)\n }\n }\n }\n\n _renderAxis (selection = this.axisGroup, duration = this.config.duration): void {\n const { config } = this\n\n const axisGen = this._buildAxis()\n const tickValues: (number | Date)[] = this._getConfiguredTickValues() || axisGen.scale<ContinuousScale>().ticks(this._getNumTicks())\n axisGen.tickValues(tickValues)\n\n // Interrupting all active transitions first to prevent them from being stuck.\n // Somehow we see it happening in Angular apps.\n selection.selectAll('*').interrupt()\n smartTransition(selection, duration).call(axisGen)\n\n const ticks = selection.selectAll<SVGGElement, number | Date>('g.tick')\n\n ticks\n .classed(s.tick, true)\n .style('font-size', config.tickTextFontSize)\n\n // Selecting the <text> elements of the ticks to apply formatting. By default, this selection\n // will include exiting elements, so we're filtering them out.\n const tickText = selection.selectAll<SVGTextElement, number | Date>('g.tick > text')\n .filter(tickValue => tickValues.some(t => isEqual(tickValue, t))) // We use isEqual to compare Dates\n .classed(s.tickLabel, true)\n\n // We interrupt the transition on tick's <text> to make it 'wrappable'\n tickText.nodes().forEach(node => interrupt(node))\n\n tickText.each((value, i, elements) => {\n const text = config.tickFormat?.(value, i, tickValues) ?? `${value}`\n const textElement = elements[i]\n const textMaxWidth = config.tickTextWidth || (config.type === AxisType.X ? this._containerWidth / (ticks.size() + 1) : this._containerWidth / 5)\n const styleDeclaration = getComputedStyle(textElement)\n const fontSize = Number.parseFloat(styleDeclaration.fontSize)\n const fontFamily = styleDeclaration.fontFamily\n\n if (config.tickTextFitMode === FitMode.Trim) {\n const textElementSelection = select<SVGTextElement, string>(textElement).text(text)\n trimSVGText(textElementSelection, textMaxWidth, config.tickTextTrimType, true, fontSize, 0.58)\n } else {\n const textBlock: UnovisText = { text, fontFamily, fontSize }\n const textOptions: UnovisTextOptions = {\n verticalAlign: config.type === AxisType.X ? VerticalAlign.Top : VerticalAlign.Middle,\n width: textMaxWidth,\n separator: config.tickTextSeparator,\n wordBreak: config.tickTextForceWordBreak,\n }\n renderTextToSvgTextElement(textElement, textBlock, textOptions)\n }\n })\n\n selection\n .classed(s.axis, true)\n .classed(s.hideTickLine, !config.tickLine)\n .classed(s.hideDomain, !config.domainLine)\n\n if (config.fullSize) {\n const path = this._getFullDomainPath(0)\n smartTransition(selection.select('.domain'), duration).attr('d', path)\n }\n }\n\n _getNumTicks (): number {\n const { config: { type, numTicks } } = this\n\n if (numTicks) return numTicks\n\n if (type === AxisType.X) {\n const xRange = this.xScale.range() as [number, number]\n const width = xRange[1] - xRange[0]\n return Math.floor(width / 175)\n }\n\n if (type === AxisType.Y) {\n const yRange = this.yScale.range() as [number, number]\n const height = Math.abs(yRange[0] - yRange[1])\n return Math.pow(height, 0.85) / 25\n }\n\n return this._defaultNumTicks\n }\n\n _getConfiguredTickValues (): number[] | null {\n const { config: { tickValues, type, minMaxTicksOnly } } = this\n const scale = type === AxisType.X ? this.xScale : this.yScale\n const scaleDomain = scale?.domain()\n\n if (tickValues) {\n return tickValues.filter(v => (v >= scaleDomain[0]) && (v <= scaleDomain[1]))\n }\n\n if (minMaxTicksOnly || (type === AxisType.X && this._width < this._minMaxTicksOnlyEnforceWidth)) {\n return scaleDomain as number[]\n }\n\n return null\n }\n\n _getFullDomainPath (tickSize = 0): string {\n const { config: { type } } = this\n switch (type) {\n case AxisType.X: return `M0.5, ${tickSize} V0.5 H${this._width + 0.5} V${tickSize}`\n case AxisType.Y: return `M${-tickSize}, ${this._height + 0.5} H0.5 V0.5 H${-tickSize}`\n }\n }\n\n _renderAxisLabel (selection = this.axisGroup): void {\n const { type, label, labelMargin, labelFontSize } = this.config\n\n // Remove the old label first to calculate the axis size properly\n selection.selectAll(`.${s.label}`).remove()\n\n // Calculate label position and rotation\n const axisPosition = this.getPosition()\n // We always use this.axisRenderHelperGroup to calculate the size of the axis because\n // this.axisGroup will give us incorrect values due to animation\n const { width: axisWidth, height: axisHeight } = this._axisRawBBox ?? selection.node().getBBox()\n\n const offsetX = type === AxisType.X ? this._width / 2 : (-1) ** (+(axisPosition === Position.Left)) * axisWidth\n const offsetY = type === AxisType.X ? (-1) ** (+(axisPosition === Position.Top)) * axisHeight : this._height / 2\n\n const marginX = type === AxisType.X ? 0 : (-1) ** (+(axisPosition === Position.Left)) * labelMargin\n const marginY = type === AxisType.X ? (-1) ** (+(axisPosition === Position.Top)) * labelMargin : 0\n\n const rotation = type === AxisType.Y ? -90 : 0\n\n // Append new label\n selection\n .append('text')\n .attr('class', s.label)\n .text(label)\n .style('font-size', labelFontSize)\n .attr('dy', `${this._getLabelDY()}em`)\n .attr('transform', `translate(${offsetX + marginX},${offsetY + marginY}) rotate(${rotation})`)\n }\n\n _getLabelDY (): number {\n const { type, position } = this.config\n switch (type) {\n case AxisType.X:\n switch (position) {\n case Position.Top: return 0\n case Position.Bottom: default: return 0.75\n }\n case AxisType.Y:\n switch (position) {\n case Position.Right: return 0.75\n case Position.Left: default: return -0.25\n }\n }\n }\n\n _alignTickLabels (): void {\n const { config: { type, tickTextAlign, position } } = this\n\n const tickText = this.g.selectAll('g.tick > text')\n const textAnchor = this._getTickTextAnchor(tickTextAlign)\n const translateX = type === AxisType.X ? 0 : this._getYTickTextTranslate(tickTextAlign, position)\n\n tickText\n .attr('text-anchor', textAnchor)\n .attr('transform', `translate(${translateX},0)`)\n }\n\n _getTickTextAnchor (textAlign: TextAlign): string {\n switch (textAlign) {\n case TextAlign.Left: return 'start'\n case TextAlign.Right: return 'end'\n case TextAlign.Center: return 'middle'\n default: return null\n }\n }\n\n _getYTickTextTranslate (textAlign: TextAlign, axisPosition: Position = Position.Left): number {\n const defaultTickTextSpacingPx = 9 // Default in D3\n const width = this._axisRawBBox.width - defaultTickTextSpacingPx\n\n switch (textAlign) {\n case TextAlign.Left: return axisPosition === Position.Left ? width * -1 : 0\n case TextAlign.Right: return axisPosition === Position.Left ? 0 : width\n case TextAlign.Center: return axisPosition === Position.Left ? width * (-0.5) : width * 0.5\n default: return 0\n }\n }\n}\n"],"names":["s.grid","s.tick","s.tickLabel","s.axis","s.hideTickLine","s.hideDomain","label","s.label","s"],"mappings":";;;;;;;;;;;;;;AA2BM,MAAO,IAAY,SAAQ,eAAqE,CAAA;AAcpG,IAAA,WAAA,CAAa,MAAmC,EAAA;AAC9C,QAAA,KAAK,EAAE,CAAA;AAbT,QAAA,IAAA,CAAA,MAAM,GAAsB,IAAI,UAAU,EAAS,CAAA;QAO3C,IAAgB,CAAA,gBAAA,GAAG,CAAC,CAAA;QACpB,IAA4B,CAAA,4BAAA,GAAG,GAAG,CAAA;QAE1C,IAAM,CAAA,MAAA,GAAG,EAAE,CAAA;AAIT,QAAA,IAAI,MAAM;AAAE,YAAA,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;QAEpC,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;QACnC,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC;AAChC,aAAA,IAAI,CAAC,OAAO,EAAEA,IAAM,CAAC,CAAA;KACzB;;IAGD,SAAS,GAAA;AACP,QAAA,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,CAAA;AACvB,QAAA,MAAM,qBAAqB,GAAG,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC,CAAC,CAAA;AAEnE,QAAA,IAAI,CAAC,WAAW,CAAC,qBAAqB,EAAE,CAAC,CAAC,CAAA;;QAG1C,IAAI,CAAC,YAAY,GAAG,qBAAqB,CAAC,IAAI,EAAE,CAAC,OAAO,EAAE,CAAA;;QAG1D,IAAI,MAAM,CAAC,aAAa;YAAE,IAAI,CAAC,gBAAgB,EAAE,CAAA;;AAGjD,QAAA,I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,IAAI,CAAC,YAAY,CAAC,KAAK,GAAG,wBAAwB,CAAA;AAEhE,QAAA,QAAQ,SAAS;YACf,KAAK,SAAS,CAAC,IAAI,EAAE,OAAO,YAAY,KAAK,QAAQ,CAAC,IAAI,GAAG,KAAK,GAAG,CAAC,CAAC,GAAG,CAAC,CAAA;AAC3E,YAAA,KAAK,SAAS,CAAC,KAAK,EAAE,OAAO,YAAY,KAAK,QAAQ,CAAC,IAAI,GAAG,CAAC,GAAG,KAAK,CAAA;YACvE,KAAK,SAAS,CAAC,MAAM,EAAE,OAAO,YAAY,KAAK,QAAQ,CAAC,IAAI,GAAG,KAAK,IAAI,CAAC,GAAG,CAAC,GAAG,KAAK,GAAG,GAAG,CAAA;AAC3F,YAAA,SAAS,OAAO,CAAC,CAAA;AAClB,SAAA;KACF;;AAtVM,IAAS,CAAA,SAAA,GAAGE,KAAC;;;;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/components/axis/index.ts"],"sourcesContent":["import { select, Selection } from 'd3-selection'\nimport { interrupt } from 'd3-transition'\nimport { Axis as D3Axis, axisBottom, axisLeft, axisRight, axisTop } from 'd3-axis'\n\n// Core\nimport { XYComponentCore } from 'core/xy-component'\n\n// Types\nimport { Position } from 'types/position'\nimport { ContinuousScale } from 'types/scale'\nimport { Spacing } from 'types/spacing'\nimport { FitMode, TextAlign, UnovisText, UnovisTextOptions, VerticalAlign } from 'types/text'\n\n// Utils\nimport { smartTransition } from 'utils/d3'\nimport { renderTextToSvgTextElement, trimSVGText } from 'utils/text'\nimport { isEqual } from 'utils/data'\n\n// Local Types\nimport { AxisType } from './types'\n\n// Config\nimport { AxisConfig, AxisConfigInterface } from './config'\n\n// Styles\nimport * as s from './style'\n\nexport class Axis<Datum> extends XYComponentCore<Datum, AxisConfig<Datum>, AxisConfigInterface<Datum>> {\n static selectors = s\n config: AxisConfig<Datum> = new AxisConfig<Datum>()\n axisGroup: Selection<SVGGElement, unknown, SVGGElement, unknown>\n gridGroup: Selection<SVGGElement, unknown, SVGGElement, unknown>\n\n private _axisRawBBox: DOMRect\n private _axisSizeBBox: SVGRect\n private _requiredMargin: Spacing\n private _defaultNumTicks = 3\n private _minMaxTicksOnlyEnforceWidth = 250\n\n events = {}\n\n constructor (config?: AxisConfigInterface<Datum>) {\n super()\n if (config) this.config.init(config)\n\n this.axisGroup = this.g.append('g')\n this.gridGroup = this.g.append('g')\n .attr('class', s.grid)\n }\n\n /** Renders axis to an invisible grouped to calculate automatic chart margins */\n preRender (): void {\n const { config } = this\n const axisRenderHelperGroup = this.g.append('g').attr('opacity', 0)\n\n this._renderAxis(axisRenderHelperGroup, 0)\n\n // Store axis raw BBox (without the label) for further label positioning (see _renderAxisLabel)\n this._axisRawBBox = axisRenderHelperGroup.node().getBBox()\n\n // Align tick text\n if (config.tickTextAlign) this._alignTickLabels()\n\n // Render label and store total axis size and required margins\n this._renderAxisLabel(axisRenderHelperGroup)\n this._axisSizeBBox = this._getAxisSize(axisRenderHelperGroup)\n this._requiredMargin = this._getRequiredMargin(this._axisSizeBBox)\n\n axisRenderHelperGroup.remove()\n }\n\n getPosition (): Position {\n const { config: { type, position } } = this\n return (position ?? ((type === AxisType.X) ? Position.Bottom : Position.Left)) as Position\n }\n\n _getAxisSize (selection: Selection<SVGGElement, unknown, SVGGElement, undefined>): SVGRect {\n const bBox = selection.node().getBBox()\n return bBox\n }\n\n _getRequiredMargin (axisSize = this._axisSizeBBox): Spacing {\n const { config: { type, position } } = this\n\n switch (type) {\n case AxisType.X: {\n const tolerancePx = 1\n const xEnd = this._axisSizeBBox.x + this._axisSizeBBox.width\n\n const left = this._axisSizeBBox.x < 0 ? Math.abs(this._axisSizeBBox.x) : 0\n const right = (xEnd - this._width) > tolerancePx ? xEnd - this._width : 0\n\n switch (position) {\n case Position.Top: return { top: axisSize.height, left, right }\n case Position.Bottom: default: return { bottom: axisSize.height, left, right }\n }\n }\n case AxisType.Y: {\n const bleedY = axisSize.height > this._height ? (axisSize.height - this._height) / 2 : 0\n const top = bleedY\n const bottom = bleedY\n\n switch (position) {\n case Position.Right: return { right: axisSize.width, top, bottom }\n case Position.Left: default: return { left: axisSize.width, top, bottom }\n }\n }\n }\n }\n\n getRequiredMargin (): Spacing {\n return this._requiredMargin\n }\n\n /** Calculates axis transform:translate offset based on passed container margins */\n getOffset (containerMargin: Spacing): {left: number; top: number} {\n const { config: { type, position } } = this\n\n switch (type) {\n case AxisType.X:\n switch (position) {\n case Position.Top: return { top: containerMargin.top, left: containerMargin.left }\n case Position.Bottom: default: return { top: containerMargin.top + this._height, left: containerMargin.left }\n }\n case AxisType.Y:\n switch (position) {\n case Position.Right: return { top: containerMargin.top, left: containerMargin.left + this._width }\n case Position.Left: default: return { top: containerMargin.top, left: containerMargin.left }\n }\n }\n }\n\n _render (duration = this.config.duration, selection = this.axisGroup): void {\n const { config } = this\n\n this._renderAxis(selection, duration)\n this._renderAxisLabel(selection)\n\n if (config.gridLine) {\n const gridGen = this._buildGrid().tickFormat(() => '')\n gridGen.tickValues(this._getConfiguredTickValues())\n // Interrupting all active transitions first to prevent them from being stuck.\n // Somehow we see it happening in Angular apps.\n this.gridGroup.selectAll('*').interrupt()\n smartTransition(this.gridGroup, duration).call(gridGen).style('opacity', 1)\n } else {\n smartTransition(this.gridGroup, duration).style('opacity', 0)\n }\n\n if (config.tickTextAlign) this._alignTickLabels()\n }\n\n _buildAxis (): D3Axis<any> {\n const { config: { type, position, tickPadding } } = this\n\n const ticks = this._getNumTicks()\n switch (type) {\n case AxisType.X:\n switch (position) {\n case Position.Top: return axisTop(this.xScale).ticks(ticks).tickPadding(tickPadding)\n case Position.Bottom: default: return axisBottom(this.xScale).ticks(ticks).tickPadding(tickPadding)\n }\n case AxisType.Y:\n switch (position) {\n case Position.Right: return axisRight(this.yScale).ticks(ticks).tickPadding(tickPadding)\n case Position.Left: default: return axisLeft(this.yScale).ticks(ticks).tickPadding(tickPadding)\n }\n }\n }\n\n _buildGrid (): D3Axis<any> {\n const { config: { type, position } } = this\n\n const ticks = this._getNumTicks()\n switch (type) {\n case AxisType.X:\n switch (position) {\n case Position.Top: return axisTop(this.xScale).ticks(ticks * 2).tickSize(-this._height).tickSizeOuter(0)\n case Position.Bottom: default: return axisBottom(this.xScale).ticks(ticks * 2).tickSize(-this._height).tickSizeOuter(0)\n }\n case AxisType.Y:\n switch (position) {\n case Position.Right: return axisRight(this.yScale).ticks(ticks * 2).tickSize(-this._width).tickSizeOuter(0)\n case Position.Left: default: return axisLeft(this.yScale).ticks(ticks * 2).tickSize(-this._width).tickSizeOuter(0)\n }\n }\n }\n\n _renderAxis (selection = this.axisGroup, duration = this.config.duration): void {\n const { config } = this\n\n const axisGen = this._buildAxis()\n const tickValues: (number | Date)[] = this._getConfiguredTickValues() || axisGen.scale<ContinuousScale>().ticks(this._getNumTicks())\n axisGen.tickValues(tickValues)\n\n // Interrupting all active transitions first to prevent them from being stuck.\n // Somehow we see it happening in Angular apps.\n selection.selectAll('*').interrupt()\n smartTransition(selection, duration).call(axisGen)\n\n const ticks = selection.selectAll<SVGGElement, number | Date>('g.tick')\n\n ticks\n .classed(s.tick, true)\n .style('font-size', config.tickTextFontSize)\n\n // Selecting the <text> elements of the ticks to apply formatting. By default, this selection\n // will include exiting elements, so we're filtering them out.\n const tickText = selection.selectAll<SVGTextElement, number | Date>('g.tick > text')\n .filter(tickValue => tickValues.some(t => isEqual(tickValue, t))) // We use isEqual to compare Dates\n .classed(s.tickLabel, true)\n .style('fill', config.tickTextColor)\n\n // We interrupt the transition on tick's <text> to make it 'wrappable'\n tickText.nodes().forEach(node => interrupt(node))\n\n tickText.each((value, i, elements) => {\n const text = config.tickFormat?.(value, i, tickValues) ?? `${value}`\n const textElement = elements[i]\n const textMaxWidth = config.tickTextWidth || (config.type === AxisType.X ? this._containerWidth / (ticks.size() + 1) : this._containerWidth / 5)\n const styleDeclaration = getComputedStyle(textElement)\n const fontSize = Number.parseFloat(styleDeclaration.fontSize)\n const fontFamily = styleDeclaration.fontFamily\n\n if (config.tickTextFitMode === FitMode.Trim) {\n const textElementSelection = select<SVGTextElement, string>(textElement).text(text)\n trimSVGText(textElementSelection, textMaxWidth, config.tickTextTrimType, true, fontSize, 0.58)\n } else {\n const textBlock: UnovisText = { text, fontFamily, fontSize }\n const textOptions: UnovisTextOptions = {\n verticalAlign: config.type === AxisType.X ? VerticalAlign.Top : VerticalAlign.Middle,\n width: textMaxWidth,\n separator: config.tickTextSeparator,\n wordBreak: config.tickTextForceWordBreak,\n }\n renderTextToSvgTextElement(textElement, textBlock, textOptions)\n }\n })\n\n selection\n .classed(s.axis, true)\n .classed(s.hideTickLine, !config.tickLine)\n .classed(s.hideDomain, !config.domainLine)\n\n if (config.fullSize) {\n const path = this._getFullDomainPath(0)\n smartTransition(selection.select('.domain'), duration).attr('d', path)\n }\n }\n\n _getNumTicks (): number {\n const { config: { type, numTicks } } = this\n\n if (numTicks) return numTicks\n\n if (type === AxisType.X) {\n const xRange = this.xScale.range() as [number, number]\n const width = xRange[1] - xRange[0]\n return Math.floor(width / 175)\n }\n\n if (type === AxisType.Y) {\n const yRange = this.yScale.range() as [number, number]\n const height = Math.abs(yRange[0] - yRange[1])\n return Math.pow(height, 0.85) / 25\n }\n\n return this._defaultNumTicks\n }\n\n _getConfiguredTickValues (): number[] | null {\n const { config: { tickValues, type, minMaxTicksOnly } } = this\n const scale = type === AxisType.X ? this.xScale : this.yScale\n const scaleDomain = scale?.domain()\n\n if (tickValues) {\n return tickValues.filter(v => (v >= scaleDomain[0]) && (v <= scaleDomain[1]))\n }\n\n if (minMaxTicksOnly || (type === AxisType.X && this._width < this._minMaxTicksOnlyEnforceWidth)) {\n return scaleDomain as number[]\n }\n\n return null\n }\n\n _getFullDomainPath (tickSize = 0): string {\n const { config: { type } } = this\n switch (type) {\n case AxisType.X: return `M0.5, ${tickSize} V0.5 H${this._width + 0.5} V${tickSize}`\n case AxisType.Y: return `M${-tickSize}, ${this._height + 0.5} H0.5 V0.5 H${-tickSize}`\n }\n }\n\n _renderAxisLabel (selection = this.axisGroup): void {\n const { type, label, labelMargin, labelFontSize } = this.config\n\n // Remove the old label first to calculate the axis size properly\n selection.selectAll(`.${s.label}`).remove()\n\n // Calculate label position and rotation\n const axisPosition = this.getPosition()\n // We always use this.axisRenderHelperGroup to calculate the size of the axis because\n // this.axisGroup will give us incorrect values due to animation\n const { width: axisWidth, height: axisHeight } = this._axisRawBBox ?? selection.node().getBBox()\n\n const offsetX = type === AxisType.X ? this._width / 2 : (-1) ** (+(axisPosition === Position.Left)) * axisWidth\n const offsetY = type === AxisType.X ? (-1) ** (+(axisPosition === Position.Top)) * axisHeight : this._height / 2\n\n const marginX = type === AxisType.X ? 0 : (-1) ** (+(axisPosition === Position.Left)) * labelMargin\n const marginY = type === AxisType.X ? (-1) ** (+(axisPosition === Position.Top)) * labelMargin : 0\n\n const rotation = type === AxisType.Y ? -90 : 0\n\n // Append new label\n selection\n .append('text')\n .attr('class', s.label)\n .text(label)\n .attr('dy', `${this._getLabelDY()}em`)\n .attr('transform', `translate(${offsetX + marginX},${offsetY + marginY}) rotate(${rotation})`)\n .style('font-size', labelFontSize)\n .style('fill', this.config.labelColor)\n }\n\n _getLabelDY (): number {\n const { type, position } = this.config\n switch (type) {\n case AxisType.X:\n switch (position) {\n case Position.Top: return 0\n case Position.Bottom: default: return 0.75\n }\n case AxisType.Y:\n switch (position) {\n case Position.Right: return 0.75\n case Position.Left: default: return -0.25\n }\n }\n }\n\n _alignTickLabels (): void {\n const { config: { type, tickTextAlign, position } } = this\n\n const tickText = this.g.selectAll('g.tick > text')\n const textAnchor = this._getTickTextAnchor(tickTextAlign)\n const translateX = type === AxisType.X ? 0 : this._getYTickTextTranslate(tickTextAlign, position)\n\n tickText\n .attr('text-anchor', textAnchor)\n .attr('transform', `translate(${translateX},0)`)\n }\n\n _getTickTextAnchor (textAlign: TextAlign): string {\n switch (textAlign) {\n case TextAlign.Left: return 'start'\n case TextAlign.Right: return 'end'\n case TextAlign.Center: return 'middle'\n default: return null\n }\n }\n\n _getYTickTextTranslate (textAlign: TextAlign, axisPosition: Position = Position.Left): number {\n const defaultTickTextSpacingPx = 9 // Default in D3\n const width = this._axisRawBBox.width - defaultTickTextSpacingPx\n\n switch (textAlign) {\n case TextAlign.Left: return axisPosition === Position.Left ? width * -1 : 0\n case TextAlign.Right: return axisPosition === Position.Left ? 0 : width\n case TextAlign.Center: return axisPosition === Position.Left ? width * (-0.5) : width * 0.5\n default: return 0\n }\n }\n}\n"],"names":["s.grid","s.tick","s.tickLabel","s.axis","s.hideTickLine","s.hideDomain","label","s.label","s"],"mappings":";;;;;;;;;;;;;;AA2BM,MAAO,IAAY,SAAQ,eAAqE,CAAA;AAcpG,IAAA,WAAA,CAAa,MAAmC,EAAA;AAC9C,QAAA,KAAK,EAAE,CAAA;AAbT,QAAA,IAAA,CAAA,MAAM,GAAsB,IAAI,UAAU,EAAS,CAAA;QAO3C,IAAgB,CAAA,gBAAA,GAAG,CAAC,CAAA;QACpB,IAA4B,CAAA,4BAAA,GAAG,GAAG,CAAA;QAE1C,IAAM,CAAA,MAAA,GAAG,EAAE,CAAA;AAIT,QAAA,IAAI,MAAM;AAAE,YAAA,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;QAEpC,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;QACnC,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC;AAChC,aAAA,IAAI,CAAC,OAAO,EAAEA,IAAM,CAAC,CAAA;KACzB;;IAGD,SAAS,GAAA;AACP,QAAA,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,CAAA;AACvB,QAAA,MAAM,qBAAqB,GAAG,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC,CAAC,CAAA;AAEnE,QAAA,IAAI,CAAC,WAAW,CAAC,qBA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C,YAAA,KAAK,SAAS,CAAC,KAAK,EAAE,OAAO,KAAK,CAAA;AAClC,YAAA,KAAK,SAAS,CAAC,MAAM,EAAE,OAAO,QAAQ,CAAA;AACtC,YAAA,SAAS,OAAO,IAAI,CAAA;AACrB,SAAA;KACF;AAED,IAAA,sBAAsB,CAAE,SAAoB,EAAE,YAAyB,GAAA,QAAQ,CAAC,IAAI,EAAA;AAClF,QAAA,MAAM,wBAAwB,GAAG,CAAC,CAAA;QAClC,MAAM,KAAK,GAAG,IAAI,CAAC,YAAY,CAAC,KAAK,GAAG,wBAAwB,CAAA;AAEhE,QAAA,QAAQ,SAAS;YACf,KAAK,SAAS,CAAC,IAAI,EAAE,OAAO,YAAY,KAAK,QAAQ,CAAC,IAAI,GAAG,KAAK,GAAG,CAAC,CAAC,GAAG,CAAC,CAAA;AAC3E,YAAA,KAAK,SAAS,CAAC,KAAK,EAAE,OAAO,YAAY,KAAK,QAAQ,CAAC,IAAI,GAAG,CAAC,GAAG,KAAK,CAAA;YACvE,KAAK,SAAS,CAAC,MAAM,EAAE,OAAO,YAAY,KAAK,QAAQ,CAAC,IAAI,GAAG,KAAK,IAAI,CAAC,GAAG,CAAC,GAAG,KAAK,GAAG,GAAG,CAAA;AAC3F,YAAA,SAAS,OAAO,CAAC,CAAA;AAClB,SAAA;KACF;;AAxVM,IAAS,CAAA,SAAA,GAAGE,KAAC;;;;"}
|
package/components/axis/style.js
CHANGED
|
@@ -86,13 +86,14 @@ const tick = css `
|
|
|
86
86
|
stroke-width: var(--vis-axis-tick-line-width);
|
|
87
87
|
}
|
|
88
88
|
|
|
89
|
-
text
|
|
89
|
+
text {
|
|
90
90
|
fill: var(--vis-axis-tick-label-color);
|
|
91
|
-
font-family: var(--vis-axis-font-family, var(--vis-font-family));
|
|
92
91
|
cursor: var(--vis-axis-tick-label-cursor);
|
|
92
|
+
font-family: var(--vis-axis-font-family, var(--vis-font-family));
|
|
93
93
|
text-decoration: var(--vis-axis-tick-label-text-decoration);
|
|
94
94
|
stroke: none;
|
|
95
95
|
}
|
|
96
|
+
|
|
96
97
|
`;
|
|
97
98
|
const label = css `
|
|
98
99
|
label: label;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"style.js","sources":["../../../src/components/axis/style.ts"],"sourcesContent":["import { css, injectGlobal } from '@emotion/css'\n\nexport const root = css`\n label: axis-component;\n`\n\nexport const globalStyles = injectGlobal`\n :root {\n // Undefined by default to allow proper fallback to var(--vis-font-family)\n /* --vis-axis-font-family: */\n --vis-axis-tick-color: #e8e9ef;\n /* --vis-axis-domain-color: // Undefined by default to allow fallback to var(--vis-axis-tick-color) */\n --vis-axis-grid-color: #e8e9ef;\n --vis-axis-label-color: #6c778c;\n --vis-axis-tick-label-color: #6c778c;\n --vis-axis-tick-label-font-size: 12px;\n --vis-axis-tick-label-cursor: default;\n --vis-axis-tick-label-text-decoration: none;\n --vis-axis-label-font-size: 14px;\n --vis-axis-tick-line-width: 1px;\n --vis-axis-grid-line-width: 1px;\n /* --vis-axis-domain-line-width: // Undefined by default to allow fallback to var(--vis-axis-grid-line-width) */\n\n --vis-dark-axis-tick-color: #6c778c;\n /* --vis-dark-axis-domain-color: // Undefined by default to allow fallback to var(--vis-dark-axis-tick-color) */\n --vis-dark-axis-tick-label-color: #e8e9ef;\n --vis-dark-axis-grid-color: #6c778c;\n --vis-dark-axis-label-color: #fefefe;\n }\n\n body.theme-dark ${`.${root}`} {\n --vis-axis-tick-color: var(--vis-dark-axis-tick-color);\n --vis-axis-domain-color: var(--vis-dark-axis-domain-color);\n --vis-axis-tick-label-color: var(--vis-dark-axis-tick-label-color);\n --vis-axis-grid-color: var(--vis-dark-axis-grid-color);\n --vis-axis-label-color: var(--vis-dark-axis-label-color);\n }\n`\n\nexport const hideTickLine = css`\n label: hide-tick-line;\n`\n\nexport const hideDomain = css`\n label: hide-domain;\n`\n\nexport const axis = css`\n label: axis;\n\n user-select: none;\n\n .domain {\n stroke: var(--vis-axis-domain-color, var(--vis-axis-tick-color));\n stroke-width: var(--vis-axis-domain-line-width, var(--vis-axis-grid-line-width));\n }\n\n &${`.${hideTickLine}`} {\n .tick > line {\n opacity: 0;\n }\n }\n\n &${`.${hideDomain}`} {\n .domain {\n opacity: 0;\n }\n }\n`\n\nexport const grid = css`\n label: grid;\n\n .domain {\n opacity: 0;\n }\n\n line {\n stroke: var(--vis-axis-grid-color);\n stroke-width: var(--vis-axis-grid-line-width);\n }\n`\n\nexport const tick = css`\n label: tick;\n\n stroke: none;\n font-size: var(--vis-axis-tick-label-font-size);\n\n line {\n stroke: var(--vis-axis-tick-color);\n stroke-width: var(--vis-axis-tick-line-width);\n }\n\n text
|
|
1
|
+
{"version":3,"file":"style.js","sources":["../../../src/components/axis/style.ts"],"sourcesContent":["import { css, injectGlobal } from '@emotion/css'\n\nexport const root = css`\n label: axis-component;\n`\n\nexport const globalStyles = injectGlobal`\n :root {\n // Undefined by default to allow proper fallback to var(--vis-font-family)\n /* --vis-axis-font-family: */\n --vis-axis-tick-color: #e8e9ef;\n /* --vis-axis-domain-color: // Undefined by default to allow fallback to var(--vis-axis-tick-color) */\n --vis-axis-grid-color: #e8e9ef;\n --vis-axis-label-color: #6c778c;\n --vis-axis-tick-label-color: #6c778c;\n --vis-axis-tick-label-font-size: 12px;\n --vis-axis-tick-label-cursor: default;\n --vis-axis-tick-label-text-decoration: none;\n --vis-axis-label-font-size: 14px;\n --vis-axis-tick-line-width: 1px;\n --vis-axis-grid-line-width: 1px;\n /* --vis-axis-domain-line-width: // Undefined by default to allow fallback to var(--vis-axis-grid-line-width) */\n\n --vis-dark-axis-tick-color: #6c778c;\n /* --vis-dark-axis-domain-color: // Undefined by default to allow fallback to var(--vis-dark-axis-tick-color) */\n --vis-dark-axis-tick-label-color: #e8e9ef;\n --vis-dark-axis-grid-color: #6c778c;\n --vis-dark-axis-label-color: #fefefe;\n }\n\n body.theme-dark ${`.${root}`} {\n --vis-axis-tick-color: var(--vis-dark-axis-tick-color);\n --vis-axis-domain-color: var(--vis-dark-axis-domain-color);\n --vis-axis-tick-label-color: var(--vis-dark-axis-tick-label-color);\n --vis-axis-grid-color: var(--vis-dark-axis-grid-color);\n --vis-axis-label-color: var(--vis-dark-axis-label-color);\n }\n`\n\nexport const hideTickLine = css`\n label: hide-tick-line;\n`\n\nexport const hideDomain = css`\n label: hide-domain;\n`\n\nexport const axis = css`\n label: axis;\n\n user-select: none;\n\n .domain {\n stroke: var(--vis-axis-domain-color, var(--vis-axis-tick-color));\n stroke-width: var(--vis-axis-domain-line-width, var(--vis-axis-grid-line-width));\n }\n\n &${`.${hideTickLine}`} {\n .tick > line {\n opacity: 0;\n }\n }\n\n &${`.${hideDomain}`} {\n .domain {\n opacity: 0;\n }\n }\n`\n\nexport const grid = css`\n label: grid;\n\n .domain {\n opacity: 0;\n }\n\n line {\n stroke: var(--vis-axis-grid-color);\n stroke-width: var(--vis-axis-grid-line-width);\n }\n`\n\nexport const tick = css`\n label: tick;\n\n stroke: none;\n font-size: var(--vis-axis-tick-label-font-size);\n\n line {\n stroke: var(--vis-axis-tick-color);\n stroke-width: var(--vis-axis-tick-line-width);\n }\n\n text {\n fill: var(--vis-axis-tick-label-color);\n cursor: var(--vis-axis-tick-label-cursor);\n font-family: var(--vis-axis-font-family, var(--vis-font-family));\n text-decoration: var(--vis-axis-tick-label-text-decoration);\n stroke: none;\n }\n\n`\n\nexport const label = css`\n label: label;\n fill: var(--vis-axis-label-color);\n font-size: var(--vis-axis-label-font-size);\n font-family: var(--vis-axis-font-family, var(--vis-font-family));\n text-anchor: middle;\n`\n\nexport const tickLabel = css`\n label: tick-label;\n`\n"],"names":[],"mappings":";;AAEO,MAAM,IAAI,GAAG,GAAG,CAAA,CAAA;;EAEtB;AAEM,MAAM,YAAY,GAAG,YAAY,CAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;AAwBpB,kBAAA,EAAA,CAAA,CAAA,EAAI,IAAI,CAAE,CAAA,CAAA;;;;;;;EAO7B;AAEM,MAAM,YAAY,GAAG,GAAG,CAAA,CAAA;;EAE9B;AAEM,MAAM,UAAU,GAAG,GAAG,CAAA,CAAA;;EAE5B;AAEM,MAAM,IAAI,GAAG,GAAG,CAAA,CAAA;;;;;;;;;;AAUlB,GAAA,EAAA,CAAA,CAAA,EAAI,YAAY,CAAE,CAAA,CAAA;;;;;;AAMlB,GAAA,EAAA,CAAA,CAAA,EAAI,UAAU,CAAE,CAAA,CAAA;;;;;EAKpB;AAEM,MAAM,IAAI,GAAG,GAAG,CAAA,CAAA;;;;;;;;;;;EAWtB;AAEM,MAAM,IAAI,GAAG,GAAG,CAAA,CAAA;;;;;;;;;;;;;;;;;;;EAmBtB;AAEM,MAAM,KAAK,GAAG,GAAG,CAAA,CAAA;;;;;;EAMvB;AAEM,MAAM,SAAS,GAAG,GAAG,CAAA,CAAA;;;;;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Config } from "../../core/config";
|
|
2
|
-
import { BulletLegendItemInterface } from './types';
|
|
2
|
+
import { BulletLegendItemInterface, BulletShape } from './types';
|
|
3
3
|
export interface BulletLegendConfigInterface {
|
|
4
4
|
/** Legend items. Array of `BulletLegendItemInterface`:
|
|
5
5
|
* ```
|
|
@@ -21,8 +21,10 @@ export interface BulletLegendConfigInterface {
|
|
|
21
21
|
labelFontSize?: string | null;
|
|
22
22
|
/** Label text (<span> element) max-width CSS property. Default: `null` */
|
|
23
23
|
labelMaxWidth?: string | null;
|
|
24
|
-
/** Bullet
|
|
24
|
+
/** Bullet shape size, mapped to the width and height CSS properties. Default: `null` */
|
|
25
25
|
bulletSize?: string | null;
|
|
26
|
+
/** Bullet shape: `BulletShape.Circle`, `BulletShape.Line` or `BulletShape.Square`. Default: `BulletShape.Circle` */
|
|
27
|
+
bulletShape?: BulletShape;
|
|
26
28
|
}
|
|
27
29
|
export declare class BulletLegendConfig extends Config implements BulletLegendConfigInterface {
|
|
28
30
|
items: BulletLegendItemInterface[];
|
|
@@ -31,4 +33,5 @@ export declare class BulletLegendConfig extends Config implements BulletLegendCo
|
|
|
31
33
|
labelFontSize: any;
|
|
32
34
|
labelMaxWidth: any;
|
|
33
35
|
bulletSize: any;
|
|
36
|
+
bulletShape: BulletShape;
|
|
34
37
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Config } from '../../core/config/index.js';
|
|
2
|
+
import { BulletShape } from './types.js';
|
|
2
3
|
|
|
3
4
|
class BulletLegendConfig extends Config {
|
|
4
5
|
constructor() {
|
|
@@ -9,6 +10,7 @@ class BulletLegendConfig extends Config {
|
|
|
9
10
|
this.labelFontSize = null;
|
|
10
11
|
this.labelMaxWidth = null;
|
|
11
12
|
this.bulletSize = null;
|
|
13
|
+
this.bulletShape = BulletShape.Circle;
|
|
12
14
|
}
|
|
13
15
|
}
|
|
14
16
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sources":["../../../src/components/bullet-legend/config.ts"],"sourcesContent":["import { Config } from 'core/config'\n\n// Local Types\nimport { BulletLegendItemInterface } from './types'\n\nexport interface BulletLegendConfigInterface {\n /** Legend items. Array of `BulletLegendItemInterface`:\n * ```\n * {\n * name: string | number;\n * color?: string;\n * inactive?: boolean;\n * hidden?: boolean;\n * pointer?: boolean;\n * }\n * ```\n * Default: `[]` */\n items: BulletLegendItemInterface[];\n /** Apply a specific class to the labels. Default: `''` */\n labelClassName?: string;\n /** Callback function for the legend item click. Default: `undefined` */\n onLegendItemClick?: ((d: BulletLegendItemInterface, i: number) => void);\n /** Label text (<span> element) font-size CSS. Default: `null` */\n labelFontSize?: string | null;\n /** Label text (<span> element) max-width CSS property. Default: `null` */\n labelMaxWidth?: string | null;\n /** Bullet
|
|
1
|
+
{"version":3,"file":"config.js","sources":["../../../src/components/bullet-legend/config.ts"],"sourcesContent":["import { Config } from 'core/config'\n\n// Local Types\nimport { BulletLegendItemInterface, BulletShape } from './types'\n\nexport interface BulletLegendConfigInterface {\n /** Legend items. Array of `BulletLegendItemInterface`:\n * ```\n * {\n * name: string | number;\n * color?: string;\n * inactive?: boolean;\n * hidden?: boolean;\n * pointer?: boolean;\n * }\n * ```\n * Default: `[]` */\n items: BulletLegendItemInterface[];\n /** Apply a specific class to the labels. Default: `''` */\n labelClassName?: string;\n /** Callback function for the legend item click. Default: `undefined` */\n onLegendItemClick?: ((d: BulletLegendItemInterface, i: number) => void);\n /** Label text (<span> element) font-size CSS. Default: `null` */\n labelFontSize?: string | null;\n /** Label text (<span> element) max-width CSS property. Default: `null` */\n labelMaxWidth?: string | null;\n /** Bullet shape size, mapped to the width and height CSS properties. Default: `null` */\n bulletSize?: string | null;\n /** Bullet shape: `BulletShape.Circle`, `BulletShape.Line` or `BulletShape.Square`. Default: `BulletShape.Circle` */\n bulletShape?: BulletShape;\n}\n\nexport class BulletLegendConfig extends Config implements BulletLegendConfigInterface {\n items: BulletLegendItemInterface[] = []\n labelClassName = ''\n onLegendItemClick = undefined\n labelFontSize = null\n labelMaxWidth = null\n bulletSize = null\n bulletShape = BulletShape.Circle\n}\n"],"names":[],"mappings":";;;AAgCM,MAAO,kBAAmB,SAAQ,MAAM,CAAA;AAA9C,IAAA,WAAA,GAAA;;QACE,IAAK,CAAA,KAAA,GAAgC,EAAE,CAAA;QACvC,IAAc,CAAA,cAAA,GAAG,EAAE,CAAA;QACnB,IAAiB,CAAA,iBAAA,GAAG,SAAS,CAAA;QAC7B,IAAa,CAAA,aAAA,GAAG,IAAI,CAAA;QACpB,IAAa,CAAA,aAAA,GAAG,IAAI,CAAA;QACpB,IAAU,CAAA,UAAA,GAAG,IAAI,CAAA;AACjB,QAAA,IAAA,CAAA,WAAW,GAAG,WAAW,CAAC,MAAM,CAAA;KACjC;AAAA;;;;"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { select } from 'd3-selection';
|
|
2
|
-
import { color } from 'd3-color';
|
|
3
|
-
import { getColor } from '../../utils/color.js';
|
|
4
2
|
import { BulletLegendConfig } from './config.js';
|
|
3
|
+
import { createBullets, updateBullets } from './modules/shape.js';
|
|
5
4
|
import * as style from './style.js';
|
|
6
5
|
import { root, item, bullet, label, clickable } from './style.js';
|
|
7
6
|
|
|
@@ -32,8 +31,7 @@ class BulletLegend {
|
|
|
32
31
|
.on('click', this._onItemClick.bind(this));
|
|
33
32
|
legendItemsEnter.append('span')
|
|
34
33
|
.attr('class', bullet)
|
|
35
|
-
.
|
|
36
|
-
.style('height', config.bulletSize);
|
|
34
|
+
.call(createBullets, config);
|
|
37
35
|
legendItemsEnter.append('span')
|
|
38
36
|
.attr('class', label)
|
|
39
37
|
.classed(config.labelClassName, true)
|
|
@@ -43,18 +41,10 @@ class BulletLegend {
|
|
|
43
41
|
legendItemsMerged
|
|
44
42
|
.classed(clickable, d => !!config.onLegendItemClick && this._isItemClickable(d))
|
|
45
43
|
.style('display', (d) => d.hidden ? 'none' : null);
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
.style('
|
|
49
|
-
|
|
50
|
-
if (d.inactive) {
|
|
51
|
-
const bulletColor = window.getComputedStyle(elements[i]).getPropertyValue('background-color');
|
|
52
|
-
const transparentColor = color(bulletColor);
|
|
53
|
-
transparentColor.opacity = 0.4;
|
|
54
|
-
select(elements[i])
|
|
55
|
-
.style('background-color', transparentColor.toString());
|
|
56
|
-
}
|
|
57
|
-
});
|
|
44
|
+
legendItemsMerged.select(`.${bullet}`)
|
|
45
|
+
.style('min-width', config.bulletSize)
|
|
46
|
+
.style('height', config.bulletSize)
|
|
47
|
+
.call(updateBullets, this.config, this._colorAccessor);
|
|
58
48
|
legendItemsMerged.select(`.${label}`)
|
|
59
49
|
.text((d) => d.name);
|
|
60
50
|
legendItems.exit().remove();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/components/bullet-legend/index.ts"],"sourcesContent":["import { select, Selection } from 'd3-selection'\
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/components/bullet-legend/index.ts"],"sourcesContent":["import { select, Selection } from 'd3-selection'\n\n// Config\nimport { BulletLegendConfig, BulletLegendConfigInterface } from './config'\n\n// Local Types\nimport { BulletLegendItemInterface } from './types'\n\n// Modules\nimport { createBullets, updateBullets } from './modules/shape'\n\n// Styles\nimport * as s from './style'\n\nexport class BulletLegend {\n static selectors = s\n div: Selection<HTMLDivElement, unknown, null, undefined>\n element: HTMLElement\n prevConfig: BulletLegendConfig\n config: BulletLegendConfig\n protected _container: HTMLElement\n\n private _colorAccessor = (d: BulletLegendItemInterface): string => d.color\n\n constructor (element: HTMLElement, config?: BulletLegendConfigInterface) {\n this._container = element\n\n // Create SVG element for visualizations\n this.div = select(this._container)\n .append('div')\n .attr('class', s.root)\n\n this.element = this.div.node()\n\n if (config) this.update(config)\n }\n\n update (config: BulletLegendConfigInterface): void {\n this.prevConfig = this.config\n this.config = new BulletLegendConfig().init(config)\n this.render()\n }\n\n render (): void {\n const { config } = this\n const legendItems = this.div.selectAll<HTMLDivElement, unknown>(`.${s.item}`)\n .data(config.items)\n\n const legendItemsEnter = legendItems.enter()\n .append('div')\n .attr('class', s.item)\n .on('click', this._onItemClick.bind(this))\n\n legendItemsEnter.append('span')\n .attr('class', s.bullet)\n .call(createBullets, config)\n\n legendItemsEnter.append('span')\n .attr('class', s.label)\n .classed(config.labelClassName, true)\n .style('max-width', config.labelMaxWidth)\n .style('font-size', config.labelFontSize)\n\n const legendItemsMerged = legendItemsEnter.merge(legendItems)\n legendItemsMerged\n .classed(s.clickable, d => !!config.onLegendItemClick && this._isItemClickable(d))\n .style('display', (d: BulletLegendItemInterface) => d.hidden ? 'none' : null)\n\n legendItemsMerged.select<HTMLSpanElement>(`.${s.bullet}`)\n .style('min-width', config.bulletSize)\n .style('height', config.bulletSize)\n .call(updateBullets, this.config, this._colorAccessor)\n\n legendItemsMerged.select(`.${s.label}`)\n .text((d: BulletLegendItemInterface) => d.name)\n\n legendItems.exit().remove()\n }\n\n _isItemClickable (item: BulletLegendItemInterface): boolean {\n return item.pointer === undefined ? true : item.pointer\n }\n\n _onItemClick (event: MouseEvent, d: BulletLegendItemInterface): void {\n const { config: { onLegendItemClick } } = this\n\n const legendItems = this.div.selectAll(`.${s.item}`).nodes() as HTMLElement[]\n const index = legendItems.indexOf(event.currentTarget as HTMLElement)\n if (onLegendItemClick) onLegendItemClick(d, index)\n }\n\n public destroy (): void {\n this.div.remove()\n }\n}\n"],"names":["s.root","s.item","s.bullet","s.label","s.clickable","s"],"mappings":";;;;;;MAca,YAAY,CAAA;IAUvB,WAAa,CAAA,OAAoB,EAAE,MAAoC,EAAA;QAF/D,IAAc,CAAA,cAAA,GAAG,CAAC,CAA4B,KAAa,CAAC,CAAC,KAAK,CAAA;AAGxE,QAAA,IAAI,CAAC,UAAU,GAAG,OAAO,CAAA;;QAGzB,IAAI,CAAC,GAAG,GAAG,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC;aAC/B,MAAM,CAAC,KAAK,CAAC;AACb,aAAA,IAAI,CAAC,OAAO,EAAEA,IAAM,CAAC,CAAA;QAExB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,CAAA;AAE9B,QAAA,IAAI,MAAM;AAAE,YAAA,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAA;KAChC;AAED,IAAA,MAAM,CAAE,MAAmC,EAAA;AACzC,QAAA,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,MAAM,CAAA;QAC7B,IAAI,CAAC,MAAM,GAAG,IAAI,kBAAkB,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;QACnD,IAAI,CAAC,MAAM,EAAE,CAAA;KACd;IAED,MAAM,GAAA;AACJ,QAAA,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,CAAA;AACvB,QAAA,MAAM,WAAW,GAAG,IAAI,CAAC,GAAG,CAAC,SAAS,CAA0B,CAAI,CAAA,EAAAC,IAAM,EAAE,CAAC;AAC1E,aAAA,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;AAErB,QAAA,MAAM,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AC,cAAc,CAAC,CAAA;QAExD,iBAAiB,CAAC,MAAM,CAAC,CAAA,CAAA,EAAIC,KAAO,EAAE,CAAC;aACpC,IAAI,CAAC,CAAC,CAA4B,KAAK,CAAC,CAAC,IAAI,CAAC,CAAA;AAEjD,QAAA,WAAW,CAAC,IAAI,EAAE,CAAC,MAAM,EAAE,CAAA;KAC5B;AAED,IAAA,gBAAgB,CAAE,IAA+B,EAAA;AAC/C,QAAA,OAAO,IAAI,CAAC,OAAO,KAAK,SAAS,GAAG,IAAI,GAAG,IAAI,CAAC,OAAO,CAAA;KACxD;IAED,YAAY,CAAE,KAAiB,EAAE,CAA4B,EAAA;QAC3D,MAAM,EAAE,MAAM,EAAE,EAAE,iBAAiB,EAAE,EAAE,GAAG,IAAI,CAAA;AAE9C,QAAA,MAAM,WAAW,GAAG,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,CAAI,CAAA,EAAAF,IAAM,CAAA,CAAE,CAAC,CAAC,KAAK,EAAmB,CAAA;QAC7E,MAAM,KAAK,GAAG,WAAW,CAAC,OAAO,CAAC,KAAK,CAAC,aAA4B,CAAC,CAAA;AACrE,QAAA,IAAI,iBAAiB;AAAE,YAAA,iBAAiB,CAAC,CAAC,EAAE,KAAK,CAAC,CAAA;KACnD;IAEM,OAAO,GAAA;AACZ,QAAA,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,CAAA;KAClB;;AA9EM,YAAS,CAAA,SAAA,GAAGI,KAAC;;;;"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Selection } from 'd3-selection';
|
|
2
|
+
import { ColorAccessor } from "../../../types/accessor";
|
|
3
|
+
import { BulletLegendConfigInterface } from '../config';
|
|
4
|
+
import { BulletLegendItemInterface } from '../types';
|
|
5
|
+
export declare function createBullets(container: Selection<HTMLSpanElement, BulletLegendItemInterface, HTMLDivElement, unknown>, config: BulletLegendConfigInterface): void;
|
|
6
|
+
export declare function updateBullets(container: Selection<HTMLSpanElement, BulletLegendItemInterface, HTMLDivElement, unknown>, config: BulletLegendConfigInterface, colorAccessor: ColorAccessor<BulletLegendItemInterface>): void;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { getColor } from '../../../utils/color.js';
|
|
2
|
+
import { circlePath } from '../../../utils/path.js';
|
|
3
|
+
import { BulletShape } from '../types.js';
|
|
4
|
+
|
|
5
|
+
// Utils
|
|
6
|
+
// Size with respect to the viewBox. We use this to compute path data which is independent of the
|
|
7
|
+
// the configured size.
|
|
8
|
+
const BULLET_SIZE = 20;
|
|
9
|
+
function getWidth(shape) {
|
|
10
|
+
switch (shape) {
|
|
11
|
+
case BulletShape.Line:
|
|
12
|
+
return BULLET_SIZE * 2.5;
|
|
13
|
+
default:
|
|
14
|
+
return BULLET_SIZE;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
function getPath(shape, width, height) {
|
|
18
|
+
switch (shape) {
|
|
19
|
+
case BulletShape.Line:
|
|
20
|
+
return `M0,${height / 2} L${width / 2},${height / 2} L${width},${height / 2}`;
|
|
21
|
+
case BulletShape.Square:
|
|
22
|
+
return `M0,0 L${width},0 L${width},${height} L0,${height}Z`;
|
|
23
|
+
case BulletShape.Circle:
|
|
24
|
+
return circlePath(height / 2, height / 2, height / 2 - 1);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
function createBullets(container, config) {
|
|
28
|
+
container.append('svg')
|
|
29
|
+
.attr('width', '100%')
|
|
30
|
+
.attr('height', '100%')
|
|
31
|
+
.append('path')
|
|
32
|
+
.attr('d', getPath(config.bulletShape, getWidth(config.bulletShape), BULLET_SIZE));
|
|
33
|
+
}
|
|
34
|
+
function updateBullets(container, config, colorAccessor) {
|
|
35
|
+
const height = BULLET_SIZE;
|
|
36
|
+
const width = getWidth(config.bulletShape);
|
|
37
|
+
const getOpacity = (d) => d.inactive ? 0.4 : 1;
|
|
38
|
+
const selection = container.select('svg')
|
|
39
|
+
.attr('viewBox', `0 0 ${width} ${height}`)
|
|
40
|
+
.select('path')
|
|
41
|
+
.attr('d', getPath(config.bulletShape, width, height))
|
|
42
|
+
.attr('stroke', (d, i) => getColor(d, colorAccessor, i))
|
|
43
|
+
.style('stroke-width', '1px')
|
|
44
|
+
.style('fill', (d, i) => getColor(d, colorAccessor, i))
|
|
45
|
+
.style('fill-opacity', getOpacity);
|
|
46
|
+
if (config.bulletShape === BulletShape.Line) {
|
|
47
|
+
selection
|
|
48
|
+
.style('stroke-width', `${height / 5}px`)
|
|
49
|
+
.style('opacity', getOpacity)
|
|
50
|
+
.style('fill', null)
|
|
51
|
+
.style('fill-opacity', null)
|
|
52
|
+
.style('marker-start', 'none')
|
|
53
|
+
.style('marker-end', 'none');
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export { createBullets, updateBullets };
|
|
58
|
+
//# sourceMappingURL=shape.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shape.js","sources":["../../../../src/components/bullet-legend/modules/shape.ts"],"sourcesContent":["import { Selection } from 'd3-selection'\n\n// Types\nimport { ColorAccessor } from 'types/accessor'\n\n// Utils\nimport { getColor } from 'utils/color'\nimport { circlePath } from 'utils/path'\n\n// Local types\nimport { BulletLegendConfigInterface } from '../config'\nimport { BulletShape, BulletLegendItemInterface } from '../types'\n\n// Size with respect to the viewBox. We use this to compute path data which is independent of the\n// the configured size.\nconst BULLET_SIZE = 20\n\nfunction getWidth (shape: BulletShape): number {\n switch (shape) {\n case BulletShape.Line:\n return BULLET_SIZE * 2.5\n default:\n return BULLET_SIZE\n }\n}\n\nfunction getPath (shape: BulletShape, width: number, height: number): string {\n switch (shape) {\n case BulletShape.Line:\n return `M0,${height / 2} L${width / 2},${height / 2} L${width},${height / 2}`\n case BulletShape.Square:\n return `M0,0 L${width},0 L${width},${height} L0,${height}Z`\n case BulletShape.Circle:\n return circlePath(height / 2, height / 2, height / 2 - 1)\n }\n}\n\nexport function createBullets (\n container: Selection<HTMLSpanElement, BulletLegendItemInterface, HTMLDivElement, unknown>,\n config: BulletLegendConfigInterface\n): void {\n container.append('svg')\n .attr('width', '100%')\n .attr('height', '100%')\n .append('path')\n .attr('d', getPath(config.bulletShape, getWidth(config.bulletShape), BULLET_SIZE))\n}\n\nexport function updateBullets (\n container: Selection<HTMLSpanElement, BulletLegendItemInterface, HTMLDivElement, unknown>,\n config: BulletLegendConfigInterface,\n colorAccessor: ColorAccessor<BulletLegendItemInterface>\n): void {\n const height = BULLET_SIZE\n const width = getWidth(config.bulletShape)\n\n const getOpacity = (d: BulletLegendItemInterface): number => d.inactive ? 0.4 : 1\n\n const selection = container.select('svg')\n .attr('viewBox', `0 0 ${width} ${height}`)\n .select('path')\n .attr('d', getPath(config.bulletShape, width, height))\n .attr('stroke', (d, i) => getColor(d, colorAccessor, i))\n .style('stroke-width', '1px')\n .style('fill', (d, i) => getColor(d, colorAccessor, i))\n .style('fill-opacity', getOpacity)\n\n if (config.bulletShape === BulletShape.Line) {\n selection\n .style('stroke-width', `${height / 5}px`)\n .style('opacity', getOpacity)\n .style('fill', null)\n .style('fill-opacity', null)\n .style('marker-start', 'none')\n .style('marker-end', 'none')\n }\n}\n"],"names":[],"mappings":";;;;AAKA;AAQA;AACA;AACA,MAAM,WAAW,GAAG,EAAE,CAAA;AAEtB,SAAS,QAAQ,CAAE,KAAkB,EAAA;AACnC,IAAA,QAAQ,KAAK;QACX,KAAK,WAAW,CAAC,IAAI;YACnB,OAAO,WAAW,GAAG,GAAG,CAAA;AAC1B,QAAA;AACE,YAAA,OAAO,WAAW,CAAA;AACrB,KAAA;AACH,CAAC;AAED,SAAS,OAAO,CAAE,KAAkB,EAAE,KAAa,EAAE,MAAc,EAAA;AACjE,IAAA,QAAQ,KAAK;QACX,KAAK,WAAW,CAAC,IAAI;AACnB,YAAA,OAAO,MAAM,MAAM,GAAG,CAAC,CAAK,EAAA,EAAA,KAAK,GAAG,CAAC,CAAA,CAAA,EAAI,MAAM,GAAG,CAAC,KAAK,KAAK,CAAA,CAAA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AAO,CAAC,MAAM,CAAC,WAAW,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;AACrD,SAAA,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC,EAAE,CAAC,KAAK,QAAQ,CAAC,CAAC,EAAE,aAAa,EAAE,CAAC,CAAC,CAAC;AACvD,SAAA,KAAK,CAAC,cAAc,EAAE,KAAK,CAAC;AAC5B,SAAA,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC,EAAE,CAAC,KAAK,QAAQ,CAAC,CAAC,EAAE,aAAa,EAAE,CAAC,CAAC,CAAC;AACtD,SAAA,KAAK,CAAC,cAAc,EAAE,UAAU,CAAC,CAAA;AAEpC,IAAA,IAAI,MAAM,CAAC,WAAW,KAAK,WAAW,CAAC,IAAI,EAAE;QAC3C,SAAS;aACN,KAAK,CAAC,cAAc,EAAE,CAAA,EAAG,MAAM,GAAG,CAAC,IAAI,CAAC;AACxC,aAAA,KAAK,CAAC,SAAS,EAAE,UAAU,CAAC;AAC5B,aAAA,KAAK,CAAC,MAAM,EAAE,IAAI,CAAC;AACnB,aAAA,KAAK,CAAC,cAAc,EAAE,IAAI,CAAC;AAC3B,aAAA,KAAK,CAAC,cAAc,EAAE,MAAM,CAAC;AAC7B,aAAA,KAAK,CAAC,YAAY,EAAE,MAAM,CAAC,CAAA;AAC/B,KAAA;AACH;;;;"}
|
|
@@ -27,7 +27,8 @@ const variables = injectGlobal `
|
|
|
27
27
|
`;
|
|
28
28
|
const item = css `
|
|
29
29
|
label: legendItem;
|
|
30
|
-
display: inline;
|
|
30
|
+
display: inline-flex;
|
|
31
|
+
align-items: center;
|
|
31
32
|
font-family: var(--vis-legend-font-family, var(--vis-font-family));
|
|
32
33
|
margin-right: var(--vis-legend-item-spacing);
|
|
33
34
|
white-space: nowrap;
|
|
@@ -50,18 +51,14 @@ const label = css `
|
|
|
50
51
|
`;
|
|
51
52
|
const bullet = css `
|
|
52
53
|
label: legendItemBullet;
|
|
53
|
-
border-radius: 100%;
|
|
54
|
-
background-color: var(--vis-legend-bullet-inactive-color);
|
|
55
|
-
border: 1px solid;
|
|
56
|
-
display: inline-block;
|
|
57
54
|
margin-right: var(--vis-legend-bullet-label-spacing);
|
|
58
|
-
width: var(--vis-legend-bullet-size);
|
|
55
|
+
min-width: var(--vis-legend-bullet-size);
|
|
59
56
|
height: var(--vis-legend-bullet-size);
|
|
60
|
-
vertical-align: middle;
|
|
61
|
-
|
|
62
|
-
.inactive {
|
|
63
57
|
|
|
58
|
+
> svg {
|
|
59
|
+
display: block;
|
|
64
60
|
}
|
|
61
|
+
}
|
|
65
62
|
`;
|
|
66
63
|
|
|
67
64
|
export { bullet, clickable, item, label, root, variables };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"style.js","sources":["../../../src/components/bullet-legend/style.ts"],"sourcesContent":["import { css, injectGlobal } from '@emotion/css'\n\nexport const root = css`\n label: bullet-legend-component;\n`\n\nexport const variables = injectGlobal`\n :root {\n // Undefined by default to allow proper fallback to var(--vis-font-family)\n /* --vis-legend-font-family: */\n\n --vis-legend-label-color: #6c778c;\n --vis-legend-label-max-width: 300px;\n --vis-legend-label-font-size: 12px;\n --vis-legend-bullet-size: 9px;\n --vis-legend-bullet-inactive-color: #eee;\n --vis-legend-item-spacing: 20px;\n --vis-legend-bullet-label-spacing: 8px;\n\n --vis-dark-legend-label-color: #eee;\n --vis-dark-legend-bullet-inactive-color: #6c778c;\n }\n\n body.theme-dark ${`.${root}`} {\n --vis-legend-label-color: var(--vis-dark-legend-label-color);\n --vis-legend-bullet-inactive-color: var(--vis-dark-legend-bullet-inactive-color);\n }\n`\n\nexport const item = css`\n label: legendItem;\n display: inline;\n font-family: var(--vis-legend-font-family, var(--vis-font-family));\n margin-right: var(--vis-legend-item-spacing);\n white-space: nowrap;\n cursor: default;\n user-select: none;\n`\n\nexport const clickable = css`\n cursor: pointer;\n`\n\nexport const label = css`\n label: legendItemLabel;\n font-size: var(--vis-legend-label-font-size);\n display: inline-block;\n vertical-align: middle;\n color: var(--vis-legend-label-color);\n max-width: var(--vis-legend-label-max-width);\n text-overflow: ellipsis;\n overflow: hidden;\n white-space: nowrap;\n`\n\nexport const bullet = css`\n label: legendItemBullet;\n
|
|
1
|
+
{"version":3,"file":"style.js","sources":["../../../src/components/bullet-legend/style.ts"],"sourcesContent":["import { css, injectGlobal } from '@emotion/css'\n\nexport const root = css`\n label: bullet-legend-component;\n`\n\nexport const variables = injectGlobal`\n :root {\n // Undefined by default to allow proper fallback to var(--vis-font-family)\n /* --vis-legend-font-family: */\n\n --vis-legend-label-color: #6c778c;\n --vis-legend-label-max-width: 300px;\n --vis-legend-label-font-size: 12px;\n --vis-legend-bullet-size: 9px;\n --vis-legend-bullet-inactive-color: #eee;\n --vis-legend-item-spacing: 20px;\n --vis-legend-bullet-label-spacing: 8px;\n\n --vis-dark-legend-label-color: #eee;\n --vis-dark-legend-bullet-inactive-color: #6c778c;\n }\n\n body.theme-dark ${`.${root}`} {\n --vis-legend-label-color: var(--vis-dark-legend-label-color);\n --vis-legend-bullet-inactive-color: var(--vis-dark-legend-bullet-inactive-color);\n }\n`\n\nexport const item = css`\n label: legendItem;\n display: inline-flex;\n align-items: center;\n font-family: var(--vis-legend-font-family, var(--vis-font-family));\n margin-right: var(--vis-legend-item-spacing);\n white-space: nowrap;\n cursor: default;\n user-select: none;\n`\n\nexport const clickable = css`\n cursor: pointer;\n`\n\nexport const label = css`\n label: legendItemLabel;\n font-size: var(--vis-legend-label-font-size);\n display: inline-block;\n vertical-align: middle;\n color: var(--vis-legend-label-color);\n max-width: var(--vis-legend-label-max-width);\n text-overflow: ellipsis;\n overflow: hidden;\n white-space: nowrap;\n`\n\nexport const bullet = css`\n label: legendItemBullet;\n margin-right: var(--vis-legend-bullet-label-spacing);\n min-width: var(--vis-legend-bullet-size);\n height: var(--vis-legend-bullet-size);\n\n > svg {\n display: block;\n }\n}\n`\n"],"names":[],"mappings":";;AAEO,MAAM,IAAI,GAAG,GAAG,CAAA,CAAA;;EAEtB;AAEM,MAAM,SAAS,GAAG,YAAY,CAAA,CAAA;;;;;;;;;;;;;;;;;AAiBjB,kBAAA,EAAA,CAAA,CAAA,EAAI,IAAI,CAAE,CAAA,CAAA;;;;EAI7B;AAEM,MAAM,IAAI,GAAG,GAAG,CAAA,CAAA;;;;;;;;;EAStB;AAEM,MAAM,SAAS,GAAG,GAAG,CAAA,CAAA;;EAE3B;AAEM,MAAM,KAAK,GAAG,GAAG,CAAA,CAAA;;;;;;;;;;EAUvB;AAEM,MAAM,MAAM,GAAG,GAAG,CAAA,CAAA;;;;;;;;;;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"types.js","sources":["../../../src/components/bullet-legend/types.ts"],"sourcesContent":["export interface BulletLegendItemInterface {\n name: string | number;\n color?: string;\n inactive?: boolean;\n hidden?: boolean;\n pointer?: boolean;\n}\n\nexport enum BulletShape {\n Circle = 'circle',\n Line = 'line',\n Square = 'square',\n}\n"],"names":[],"mappings":"IAQY,YAIX;AAJD,CAAA,UAAY,WAAW,EAAA;AACrB,IAAA,WAAA,CAAA,QAAA,CAAA,GAAA,QAAiB,CAAA;AACjB,IAAA,WAAA,CAAA,MAAA,CAAA,GAAA,MAAa,CAAA;AACb,IAAA,WAAA,CAAA,QAAA,CAAA,GAAA,QAAiB,CAAA;AACnB,CAAC,EAJW,WAAW,KAAX,WAAW,GAItB,EAAA,CAAA,CAAA;;;;"}
|
|
@@ -2,6 +2,10 @@ import { ComponentConfigInterface, ComponentConfig } from "../../core/component/
|
|
|
2
2
|
import { ColorAccessor, GenericAccessor, NumericAccessor, StringAccessor } from "../../types/accessor";
|
|
3
3
|
import { ChordInputLink, ChordInputNode, ChordLabelAlignment, ChordNodeDatum } from './types';
|
|
4
4
|
export interface ChordDiagramConfigInterface<N extends ChordInputNode, L extends ChordInputLink> extends ComponentConfigInterface {
|
|
5
|
+
/** Node id or index to highlight. Overrides default hover behavior if supplied. Default: `undefined` */
|
|
6
|
+
highlightedNodeId?: number | string;
|
|
7
|
+
/** Link ids or index values to highlight. Overrides default hover behavior if supplied. Default: [] */
|
|
8
|
+
highlightedLinkIds?: (number | string)[];
|
|
5
9
|
/** Link color accessor function. Default: `var(--vis-chord-diagram-link-fill-color)` */
|
|
6
10
|
linkColor?: ColorAccessor<L>;
|
|
7
11
|
/** Link value accessor function. Default: `l => l.value` */
|
|
@@ -29,6 +33,8 @@ export interface ChordDiagramConfigInterface<N extends ChordInputNode, L extends
|
|
|
29
33
|
}
|
|
30
34
|
export declare class ChordDiagramConfig<N extends ChordInputNode, L extends ChordInputLink> extends ComponentConfig implements ChordDiagramConfigInterface<N, L> {
|
|
31
35
|
duration: number;
|
|
36
|
+
highlightedNodeId: any;
|
|
37
|
+
highlightedLinkIds: any[];
|
|
32
38
|
linkColor: any;
|
|
33
39
|
linkValue: (d: L) => number;
|
|
34
40
|
nodeLevels: any[];
|
|
@@ -6,6 +6,8 @@ class ChordDiagramConfig extends ComponentConfig {
|
|
|
6
6
|
constructor() {
|
|
7
7
|
super(...arguments);
|
|
8
8
|
this.duration = 800;
|
|
9
|
+
this.highlightedNodeId = undefined;
|
|
10
|
+
this.highlightedLinkIds = [];
|
|
9
11
|
this.linkColor = undefined;
|
|
10
12
|
this.linkValue = (d) => d['value'];
|
|
11
13
|
this.nodeLevels = [];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sources":["../../../src/components/chord-diagram/config.ts"],"sourcesContent":["/* eslint-disable dot-notation */\n\n// Core\nimport { ComponentConfigInterface, ComponentConfig } from 'core/component/config'\n\n// Types\nimport { ColorAccessor, GenericAccessor, NumericAccessor, StringAccessor } from 'types/accessor'\n\n// Local Types\nimport { ChordInputLink, ChordInputNode, ChordLabelAlignment, ChordNodeDatum } from './types'\n\nexport interface ChordDiagramConfigInterface<N extends ChordInputNode, L extends ChordInputLink> extends ComponentConfigInterface {\n /** Link color accessor function. Default: `var(--vis-chord-diagram-link-fill-color)` */\n linkColor?: ColorAccessor<L>;\n /** Link value accessor function. Default: `l => l.value` */\n linkValue?: NumericAccessor<L>;\n /** Array of node hierarchy levels. Data records are supposed to have corresponding properties, e.g. ['level1', 'level2']. Default: `[]` */\n nodeLevels?: string[];\n /** Node width in pixels. Default: `15` */\n nodeWidth?: number;\n /** Node color accessor function ot constant value. Default: `d => d.color` */\n nodeColor?: ColorAccessor<ChordNodeDatum<N>>;\n /** Node label accessor function. Default: `d => d.label ?? d.key` */\n nodeLabel?: StringAccessor<ChordNodeDatum<N>>;\n /** Node label color accessor function. Default: `undefined` */\n nodeLabelColor?: StringAccessor<ChordNodeDatum<N>>;\n /** Node label alignment. Default: `ChordLabelAlignment.Along` */\n nodeLabelAlignment?: GenericAccessor<ChordLabelAlignment | string, ChordNodeDatum<N>>;\n /** Pad angle in radians. Constant value or accessor function. Default: `0.02` */\n padAngle?: NumericAccessor<N>;\n /** Corner radius constant value or accessor function. Default: `2` */\n cornerRadius?: NumericAccessor<N>;\n /** Angular range of the diagram. Default: `[0, 2 * Math.PI]` */\n angleRange?: [number, number];\n /** The exponent property of the radius scale. Default: `2` */\n radiusScaleExponent?: number;\n}\n\nexport class ChordDiagramConfig<N extends ChordInputNode, L extends ChordInputLink> extends ComponentConfig implements ChordDiagramConfigInterface<N, L> {\n duration = 800\n linkColor = undefined\n linkValue = (d: L): number => d['value']\n nodeLevels = []\n nodeWidth = 15\n nodeColor = (d: ChordNodeDatum<N>): string => d['color']\n nodeLabel = (d: ChordNodeDatum<N>): string => d['label'] ?? d['key']\n nodeLabelColor = undefined\n nodeLabelAlignment = ChordLabelAlignment.Along\n padAngle = 0.02\n cornerRadius = 2\n angleRange: [number, number] = [0, 2 * Math.PI]\n radiusScaleExponent = 2\n}\n"],"names":[],"mappings":";;;AAAA;
|
|
1
|
+
{"version":3,"file":"config.js","sources":["../../../src/components/chord-diagram/config.ts"],"sourcesContent":["/* eslint-disable dot-notation */\n\n// Core\nimport { ComponentConfigInterface, ComponentConfig } from 'core/component/config'\n\n// Types\nimport { ColorAccessor, GenericAccessor, NumericAccessor, StringAccessor } from 'types/accessor'\n\n// Local Types\nimport { ChordInputLink, ChordInputNode, ChordLabelAlignment, ChordNodeDatum } from './types'\n\nexport interface ChordDiagramConfigInterface<N extends ChordInputNode, L extends ChordInputLink> extends ComponentConfigInterface {\n /** Node id or index to highlight. Overrides default hover behavior if supplied. Default: `undefined` */\n highlightedNodeId?: number | string;\n /** Link ids or index values to highlight. Overrides default hover behavior if supplied. Default: [] */\n highlightedLinkIds?: (number | string)[];\n /** Link color accessor function. Default: `var(--vis-chord-diagram-link-fill-color)` */\n linkColor?: ColorAccessor<L>;\n /** Link value accessor function. Default: `l => l.value` */\n linkValue?: NumericAccessor<L>;\n /** Array of node hierarchy levels. Data records are supposed to have corresponding properties, e.g. ['level1', 'level2']. Default: `[]` */\n nodeLevels?: string[];\n /** Node width in pixels. Default: `15` */\n nodeWidth?: number;\n /** Node color accessor function ot constant value. Default: `d => d.color` */\n nodeColor?: ColorAccessor<ChordNodeDatum<N>>;\n /** Node label accessor function. Default: `d => d.label ?? d.key` */\n nodeLabel?: StringAccessor<ChordNodeDatum<N>>;\n /** Node label color accessor function. Default: `undefined` */\n nodeLabelColor?: StringAccessor<ChordNodeDatum<N>>;\n /** Node label alignment. Default: `ChordLabelAlignment.Along` */\n nodeLabelAlignment?: GenericAccessor<ChordLabelAlignment | string, ChordNodeDatum<N>>;\n /** Pad angle in radians. Constant value or accessor function. Default: `0.02` */\n padAngle?: NumericAccessor<N>;\n /** Corner radius constant value or accessor function. Default: `2` */\n cornerRadius?: NumericAccessor<N>;\n /** Angular range of the diagram. Default: `[0, 2 * Math.PI]` */\n angleRange?: [number, number];\n /** The exponent property of the radius scale. Default: `2` */\n radiusScaleExponent?: number;\n}\n\nexport class ChordDiagramConfig<N extends ChordInputNode, L extends ChordInputLink> extends ComponentConfig implements ChordDiagramConfigInterface<N, L> {\n duration = 800\n highlightedNodeId = undefined\n highlightedLinkIds = []\n linkColor = undefined\n linkValue = (d: L): number => d['value']\n nodeLevels = []\n nodeWidth = 15\n nodeColor = (d: ChordNodeDatum<N>): string => d['color']\n nodeLabel = (d: ChordNodeDatum<N>): string => d['label'] ?? d['key']\n nodeLabelColor = undefined\n nodeLabelAlignment = ChordLabelAlignment.Along\n padAngle = 0.02\n cornerRadius = 2\n angleRange: [number, number] = [0, 2 * Math.PI]\n radiusScaleExponent = 2\n}\n"],"names":[],"mappings":";;;AAAA;AA0CM,MAAO,kBAAuE,SAAQ,eAAe,CAAA;AAA3G,IAAA,WAAA,GAAA;;QACE,IAAQ,CAAA,QAAA,GAAG,GAAG,CAAA;QACd,IAAiB,CAAA,iBAAA,GAAG,SAAS,CAAA;QAC7B,IAAkB,CAAA,kBAAA,GAAG,EAAE,CAAA;QACvB,IAAS,CAAA,SAAA,GAAG,SAAS,CAAA;QACrB,IAAS,CAAA,SAAA,GAAG,CAAC,CAAI,KAAa,CAAC,CAAC,OAAO,CAAC,CAAA;QACxC,IAAU,CAAA,UAAA,GAAG,EAAE,CAAA;QACf,IAAS,CAAA,SAAA,GAAG,EAAE,CAAA;QACd,IAAS,CAAA,SAAA,GAAG,CAAC,CAAoB,KAAa,CAAC,CAAC,OAAO,CAAC,CAAA;AACxD,QAAA,IAAA,CAAA,SAAS,GAAG,CAAC,CAAoB,KAAY,EAAA,IAAA,EAAA,CAAA,CAAC,OAAA,CAAA,EAAA,GAAA,CAAC,CAAC,OAAO,CAAC,mCAAI,CAAC,CAAC,KAAK,CAAC,CAAA,EAAA,CAAA;QACpE,IAAc,CAAA,cAAA,GAAG,SAAS,CAAA;AAC1B,QAAA,IAAA,CAAA,kBAAkB,GAAG,mBAAmB,CAAC,KAAK,CAAA;QAC9C,IAAQ,CAAA,QAAA,GAAG,IAAI,CAAA;QACf,IAAY,CAAA,YAAA,GAAG,CAAC,CAAA;QAChB,IAAU,CAAA,UAAA,GAAqB,CAAC,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,EAAE,CAAC,CAAA;QAC/C,IAAmB,CAAA,mBAAA,GAAG,CAAC,CAAA;KACxB;AAAA;;;;"}
|