@visactor/vgrammar-plot 0.10.0-alpha.4 → 0.10.0-alpha.5

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.
@@ -2,7 +2,7 @@ import type { GenerateBaseEncodeSpec, Nil, ScaleSpec, ValueOf, TransformSpec, Ch
2
2
  import { SemanticMark } from './semantic-mark';
3
3
  import { GrammarMarkType } from '@visactor/vgrammar-core';
4
4
  import { PlotMakType } from './enums';
5
- import type { ITextAttribute } from '@visactor/vrender/es/core';
5
+ import type { ITextAttribute } from '@visactor/vrender-core';
6
6
  export declare class CirclePackingSemanticMark extends SemanticMark<PlotCirclePackingEncodeSpec, CirclepackingEncodeChannels> {
7
7
  static readonly type = PlotMakType.circlePacking;
8
8
  constructor(id?: string | number);
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/circle-packing.ts"],"names":[],"mappings":";;;AAcA,mDAA+C;AAE/C,2DAAmE;AACnE,mCAAsC;AACtC,2DAAoE;AAGpE,MAAa,yBAA0B,SAAQ,4BAAsE;IAEnH,YAAY,EAAoB;QAC9B,KAAK,CAAC,mBAAW,CAAC,aAAa,EAAE,EAAE,CAAC,CAAC;QAErC,IAAI,CAAC,uBAAO,CAAC,YAAY,CAAC,mBAAW,CAAC,aAAa,CAAC,EAAE;YACpD,IAAI,CAAC,OAAO,CAAC,KAAK,CAChB;2EACmE,CACpE,CAAC;SACH;IACH,CAAC;IAED,WAAW;QACT,OAAO,+BAAe,CAAC,MAAM,CAAC;IAChC,CAAC;IAED,uBAAuB;;QACrB,OAAO;YACL;gBACE,IAAI,EAAE,mBAAW,CAAC,aAAa;gBAC/B,KAAK,EAAE,EAAE,MAAM,EAAE,WAAW,EAAE;gBAC9B,MAAM,EAAE,EAAE,MAAM,EAAE,YAAY,EAAE;gBAChC,OAAO,EAAE,MAAA,IAAI,CAAC,IAAI,CAAC,MAAM,0CAAE,IAAI;gBAC/B,OAAO,EAAE,IAAI;aACd;SACF,CAAC;IACJ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AAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;YACpG,CAAC,CAAC;SACH;aAAM;YACL,GAAG,CAAC,IAAI,GAAG,MAAA,MAAA,IAAI,CAAC,IAAI,CAAC,KAAK,0CAAE,IAAI,mCAAI,MAAA,IAAI,CAAC,UAAU,EAAE,0CAAG,CAAC,CAAC,CAAC;SAC5D;QAED,OAAO,GAAG,CAAC;IACb,CAAC;IAED,eAAe;QACb,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC;IACxB,CAAC;IAES,kBAAkB,CAC1B,OAAe,EACf,MAAqC;QAErC,MAAM,UAAU,GAAG,IAAA,qBAAgB,EAAC,OAAO,CAAC,CAAC;QAC7C,OAAO,CAAC,KAAU,EAAE,EAAY,EAAE,MAAW,EAAE,EAAE;YAC/C,OAAO,UAAU,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC;QACzD,CAAC,CAAC;IACJ,CAAC;;AA5FH,8DA6FC;AA5FiB,8BAAI,GAAG,mBAAW,CAAC,aAAa,CAAC","file":"circle-packing.js","sourcesContent":["import type {\n GenerateBaseEncodeSpec,\n GenerateEncoderSpec,\n Nil,\n ScaleSpec,\n ValueOf,\n TransformSpec,\n IElement,\n ChannelEncodeType,\n CirclepackingEncodeChannels,\n WithDefaultEncode,\n PlotCirclePackingEncodeSpec,\n SemanticLabelOption\n} from '@visactor/vgrammar-core';\nimport { SemanticMark } from './semantic-mark';\n// eslint-disable-next-line no-duplicate-imports\nimport { GrammarMarkType, Factory } from '@visactor/vgrammar-core';\nimport { PlotMakType } from './enums';\nimport { field as getFieldAccessor } from '@visactor/vgrammar-util';\nimport type { ITextAttribute } from '@visactor/vrender/es/core';\n\nexport class CirclePackingSemanticMark extends SemanticMark<PlotCirclePackingEncodeSpec, CirclepackingEncodeChannels> {\n static readonly type = PlotMakType.circlePacking;\n constructor(id?: string | number) {\n super(PlotMakType.circlePacking, id);\n\n if (!Factory.getTransform(PlotMakType.circlePacking)) {\n this._logger.error(\n `Please add this line of code: import { registerCirclePackingTransforms } from '@visactor/vgrammar-hierarchy'; \n and run registerCirclePackingTransforms() before use treemap chart`\n );\n }\n }\n\n setMarkType() {\n return GrammarMarkType.circle;\n }\n\n setDefaultDataTransform(): TransformSpec[] {\n return [\n {\n type: PlotMakType.circlePacking,\n width: { signal: 'viewWidth' },\n height: { signal: 'viewHeight' },\n nodeKey: this.spec.encode?.node,\n flatten: true\n }\n ];\n }\n parseScaleByEncode(\n channel: CirclepackingEncodeChannels,\n option: ValueOf<\n WithDefaultEncode<PlotCirclePackingEncodeSpec, CirclepackingEncodeChannels>,\n CirclepackingEncodeChannels\n >\n ): ScaleSpec | Nil {\n if (channel === 'color') {\n return {\n type: 'ordinal',\n id: this.getScaleId('color'),\n domain: {\n data: this.getDataIdOfFiltered(),\n field: option as string\n },\n range: this.getPalette()\n };\n }\n\n return null;\n }\n\n convertMarkEncode(\n encode: WithDefaultEncode<PlotCirclePackingEncodeSpec, CirclepackingEncodeChannels>\n ): GenerateBaseEncodeSpec<PlotCirclePackingEncodeSpec> {\n const markEncoder = this.convertSimpleMarkEncode(encode);\n\n const res: GenerateEncoderSpec<PlotCirclePackingEncodeSpec> = {\n x: { field: 'x' },\n y: { field: 'y' },\n radius: { field: 'radius' }\n };\n\n if (markEncoder.stroke) {\n res.stroke = markEncoder.stroke;\n }\n\n if (markEncoder.color) {\n const scaleColorId = this.getScaleId('color');\n const colorAccessor = getFieldAccessor(markEncoder.color.field);\n\n res.fill = (datum: any, el: IElement, params: any) => {\n const scale = params[scaleColorId];\n return datum?.datum ? scale.scale(colorAccessor(datum.datum[datum.datum.length - 1])) : undefined;\n };\n } else {\n res.fill = this.spec.style?.fill ?? this.getPalette()?.[0];\n }\n\n return res;\n }\n\n setMainMarkSpec() {\n return { key: 'key' };\n }\n\n protected setLabelTextGetter(\n channel: string,\n option: SemanticLabelOption | boolean\n ): ChannelEncodeType<ITextAttribute['text']> {\n const textGetter = getFieldAccessor(channel);\n return (datum: any, el: IElement, params: any) => {\n return textGetter(datum.datum[datum.datum.length - 1]);\n };\n }\n}\n"]}
1
+ {"version":3,"sources":["../src/circle-packing.ts"],"names":[],"mappings":";;;AAcA,mDAA+C;AAE/C,2DAAmE;AACnE,mCAAsC;AACtC,2DAAoE;AAGpE,MAAa,yBAA0B,SAAQ,4BAAsE;IAEnH,YAAY,EAAoB;QAC9B,KAAK,CAAC,mBAAW,CAAC,aAAa,EAAE,EAAE,CAAC,CAAC;QAErC,IAAI,CAAC,uBAAO,CAAC,YAAY,CAAC,mBAAW,CAAC,aAAa,CAAC,EAAE;YACpD,IAAI,CAAC,OAAO,CAAC,KAAK,CAChB;2EACmE,CACpE,CAAC;SACH;IACH,CAAC;IAED,WAAW;QACT,OAAO,+BAAe,CAAC,MAAM,CAAC;IAChC,CAAC;IAED,uBAAuB;;QACrB,OAAO;YACL;gBACE,IAAI,EAAE,mBAAW,CAAC,aAAa;gBAC/B,KAAK,EAAE,EAAE,MAAM,EAAE,WAAW,EAAE;gBAC9B,MAAM,EAAE,EAAE,MAAM,EAAE,YAAY,EAAE;gBAChC,OAAO,EAAE,MAAA,IAAI,CAAC,IAAI,CAAC,MAAM,0CAAE,IAAI;gBAC/B,OAAO,EAAE,IAAI;aACd;SACF,CAAC;IACJ,CAAC;IACD,kBAAkB,CAChB,OAAoC,EACpC,MAGC;QAED,IAAI,OAAO,KAAK,OAAO,EAAE;YACvB,OAAO;gBACL,IAAI,EAAE,SAAS;gBACf,EAAE,EAAE,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC;gBAC5B,MAAM,EAAE;oBACN,IAAI,EAAE,IAAI,CAAC,mBAAmB,EAAE;oBAChC,KAAK,EAAE,MAAgB;iBACxB;gBACD,KAAK,EAAE,IAAI,CAAC,UAAU,EAAE;aACzB,CAAC;SACH;QAED,OAAO,IAAI,CAAC;IACd,CAAC;IAED,iBAAiB,C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EACf,MAAqC;QAErC,MAAM,UAAU,GAAG,IAAA,qBAAgB,EAAC,OAAO,CAAC,CAAC;QAC7C,OAAO,CAAC,KAAU,EAAE,EAAY,EAAE,MAAW,EAAE,EAAE;YAC/C,OAAO,UAAU,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC;QACzD,CAAC,CAAC;IACJ,CAAC;;AA5FH,8DA6FC;AA5FiB,8BAAI,GAAG,mBAAW,CAAC,aAAa,CAAC","file":"circle-packing.js","sourcesContent":["import type {\n GenerateBaseEncodeSpec,\n GenerateEncoderSpec,\n Nil,\n ScaleSpec,\n ValueOf,\n TransformSpec,\n IElement,\n ChannelEncodeType,\n CirclepackingEncodeChannels,\n WithDefaultEncode,\n PlotCirclePackingEncodeSpec,\n SemanticLabelOption\n} from '@visactor/vgrammar-core';\nimport { SemanticMark } from './semantic-mark';\n// eslint-disable-next-line no-duplicate-imports\nimport { GrammarMarkType, Factory } from '@visactor/vgrammar-core';\nimport { PlotMakType } from './enums';\nimport { field as getFieldAccessor } from '@visactor/vgrammar-util';\nimport type { ITextAttribute } from '@visactor/vrender-core';\n\nexport class CirclePackingSemanticMark extends SemanticMark<PlotCirclePackingEncodeSpec, CirclepackingEncodeChannels> {\n static readonly type = PlotMakType.circlePacking;\n constructor(id?: string | number) {\n super(PlotMakType.circlePacking, id);\n\n if (!Factory.getTransform(PlotMakType.circlePacking)) {\n this._logger.error(\n `Please add this line of code: import { registerCirclePackingTransforms } from '@visactor/vgrammar-hierarchy'; \n and run registerCirclePackingTransforms() before use treemap chart`\n );\n }\n }\n\n setMarkType() {\n return GrammarMarkType.circle;\n }\n\n setDefaultDataTransform(): TransformSpec[] {\n return [\n {\n type: PlotMakType.circlePacking,\n width: { signal: 'viewWidth' },\n height: { signal: 'viewHeight' },\n nodeKey: this.spec.encode?.node,\n flatten: true\n }\n ];\n }\n parseScaleByEncode(\n channel: CirclepackingEncodeChannels,\n option: ValueOf<\n WithDefaultEncode<PlotCirclePackingEncodeSpec, CirclepackingEncodeChannels>,\n CirclepackingEncodeChannels\n >\n ): ScaleSpec | Nil {\n if (channel === 'color') {\n return {\n type: 'ordinal',\n id: this.getScaleId('color'),\n domain: {\n data: this.getDataIdOfFiltered(),\n field: option as string\n },\n range: this.getPalette()\n };\n }\n\n return null;\n }\n\n convertMarkEncode(\n encode: WithDefaultEncode<PlotCirclePackingEncodeSpec, CirclepackingEncodeChannels>\n ): GenerateBaseEncodeSpec<PlotCirclePackingEncodeSpec> {\n const markEncoder = this.convertSimpleMarkEncode(encode);\n\n const res: GenerateEncoderSpec<PlotCirclePackingEncodeSpec> = {\n x: { field: 'x' },\n y: { field: 'y' },\n radius: { field: 'radius' }\n };\n\n if (markEncoder.stroke) {\n res.stroke = markEncoder.stroke;\n }\n\n if (markEncoder.color) {\n const scaleColorId = this.getScaleId('color');\n const colorAccessor = getFieldAccessor(markEncoder.color.field);\n\n res.fill = (datum: any, el: IElement, params: any) => {\n const scale = params[scaleColorId];\n return datum?.datum ? scale.scale(colorAccessor(datum.datum[datum.datum.length - 1])) : undefined;\n };\n } else {\n res.fill = this.spec.style?.fill ?? this.getPalette()?.[0];\n }\n\n return res;\n }\n\n setMainMarkSpec() {\n return { key: 'key' };\n }\n\n protected setLabelTextGetter(\n channel: string,\n option: SemanticLabelOption | boolean\n ): ChannelEncodeType<ITextAttribute['text']> {\n const textGetter = getFieldAccessor(channel);\n return (datum: any, el: IElement, params: any) => {\n return textGetter(datum.datum[datum.datum.length - 1]);\n };\n }\n}\n"]}
package/cjs/sankey.d.ts CHANGED
@@ -2,7 +2,7 @@ import type { SankeyEncodeChannels, WithDefaultEncode, PlotSankeyEncoderSpec, Se
2
2
  import { SemanticMark } from './semantic-mark';
3
3
  import { GrammarMarkType } from '@visactor/vgrammar-core';
4
4
  import { PlotMakType } from './enums';
5
- import type { ITextAttribute } from '@visactor/vrender/es/core';
5
+ import type { ITextAttribute } from '@visactor/vrender-core';
6
6
  export declare class SankeySemanticMark extends SemanticMark<PlotSankeyEncoderSpec, SankeyEncodeChannels> {
7
7
  static readonly type = PlotMakType.sankey;
8
8
  constructor(id?: string | number);
package/cjs/sankey.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/sankey.ts"],"names":[],"mappings":";;;AAeA,mDAA+C;AAE/C,2DAAoF;AACpF,mCAAsC;AACtC,2DAAoE;AAGpE,MAAa,kBAAmB,SAAQ,4BAAyD;IAE/F,YAAY,EAAoB;QAC9B,KAAK,CAAC,mBAAW,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;QAE9B,IAAI,CAAC,uBAAO,CAAC,YAAY,CAAC,mBAAW,CAAC,MAAM,CAAC,EAAE;YAC7C,IAAI,CAAC,OAAO,CAAC,KAAK,CAChB;6DACqD,CACtD,CAAC;SACH;QAED,IAAI,CAAC,uBAAO,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE;YACjC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC;;;OAGlB,CAAC,CAAC;SACJ;IACH,CAAC;IAED,WAAW;QACT,OAAO,+BAAe,CAAC,IAAI,CAAC;IAC9B,CAAC;IAED,uBAAuB;;QACrB,OAAO;YACL;gBACE,IAAI,EAAE,QAAQ;gBACd,KAAK,EAAE,EAAE,MAAM,EAAE,WAAW,EAAE;gBAC9B,MAAM,EAAE,EAAE,MAAM,EAAE,YAAY,EAAE;gBAChC,OAAO,EAAE,MAAA,IAAI,CAAC,IAAI,CAAC,MAAM,0CAAE,IAAI;aAChC;SACF,CAAC;IACJ,CAAC;IAED,eAAe;;QACb,OAAO,GAAG,MAAA,MAAA,IAAI,CAAC,IAAI,CAAC,IAAI,0CAAE,EAAE,mCAAI,IAAI,CAAC,IAAI,CAAC,EAAE,YAAY,CAAC;IAC3D,CAAC;IAED,eAAe;QACb,OAAO;YACL;gBACE,EAAE,EAAE,IAAI,CAAC,mBAAmB,EAAE;gBAC9B,SAAS,EAAE;oBACT;wBAC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AG,mBAAW,CAAC,MAAM,CAAC","file":"sankey.js","sourcesContent":["import type {\n SankeyEncodeChannels,\n WithDefaultEncode,\n PlotSankeyEncoderSpec,\n SemanticLabelOption,\n ChannelEncodeType,\n DataSpec,\n GenerateBaseEncodeSpec,\n GenerateEncoderSpec,\n Nil,\n ScaleSpec,\n ValueOf,\n TransformSpec,\n IElement\n} from '@visactor/vgrammar-core';\nimport { SemanticMark } from './semantic-mark';\n// eslint-disable-next-line no-duplicate-imports\nimport { GrammarMarkType, SIGNAL_VIEW_BOX, Factory } from '@visactor/vgrammar-core';\nimport { PlotMakType } from './enums';\nimport { field as getFieldAccessor } from '@visactor/vgrammar-util';\nimport type { ITextAttribute } from '@visactor/vrender/es/core';\n\nexport class SankeySemanticMark extends SemanticMark<PlotSankeyEncoderSpec, SankeyEncodeChannels> {\n static readonly type = PlotMakType.sankey;\n constructor(id?: string | number) {\n super(PlotMakType.sankey, id);\n\n if (!Factory.getTransform(PlotMakType.sankey)) {\n this._logger.error(\n `Please add this line of code: import { registerSankeyTransforms } from '@visactor/vgrammar-sankey'; \n and run registerSankeyTransforms() before use sankey`\n );\n }\n\n if (!Factory.getGlyph('linkPath')) {\n this._logger.error(`\n Please add this line of code: import { registerLinkPathGlyph } from '@visactor/vgrammar-core';\n add run registerLinkPathGlyph() before use sankey\n `);\n }\n }\n\n setMarkType() {\n return GrammarMarkType.rect;\n }\n\n setDefaultDataTransform(): TransformSpec[] {\n return [\n {\n type: 'sankey',\n width: { signal: 'viewWidth' },\n height: { signal: 'viewHeight' },\n nodeKey: this.spec.encode?.node\n }\n ];\n }\n\n getDataIdOfLink() {\n return `${this.spec.data?.id ?? this.spec.id}-data-link`;\n }\n\n setMultipleData(): DataSpec[] {\n return [\n {\n id: this.getDataIdOfFiltered(),\n transform: [\n {\n type: 'map',\n all: true,\n callback: (datum: any) => {\n return datum[0].nodes;\n }\n }\n ]\n },\n {\n source: this.getDataIdOfMain(),\n id: this.getDataIdOfLink(),\n transform: [\n {\n type: 'map',\n all: true,\n callback: (datum: any) => {\n // return formatLinkPath(datum[0].links);\n return datum[0].links;\n }\n }\n ]\n }\n ];\n }\n\n parseScaleByEncode(\n channel: SankeyEncodeChannels,\n option: ValueOf<WithDefaultEncode<PlotSankeyEncoderSpec, SankeyEncodeChannels>, SankeyEncodeChannels>\n ): ScaleSpec | Nil {\n if (channel === 'color') {\n return {\n type: 'ordinal',\n id: this.getScaleId('color'),\n domain: {\n data: this.getDataIdOfFiltered(),\n field: option as string\n },\n range: this.getPalette()\n };\n }\n\n return null;\n }\n\n convertMarkEncode(\n encode: WithDefaultEncode<PlotSankeyEncoderSpec, SankeyEncodeChannels>\n ): GenerateBaseEncodeSpec<PlotSankeyEncoderSpec> {\n const markEncoder = this.convertSimpleMarkEncode(encode);\n\n const res: GenerateEncoderSpec<PlotSankeyEncoderSpec> = {\n x: { field: 'x0' },\n x1: { field: 'x1' },\n y: { field: 'y0' },\n y1: { field: 'y1' }\n };\n\n if (markEncoder.stroke) {\n res.stroke = markEncoder.stroke;\n }\n\n if (markEncoder.color) {\n const scaleColorId = this.getScaleId('color');\n const colorAccessor = getFieldAccessor(markEncoder.color.field);\n\n res.fill = (datum: any, el: IElement, params: any) => {\n const scale = params[scaleColorId];\n return scale.scale(colorAccessor(datum?.datum));\n };\n } else {\n res.fill = this.spec.style?.nodeStyle?.fill ?? this.getPalette()?.[0];\n }\n\n return res;\n }\n\n setMainMarkSpec() {\n return { key: 'key' };\n }\n\n protected setLabelTextGetter(\n channel: string,\n option: SemanticLabelOption | boolean\n ): ChannelEncodeType<ITextAttribute['text']> {\n const textGetter = getFieldAccessor(channel);\n return (datum: any, el: IElement, params: any) => {\n return textGetter(datum.datum);\n };\n }\n\n setMultiMarksSpec() {\n // TODO: optimize the default style\n return [\n {\n id: `${this.getMarkId()}-link`,\n type: 'glyph',\n glyphType: 'linkPath',\n from: {\n data: this.getDataIdOfLink()\n },\n layout: {\n position: 'content',\n skipBeforeLayouted: true\n },\n key: 'index',\n dependency: this.viewSpec.scales.map(scale => scale.id).concat(SIGNAL_VIEW_BOX),\n animation: this.convertMarkAnimation(),\n encode: Object.assign({}, this.spec.state, {\n enter: Object.assign(\n {\n backgroundStyle: { fillColor: '#ccc', fillOpacity: 0.2 },\n fillOpacity: 0.8,\n round: true\n },\n this.spec.style?.linkStyle\n ),\n update: (datum: any, el: IElement, params: any) => {\n return {\n direction: datum.vertical ? 'vertical' : 'horizontal',\n x0: datum.x0,\n x1: datum.x1,\n y0: datum.y0,\n y1: datum.y1,\n thickness: datum.thickness,\n fill: this.spec.style?.linkStyle?.fill ?? this.getPalette()?.[0]\n };\n }\n })\n }\n ];\n }\n}\n"]}
1
+ {"version":3,"sources":["../src/sankey.ts"],"names":[],"mappings":";;;AAeA,mDAA+C;AAE/C,2DAAoF;AACpF,mCAAsC;AACtC,2DAAoE;AAGpE,MAAa,kBAAmB,SAAQ,4BAAyD;IAE/F,YAAY,EAAoB;QAC9B,KAAK,CAAC,mBAAW,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;QAE9B,IAAI,CAAC,uBAAO,CAAC,YAAY,CAAC,mBAAW,CAAC,MAAM,CAAC,EAAE;YAC7C,IAAI,CAAC,OAAO,CAAC,KAAK,CAChB;6DACqD,CACtD,CAAC;SACH;QAED,IAAI,CAAC,uBAAO,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE;YACjC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC;;;OAGlB,CAAC,CAAC;SACJ;IACH,CAAC;IAED,WAAW;QACT,OAAO,+BAAe,CAAC,IAAI,CAAC;IAC9B,CAAC;IAED,uBAAuB;;QACrB,OAAO;YACL;gBACE,IAAI,EAAE,QAAQ;gBACd,KAAK,EAAE,EAAE,MAAM,EAAE,WAAW,EAAE;gBAC9B,MAAM,EAAE,EAAE,MAAM,EAAE,YAAY,EAAE;gBAChC,OAAO,EAAE,MAAA,IAAI,CAAC,IAAI,CAAC,MAAM,0CAAE,IAAI;aAChC;SACF,CAAC;I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SAAS;4BAC1B,IAAI,EAAE,MAAA,MAAA,MAAA,IAAI,CAAC,IAAI,CAAC,KAAK,0CAAE,SAAS,0CAAE,IAAI,mCAAI,MAAA,IAAI,CAAC,UAAU,EAAE,0CAAG,CAAC,CAAC;yBACjE,CAAC;oBACJ,CAAC;iBACF,CAAC;aACH;SACF,CAAC;IACJ,CAAC;;AA9KH,gDA+KC;AA9KiB,uBAAI,GAAG,mBAAW,CAAC,MAAM,CAAC","file":"sankey.js","sourcesContent":["import type {\n SankeyEncodeChannels,\n WithDefaultEncode,\n PlotSankeyEncoderSpec,\n SemanticLabelOption,\n ChannelEncodeType,\n DataSpec,\n GenerateBaseEncodeSpec,\n GenerateEncoderSpec,\n Nil,\n ScaleSpec,\n ValueOf,\n TransformSpec,\n IElement\n} from '@visactor/vgrammar-core';\nimport { SemanticMark } from './semantic-mark';\n// eslint-disable-next-line no-duplicate-imports\nimport { GrammarMarkType, SIGNAL_VIEW_BOX, Factory } from '@visactor/vgrammar-core';\nimport { PlotMakType } from './enums';\nimport { field as getFieldAccessor } from '@visactor/vgrammar-util';\nimport type { ITextAttribute } from '@visactor/vrender-core';\n\nexport class SankeySemanticMark extends SemanticMark<PlotSankeyEncoderSpec, SankeyEncodeChannels> {\n static readonly type = PlotMakType.sankey;\n constructor(id?: string | number) {\n super(PlotMakType.sankey, id);\n\n if (!Factory.getTransform(PlotMakType.sankey)) {\n this._logger.error(\n `Please add this line of code: import { registerSankeyTransforms } from '@visactor/vgrammar-sankey'; \n and run registerSankeyTransforms() before use sankey`\n );\n }\n\n if (!Factory.getGlyph('linkPath')) {\n this._logger.error(`\n Please add this line of code: import { registerLinkPathGlyph } from '@visactor/vgrammar-core';\n add run registerLinkPathGlyph() before use sankey\n `);\n }\n }\n\n setMarkType() {\n return GrammarMarkType.rect;\n }\n\n setDefaultDataTransform(): TransformSpec[] {\n return [\n {\n type: 'sankey',\n width: { signal: 'viewWidth' },\n height: { signal: 'viewHeight' },\n nodeKey: this.spec.encode?.node\n }\n ];\n }\n\n getDataIdOfLink() {\n return `${this.spec.data?.id ?? this.spec.id}-data-link`;\n }\n\n setMultipleData(): DataSpec[] {\n return [\n {\n id: this.getDataIdOfFiltered(),\n transform: [\n {\n type: 'map',\n all: true,\n callback: (datum: any) => {\n return datum[0].nodes;\n }\n }\n ]\n },\n {\n source: this.getDataIdOfMain(),\n id: this.getDataIdOfLink(),\n transform: [\n {\n type: 'map',\n all: true,\n callback: (datum: any) => {\n // return formatLinkPath(datum[0].links);\n return datum[0].links;\n }\n }\n ]\n }\n ];\n }\n\n parseScaleByEncode(\n channel: SankeyEncodeChannels,\n option: ValueOf<WithDefaultEncode<PlotSankeyEncoderSpec, SankeyEncodeChannels>, SankeyEncodeChannels>\n ): ScaleSpec | Nil {\n if (channel === 'color') {\n return {\n type: 'ordinal',\n id: this.getScaleId('color'),\n domain: {\n data: this.getDataIdOfFiltered(),\n field: option as string\n },\n range: this.getPalette()\n };\n }\n\n return null;\n }\n\n convertMarkEncode(\n encode: WithDefaultEncode<PlotSankeyEncoderSpec, SankeyEncodeChannels>\n ): GenerateBaseEncodeSpec<PlotSankeyEncoderSpec> {\n const markEncoder = this.convertSimpleMarkEncode(encode);\n\n const res: GenerateEncoderSpec<PlotSankeyEncoderSpec> = {\n x: { field: 'x0' },\n x1: { field: 'x1' },\n y: { field: 'y0' },\n y1: { field: 'y1' }\n };\n\n if (markEncoder.stroke) {\n res.stroke = markEncoder.stroke;\n }\n\n if (markEncoder.color) {\n const scaleColorId = this.getScaleId('color');\n const colorAccessor = getFieldAccessor(markEncoder.color.field);\n\n res.fill = (datum: any, el: IElement, params: any) => {\n const scale = params[scaleColorId];\n return scale.scale(colorAccessor(datum?.datum));\n };\n } else {\n res.fill = this.spec.style?.nodeStyle?.fill ?? this.getPalette()?.[0];\n }\n\n return res;\n }\n\n setMainMarkSpec() {\n return { key: 'key' };\n }\n\n protected setLabelTextGetter(\n channel: string,\n option: SemanticLabelOption | boolean\n ): ChannelEncodeType<ITextAttribute['text']> {\n const textGetter = getFieldAccessor(channel);\n return (datum: any, el: IElement, params: any) => {\n return textGetter(datum.datum);\n };\n }\n\n setMultiMarksSpec() {\n // TODO: optimize the default style\n return [\n {\n id: `${this.getMarkId()}-link`,\n type: 'glyph',\n glyphType: 'linkPath',\n from: {\n data: this.getDataIdOfLink()\n },\n layout: {\n position: 'content',\n skipBeforeLayouted: true\n },\n key: 'index',\n dependency: this.viewSpec.scales.map(scale => scale.id).concat(SIGNAL_VIEW_BOX),\n animation: this.convertMarkAnimation(),\n encode: Object.assign({}, this.spec.state, {\n enter: Object.assign(\n {\n backgroundStyle: { fillColor: '#ccc', fillOpacity: 0.2 },\n fillOpacity: 0.8,\n round: true\n },\n this.spec.style?.linkStyle\n ),\n update: (datum: any, el: IElement, params: any) => {\n return {\n direction: datum.vertical ? 'vertical' : 'horizontal',\n x0: datum.x0,\n x1: datum.x1,\n y0: datum.y0,\n y1: datum.y1,\n thickness: datum.thickness,\n fill: this.spec.style?.linkStyle?.fill ?? this.getPalette()?.[0]\n };\n }\n })\n }\n ];\n }\n}\n"]}
@@ -1,6 +1,6 @@
1
1
  import type { ILogger } from '@visactor/vutils';
2
2
  import type { ISemanticMark, ISemanticMarkSpec, ParsedSimpleEncode, WithDefaultEncode, SemanticTooltipOption, SemanticAxisOption, SemanticPlayerOption, SemanticLabelOption, SemanticDataZoomOption, SemanticSliderOption, SemanticLegendOption, SemanticCrosshairOption, CoordinateOption, AxisSpec, CrosshairSpec, DatazoomSpec, LabelSpec, LegendSpec, PlayerSpec, SliderSpec, CoordinateSpec, DataSpec, ChannelEncodeType, ScaleSpec, TransformSpec, MarkAnimationSpec, ViewSpec, MarkType, Nil, ValueOf, GenerateBaseEncodeSpec, IAnimationConfig, MarkSpec, MarkRelativeItemSpec, IPlot, SemanticGridOption, GridSpec, TitleSpec, SemanticTitleOption, InteractionSpec } from '@visactor/vgrammar-core';
3
- import type { ITextAttribute } from '@visactor/vrender/es/core';
3
+ import type { ITextAttribute } from '@visactor/vrender-core';
4
4
  export declare abstract class SemanticMark<EncodeSpec, K extends string> implements ISemanticMark<EncodeSpec, K> {
5
5
  spec: ISemanticMarkSpec<EncodeSpec, K>;
6
6
  viewSpec?: ViewSpec;
@@ -29,7 +29,7 @@ export declare abstract class SemanticMark<EncodeSpec, K extends string> impleme
29
29
  label(channel: string, option?: SemanticLabelOption | boolean): this;
30
30
  player(data?: any[], option?: SemanticPlayerOption | boolean, layout?: MarkRelativeItemSpec): this;
31
31
  title(option: SemanticTitleOption, layout?: MarkRelativeItemSpec): this;
32
- protected getPalette(): import("@visactor/vrender/es/core").IColor[];
32
+ protected getPalette(): import("@visactor/vrender-core").IColor[];
33
33
  abstract setMarkType(): MarkType;
34
34
  abstract parseScaleByEncode(channel: K, option: ValueOf<WithDefaultEncode<EncodeSpec, K>, K>): ScaleSpec | Nil;
35
35
  abstract convertMarkEncode(encode: WithDefaultEncode<EncodeSpec, K>): GenerateBaseEncodeSpec<EncodeSpec>;
@@ -489,7 +489,7 @@ class SemanticMark {
489
489
  var _a, _b;
490
490
  const scale = params[anotherDimScaleId];
491
491
  return scale && (0, vscale_1.isDiscrete)(scale.type) ? scale.range()[1] + (null !== (_b = null === (_a = null == scale ? void 0 : scale.bandwidth) || void 0 === _a ? void 0 : _a.call(scale)) && void 0 !== _b ? _b : 0) / 2 : void 0;
492
- }, interactionSpec.dependencies = [ anotherDimScaleId ];
492
+ }, interactionSpec.dependency = [ anotherDimScaleId ];
493
493
  }
494
494
  res.interactions.push(interactionSpec);
495
495
  }
@@ -544,7 +544,7 @@ class SemanticMark {
544
544
  attributes: {
545
545
  zIndex: 1e3
546
546
  },
547
- dependencies: [ this.getScaleId(colorChannel), this.getScaleId("shape") ]
547
+ dependency: [ this.getScaleId(colorChannel), this.getScaleId("shape") ]
548
548
  };
549
549
  res.interactions.push(interactionSpec);
550
550
  }
@@ -563,7 +563,7 @@ class SemanticMark {
563
563
  attributes: {
564
564
  zIndex: 1e3
565
565
  },
566
- dependencies: [ this.getScaleId(colorChannel), this.getScaleId("shape") ]
566
+ dependency: [ this.getScaleId(colorChannel), this.getScaleId("shape") ]
567
567
  };
568
568
  res.interactions.push(interactionSpec);
569
569
  }