@visactor/vseed 0.1.13 → 0.1.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/esm/builder/builder/builder.d.ts +3372 -108
- package/dist/esm/pipeline/advanced/chart/pipes/encoding/{encodingAdapter.d.ts → adapter/encodingAdapter.d.ts} +1 -1
- package/dist/esm/pipeline/advanced/chart/pipes/encoding/{encodingAdapter.js → adapter/encodingAdapter.js} +1 -1
- package/dist/esm/pipeline/advanced/chart/pipes/encoding/adapter/encodingAdapter.js.map +1 -0
- package/dist/esm/pipeline/advanced/chart/pipes/encoding/adapter/index.d.ts +1 -0
- package/dist/esm/pipeline/advanced/chart/pipes/encoding/adapter/index.js +2 -0
- package/dist/esm/pipeline/advanced/chart/pipes/encoding/bar.js +4 -6
- package/dist/esm/pipeline/advanced/chart/pipes/encoding/bar.js.map +1 -1
- package/dist/esm/pipeline/advanced/chart/pipes/encoding/color/addColorToEncoding.d.ts +8 -0
- package/dist/esm/pipeline/advanced/chart/pipes/encoding/color/addColorToEncoding.js +13 -0
- package/dist/esm/pipeline/advanced/chart/pipes/encoding/color/addColorToEncoding.js.map +1 -0
- package/dist/esm/pipeline/advanced/chart/pipes/encoding/color/index.d.ts +1 -0
- package/dist/esm/pipeline/advanced/chart/pipes/encoding/color/index.js +2 -0
- package/dist/esm/pipeline/advanced/chart/pipes/encoding/column.js +4 -6
- package/dist/esm/pipeline/advanced/chart/pipes/encoding/column.js.map +1 -1
- package/dist/esm/pipeline/advanced/chart/pipes/encoding/dualAxis.js +4 -6
- package/dist/esm/pipeline/advanced/chart/pipes/encoding/dualAxis.js.map +1 -1
- package/dist/esm/pipeline/advanced/chart/pipes/encoding/funnel.js +4 -6
- package/dist/esm/pipeline/advanced/chart/pipes/encoding/funnel.js.map +1 -1
- package/dist/esm/pipeline/advanced/chart/pipes/encoding/heatmap.js +4 -6
- package/dist/esm/pipeline/advanced/chart/pipes/encoding/heatmap.js.map +1 -1
- package/dist/esm/pipeline/advanced/chart/pipes/encoding/index.d.ts +1 -1
- package/dist/esm/pipeline/advanced/chart/pipes/encoding/index.js +1 -1
- package/dist/esm/pipeline/advanced/chart/pipes/encoding/line.js +4 -6
- package/dist/esm/pipeline/advanced/chart/pipes/encoding/line.js.map +1 -1
- package/dist/esm/pipeline/advanced/chart/pipes/encoding/pie.js +4 -6
- package/dist/esm/pipeline/advanced/chart/pipes/encoding/pie.js.map +1 -1
- package/dist/esm/pipeline/advanced/chart/pipes/encoding/radar.js +4 -6
- package/dist/esm/pipeline/advanced/chart/pipes/encoding/radar.js.map +1 -1
- package/dist/esm/pipeline/advanced/chart/pipes/encoding/rose.js +4 -6
- package/dist/esm/pipeline/advanced/chart/pipes/encoding/rose.js.map +1 -1
- package/dist/esm/pipeline/advanced/chart/pipes/encoding/scatter.js +2 -4
- package/dist/esm/pipeline/advanced/chart/pipes/encoding/scatter.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipeline/heatmap.js +1 -3
- package/dist/esm/pipeline/spec/chart/pipeline/heatmap.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipeline/scatter.js +3 -3
- package/dist/esm/pipeline/spec/chart/pipeline/scatter.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipes/axes/angle.js +1 -0
- package/dist/esm/pipeline/spec/chart/pipes/axes/angle.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipes/axes/radius.js +1 -0
- package/dist/esm/pipeline/spec/chart/pipes/axes/radius.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipes/axes/xLinear.js +9 -3
- package/dist/esm/pipeline/spec/chart/pipes/axes/xLinear.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipes/axes/yLinear.js +9 -3
- package/dist/esm/pipeline/spec/chart/pipes/axes/yLinear.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipes/axes/yLinearPrimary.js +8 -3
- package/dist/esm/pipeline/spec/chart/pipes/axes/yLinearPrimary.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipes/axes/yLinearSecondary.js +8 -3
- package/dist/esm/pipeline/spec/chart/pipes/axes/yLinearSecondary.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipes/label/index.d.ts +1 -1
- package/dist/esm/pipeline/spec/chart/pipes/label/index.js +2 -2
- package/dist/esm/pipeline/spec/chart/pipes/label/label.d.ts +5 -1
- package/dist/esm/pipeline/spec/chart/pipes/label/label.js +59 -38
- package/dist/esm/pipeline/spec/chart/pipes/label/label.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipes/label/labelDualAxis.js +15 -52
- package/dist/esm/pipeline/spec/chart/pipes/label/labelDualAxis.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipes/label/{labelColorInversion.d.ts → labelScatter.d.ts} +1 -1
- package/dist/esm/pipeline/spec/chart/pipes/label/labelScatter.js +19 -0
- package/dist/esm/pipeline/spec/chart/pipes/label/labelScatter.js.map +1 -0
- package/dist/esm/pipeline/spec/chart/pipes/legend/colorLegend.js +3 -3
- package/dist/esm/pipeline/spec/chart/pipes/legend/colorLegend.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipes/legend/discreteLegend.js +4 -4
- package/dist/esm/pipeline/spec/chart/pipes/legend/discreteLegend.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipes/legend/pivotColorLegend.js +3 -3
- package/dist/esm/pipeline/spec/chart/pipes/legend/pivotColorLegend.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipes/legend/pivotDiscreteLegend.js +4 -4
- package/dist/esm/pipeline/spec/chart/pipes/legend/pivotDiscreteLegend.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipes/series/series.js +1 -0
- package/dist/esm/pipeline/spec/chart/pipes/series/series.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipes/tooltip/tooltip.d.ts +3 -3
- package/dist/esm/pipeline/spec/chart/pipes/tooltip/tooltip.js +13 -30
- package/dist/esm/pipeline/spec/chart/pipes/tooltip/tooltip.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipes/tooltip/tooltipDualAxis.js +6 -6
- package/dist/esm/pipeline/spec/chart/pipes/tooltip/tooltipDualAxis.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipes/tooltip/tooltipHeatmap.js +6 -18
- package/dist/esm/pipeline/spec/chart/pipes/tooltip/tooltipHeatmap.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipes/tooltip/tooltipScatter.js +6 -18
- package/dist/esm/pipeline/spec/chart/pipes/tooltip/tooltipScatter.js.map +1 -1
- package/dist/esm/pipeline/spec/table/pipes/columns/measuresToColumns.js +8 -11
- package/dist/esm/pipeline/spec/table/pipes/columns/measuresToColumns.js.map +1 -1
- package/dist/esm/pipeline/spec/table/pipes/indicators/pivotIndicators.js +8 -13
- package/dist/esm/pipeline/spec/table/pipes/indicators/pivotIndicators.js.map +1 -1
- package/dist/esm/pipeline/utils/constant.d.ts +1 -0
- package/dist/esm/pipeline/utils/constant.js +2 -1
- package/dist/esm/pipeline/utils/constant.js.map +1 -1
- package/dist/esm/pipeline/utils/format/createFormatter.d.ts +1 -1
- package/dist/esm/pipeline/utils/format/createFormatter.js +3 -2
- package/dist/esm/pipeline/utils/format/createFormatter.js.map +1 -1
- package/dist/esm/pipeline/utils/format/createFormatterByMeasure.d.ts +2 -0
- package/dist/esm/pipeline/utils/format/createFormatterByMeasure.js +13 -0
- package/dist/esm/pipeline/utils/format/createFormatterByMeasure.js.map +1 -0
- package/dist/esm/pipeline/utils/format/createNumFormatter.d.ts +1 -1
- package/dist/esm/pipeline/utils/format/createNumFormatter.js.map +1 -1
- package/dist/esm/pipeline/utils/format/index.d.ts +1 -0
- package/dist/esm/pipeline/utils/format/index.js +1 -0
- package/dist/esm/theme/dark.js +9 -3
- package/dist/esm/theme/dark.js.map +1 -1
- package/dist/esm/theme/light.js +27 -6
- package/dist/esm/theme/light.js.map +1 -1
- package/dist/esm/types/advancedVSeed.d.ts +2334 -36
- package/dist/esm/types/chartType/area/zArea.d.ts +99 -1
- package/dist/esm/types/chartType/areaPercent/zAreaPercent.d.ts +99 -1
- package/dist/esm/types/chartType/bar/zBar.d.ts +99 -1
- package/dist/esm/types/chartType/barParallel/zBarParallel.d.ts +99 -1
- package/dist/esm/types/chartType/barPercent/zBarPercent.d.ts +99 -1
- package/dist/esm/types/chartType/column/zColumn.d.ts +99 -1
- package/dist/esm/types/chartType/columnParallel/zColumnParallel.d.ts +99 -1
- package/dist/esm/types/chartType/columnPercent/zColumnPercent.d.ts +99 -1
- package/dist/esm/types/chartType/donut/zDonut.d.ts +69 -1
- package/dist/esm/types/chartType/dualAxis/zDualAxis.d.ts +309 -1
- package/dist/esm/types/chartType/funnel/zFunnel.d.ts +68 -0
- package/dist/esm/types/chartType/heatmap/zHeatmap.d.ts +68 -0
- package/dist/esm/types/chartType/line/zLine.d.ts +99 -1
- package/dist/esm/types/chartType/pie/zPie.d.ts +69 -1
- package/dist/esm/types/chartType/pivotTable/zPivotTable.d.ts +30 -0
- package/dist/esm/types/chartType/radar/zRadar.d.ts +69 -1
- package/dist/esm/types/chartType/rose/zRose.d.ts +69 -1
- package/dist/esm/types/chartType/roseParallel/zRoseParallel.d.ts +69 -1
- package/dist/esm/types/chartType/scatter/zScatter.d.ts +249 -1
- package/dist/esm/types/chartType/table/zTable.d.ts +30 -0
- package/dist/esm/types/properties/config/axes/bandAxis.d.ts +146 -82
- package/dist/esm/types/properties/config/axes/bandAxis.js +0 -48
- package/dist/esm/types/properties/config/axes/index.d.ts +4 -3
- package/dist/esm/types/properties/config/axes/index.js +2 -3
- package/dist/esm/types/properties/config/axes/linearAxis.d.ts +149 -84
- package/dist/esm/types/properties/config/axes/linearAxis.js +0 -45
- package/dist/esm/types/properties/config/axes/zBandAxis.d.ts +79 -0
- package/dist/esm/types/properties/config/axes/{axis.js → zBandAxis.js} +5 -11
- package/dist/esm/types/properties/config/axes/zBandAxis.js.map +1 -0
- package/dist/esm/types/properties/config/axes/zLinearAxis.d.ts +141 -0
- package/dist/esm/types/properties/config/axes/zLinearAxis.js +47 -0
- package/dist/esm/types/properties/config/axes/zLinearAxis.js.map +1 -0
- package/dist/esm/types/properties/config/config.d.ts +2304 -37
- package/dist/esm/types/properties/config/config.js +1 -2
- package/dist/esm/types/properties/config/config.js.map +1 -1
- package/dist/esm/types/properties/config/label/label.d.ts +37 -0
- package/dist/esm/types/properties/config/label/zLabel.d.ts +38 -0
- package/dist/esm/types/properties/config/label/zLabel.js +11 -1
- package/dist/esm/types/properties/config/label/zLabel.js.map +1 -1
- package/dist/esm/types/properties/config/legend/legend.d.ts +6 -2
- package/dist/esm/types/properties/config/legend/legend.js +1 -1
- package/dist/esm/types/properties/config/legend/legend.js.map +1 -1
- package/dist/esm/types/properties/format/numFormat.js.map +1 -0
- package/dist/esm/types/properties/index.d.ts +1 -0
- package/dist/esm/types/properties/index.js +1 -0
- package/dist/esm/types/properties/measures/index.d.ts +0 -1
- package/dist/esm/types/properties/measures/index.js +0 -1
- package/dist/esm/types/properties/measures/measures.d.ts +6 -2
- package/dist/esm/types/properties/measures/zDualMeasures.d.ts +240 -0
- package/dist/esm/types/properties/measures/zMeasures.d.ts +90 -0
- package/dist/esm/types/properties/measures/zMeasures.js +2 -1
- package/dist/esm/types/properties/measures/zMeasures.js.map +1 -1
- package/dist/esm/types/properties/measures/zScatterMeasures.d.ts +240 -0
- package/dist/esm/types/properties/theme/customTheme.d.ts +2304 -36
- package/dist/esm/types/zVseed.d.ts +2090 -116
- package/dist/umd/index.js +270 -335
- package/dist/umd/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/esm/pipeline/advanced/chart/pipes/encoding/encodingAdapter.js.map +0 -1
- package/dist/esm/pipeline/spec/chart/pipes/label/labelColorInversion.js +0 -13
- package/dist/esm/pipeline/spec/chart/pipes/label/labelColorInversion.js.map +0 -1
- package/dist/esm/types/properties/config/axes/axis.d.ts +0 -255
- package/dist/esm/types/properties/config/axes/axis.js.map +0 -1
- package/dist/esm/types/properties/config/axes/bandAxis.js.map +0 -1
- package/dist/esm/types/properties/config/axes/linearAxis.js.map +0 -1
- package/dist/esm/types/properties/measures/format/numFormat.js.map +0 -1
- /package/dist/esm/types/properties/{measures/format → format}/formatter.d.ts +0 -0
- /package/dist/esm/types/properties/{measures/format → format}/formatter.js +0 -0
- /package/dist/esm/types/properties/{measures/format → format}/index.d.ts +0 -0
- /package/dist/esm/types/properties/{measures/format → format}/index.js +0 -0
- /package/dist/esm/types/properties/{measures/format → format}/numFormat.d.ts +0 -0
- /package/dist/esm/types/properties/{measures/format → format}/numFormat.js +0 -0
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"pipeline/spec/chart/pipes/legend/pivotDiscreteLegend.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/chart/pipes/legend/pivotDiscreteLegend.ts"],"sourcesContent":["import type { PivotChartConstructorOptions } from '@visactor/vtable'\nimport type { IDiscreteTableLegendOption } from '@visactor/vtable/es/ts-types/component/legend'\nimport { unique } from 'remeda'\nimport type { Color, Legend, SpecPipe } from 'src/types'\nimport { createSpecifiedForColorMapping } from '../color/color'\n\nexport const pivotDiscreteLegend: SpecPipe = (spec, context) => {\n const result = { ...spec } as PivotChartConstructorOptions\n const { advancedVSeed } = context\n const { chartType } = advancedVSeed\n const baseConfig = advancedVSeed.config[chartType] as { legend: Legend; color: Color }\n\n if (!baseConfig || !baseConfig.legend) {\n return result\n }\n\n const { datasetReshapeInfo } = advancedVSeed\n\n const colorItems = unique(\n datasetReshapeInfo.flatMap((d) => {\n return d.unfoldInfo.colorItems\n }),\n )\n\n const colorIdMap = datasetReshapeInfo.reduce<Record<string, string>>((prev, cur) => {\n return { ...prev, ...cur.unfoldInfo.colorIdMap }\n }, {})\n\n const { legend, color } = baseConfig\n const { colorScheme, colorMapping } = color\n\n const colorSpecified = createSpecifiedForColorMapping(colorMapping, colorIdMap, colorItems)\n\n const {\n enable,\n position = 'bottom',\n labelFontColor,\n labelFontSize = 12,\n labelFontWeight = 400,\n maxSize = 1,\n border,\n shapeType = 'rectRound',\n } = legend || {}\n\n const orient = ['bottom', 'bottomLeft', 'bottomRight', 'bl', 'br'].includes(position)\n ? 'bottom'\n : ['top', 'topLeft', 'topRight', 'tl', 'tr'].includes(position)\n ? 'top'\n : ['left', 'leftTop', 'leftBottom', 'lt', 'lb'].includes(position)\n ? 'left'\n : 'right'\n\n const legendPosition = ['topLeft', 'bottomLeft', 'leftTop', 'rightTop', 'lt', 'rt', 'tl', 'bl'].includes(position)\n ? 'start'\n : ['topRight', 'bottomRight', 'leftBottom', 'rightBottom', 'lb', 'rb', 'rt', 'br'].includes(position)\n ? 'end'\n : 'middle'\n\n const legends: IDiscreteTableLegendOption = {\n visible: enable,\n type: 'discrete',\n orient,\n position: legendPosition,\n maxCol: Math.max(1, maxSize),\n maxRow: Math.max(1, maxSize),\n data: colorItems.map((d, index) => {\n const color = colorSpecified?.[d] ?? colorScheme?.[index % colorScheme.length]\n return {\n label: d,\n shape: {\n outerBorder: border\n ? {\n stroke: color,\n distance: 3,\n lineWidth: 1,\n }\n : undefined,\n fill: color,\n },\n }\n }),\n\n item: {\n focus: true,\n maxWidth: '30%',\n focusIconStyle: {\n size: labelFontSize + 2,\n fill: labelFontColor,\n fontWeight: labelFontWeight,\n },\n shape: {\n space: border ? 6 : 4,\n style: {\n symbolType: shapeType,\n size: border ? 8 : 10,\n },\n },\n label: {\n formatMethod: (value: string) => {\n return colorIdMap[value] ?? value\n },\n style: {\n fontSize: labelFontSize,\n fill: labelFontColor,\n fontWeight: labelFontWeight,\n },\n },\n background: {\n state: {\n selectedHover: {\n fill: labelFontColor,\n fillOpacity: 0.05,\n },\n },\n },\n },\n } as unknown as IDiscreteTableLegendOption\n return { ...result, legends }\n}\n"],"names":["pivotDiscreteLegend","spec","context","result","advancedVSeed","chartType","baseConfig","datasetReshapeInfo","colorItems","unique","d","colorIdMap","prev","cur","legend","color","colorScheme","colorMapping","colorSpecified","createSpecifiedForColorMapping","enable","position","labelFontColor","labelFontSize","labelFontWeight","maxSize","border","shapeType","orient","legendPosition","legends","Math","index","undefined","value"],"mappings":";;AAMO,MAAMA,sBAAgC,CAACC,MAAMC;IAClD,MAAMC,SAAS;QAAE,GAAGF,IAAI;IAAC;IACzB,MAAM,EAAEG,aAAa,EAAE,GAAGF;IAC1B,MAAM,EAAEG,SAAS,EAAE,GAAGD;IACtB,MAAME,aAAaF,cAAc,MAAM,CAACC,UAAU;IAElD,IAAI,CAACC,cAAc,CAACA,WAAW,MAAM,EACnC,OAAOH;IAGT,MAAM,EAAEI,kBAAkB,EAAE,GAAGH;IAE/B,MAAMI,aAAaC,OACjBF,mBAAmB,OAAO,CAAC,CAACG,IACnBA,EAAE,UAAU,CAAC,UAAU;IAIlC,MAAMC,aAAaJ,mBAAmB,MAAM,CAAyB,CAACK,MAAMC,MACnE;YAAE,GAAGD,IAAI;YAAE,GAAGC,IAAI,UAAU,CAAC,UAAU;QAAC,IAC9C,CAAC;IAEJ,MAAM,EAAEC,MAAM,EAAEC,KAAK,EAAE,GAAGT;IAC1B,MAAM,EAAEU,WAAW,EAAEC,YAAY,EAAE,GAAGF;IAEtC,MAAMG,iBAAiBC,+BAA+BF,cAAcN,YAAYH;IAEhF,MAAM,EACJY,MAAM,EACNC,WAAW,QAAQ,EACnBC,cAAc,EACdC,gBAAgB,EAAE,EAClBC,kBAAkB,GAAG,EACrBC,UAAU,CAAC,EACXC,MAAM,EACNC,YAAY,WAAW,EACxB,
|
1
|
+
{"version":3,"file":"pipeline/spec/chart/pipes/legend/pivotDiscreteLegend.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/chart/pipes/legend/pivotDiscreteLegend.ts"],"sourcesContent":["import type { PivotChartConstructorOptions } from '@visactor/vtable'\nimport type { IDiscreteTableLegendOption } from '@visactor/vtable/es/ts-types/component/legend'\nimport { unique } from 'remeda'\nimport type { Color, Legend, SpecPipe } from 'src/types'\nimport { createSpecifiedForColorMapping } from '../color/color'\n\nexport const pivotDiscreteLegend: SpecPipe = (spec, context) => {\n const result = { ...spec } as PivotChartConstructorOptions\n const { advancedVSeed } = context\n const { chartType } = advancedVSeed\n const baseConfig = advancedVSeed.config[chartType] as { legend: Legend; color: Color }\n\n if (!baseConfig || !baseConfig.legend) {\n return result\n }\n\n const { datasetReshapeInfo } = advancedVSeed\n\n const colorItems = unique(\n datasetReshapeInfo.flatMap((d) => {\n return d.unfoldInfo.colorItems\n }),\n )\n\n const colorIdMap = datasetReshapeInfo.reduce<Record<string, string>>((prev, cur) => {\n return { ...prev, ...cur.unfoldInfo.colorIdMap }\n }, {})\n\n const { legend, color } = baseConfig\n const { colorScheme, colorMapping } = color\n\n const colorSpecified = createSpecifiedForColorMapping(colorMapping, colorIdMap, colorItems)\n\n const {\n enable,\n position = 'bottom',\n labelFontColor,\n labelColor,\n labelFontSize = 12,\n labelFontWeight = 400,\n maxSize = 1,\n border,\n shapeType = 'rectRound',\n } = legend || {}\n\n const orient = ['bottom', 'bottomLeft', 'bottomRight', 'bl', 'br'].includes(position)\n ? 'bottom'\n : ['top', 'topLeft', 'topRight', 'tl', 'tr'].includes(position)\n ? 'top'\n : ['left', 'leftTop', 'leftBottom', 'lt', 'lb'].includes(position)\n ? 'left'\n : 'right'\n\n const legendPosition = ['topLeft', 'bottomLeft', 'leftTop', 'rightTop', 'lt', 'rt', 'tl', 'bl'].includes(position)\n ? 'start'\n : ['topRight', 'bottomRight', 'leftBottom', 'rightBottom', 'lb', 'rb', 'rt', 'br'].includes(position)\n ? 'end'\n : 'middle'\n\n const legends: IDiscreteTableLegendOption = {\n visible: enable,\n type: 'discrete',\n orient,\n position: legendPosition,\n maxCol: Math.max(1, maxSize),\n maxRow: Math.max(1, maxSize),\n data: colorItems.map((d, index) => {\n const color = colorSpecified?.[d] ?? colorScheme?.[index % colorScheme.length]\n return {\n label: d,\n shape: {\n outerBorder: border\n ? {\n stroke: color,\n distance: 3,\n lineWidth: 1,\n }\n : undefined,\n fill: color,\n },\n }\n }),\n\n item: {\n focus: true,\n maxWidth: '30%',\n focusIconStyle: {\n size: labelFontSize + 2,\n fill: labelColor || labelFontColor,\n fontWeight: labelFontWeight,\n },\n shape: {\n space: border ? 6 : 4,\n style: {\n symbolType: shapeType,\n size: border ? 8 : 10,\n },\n },\n label: {\n formatMethod: (value: string) => {\n return colorIdMap[value] ?? value\n },\n style: {\n fontSize: labelFontSize,\n fill: labelColor || labelFontColor,\n fontWeight: labelFontWeight,\n },\n },\n background: {\n state: {\n selectedHover: {\n fill: labelColor || labelFontColor,\n fillOpacity: 0.05,\n },\n },\n },\n },\n } as unknown as IDiscreteTableLegendOption\n return { ...result, legends }\n}\n"],"names":["pivotDiscreteLegend","spec","context","result","advancedVSeed","chartType","baseConfig","datasetReshapeInfo","colorItems","unique","d","colorIdMap","prev","cur","legend","color","colorScheme","colorMapping","colorSpecified","createSpecifiedForColorMapping","enable","position","labelFontColor","labelColor","labelFontSize","labelFontWeight","maxSize","border","shapeType","orient","legendPosition","legends","Math","index","undefined","value"],"mappings":";;AAMO,MAAMA,sBAAgC,CAACC,MAAMC;IAClD,MAAMC,SAAS;QAAE,GAAGF,IAAI;IAAC;IACzB,MAAM,EAAEG,aAAa,EAAE,GAAGF;IAC1B,MAAM,EAAEG,SAAS,EAAE,GAAGD;IACtB,MAAME,aAAaF,cAAc,MAAM,CAACC,UAAU;IAElD,IAAI,CAACC,cAAc,CAACA,WAAW,MAAM,EACnC,OAAOH;IAGT,MAAM,EAAEI,kBAAkB,EAAE,GAAGH;IAE/B,MAAMI,aAAaC,OACjBF,mBAAmB,OAAO,CAAC,CAACG,IACnBA,EAAE,UAAU,CAAC,UAAU;IAIlC,MAAMC,aAAaJ,mBAAmB,MAAM,CAAyB,CAACK,MAAMC,MACnE;YAAE,GAAGD,IAAI;YAAE,GAAGC,IAAI,UAAU,CAAC,UAAU;QAAC,IAC9C,CAAC;IAEJ,MAAM,EAAEC,MAAM,EAAEC,KAAK,EAAE,GAAGT;IAC1B,MAAM,EAAEU,WAAW,EAAEC,YAAY,EAAE,GAAGF;IAEtC,MAAMG,iBAAiBC,+BAA+BF,cAAcN,YAAYH;IAEhF,MAAM,EACJY,MAAM,EACNC,WAAW,QAAQ,EACnBC,cAAc,EACdC,UAAU,EACVC,gBAAgB,EAAE,EAClBC,kBAAkB,GAAG,EACrBC,UAAU,CAAC,EACXC,MAAM,EACNC,YAAY,WAAW,EACxB,GAAGd,UAAU,CAAC;IAEf,MAAMe,SAAS;QAAC;QAAU;QAAc;QAAe;QAAM;KAAK,CAAC,QAAQ,CAACR,YACxE,WACA;QAAC;QAAO;QAAW;QAAY;QAAM;KAAK,CAAC,QAAQ,CAACA,YAClD,QACA;QAAC;QAAQ;QAAW;QAAc;QAAM;KAAK,CAAC,QAAQ,CAACA,YACrD,SACA;IAER,MAAMS,iBAAiB;QAAC;QAAW;QAAc;QAAW;QAAY;QAAM;QAAM;QAAM;KAAK,CAAC,QAAQ,CAACT,YACrG,UACA;QAAC;QAAY;QAAe;QAAc;QAAe;QAAM;QAAM;QAAM;KAAK,CAAC,QAAQ,CAACA,YACxF,QACA;IAEN,MAAMU,UAAsC;QAC1C,SAASX;QACT,MAAM;QACNS;QACA,UAAUC;QACV,QAAQE,KAAK,GAAG,CAAC,GAAGN;QACpB,QAAQM,KAAK,GAAG,CAAC,GAAGN;QACpB,MAAMlB,WAAW,GAAG,CAAC,CAACE,GAAGuB;YACvB,MAAMlB,QAAQG,gBAAgB,CAACR,EAAE,IAAIM,aAAa,CAACiB,QAAQjB,YAAY,MAAM,CAAC;YAC9E,OAAO;gBACL,OAAON;gBACP,OAAO;oBACL,aAAaiB,SACT;wBACE,QAAQZ;wBACR,UAAU;wBACV,WAAW;oBACb,IACAmB;oBACJ,MAAMnB;gBACR;YACF;QACF;QAEA,MAAM;YACJ,OAAO;YACP,UAAU;YACV,gBAAgB;gBACd,MAAMS,gBAAgB;gBACtB,MAAMD,cAAcD;gBACpB,YAAYG;YACd;YACA,OAAO;gBACL,OAAOE,SAAS,IAAI;gBACpB,OAAO;oBACL,YAAYC;oBACZ,MAAMD,SAAS,IAAI;gBACrB;YACF;YACA,OAAO;gBACL,cAAc,CAACQ,QACNxB,UAAU,CAACwB,MAAM,IAAIA;gBAE9B,OAAO;oBACL,UAAUX;oBACV,MAAMD,cAAcD;oBACpB,YAAYG;gBACd;YACF;YACA,YAAY;gBACV,OAAO;oBACL,eAAe;wBACb,MAAMF,cAAcD;wBACpB,aAAa;oBACf;gBACF;YACF;QACF;IACF;IACA,OAAO;QAAE,GAAGnB,MAAM;QAAE4B;IAAQ;AAC9B"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"pipeline/spec/chart/pipes/series/series.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/chart/pipes/series/series.ts"],"sourcesContent":["import type { Spec, SpecPipe, SpecPipeline, SpecPipelineContext } from 'src/types'\nimport { execPipeline } from '../../../../utils'\nimport type { ICommonChartSpec, ILineSeriesSpec } from '@visactor/vchart'\n\nexport const series = (...args: SpecPipeline[]): SpecPipe => {\n const result = {\n type: 'common',\n padding: 0,\n region: [\n {\n clip: true,\n },\n ],\n } as ICommonChartSpec\n\n return (_, context) => {\n result.series = args.map((pipeline) => {\n return execPipeline<Spec, SpecPipelineContext>(pipeline, context, {})\n }) as ILineSeriesSpec[]\n\n return result\n }\n}\n\n/**\n * @description 双轴图的透视场景, 不能使用此pipe, 请使用series\n * 因为VTable.PivotVChart会自行解析数据, 而非VChart解析.\n */\nexport const seriesDualAxis = (...args: SpecPipeline[]): SpecPipe => {\n const result = {\n type: 'common',\n padding: 0,\n region: [\n {\n clip: true,\n },\n ],\n } as ICommonChartSpec\n\n const createDualContext = <T extends SpecPipelineContext>(context: T, index: number): T => {\n const { advancedVSeed } = context\n const dataset = advancedVSeed.dataset[index]\n return {\n ...context,\n advancedVSeed: {\n ...advancedVSeed,\n dataset: dataset,\n },\n }\n }\n\n return (_, context) => {\n result.series = args.map((pipeline, index) => {\n const seriesContext = createDualContext(context, index)\n return execPipeline<Spec, SpecPipelineContext>(pipeline, seriesContext, {})\n }) as ILineSeriesSpec[]\n\n return result\n }\n}\n"],"names":["series","args","result","_","context","pipeline","execPipeline","seriesDualAxis","createDualContext","index","advancedVSeed","dataset","seriesContext"],"mappings":";AAIO,MAAMA,SAAS,CAAC,GAAGC;IACxB,MAAMC,SAAS;QACb,MAAM;QACN,SAAS;QACT,QAAQ;YACN;gBACE,MAAM;YACR;SACD;IACH;IAEA,OAAO,CAACC,GAAGC;QACTF,OAAO,MAAM,GAAGD,KAAK,GAAG,CAAC,CAACI,WACjBC,aAAwCD,UAAUD,SAAS,CAAC;QAGrE,OAAOF;IACT;AACF;AAMO,MAAMK,iBAAiB,CAAC,GAAGN;IAChC,MAAMC,SAAS;QACb,MAAM;QACN,SAAS;QACT,QAAQ;YACN;gBACE,MAAM;YACR;SACD;IACH;IAEA,MAAMM,oBAAoB,CAAgCJ,SAAYK;QACpE,MAAM,EAAEC,aAAa,EAAE,GAAGN;QAC1B,MAAMO,UAAUD,cAAc,OAAO,CAACD,MAAM;QAC5C,OAAO;YACL,GAAGL,OAAO;YACV,eAAe;gBACb,GAAGM,aAAa;gBAChB,SAASC;YACX;QACF;IACF;IAEA,OAAO,CAACR,GAAGC;QACTF,OAAO,MAAM,GAAGD,KAAK,GAAG,CAAC,CAACI,UAAUI;YAClC,MAAMG,gBAAgBJ,kBAAkBJ,SAASK;YACjD,OAAOH,aAAwCD,UAAUO,eAAe,CAAC;QAC3E;QAEA,OAAOV;IACT;AACF"}
|
1
|
+
{"version":3,"file":"pipeline/spec/chart/pipes/series/series.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/chart/pipes/series/series.ts"],"sourcesContent":["import type { Spec, SpecPipe, SpecPipeline, SpecPipelineContext } from 'src/types'\nimport { execPipeline } from '../../../../utils'\nimport type { ICommonChartSpec, ILineSeriesSpec } from '@visactor/vchart'\n\nexport const series = (...args: SpecPipeline[]): SpecPipe => {\n const result = {\n type: 'common',\n padding: 0,\n region: [\n {\n clip: true,\n },\n ],\n } as ICommonChartSpec\n\n return (_, context) => {\n result.series = args.map((pipeline) => {\n return execPipeline<Spec, SpecPipelineContext>(pipeline, context, {})\n }) as ILineSeriesSpec[]\n\n return result\n }\n}\n\n/**\n * @description 双轴图的透视场景, 不能使用此pipe, 请使用series\n * 因为VTable.PivotVChart会自行解析数据, 而非VChart解析.\n */\nexport const seriesDualAxis = (...args: SpecPipeline[]): SpecPipe => {\n const result = {\n type: 'common',\n padding: 0,\n labelLayout: 'region',\n region: [\n {\n clip: true,\n },\n ],\n } as ICommonChartSpec\n\n const createDualContext = <T extends SpecPipelineContext>(context: T, index: number): T => {\n const { advancedVSeed } = context\n const dataset = advancedVSeed.dataset[index]\n return {\n ...context,\n advancedVSeed: {\n ...advancedVSeed,\n dataset: dataset,\n },\n }\n }\n\n return (_, context) => {\n result.series = args.map((pipeline, index) => {\n const seriesContext = createDualContext(context, index)\n return execPipeline<Spec, SpecPipelineContext>(pipeline, seriesContext, {})\n }) as ILineSeriesSpec[]\n\n return result\n }\n}\n"],"names":["series","args","result","_","context","pipeline","execPipeline","seriesDualAxis","createDualContext","index","advancedVSeed","dataset","seriesContext"],"mappings":";AAIO,MAAMA,SAAS,CAAC,GAAGC;IACxB,MAAMC,SAAS;QACb,MAAM;QACN,SAAS;QACT,QAAQ;YACN;gBACE,MAAM;YACR;SACD;IACH;IAEA,OAAO,CAACC,GAAGC;QACTF,OAAO,MAAM,GAAGD,KAAK,GAAG,CAAC,CAACI,WACjBC,aAAwCD,UAAUD,SAAS,CAAC;QAGrE,OAAOF;IACT;AACF;AAMO,MAAMK,iBAAiB,CAAC,GAAGN;IAChC,MAAMC,SAAS;QACb,MAAM;QACN,SAAS;QACT,aAAa;QACb,QAAQ;YACN;gBACE,MAAM;YACR;SACD;IACH;IAEA,MAAMM,oBAAoB,CAAgCJ,SAAYK;QACpE,MAAM,EAAEC,aAAa,EAAE,GAAGN;QAC1B,MAAMO,UAAUD,cAAc,OAAO,CAACD,MAAM;QAC5C,OAAO;YACL,GAAGL,OAAO;YACV,eAAe;gBACb,GAAGM,aAAa;gBAChB,SAASC;YACX;QACF;IACF;IAEA,OAAO,CAACR,GAAGC;QACTF,OAAO,MAAM,GAAGD,KAAK,GAAG,CAAC,CAACI,UAAUI;YAClC,MAAMG,gBAAgBJ,kBAAkBJ,SAASK;YACjD,OAAOH,aAAwCD,UAAUO,eAAe,CAAC;QAC3E;QAEA,OAAOV;IACT;AACF"}
|
@@ -1,13 +1,13 @@
|
|
1
|
-
import type { Dimensions, FoldInfo,
|
1
|
+
import type { Dimensions, FoldInfo, Measures, SpecPipe, UnfoldInfo } from '../../../../../types';
|
2
2
|
export declare const tooltip: SpecPipe;
|
3
|
-
export declare const createDimensionContent: (measures: Measures, foldInfo: FoldInfo, unfoldInfo: UnfoldInfo
|
3
|
+
export declare const createDimensionContent: (measures: Measures, foldInfo: FoldInfo, unfoldInfo: UnfoldInfo) => {
|
4
4
|
visible: boolean;
|
5
5
|
shapeType: string;
|
6
6
|
hasShape: boolean;
|
7
7
|
key: (v: unknown) => string;
|
8
8
|
value: (v: unknown) => string;
|
9
9
|
}[];
|
10
|
-
export declare const createMarkContent: (tooltip: string[], dimensions: Dimensions, measures: Measures,
|
10
|
+
export declare const createMarkContent: (tooltip: string[], dimensions: Dimensions, measures: Measures, foldInfo: FoldInfo, unfoldInfo: UnfoldInfo) => ({
|
11
11
|
visible: boolean;
|
12
12
|
hasShape: boolean;
|
13
13
|
shapeType: string;
|
@@ -1,12 +1,12 @@
|
|
1
|
-
import {
|
2
|
-
import {
|
1
|
+
import { pipe, uniqueBy } from "remeda";
|
2
|
+
import { createFormatterByMeasure, findAllMeasures, findMeasureById } from "../../../../utils/index.js";
|
3
3
|
import { ORIGINAL_DATA } from "../../../../../dataReshape/index.js";
|
4
4
|
const tooltip_tooltip = (spec, context)=>{
|
5
5
|
const result = {
|
6
6
|
...spec
|
7
7
|
};
|
8
8
|
const { advancedVSeed, vseed } = context;
|
9
|
-
const { measures, datasetReshapeInfo, chartType,
|
9
|
+
const { measures, datasetReshapeInfo, chartType, dimensions, encoding } = advancedVSeed;
|
10
10
|
const baseConfig = advancedVSeed.config[chartType];
|
11
11
|
const { tooltip = {
|
12
12
|
enable: true
|
@@ -19,18 +19,18 @@ const tooltip_tooltip = (spec, context)=>{
|
|
19
19
|
title: {
|
20
20
|
visible: false
|
21
21
|
},
|
22
|
-
content: createMarkContent(encoding.tooltip || [], dimensions, findAllMeasures(vseed.measures),
|
22
|
+
content: createMarkContent(encoding.tooltip || [], dimensions, findAllMeasures(vseed.measures), foldInfo, unfoldInfo)
|
23
23
|
},
|
24
24
|
dimension: {
|
25
25
|
title: {
|
26
26
|
visible: true
|
27
27
|
},
|
28
|
-
content: createDimensionContent(measures, foldInfo, unfoldInfo
|
28
|
+
content: createDimensionContent(measures, foldInfo, unfoldInfo)
|
29
29
|
}
|
30
30
|
};
|
31
31
|
return result;
|
32
32
|
};
|
33
|
-
const createDimensionContent = (measures, foldInfo, unfoldInfo
|
33
|
+
const createDimensionContent = (measures, foldInfo, unfoldInfo)=>{
|
34
34
|
const { measureId, measureValue } = foldInfo;
|
35
35
|
const { encodingColor } = unfoldInfo;
|
36
36
|
return [
|
@@ -48,19 +48,13 @@ const createDimensionContent = (measures, foldInfo, unfoldInfo, locale)=>{
|
|
48
48
|
const value = datum[measureValue];
|
49
49
|
const id = datum[measureId];
|
50
50
|
const measure = findMeasureById(measures, id);
|
51
|
-
|
52
|
-
|
53
|
-
if (!isEmpty(format)) {
|
54
|
-
const formatter = createFormatter(format);
|
55
|
-
return formatter(value);
|
56
|
-
}
|
57
|
-
if (autoFormat) return autoFormatter(value, locale);
|
58
|
-
return String(value);
|
51
|
+
const formatter = createFormatterByMeasure(measure);
|
52
|
+
return formatter(value);
|
59
53
|
}
|
60
54
|
}
|
61
55
|
];
|
62
56
|
};
|
63
|
-
const createMarkContent = (tooltip, dimensions, measures,
|
57
|
+
const createMarkContent = (tooltip, dimensions, measures, foldInfo, unfoldInfo)=>{
|
64
58
|
const dims = pipe(dimensions.filter((item)=>tooltip.includes(item.id)), uniqueBy((item)=>item.id), uniqueBy((item)=>item.alias));
|
65
59
|
const meas = pipe(measures.filter((item)=>tooltip.includes(item.id)), uniqueBy((item)=>item.id), uniqueBy((item)=>item.alias));
|
66
60
|
const dimContent = dims.map((item)=>({
|
@@ -90,14 +84,8 @@ const createMarkContent = (tooltip, dimensions, measures, locale, foldInfo, unfo
|
|
90
84
|
const originalData = datum[ORIGINAL_DATA];
|
91
85
|
const value = originalData[id];
|
92
86
|
const measure = findMeasureById(measures, id);
|
93
|
-
|
94
|
-
|
95
|
-
if (!isEmpty(format)) {
|
96
|
-
const formatter = createFormatter(format);
|
97
|
-
return formatter(value);
|
98
|
-
}
|
99
|
-
if (autoFormat) return autoFormatter(value, locale);
|
100
|
-
return String(value);
|
87
|
+
const formatter = createFormatterByMeasure(measure);
|
88
|
+
return formatter(value);
|
101
89
|
}
|
102
90
|
}));
|
103
91
|
const defaultContent = {
|
@@ -118,13 +106,8 @@ const createMarkContent = (tooltip, dimensions, measures, locale, foldInfo, unfo
|
|
118
106
|
const id = datum[measureId];
|
119
107
|
const measure = findMeasureById(measures, id);
|
120
108
|
if (!measure) return String(value);
|
121
|
-
const
|
122
|
-
|
123
|
-
const formatter = createFormatter(format);
|
124
|
-
return formatter(value);
|
125
|
-
}
|
126
|
-
if (autoFormat) return autoFormatter(value, locale);
|
127
|
-
return String(value);
|
109
|
+
const formatter = createFormatterByMeasure(measure);
|
110
|
+
return formatter(value);
|
128
111
|
}
|
129
112
|
};
|
130
113
|
return [
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"pipeline/spec/chart/pipes/tooltip/tooltip.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/chart/pipes/tooltip/tooltip.ts"],"sourcesContent":["import {
|
1
|
+
{"version":3,"file":"pipeline/spec/chart/pipes/tooltip/tooltip.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/chart/pipes/tooltip/tooltip.ts"],"sourcesContent":["import { pipe, uniqueBy } from 'remeda'\nimport { createFormatterByMeasure, findAllMeasures, findMeasureById } from '../../../../utils'\nimport type { Datum, Dimensions, FoldInfo, Measures, SpecPipe, Tooltip, UnfoldInfo } from 'src/types'\nimport { ORIGINAL_DATA } from 'src/dataReshape'\n\nexport const tooltip: SpecPipe = (spec, context) => {\n const result = { ...spec }\n const { advancedVSeed, vseed } = context\n const { measures, datasetReshapeInfo, chartType, dimensions, encoding } = advancedVSeed\n const baseConfig = advancedVSeed.config[chartType] as { tooltip: Tooltip }\n const { tooltip = { enable: true } } = baseConfig\n const { enable } = tooltip\n const { foldInfo, unfoldInfo } = datasetReshapeInfo[0] as unknown as {\n foldInfo: FoldInfo\n unfoldInfo: UnfoldInfo\n }\n\n result.tooltip = {\n visible: enable,\n mark: {\n title: {\n visible: false,\n },\n content: createMarkContent(\n encoding.tooltip || [],\n dimensions,\n findAllMeasures(vseed.measures),\n foldInfo,\n unfoldInfo,\n ),\n },\n dimension: {\n title: {\n visible: true,\n },\n content: createDimensionContent(measures, foldInfo, unfoldInfo),\n },\n }\n return result\n}\n\nexport const createDimensionContent = (measures: Measures, foldInfo: FoldInfo, unfoldInfo: UnfoldInfo) => {\n const { measureId, measureValue } = foldInfo\n const { encodingColor } = unfoldInfo\n\n return [\n {\n visible: true,\n shapeType: 'rectRound',\n hasShape: true,\n key: (v: unknown) => {\n const datum = v as Datum\n return (datum && (datum[encodingColor] as string)) || ''\n },\n value: (v: unknown) => {\n const datum = v as Datum\n if (!datum) {\n return ''\n }\n const value = datum[measureValue] as string | number\n const id = datum[measureId] as string\n const measure = findMeasureById(measures, id)\n const formatter = createFormatterByMeasure(measure)\n return formatter(value)\n },\n },\n ]\n}\n\nexport const createMarkContent = (\n tooltip: string[],\n dimensions: Dimensions,\n measures: Measures,\n foldInfo: FoldInfo,\n unfoldInfo: UnfoldInfo,\n) => {\n const dims = pipe(\n dimensions.filter((item) => tooltip.includes(item.id)),\n uniqueBy((item) => item.id),\n uniqueBy((item) => item.alias),\n )\n const meas = pipe(\n measures.filter((item) => tooltip.includes(item.id)),\n uniqueBy((item) => item.id),\n uniqueBy((item) => item.alias),\n )\n\n const dimContent = dims.map((item) => ({\n visible: true,\n hasShape: true,\n shapeType: 'rectRound',\n key: (v: unknown) => {\n const datum = v as Datum\n if (item.alias || item.id) {\n return item.alias || item.id\n }\n return datum && (datum[item.id] as string)\n },\n value: (v: unknown) => {\n const datum = v as Datum\n return datum && (datum[item.id] as string)\n },\n }))\n\n const meaContent = meas.map((item) => ({\n visible: true,\n hasShape: true,\n shapeType: 'rectRound',\n key: item.alias || item.id,\n value: (v: unknown) => {\n const datum = v as Datum\n if (!datum) {\n return ''\n }\n const id = item.id\n if (!datum || !datum[ORIGINAL_DATA] || !datum[ORIGINAL_DATA]) {\n return ''\n }\n const originalData = datum[ORIGINAL_DATA] as Datum\n const value = originalData[id] as string | number\n const measure = findMeasureById(measures, id)\n const formatter = createFormatterByMeasure(measure)\n return formatter(value)\n },\n }))\n\n const defaultContent = {\n visible: true,\n hasShape: true,\n shapeType: 'rectRound',\n key: (v: unknown) => {\n const { measureName } = foldInfo\n const { encodingColor: colorName } = unfoldInfo\n\n const datum = v as Datum\n return (datum && (datum[measureName || colorName] as string)) || ''\n },\n value: (v: unknown) => {\n const { measureId, measureValue } = foldInfo\n\n const datum = v as Datum\n if (!datum) {\n return ''\n }\n const value = datum[measureValue] as string | number\n const id = datum[measureId] as string\n const measure = findMeasureById(measures, id)\n if (!measure) {\n return String(value)\n }\n\n const formatter = createFormatterByMeasure(measure)\n return formatter(value)\n },\n }\n\n return [...dimContent, defaultContent, ...meaContent]\n}\n"],"names":["tooltip","spec","context","result","advancedVSeed","vseed","measures","datasetReshapeInfo","chartType","dimensions","encoding","baseConfig","enable","foldInfo","unfoldInfo","createMarkContent","findAllMeasures","createDimensionContent","measureId","measureValue","encodingColor","v","datum","value","id","measure","findMeasureById","formatter","createFormatterByMeasure","dims","pipe","item","uniqueBy","meas","dimContent","meaContent","ORIGINAL_DATA","originalData","defaultContent","measureName","colorName","String"],"mappings":"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"}
|
@@ -6,7 +6,7 @@ const tooltipPrimary = (spec, context)=>{
|
|
6
6
|
...spec
|
7
7
|
};
|
8
8
|
const { advancedVSeed, vseed } = context;
|
9
|
-
const { measures, datasetReshapeInfo, chartType,
|
9
|
+
const { measures, datasetReshapeInfo, chartType, dimensions, encoding } = advancedVSeed;
|
10
10
|
const baseConfig = advancedVSeed.config[chartType];
|
11
11
|
const { tooltip = {
|
12
12
|
enable: true
|
@@ -20,13 +20,13 @@ const tooltipPrimary = (spec, context)=>{
|
|
20
20
|
title: {
|
21
21
|
visible: false
|
22
22
|
},
|
23
|
-
content: createMarkContent(encoding.tooltip || [], dimensions, findAllMeasures(vseed.measures),
|
23
|
+
content: createMarkContent(encoding.tooltip || [], dimensions, findAllMeasures(vseed.measures), foldInfoList[0], unfoldInfo)
|
24
24
|
},
|
25
25
|
dimension: {
|
26
26
|
title: {
|
27
27
|
visible: true
|
28
28
|
},
|
29
|
-
content: createDimensionContent(measures, foldInfoList[0], unfoldInfo
|
29
|
+
content: createDimensionContent(measures, foldInfoList[0], unfoldInfo)
|
30
30
|
}
|
31
31
|
};
|
32
32
|
return result;
|
@@ -36,7 +36,7 @@ const tooltipSecondary = (spec, context)=>{
|
|
36
36
|
...spec
|
37
37
|
};
|
38
38
|
const { advancedVSeed, vseed } = context;
|
39
|
-
const { measures, datasetReshapeInfo, chartType,
|
39
|
+
const { measures, datasetReshapeInfo, chartType, dimensions, encoding } = advancedVSeed;
|
40
40
|
const baseConfig = advancedVSeed.config[chartType];
|
41
41
|
const { tooltip = {
|
42
42
|
enable: true
|
@@ -51,13 +51,13 @@ const tooltipSecondary = (spec, context)=>{
|
|
51
51
|
title: {
|
52
52
|
visible: false
|
53
53
|
},
|
54
|
-
content: createMarkContent(encoding.tooltip || [], dimensions, findAllMeasures(vseed.measures),
|
54
|
+
content: createMarkContent(encoding.tooltip || [], dimensions, findAllMeasures(vseed.measures), foldInfoList[1], unfoldInfo)
|
55
55
|
},
|
56
56
|
dimension: {
|
57
57
|
title: {
|
58
58
|
visible: true
|
59
59
|
},
|
60
|
-
content: createDimensionContent(measures, foldInfoList[1], unfoldInfo
|
60
|
+
content: createDimensionContent(measures, foldInfoList[1], unfoldInfo)
|
61
61
|
}
|
62
62
|
};
|
63
63
|
return result;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"pipeline/spec/chart/pipes/tooltip/tooltipDualAxis.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/chart/pipes/tooltip/tooltipDualAxis.ts"],"sourcesContent":["import { isNullish } from 'remeda'\nimport { createDimensionContent, createMarkContent } from './tooltip'\nimport type { FoldInfo, SpecPipe, Tooltip, UnfoldInfo } from 'src/types'\nimport { findAllMeasures } from 'src/pipeline/utils'\n\nexport const tooltipPrimary: SpecPipe = (spec, context) => {\n const result = { ...spec }\n const { advancedVSeed, vseed } = context\n const { measures, datasetReshapeInfo, chartType,
|
1
|
+
{"version":3,"file":"pipeline/spec/chart/pipes/tooltip/tooltipDualAxis.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/chart/pipes/tooltip/tooltipDualAxis.ts"],"sourcesContent":["import { isNullish } from 'remeda'\nimport { createDimensionContent, createMarkContent } from './tooltip'\nimport type { FoldInfo, SpecPipe, Tooltip, UnfoldInfo } from 'src/types'\nimport { findAllMeasures } from 'src/pipeline/utils'\n\nexport const tooltipPrimary: SpecPipe = (spec, context) => {\n const result = { ...spec }\n const { advancedVSeed, vseed } = context\n const { measures, datasetReshapeInfo, chartType, dimensions, encoding } = advancedVSeed\n const baseConfig = advancedVSeed.config[chartType] as { tooltip: Tooltip }\n const { tooltip = { enable: true } } = baseConfig\n const { enable } = tooltip\n\n const foldInfoList = datasetReshapeInfo[0].foldInfoList as FoldInfo[]\n const unfoldInfo = datasetReshapeInfo[0].unfoldInfo\n\n result.tooltip = {\n visible: enable,\n mark: {\n title: {\n visible: false,\n },\n content: createMarkContent(\n encoding.tooltip || [],\n dimensions,\n findAllMeasures(vseed.measures),\n foldInfoList[0],\n unfoldInfo,\n ),\n },\n dimension: {\n title: {\n visible: true,\n },\n content: createDimensionContent(measures, foldInfoList[0], unfoldInfo),\n },\n }\n return result\n}\n\nexport const tooltipSecondary: SpecPipe = (spec, context) => {\n const result = { ...spec }\n const { advancedVSeed, vseed } = context\n const { measures, datasetReshapeInfo, chartType, dimensions, encoding } = advancedVSeed\n const baseConfig = advancedVSeed.config[chartType] as { tooltip: Tooltip }\n const { tooltip = { enable: true } } = baseConfig\n const { enable } = tooltip\n\n if (isNullish(datasetReshapeInfo[0].foldInfoList?.[1])) {\n return result\n }\n\n const foldInfoList = datasetReshapeInfo[0].foldInfoList as FoldInfo[]\n const unfoldInfo = datasetReshapeInfo[0].unfoldInfo as UnfoldInfo\n result.tooltip = {\n visible: enable,\n mark: {\n title: {\n visible: false,\n },\n content: createMarkContent(\n encoding.tooltip || [],\n dimensions,\n findAllMeasures(vseed.measures),\n foldInfoList[1],\n unfoldInfo,\n ),\n },\n dimension: {\n title: {\n visible: true,\n },\n content: createDimensionContent(measures, foldInfoList[1], unfoldInfo),\n },\n }\n return result\n}\n"],"names":["tooltipPrimary","spec","context","result","advancedVSeed","vseed","measures","datasetReshapeInfo","chartType","dimensions","encoding","baseConfig","tooltip","enable","foldInfoList","unfoldInfo","createMarkContent","findAllMeasures","createDimensionContent","tooltipSecondary","isNullish"],"mappings":";;;AAKO,MAAMA,iBAA2B,CAACC,MAAMC;IAC7C,MAAMC,SAAS;QAAE,GAAGF,IAAI;IAAC;IACzB,MAAM,EAAEG,aAAa,EAAEC,KAAK,EAAE,GAAGH;IACjC,MAAM,EAAEI,QAAQ,EAAEC,kBAAkB,EAAEC,SAAS,EAAEC,UAAU,EAAEC,QAAQ,EAAE,GAAGN;IAC1E,MAAMO,aAAaP,cAAc,MAAM,CAACI,UAAU;IAClD,MAAM,EAAEI,UAAU;QAAE,QAAQ;IAAK,CAAC,EAAE,GAAGD;IACvC,MAAM,EAAEE,MAAM,EAAE,GAAGD;IAEnB,MAAME,eAAeP,kBAAkB,CAAC,EAAE,CAAC,YAAY;IACvD,MAAMQ,aAAaR,kBAAkB,CAAC,EAAE,CAAC,UAAU;IAEnDJ,OAAO,OAAO,GAAG;QACf,SAASU;QACT,MAAM;YACJ,OAAO;gBACL,SAAS;YACX;YACA,SAASG,kBACPN,SAAS,OAAO,IAAI,EAAE,EACtBD,YACAQ,gBAAgBZ,MAAM,QAAQ,GAC9BS,YAAY,CAAC,EAAE,EACfC;QAEJ;QACA,WAAW;YACT,OAAO;gBACL,SAAS;YACX;YACA,SAASG,uBAAuBZ,UAAUQ,YAAY,CAAC,EAAE,EAAEC;QAC7D;IACF;IACA,OAAOZ;AACT;AAEO,MAAMgB,mBAA6B,CAAClB,MAAMC;IAC/C,MAAMC,SAAS;QAAE,GAAGF,IAAI;IAAC;IACzB,MAAM,EAAEG,aAAa,EAAEC,KAAK,EAAE,GAAGH;IACjC,MAAM,EAAEI,QAAQ,EAAEC,kBAAkB,EAAEC,SAAS,EAAEC,UAAU,EAAEC,QAAQ,EAAE,GAAGN;IAC1E,MAAMO,aAAaP,cAAc,MAAM,CAACI,UAAU;IAClD,MAAM,EAAEI,UAAU;QAAE,QAAQ;IAAK,CAAC,EAAE,GAAGD;IACvC,MAAM,EAAEE,MAAM,EAAE,GAAGD;IAEnB,IAAIQ,UAAUb,kBAAkB,CAAC,EAAE,CAAC,YAAY,EAAE,CAAC,EAAE,GACnD,OAAOJ;IAGT,MAAMW,eAAeP,kBAAkB,CAAC,EAAE,CAAC,YAAY;IACvD,MAAMQ,aAAaR,kBAAkB,CAAC,EAAE,CAAC,UAAU;IACnDJ,OAAO,OAAO,GAAG;QACf,SAASU;QACT,MAAM;YACJ,OAAO;gBACL,SAAS;YACX;YACA,SAASG,kBACPN,SAAS,OAAO,IAAI,EAAE,EACtBD,YACAQ,gBAAgBZ,MAAM,QAAQ,GAC9BS,YAAY,CAAC,EAAE,EACfC;QAEJ;QACA,WAAW;YACT,OAAO;gBACL,SAAS;YACX;YACA,SAASG,uBAAuBZ,UAAUQ,YAAY,CAAC,EAAE,EAAEC;QAC7D;IACF;IACA,OAAOZ;AACT"}
|
@@ -1,5 +1,5 @@
|
|
1
|
-
import {
|
2
|
-
import {
|
1
|
+
import { uniqueBy } from "remeda";
|
2
|
+
import { createFormatterByMeasure, findAllMeasures, findMeasureById } from "../../../../utils/index.js";
|
3
3
|
import { ORIGINAL_DATA } from "../../../../../dataReshape/index.js";
|
4
4
|
const tooltipHeatmap = (spec, context)=>{
|
5
5
|
const result = {
|
@@ -57,14 +57,8 @@ const createMarkContent = (tooltip, dimensions, measures, locale, foldInfo)=>{
|
|
57
57
|
const originalData = datum[ORIGINAL_DATA];
|
58
58
|
const value = originalData[id];
|
59
59
|
const measure = findMeasureById(measures, id);
|
60
|
-
|
61
|
-
|
62
|
-
if (!isEmpty(format)) {
|
63
|
-
const formatter = createFormatter(format);
|
64
|
-
return formatter(value);
|
65
|
-
}
|
66
|
-
if (autoFormat) return autoFormatter(value, locale);
|
67
|
-
return String(value);
|
60
|
+
const formatter = createFormatterByMeasure(measure);
|
61
|
+
return formatter(value);
|
68
62
|
}
|
69
63
|
}));
|
70
64
|
const foldMeaContent = [
|
@@ -86,14 +80,8 @@ const createMarkContent = (tooltip, dimensions, measures, locale, foldInfo)=>{
|
|
86
80
|
const value = datum[measureValue];
|
87
81
|
const id = datum[measureId];
|
88
82
|
const measure = findMeasureById(measures, id);
|
89
|
-
|
90
|
-
|
91
|
-
if (!isEmpty(format)) {
|
92
|
-
const formatter = createFormatter(format);
|
93
|
-
return formatter(value);
|
94
|
-
}
|
95
|
-
if (autoFormat) return autoFormatter(value, locale);
|
96
|
-
return String(value);
|
83
|
+
const formatter = createFormatterByMeasure(measure);
|
84
|
+
return formatter(value);
|
97
85
|
}
|
98
86
|
}));
|
99
87
|
return [
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"pipeline/spec/chart/pipes/tooltip/tooltipHeatmap.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/chart/pipes/tooltip/tooltipHeatmap.ts"],"sourcesContent":["import {
|
1
|
+
{"version":3,"file":"pipeline/spec/chart/pipes/tooltip/tooltipHeatmap.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/chart/pipes/tooltip/tooltipHeatmap.ts"],"sourcesContent":["import { uniqueBy } from 'remeda'\nimport { createFormatterByMeasure, findAllMeasures, findMeasureById } from '../../../../utils'\nimport type { Datum, Dimensions, FoldInfo, Locale, Measures, SpecPipe, Tooltip, UnfoldInfo } from 'src/types'\nimport { ORIGINAL_DATA } from 'src/dataReshape'\n\nexport const tooltipHeatmap: SpecPipe = (spec, context) => {\n const result = { ...spec }\n const { advancedVSeed, vseed } = context\n const { datasetReshapeInfo, chartType, locale, dimensions, encoding } = advancedVSeed\n const baseConfig = advancedVSeed.config[chartType] as { tooltip: Tooltip }\n const { tooltip = { enable: true } } = baseConfig\n const { enable } = tooltip\n const { foldInfo } = datasetReshapeInfo[0] as unknown as {\n foldInfo: FoldInfo\n unfoldInfo: UnfoldInfo\n }\n\n result.tooltip = {\n visible: enable,\n\n mark: {\n title: {\n visible: false,\n },\n content: createMarkContent(encoding.tooltip || [], dimensions, findAllMeasures(vseed.measures), locale, foldInfo),\n },\n dimension: {\n visible: false,\n },\n }\n return result\n}\n\nexport const createMarkContent = (\n tooltip: string[],\n dimensions: Dimensions,\n measures: Measures,\n locale: Locale,\n foldInfo: FoldInfo,\n) => {\n const dims = uniqueBy(\n dimensions.filter((item) => tooltip.includes(item.id)),\n (item) => item.id,\n )\n const meas = uniqueBy(\n measures.filter((item) => tooltip.includes(item.id)),\n (item) => item.id,\n )\n\n const dimContent = dims.map((item) => ({\n visible: true,\n hasShape: true,\n shapeType: 'rectRound',\n key: (v: unknown) => {\n const datum = v as Datum\n if (item.alias || item.id) {\n return item.alias || item.id\n }\n return datum && (datum[item.id] as string)\n },\n value: (v: unknown) => {\n const datum = v as Datum\n return datum && (datum[item.id] as string)\n },\n }))\n\n const meaContent = meas.map((item) => ({\n visible: true,\n hasShape: true,\n shapeType: 'rectRound',\n key: item.alias || item.id,\n value: (v: unknown) => {\n const datum = v as Datum\n if (!datum) {\n return ''\n }\n const id = item.id\n if (!datum || !datum[ORIGINAL_DATA] || !datum[ORIGINAL_DATA]) {\n return ''\n }\n const originalData = datum[ORIGINAL_DATA] as Datum\n const value = originalData[id] as string | number\n const measure = findMeasureById(measures, id)\n const formatter = createFormatterByMeasure(measure)\n return formatter(value)\n },\n }))\n\n const foldMeaContent = [foldInfo].map((foldInfo) => {\n return {\n visible: true,\n hasShape: true,\n shapeType: 'rectRound',\n key: (v: unknown) => {\n const { measureId, foldMap } = foldInfo\n const datum = v as Datum\n const id = datum[measureId] as string\n return foldMap[id] || id\n },\n value: (v: unknown) => {\n const { measureId, measureValue } = foldInfo\n\n const datum = v as Datum\n if (!datum) {\n return ''\n }\n const value = datum[measureValue] as string | number\n const id = datum[measureId] as string\n const measure = findMeasureById(measures, id)\n const formatter = createFormatterByMeasure(measure)\n return formatter(value)\n },\n }\n })\n return [...dimContent, ...foldMeaContent, ...meaContent]\n}\n"],"names":["tooltipHeatmap","spec","context","result","advancedVSeed","vseed","datasetReshapeInfo","chartType","locale","dimensions","encoding","baseConfig","tooltip","enable","foldInfo","createMarkContent","findAllMeasures","measures","dims","uniqueBy","item","meas","dimContent","v","datum","meaContent","id","ORIGINAL_DATA","originalData","value","measure","findMeasureById","formatter","createFormatterByMeasure","foldMeaContent","measureId","foldMap","measureValue"],"mappings":";;;AAKO,MAAMA,iBAA2B,CAACC,MAAMC;IAC7C,MAAMC,SAAS;QAAE,GAAGF,IAAI;IAAC;IACzB,MAAM,EAAEG,aAAa,EAAEC,KAAK,EAAE,GAAGH;IACjC,MAAM,EAAEI,kBAAkB,EAAEC,SAAS,EAAEC,MAAM,EAAEC,UAAU,EAAEC,QAAQ,EAAE,GAAGN;IACxE,MAAMO,aAAaP,cAAc,MAAM,CAACG,UAAU;IAClD,MAAM,EAAEK,UAAU;QAAE,QAAQ;IAAK,CAAC,EAAE,GAAGD;IACvC,MAAM,EAAEE,MAAM,EAAE,GAAGD;IACnB,MAAM,EAAEE,QAAQ,EAAE,GAAGR,kBAAkB,CAAC,EAAE;IAK1CH,OAAO,OAAO,GAAG;QACf,SAASU;QAET,MAAM;YACJ,OAAO;gBACL,SAAS;YACX;YACA,SAASE,kBAAkBL,SAAS,OAAO,IAAI,EAAE,EAAED,YAAYO,gBAAgBX,MAAM,QAAQ,GAAGG,QAAQM;QAC1G;QACA,WAAW;YACT,SAAS;QACX;IACF;IACA,OAAOX;AACT;AAEO,MAAMY,oBAAoB,CAC/BH,SACAH,YACAQ,UACAT,QACAM;IAEA,MAAMI,OAAOC,SACXV,WAAW,MAAM,CAAC,CAACW,OAASR,QAAQ,QAAQ,CAACQ,KAAK,EAAE,IACpD,CAACA,OAASA,KAAK,EAAE;IAEnB,MAAMC,OAAOF,SACXF,SAAS,MAAM,CAAC,CAACG,OAASR,QAAQ,QAAQ,CAACQ,KAAK,EAAE,IAClD,CAACA,OAASA,KAAK,EAAE;IAGnB,MAAME,aAAaJ,KAAK,GAAG,CAAC,CAACE,OAAU;YACrC,SAAS;YACT,UAAU;YACV,WAAW;YACX,KAAK,CAACG;gBACJ,MAAMC,QAAQD;gBACd,IAAIH,KAAK,KAAK,IAAIA,KAAK,EAAE,EACvB,OAAOA,KAAK,KAAK,IAAIA,KAAK,EAAE;gBAE9B,OAAOI,SAAUA,KAAK,CAACJ,KAAK,EAAE,CAAC;YACjC;YACA,OAAO,CAACG;gBACN,MAAMC,QAAQD;gBACd,OAAOC,SAAUA,KAAK,CAACJ,KAAK,EAAE,CAAC;YACjC;QACF;IAEA,MAAMK,aAAaJ,KAAK,GAAG,CAAC,CAACD,OAAU;YACrC,SAAS;YACT,UAAU;YACV,WAAW;YACX,KAAKA,KAAK,KAAK,IAAIA,KAAK,EAAE;YAC1B,OAAO,CAACG;gBACN,MAAMC,QAAQD;gBACd,IAAI,CAACC,OACH,OAAO;gBAET,MAAME,KAAKN,KAAK,EAAE;gBAClB,IAAI,CAACI,SAAS,CAACA,KAAK,CAACG,cAAc,IAAI,CAACH,KAAK,CAACG,cAAc,EAC1D,OAAO;gBAET,MAAMC,eAAeJ,KAAK,CAACG,cAAc;gBACzC,MAAME,QAAQD,YAAY,CAACF,GAAG;gBAC9B,MAAMI,UAAUC,gBAAgBd,UAAUS;gBAC1C,MAAMM,YAAYC,yBAAyBH;gBAC3C,OAAOE,UAAUH;YACnB;QACF;IAEA,MAAMK,iBAAiB;QAACpB;KAAS,CAAC,GAAG,CAAC,CAACA,WAC9B;YACL,SAAS;YACT,UAAU;YACV,WAAW;YACX,KAAK,CAACS;gBACJ,MAAM,EAAEY,SAAS,EAAEC,OAAO,EAAE,GAAGtB;gBAC/B,MAAMU,QAAQD;gBACd,MAAMG,KAAKF,KAAK,CAACW,UAAU;gBAC3B,OAAOC,OAAO,CAACV,GAAG,IAAIA;YACxB;YACA,OAAO,CAACH;gBACN,MAAM,EAAEY,SAAS,EAAEE,YAAY,EAAE,GAAGvB;gBAEpC,MAAMU,QAAQD;gBACd,IAAI,CAACC,OACH,OAAO;gBAET,MAAMK,QAAQL,KAAK,CAACa,aAAa;gBACjC,MAAMX,KAAKF,KAAK,CAACW,UAAU;gBAC3B,MAAML,UAAUC,gBAAgBd,UAAUS;gBAC1C,MAAMM,YAAYC,yBAAyBH;gBAC3C,OAAOE,UAAUH;YACnB;QACF;IAEF,OAAO;WAAIP;WAAeY;WAAmBT;KAAW;AAC1D"}
|
@@ -1,5 +1,5 @@
|
|
1
|
-
import {
|
2
|
-
import {
|
1
|
+
import { uniqueBy } from "remeda";
|
2
|
+
import { createFormatterByMeasure, findAllMeasures, findMeasureById } from "../../../../utils/index.js";
|
3
3
|
import { ORIGINAL_DATA } from "../../../../../dataReshape/index.js";
|
4
4
|
const tooltipScatter = (spec, context)=>{
|
5
5
|
const result = {
|
@@ -57,14 +57,8 @@ const createMarkContent = (tooltip, dimensions, measures, locale, foldInfoList)=
|
|
57
57
|
const originalData = datum[ORIGINAL_DATA];
|
58
58
|
const value = originalData[id];
|
59
59
|
const measure = findMeasureById(measures, id);
|
60
|
-
|
61
|
-
|
62
|
-
if (!isEmpty(format)) {
|
63
|
-
const formatter = createFormatter(format);
|
64
|
-
return formatter(value);
|
65
|
-
}
|
66
|
-
if (autoFormat) return autoFormatter(value, locale);
|
67
|
-
return String(value);
|
60
|
+
const formatter = createFormatterByMeasure(measure);
|
61
|
+
return formatter(value);
|
68
62
|
}
|
69
63
|
}));
|
70
64
|
const foldMeaContent = foldInfoList.map((foldInfo)=>({
|
@@ -84,14 +78,8 @@ const createMarkContent = (tooltip, dimensions, measures, locale, foldInfoList)=
|
|
84
78
|
const value = datum[measureValue];
|
85
79
|
const id = datum[measureId];
|
86
80
|
const measure = findMeasureById(measures, id);
|
87
|
-
|
88
|
-
|
89
|
-
if (!isEmpty(format)) {
|
90
|
-
const formatter = createFormatter(format);
|
91
|
-
return formatter(value);
|
92
|
-
}
|
93
|
-
if (autoFormat) return autoFormatter(value, locale);
|
94
|
-
return String(value);
|
81
|
+
const formatter = createFormatterByMeasure(measure);
|
82
|
+
return formatter(value);
|
95
83
|
}
|
96
84
|
}));
|
97
85
|
return [
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"pipeline/spec/chart/pipes/tooltip/tooltipScatter.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/chart/pipes/tooltip/tooltipScatter.ts"],"sourcesContent":["import {
|
1
|
+
{"version":3,"file":"pipeline/spec/chart/pipes/tooltip/tooltipScatter.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/chart/pipes/tooltip/tooltipScatter.ts"],"sourcesContent":["import { uniqueBy } from 'remeda'\nimport { createFormatterByMeasure, findAllMeasures, findMeasureById } from '../../../../utils'\nimport type { Datum, Dimensions, FoldInfo, Locale, Measures, SpecPipe, Tooltip, UnfoldInfo } from 'src/types'\nimport { ORIGINAL_DATA } from 'src/dataReshape'\n\nexport const tooltipScatter: SpecPipe = (spec, context) => {\n const result = { ...spec }\n const { advancedVSeed, vseed } = context\n const { datasetReshapeInfo, chartType, locale, dimensions, encoding } = advancedVSeed\n const baseConfig = advancedVSeed.config[chartType] as { tooltip: Tooltip }\n const { tooltip = { enable: true } } = baseConfig\n const { enable } = tooltip\n const { foldInfoList } = datasetReshapeInfo[0] as unknown as {\n foldInfoList: FoldInfo[]\n unfoldInfo: UnfoldInfo\n }\n\n result.tooltip = {\n visible: enable,\n\n mark: {\n title: {\n visible: false,\n },\n content: createMarkContent(\n encoding.tooltip || [],\n dimensions,\n findAllMeasures(vseed.measures),\n locale,\n foldInfoList,\n ),\n },\n dimension: {\n visible: false,\n },\n }\n return result\n}\n\nexport const createMarkContent = (\n tooltip: string[],\n dimensions: Dimensions,\n measures: Measures,\n locale: Locale,\n foldInfoList: FoldInfo[],\n) => {\n const dims = uniqueBy(\n dimensions.filter((item) => tooltip.includes(item.id)),\n (item) => item.id,\n )\n const meas = uniqueBy(\n measures.filter((item) => tooltip.includes(item.id)),\n (item) => item.id,\n )\n\n const dimContent = dims.map((item) => ({\n visible: true,\n hasShape: true,\n shapeType: 'rectRound',\n key: (v: unknown) => {\n const datum = v as Datum\n if (item.alias || item.id) {\n return item.alias || item.id\n }\n return datum && (datum[item.id] as string)\n },\n value: (v: unknown) => {\n const datum = v as Datum\n return datum && (datum[item.id] as string)\n },\n }))\n\n const meaContent = meas.map((item) => ({\n visible: true,\n hasShape: true,\n shapeType: 'rectRound',\n key: item.alias || item.id,\n value: (v: unknown) => {\n const datum = v as Datum\n if (!datum) {\n return ''\n }\n const id = item.id\n if (!datum || !datum[ORIGINAL_DATA] || !datum[ORIGINAL_DATA]) {\n return ''\n }\n const originalData = datum[ORIGINAL_DATA] as Datum\n const value = originalData[id] as string | number\n const measure = findMeasureById(measures, id)\n const formatter = createFormatterByMeasure(measure)\n return formatter(value)\n },\n }))\n\n const foldMeaContent = foldInfoList.map((foldInfo) => {\n return {\n visible: true,\n hasShape: true,\n shapeType: 'rectRound',\n key: (v: unknown) => {\n const { measureId, foldMap } = foldInfo\n const datum = v as Datum\n const id = datum[measureId] as string\n return foldMap[id] || id\n },\n value: (v: unknown) => {\n const { measureId, measureValue } = foldInfo\n\n const datum = v as Datum\n if (!datum) {\n return ''\n }\n const value = datum[measureValue] as string | number\n const id = datum[measureId] as string\n const measure = findMeasureById(measures, id)\n const formatter = createFormatterByMeasure(measure)\n return formatter(value)\n },\n }\n })\n return [...dimContent, ...foldMeaContent, ...meaContent]\n}\n"],"names":["tooltipScatter","spec","context","result","advancedVSeed","vseed","datasetReshapeInfo","chartType","locale","dimensions","encoding","baseConfig","tooltip","enable","foldInfoList","createMarkContent","findAllMeasures","measures","dims","uniqueBy","item","meas","dimContent","v","datum","meaContent","id","ORIGINAL_DATA","originalData","value","measure","findMeasureById","formatter","createFormatterByMeasure","foldMeaContent","foldInfo","measureId","foldMap","measureValue"],"mappings":"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"}
|
@@ -1,8 +1,6 @@
|
|
1
|
-
import {
|
2
|
-
import { autoFormatter, createFormatter, isMeasure } from "../../../../utils/index.js";
|
1
|
+
import { createFormatterByMeasure, isMeasure } from "../../../../utils/index.js";
|
3
2
|
const measureTreeToColumns = (spec, context)=>{
|
4
3
|
const { advancedVSeed } = context;
|
5
|
-
const { locale } = advancedVSeed;
|
6
4
|
const measures = advancedVSeed.measures;
|
7
5
|
const result = {
|
8
6
|
...spec
|
@@ -10,7 +8,7 @@ const measureTreeToColumns = (spec, context)=>{
|
|
10
8
|
const eachNode = (node)=>{
|
11
9
|
if (isMeasure(node)) return {
|
12
10
|
width: 'auto',
|
13
|
-
fieldFormat: fieldFormat(node
|
11
|
+
fieldFormat: fieldFormat(node)
|
14
12
|
};
|
15
13
|
return {};
|
16
14
|
};
|
@@ -23,15 +21,14 @@ const measureTreeToColumns = (spec, context)=>{
|
|
23
21
|
]
|
24
22
|
};
|
25
23
|
};
|
26
|
-
const fieldFormat = (node
|
27
|
-
|
24
|
+
const fieldFormat = (node)=>{
|
25
|
+
const formatter = createFormatterByMeasure(node);
|
26
|
+
return (datum)=>{
|
27
|
+
const { id } = node;
|
28
28
|
const value = datum[id];
|
29
|
-
|
30
|
-
const formatter = createFormatter(format);
|
31
|
-
return formatter(value);
|
32
|
-
}
|
33
|
-
if (autoFormat) return autoFormatter(value, locale);
|
29
|
+
return formatter(value);
|
34
30
|
};
|
31
|
+
};
|
35
32
|
const treeTreeToColumns = (tree, callback)=>{
|
36
33
|
const result = tree.map((item)=>{
|
37
34
|
if ('children' in item && Array.isArray(item.children)) {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"pipeline/spec/table/pipes/columns/measuresToColumns.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/table/pipes/columns/measuresToColumns.ts"],"sourcesContent":["import type { ColumnsDefine, ListTableConstructorOptions } from '@visactor/vtable'\nimport type { FieldFormat } from '@visactor/vtable/es/ts-types'\nimport {
|
1
|
+
{"version":3,"file":"pipeline/spec/table/pipes/columns/measuresToColumns.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/table/pipes/columns/measuresToColumns.ts"],"sourcesContent":["import type { ColumnsDefine, ListTableConstructorOptions } from '@visactor/vtable'\nimport type { FieldFormat } from '@visactor/vtable/es/ts-types'\nimport { createFormatterByMeasure, isMeasure } from 'src/pipeline/utils'\nimport type { MeasureGroup, Measure, MeasureTree, SpecPipe, Datum } from 'src/types'\n\nexport const measureTreeToColumns: SpecPipe = (spec, context) => {\n const { advancedVSeed } = context\n const measures = (advancedVSeed as unknown as { measures: MeasureTree }).measures\n const result = { ...spec } as ListTableConstructorOptions\n\n const eachNode = (node: Measure | MeasureGroup) => {\n if (isMeasure(node)) {\n return {\n width: 'auto',\n fieldFormat: fieldFormat(node),\n }\n }\n\n return {}\n }\n const columns = treeTreeToColumns<Measure, MeasureGroup>(measures, eachNode)\n return {\n ...result,\n columns: [...(result.columns || []), ...columns] as ListTableConstructorOptions['columns'],\n }\n}\n\nconst fieldFormat = (node: Measure): FieldFormat => {\n const formatter = createFormatterByMeasure(node)\n\n return (datum: Datum) => {\n const { id } = node\n const value = datum[id] as number | string | undefined\n return formatter(value)\n }\n}\nconst treeTreeToColumns = <\n T extends { id: string; alias?: string },\n U extends { id: string; alias?: string; children?: (T | U)[] },\n>(\n tree: (T | U)[],\n callback?: (node: T | U) => object,\n): ColumnsDefine[] => {\n const result = tree.map((item) => {\n if ('children' in item && Array.isArray(item.children)) {\n const groupNode = item as unknown as U\n const field = groupNode.id\n const title = groupNode.alias ?? groupNode.id\n const props = callback?.(groupNode) || {}\n // group\n return {\n field,\n title,\n columns: treeTreeToColumns(item.children, callback),\n ...props,\n }\n } else {\n const field = item.id\n const title = item.alias ?? item.id\n const props = callback?.(item) || {}\n // leaf\n return {\n field,\n title,\n ...props,\n }\n }\n }) as unknown as ColumnsDefine[]\n\n return result || []\n}\n"],"names":["measureTreeToColumns","spec","context","advancedVSeed","measures","result","eachNode","node","isMeasure","fieldFormat","columns","treeTreeToColumns","formatter","createFormatterByMeasure","datum","id","value","tree","callback","item","Array","groupNode","field","title","props"],"mappings":";AAKO,MAAMA,uBAAiC,CAACC,MAAMC;IACnD,MAAM,EAAEC,aAAa,EAAE,GAAGD;IAC1B,MAAME,WAAYD,cAAuD,QAAQ;IACjF,MAAME,SAAS;QAAE,GAAGJ,IAAI;IAAC;IAEzB,MAAMK,WAAW,CAACC;QAChB,IAAIC,UAAUD,OACZ,OAAO;YACL,OAAO;YACP,aAAaE,YAAYF;QAC3B;QAGF,OAAO,CAAC;IACV;IACA,MAAMG,UAAUC,kBAAyCP,UAAUE;IACnE,OAAO;QACL,GAAGD,MAAM;QACT,SAAS;eAAKA,OAAO,OAAO,IAAI,EAAE;eAAMK;SAAQ;IAClD;AACF;AAEA,MAAMD,cAAc,CAACF;IACnB,MAAMK,YAAYC,yBAAyBN;IAE3C,OAAO,CAACO;QACN,MAAM,EAAEC,EAAE,EAAE,GAAGR;QACf,MAAMS,QAAQF,KAAK,CAACC,GAAG;QACvB,OAAOH,UAAUI;IACnB;AACF;AACA,MAAML,oBAAoB,CAIxBM,MACAC;IAEA,MAAMb,SAASY,KAAK,GAAG,CAAC,CAACE;QACvB,IAAI,cAAcA,QAAQC,MAAM,OAAO,CAACD,KAAK,QAAQ,GAAG;YACtD,MAAME,YAAYF;YAClB,MAAMG,QAAQD,UAAU,EAAE;YAC1B,MAAME,QAAQF,UAAU,KAAK,IAAIA,UAAU,EAAE;YAC7C,MAAMG,QAAQN,WAAWG,cAAc,CAAC;YAExC,OAAO;gBACLC;gBACAC;gBACA,SAASZ,kBAAkBQ,KAAK,QAAQ,EAAED;gBAC1C,GAAGM,KAAK;YACV;QACF;QAAO;YACL,MAAMF,QAAQH,KAAK,EAAE;YACrB,MAAMI,QAAQJ,KAAK,KAAK,IAAIA,KAAK,EAAE;YACnC,MAAMK,QAAQN,WAAWC,SAAS,CAAC;YAEnC,OAAO;gBACLG;gBACAC;gBACA,GAAGC,KAAK;YACV;QACF;IACF;IAEA,OAAOnB,UAAU,EAAE;AACrB"}
|
@@ -1,9 +1,9 @@
|
|
1
|
-
import {
|
1
|
+
import { isNumber } from "remeda";
|
2
2
|
import { intl } from "../../../../../i18n/index.js";
|
3
|
-
import {
|
3
|
+
import { createFormatterByMeasure, findMeasureById } from "../../../../utils/index.js";
|
4
4
|
const pivotIndicators = (spec, context)=>{
|
5
5
|
const { advancedVSeed } = context;
|
6
|
-
const {
|
6
|
+
const { measures, datasetReshapeInfo } = advancedVSeed;
|
7
7
|
const { foldInfo } = datasetReshapeInfo[0];
|
8
8
|
return {
|
9
9
|
...spec,
|
@@ -16,25 +16,20 @@ const pivotIndicators = (spec, context)=>{
|
|
16
16
|
indicatorKey: foldInfo.measureValue,
|
17
17
|
title: 'indicator',
|
18
18
|
width: 'auto',
|
19
|
-
format: fieldFormat(measures, foldInfo
|
19
|
+
format: fieldFormat(measures, foldInfo)
|
20
20
|
}
|
21
21
|
]
|
22
22
|
};
|
23
23
|
};
|
24
|
-
const fieldFormat = (measures, foldInfo
|
24
|
+
const fieldFormat = (measures, foldInfo)=>(value, col, row, table)=>{
|
25
25
|
if (!isNumber(col) || !isNumber(row) || !table) return value;
|
26
26
|
const datum = table.getCellOriginRecord(col, row);
|
27
27
|
if (!datum[0]) return value;
|
28
28
|
const { measureId: foldMeasureId } = foldInfo;
|
29
29
|
const measureId = datum[0][foldMeasureId];
|
30
|
-
const
|
31
|
-
|
32
|
-
|
33
|
-
if (!isEmpty(format)) {
|
34
|
-
const formatter = createFormatter(format);
|
35
|
-
return formatter(value);
|
36
|
-
}
|
37
|
-
if (autoFormat) return autoFormatter(value, locale);
|
30
|
+
const measure = findMeasureById(measures, measureId);
|
31
|
+
const formatter = createFormatterByMeasure(measure);
|
32
|
+
return formatter(value);
|
38
33
|
};
|
39
34
|
export { pivotIndicators };
|
40
35
|
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"pipeline/spec/table/pipes/indicators/pivotIndicators.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/table/pipes/indicators/pivotIndicators.ts"],"sourcesContent":["import type { PivotChartConstructorOptions } from '@visactor/vtable'\nimport type { BaseTableAPI, FieldFormat } from '@visactor/vtable/es/ts-types'\nimport {
|
1
|
+
{"version":3,"file":"pipeline/spec/table/pipes/indicators/pivotIndicators.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/table/pipes/indicators/pivotIndicators.ts"],"sourcesContent":["import type { PivotChartConstructorOptions } from '@visactor/vtable'\nimport type { BaseTableAPI, FieldFormat } from '@visactor/vtable/es/ts-types'\nimport { isNumber } from 'remeda'\nimport { intl } from 'src/i18n'\nimport { createFormatterByMeasure, findMeasureById } from 'src/pipeline/utils'\nimport type { Datum, FoldInfo, MeasureTree, SpecPipe } from 'src/types'\n\nexport const pivotIndicators: SpecPipe = (spec, context) => {\n const { advancedVSeed } = context\n const { measures, datasetReshapeInfo } = advancedVSeed\n const { foldInfo } = datasetReshapeInfo[0]\n\n return {\n ...spec,\n indicatorsAsCol: true,\n indicatorTitle: intl.i18n`指标名称`,\n hideIndicatorName: true,\n indicators: [\n {\n cellType: 'text',\n indicatorKey: foldInfo.measureValue,\n title: 'indicator',\n width: 'auto',\n format: fieldFormat(measures, foldInfo as FoldInfo),\n },\n ] as unknown as PivotChartConstructorOptions['indicators'],\n }\n}\n\nconst fieldFormat = (measures: MeasureTree, foldInfo: FoldInfo): FieldFormat => {\n return (value: number | string, col?: number, row?: number, table?: BaseTableAPI) => {\n if (!isNumber(col) || !isNumber(row) || !table) {\n return value\n }\n\n const datum = table.getCellOriginRecord(col, row) as Datum[]\n if (!datum[0]) {\n return value\n }\n const { measureId: foldMeasureId } = foldInfo\n const measureId = datum[0][foldMeasureId] as string\n const measure = findMeasureById(measures, measureId)\n const formatter = createFormatterByMeasure(measure)\n return formatter(value)\n }\n}\n"],"names":["pivotIndicators","spec","context","advancedVSeed","measures","datasetReshapeInfo","foldInfo","intl","fieldFormat","value","col","row","table","isNumber","datum","foldMeasureId","measureId","measure","findMeasureById","formatter","createFormatterByMeasure"],"mappings":";;;AAOO,MAAMA,kBAA4B,CAACC,MAAMC;IAC9C,MAAM,EAAEC,aAAa,EAAE,GAAGD;IAC1B,MAAM,EAAEE,QAAQ,EAAEC,kBAAkB,EAAE,GAAGF;IACzC,MAAM,EAAEG,QAAQ,EAAE,GAAGD,kBAAkB,CAAC,EAAE;IAE1C,OAAO;QACL,GAAGJ,IAAI;QACP,iBAAiB;QACjB,gBAAgBM,KAAK,IAAI,CAAC,IAAI,CAAC;QAC/B,mBAAmB;QACnB,YAAY;YACV;gBACE,UAAU;gBACV,cAAcD,SAAS,YAAY;gBACnC,OAAO;gBACP,OAAO;gBACP,QAAQE,YAAYJ,UAAUE;YAChC;SACD;IACH;AACF;AAEA,MAAME,cAAc,CAACJ,UAAuBE,WACnC,CAACG,OAAwBC,KAAcC,KAAcC;QAC1D,IAAI,CAACC,SAASH,QAAQ,CAACG,SAASF,QAAQ,CAACC,OACvC,OAAOH;QAGT,MAAMK,QAAQF,MAAM,mBAAmB,CAACF,KAAKC;QAC7C,IAAI,CAACG,KAAK,CAAC,EAAE,EACX,OAAOL;QAET,MAAM,EAAE,WAAWM,aAAa,EAAE,GAAGT;QACrC,MAAMU,YAAYF,KAAK,CAAC,EAAE,CAACC,cAAc;QACzC,MAAME,UAAUC,gBAAgBd,UAAUY;QAC1C,MAAMG,YAAYC,yBAAyBH;QAC3C,OAAOE,UAAUV;IACnB"}
|
@@ -2,4 +2,5 @@ export declare const ANNOTATION_Z_INDEX = 1000;
|
|
2
2
|
export declare const LINEAR_AXIS_INNER_OFFSET_TOP = 7;
|
3
3
|
export declare const DUAL_AXIS_CHART_COLUMN_Z_INDEX = 1000;
|
4
4
|
export declare const DUAL_AXIS_CHART_NON_COLUMN_Z_INDEX = 1001;
|
5
|
+
export declare const DUAL_AXIS_LABEL_Z_INDEX = 1002;
|
5
6
|
export declare const DEFAULT_PARENT_ID = "__DefaultParentId__";
|