@visactor/vseed 0.1.49 → 0.1.51
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 +3 -3
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/esm/builder/builder/buildAdvanced.js +1 -1
- package/dist/esm/builder/builder/buildAdvanced.js.map +1 -1
- package/dist/esm/builder/builder/buildSpec.js +1 -1
- package/dist/esm/builder/builder/buildSpec.js.map +1 -1
- package/dist/esm/builder/builder/builder.d.ts +483 -1
- package/dist/esm/builder/builder/builder.js +5 -1
- package/dist/esm/builder/builder/builder.js.map +1 -1
- package/dist/esm/dataSelector/selector.d.ts +5 -0
- package/dist/esm/dataSelector/selector.js +92 -50
- package/dist/esm/dataSelector/selector.js.map +1 -1
- package/dist/esm/pipeline/advanced/chart/pipes/config/boxplot.js +2 -1
- package/dist/esm/pipeline/advanced/chart/pipes/config/boxplot.js.map +1 -1
- package/dist/esm/pipeline/advanced/chart/pipes/config/column.js +2 -1
- package/dist/esm/pipeline/advanced/chart/pipes/config/column.js.map +1 -1
- package/dist/esm/pipeline/advanced/chart/pipes/config/dualAxis.js +2 -1
- package/dist/esm/pipeline/advanced/chart/pipes/config/dualAxis.js.map +1 -1
- package/dist/esm/pipeline/advanced/chart/pipes/config/histogram.js +2 -1
- package/dist/esm/pipeline/advanced/chart/pipes/config/histogram.js.map +1 -1
- package/dist/esm/pipeline/advanced/chart/pipes/config/line.js +2 -1
- package/dist/esm/pipeline/advanced/chart/pipes/config/line.js.map +1 -1
- package/dist/esm/pipeline/advanced/chart/pipes/config/scatter.js +2 -1
- package/dist/esm/pipeline/advanced/chart/pipes/config/scatter.js.map +1 -1
- package/dist/esm/pipeline/advanced/chart/pipes/reshape/reshapeWithEncoding.js +1 -1
- package/dist/esm/pipeline/advanced/chart/pipes/reshape/reshapeWithEncoding.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipeline/area.js +3 -2
- package/dist/esm/pipeline/spec/chart/pipeline/area.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipeline/areaPercent.js +3 -2
- package/dist/esm/pipeline/spec/chart/pipeline/areaPercent.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipeline/bar.js +3 -2
- package/dist/esm/pipeline/spec/chart/pipeline/bar.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipeline/barParallel.js +3 -2
- package/dist/esm/pipeline/spec/chart/pipeline/barParallel.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipeline/barPercent.js +3 -2
- package/dist/esm/pipeline/spec/chart/pipeline/barPercent.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipeline/boxplot.js +3 -2
- package/dist/esm/pipeline/spec/chart/pipeline/boxplot.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipeline/column.js +3 -2
- package/dist/esm/pipeline/spec/chart/pipeline/column.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipeline/columnParallel.js +3 -2
- package/dist/esm/pipeline/spec/chart/pipeline/columnParallel.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipeline/columnPercent.js +3 -2
- package/dist/esm/pipeline/spec/chart/pipeline/columnPercent.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipeline/dualAxis.js +5 -4
- package/dist/esm/pipeline/spec/chart/pipeline/dualAxis.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipeline/histogram.js +3 -2
- package/dist/esm/pipeline/spec/chart/pipeline/histogram.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipeline/line.js +3 -2
- package/dist/esm/pipeline/spec/chart/pipeline/line.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipeline/scatter.js +3 -2
- package/dist/esm/pipeline/spec/chart/pipeline/scatter.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipes/annotation/annotationPointOfDualAxis.d.ts +2 -0
- package/dist/esm/pipeline/spec/chart/pipes/annotation/annotationPointOfDualAxis.js +94 -0
- package/dist/esm/pipeline/spec/chart/pipes/annotation/annotationPointOfDualAxis.js.map +1 -0
- package/dist/esm/pipeline/spec/chart/pipes/annotation/index.d.ts +1 -0
- package/dist/esm/pipeline/spec/chart/pipes/annotation/index.js +2 -1
- package/dist/esm/pipeline/spec/chart/pipes/annotation/utils.d.ts +1 -1
- package/dist/esm/pipeline/spec/chart/pipes/annotation/utils.js +2 -1
- package/dist/esm/pipeline/spec/chart/pipes/annotation/utils.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipes/axes/xBand.js +12 -1
- package/dist/esm/pipeline/spec/chart/pipes/axes/xBand.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipes/axes/yBand.js +12 -1
- package/dist/esm/pipeline/spec/chart/pipes/axes/yBand.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipes/crosshair/horizontalCrosshairLine.js +3 -0
- package/dist/esm/pipeline/spec/chart/pipes/crosshair/horizontalCrosshairLine.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipes/crosshair/horizontalCrosshairRect.js +3 -0
- package/dist/esm/pipeline/spec/chart/pipes/crosshair/horizontalCrosshairRect.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipes/crosshair/verticalCrosshairLine.js +3 -0
- package/dist/esm/pipeline/spec/chart/pipes/crosshair/verticalCrosshairLine.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipes/crosshair/verticalCrosshairRect.js +3 -0
- package/dist/esm/pipeline/spec/chart/pipes/crosshair/verticalCrosshairRect.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipes/pivotChart/dimensionLinkage.d.ts +2 -0
- package/dist/esm/pipeline/spec/chart/pipes/pivotChart/dimensionLinkage.js +49 -0
- package/dist/esm/pipeline/spec/chart/pipes/pivotChart/dimensionLinkage.js.map +1 -0
- package/dist/esm/pipeline/spec/chart/pipes/pivotChart/index.d.ts +1 -0
- package/dist/esm/pipeline/spec/chart/pipes/pivotChart/index.js +2 -1
- package/dist/esm/pipeline/spec/chart/pipes/pivotChart/pivotGridStyle.js +15 -0
- package/dist/esm/pipeline/spec/chart/pipes/pivotChart/pivotGridStyle.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipes/pivotChart/pivotIndicators.js +1 -0
- package/dist/esm/pipeline/spec/chart/pipes/pivotChart/pivotIndicators.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipes/regressionLine/columnRegressionLine.js +13 -9
- package/dist/esm/pipeline/spec/chart/pipes/regressionLine/columnRegressionLine.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipes/regressionLine/ecdfRegressionLine.js +8 -5
- package/dist/esm/pipeline/spec/chart/pipes/regressionLine/ecdfRegressionLine.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipes/regressionLine/kdeRegressionLine.js +8 -5
- package/dist/esm/pipeline/spec/chart/pipes/regressionLine/kdeRegressionLine.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipes/regressionLine/linearRegressionLine.js +61 -29
- package/dist/esm/pipeline/spec/chart/pipes/regressionLine/linearRegressionLine.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipes/tooltip/tooltipBoxplot.js +8 -8
- package/dist/esm/pipeline/spec/chart/pipes/tooltip/tooltipBoxplot.js.map +1 -1
- package/dist/esm/types/advancedVSeed.d.ts +175 -0
- package/dist/esm/types/advancedVSeed.js +1 -0
- package/dist/esm/types/advancedVSeed.js.map +1 -1
- package/dist/esm/types/chartType/area/area.d.ts +6 -1
- package/dist/esm/types/chartType/area/zArea.d.ts +5 -0
- package/dist/esm/types/chartType/area/zArea.js +2 -1
- package/dist/esm/types/chartType/area/zArea.js.map +1 -1
- package/dist/esm/types/chartType/areaPercent/areaPercent.d.ts +6 -1
- package/dist/esm/types/chartType/areaPercent/zAreaPercent.d.ts +5 -0
- package/dist/esm/types/chartType/areaPercent/zAreaPercent.js +2 -1
- package/dist/esm/types/chartType/areaPercent/zAreaPercent.js.map +1 -1
- package/dist/esm/types/chartType/bar/bar.d.ts +6 -1
- package/dist/esm/types/chartType/bar/zBar.d.ts +5 -0
- package/dist/esm/types/chartType/bar/zBar.js +2 -1
- package/dist/esm/types/chartType/bar/zBar.js.map +1 -1
- package/dist/esm/types/chartType/barParallel/barParallel.d.ts +6 -1
- package/dist/esm/types/chartType/barParallel/zBarParallel.d.ts +5 -0
- package/dist/esm/types/chartType/barParallel/zBarParallel.js +2 -1
- package/dist/esm/types/chartType/barParallel/zBarParallel.js.map +1 -1
- package/dist/esm/types/chartType/barPercent/barPercent.d.ts +6 -1
- package/dist/esm/types/chartType/barPercent/zBarPercent.d.ts +5 -0
- package/dist/esm/types/chartType/barPercent/zBarPercent.js +2 -1
- package/dist/esm/types/chartType/barPercent/zBarPercent.js.map +1 -1
- package/dist/esm/types/chartType/boxplot/boxplot.d.ts +6 -1
- package/dist/esm/types/chartType/boxplot/zBoxplot.d.ts +5 -0
- package/dist/esm/types/chartType/boxplot/zBoxplot.js +2 -1
- package/dist/esm/types/chartType/boxplot/zBoxplot.js.map +1 -1
- package/dist/esm/types/chartType/column/column.d.ts +6 -1
- package/dist/esm/types/chartType/column/zColumn.d.ts +5 -0
- package/dist/esm/types/chartType/column/zColumn.js +2 -1
- package/dist/esm/types/chartType/column/zColumn.js.map +1 -1
- package/dist/esm/types/chartType/columnParallel/columnParallel.d.ts +6 -1
- package/dist/esm/types/chartType/columnParallel/zColumnParallel.d.ts +5 -0
- package/dist/esm/types/chartType/columnParallel/zColumnParallel.js +2 -1
- package/dist/esm/types/chartType/columnParallel/zColumnParallel.js.map +1 -1
- package/dist/esm/types/chartType/columnPercent/columnPercent.d.ts +6 -1
- package/dist/esm/types/chartType/columnPercent/zColumnPercent.d.ts +5 -0
- package/dist/esm/types/chartType/columnPercent/zColumnPercent.js +2 -1
- package/dist/esm/types/chartType/columnPercent/zColumnPercent.js.map +1 -1
- package/dist/esm/types/chartType/dualAxis/dualAxis.d.ts +6 -1
- package/dist/esm/types/chartType/dualAxis/zDualAxis.d.ts +5 -0
- package/dist/esm/types/chartType/dualAxis/zDualAxis.js +2 -1
- package/dist/esm/types/chartType/dualAxis/zDualAxis.js.map +1 -1
- package/dist/esm/types/chartType/histogram/histogram.d.ts +6 -1
- package/dist/esm/types/chartType/histogram/zHistogram.d.ts +5 -0
- package/dist/esm/types/chartType/histogram/zHistogram.js +2 -1
- package/dist/esm/types/chartType/histogram/zHistogram.js.map +1 -1
- package/dist/esm/types/chartType/line/line.d.ts +6 -1
- package/dist/esm/types/chartType/line/zLine.d.ts +5 -0
- package/dist/esm/types/chartType/line/zLine.js +2 -1
- package/dist/esm/types/chartType/line/zLine.js.map +1 -1
- package/dist/esm/types/chartType/scatter/scatter.d.ts +6 -1
- package/dist/esm/types/chartType/scatter/zScatter.d.ts +5 -0
- package/dist/esm/types/chartType/scatter/zScatter.js +2 -1
- package/dist/esm/types/chartType/scatter/zScatter.js.map +1 -1
- package/dist/esm/types/index.d.ts +1 -0
- package/dist/esm/types/index.js +1 -0
- package/dist/esm/types/properties/config/area.d.ts +10 -0
- package/dist/esm/types/properties/config/area.js +3 -1
- package/dist/esm/types/properties/config/area.js.map +1 -1
- package/dist/esm/types/properties/config/bar.d.ts +15 -0
- package/dist/esm/types/properties/config/bar.js +3 -1
- package/dist/esm/types/properties/config/bar.js.map +1 -1
- package/dist/esm/types/properties/config/boxplot.d.ts +5 -0
- package/dist/esm/types/properties/config/boxplot.js +3 -1
- package/dist/esm/types/properties/config/boxplot.js.map +1 -1
- package/dist/esm/types/properties/config/column.d.ts +15 -0
- package/dist/esm/types/properties/config/column.js +3 -1
- package/dist/esm/types/properties/config/column.js.map +1 -1
- package/dist/esm/types/properties/config/config.d.ts +65 -0
- package/dist/esm/types/properties/config/dimensionLinkage/dimensionLinkage.d.ts +23 -0
- package/dist/esm/types/properties/config/dimensionLinkage/dimensionLinkage.js +9 -0
- package/dist/esm/types/properties/config/dimensionLinkage/dimensionLinkage.js.map +1 -0
- package/dist/esm/types/properties/config/dimensionLinkage/index.d.ts +1 -0
- package/dist/esm/types/properties/config/dimensionLinkage/index.js +1 -0
- package/dist/esm/types/properties/config/dualAxis.d.ts +5 -0
- package/dist/esm/types/properties/config/dualAxis.js +3 -1
- package/dist/esm/types/properties/config/dualAxis.js.map +1 -1
- package/dist/esm/types/properties/config/histogram.d.ts +5 -0
- package/dist/esm/types/properties/config/histogram.js +3 -1
- package/dist/esm/types/properties/config/histogram.js.map +1 -1
- package/dist/esm/types/properties/config/index.d.ts +1 -0
- package/dist/esm/types/properties/config/index.js +1 -0
- package/dist/esm/types/properties/config/label/pieLabel.d.ts +2 -2
- package/dist/esm/types/properties/config/line.d.ts +5 -0
- package/dist/esm/types/properties/config/line.js +3 -1
- package/dist/esm/types/properties/config/line.js.map +1 -1
- package/dist/esm/types/properties/config/scatter.d.ts +5 -0
- package/dist/esm/types/properties/config/scatter.js +3 -1
- package/dist/esm/types/properties/config/scatter.js.map +1 -1
- package/dist/esm/types/properties/regressionLine/ecdfRegressionLine.d.ts +2 -2
- package/dist/esm/types/properties/regressionLine/kdeRegressionLine.d.ts +2 -2
- package/dist/esm/types/properties/regressionLine/linearRegressionLine.d.ts +2 -2
- package/dist/esm/types/properties/regressionLine/logisticRegressionLine.d.ts +2 -2
- package/dist/esm/types/properties/regressionLine/lowessRegressionLine.d.ts +2 -2
- package/dist/esm/types/properties/regressionLine/polynomialRegressionLine.d.ts +2 -2
- package/dist/esm/types/properties/theme/customTheme.d.ts +130 -0
- package/dist/esm/types/zVseed.d.ts +65 -0
- package/dist/umd/index.js +540 -205
- package/dist/umd/index.js.map +1 -1
- package/package.json +5 -5
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
import { defaultTitleText } from "./title/defaultTitleText.js";
|
|
2
2
|
import { AXIS_LABEL_SPACE } from "../../../../utils/index.js";
|
|
3
|
+
import { MeasureId } from "../../../../../dataReshape/index.js";
|
|
4
|
+
import { isArray } from "@visactor/vutils";
|
|
3
5
|
const xBand = (spec, context)=>{
|
|
4
6
|
const result = {
|
|
5
7
|
...spec
|
|
6
8
|
};
|
|
7
9
|
const { advancedVSeed, vseed } = context;
|
|
8
10
|
const { chartType } = vseed;
|
|
9
|
-
const { measures, dimensions, encoding } = advancedVSeed;
|
|
11
|
+
const { measures, dimensions, encoding, datasetReshapeInfo, pivotAllDatasetReshapeInfo } = advancedVSeed;
|
|
10
12
|
const config = advancedVSeed.config?.[chartType]?.xAxis ?? {};
|
|
11
13
|
if (!result.axes) result.axes = [];
|
|
12
14
|
const { visible = true, label, tick, title, grid, line, labelAutoHide, labelAutoHideGap, labelAutoLimit, labelAutoLimitLength = 80, labelAutoRotate, labelAutoRotateAngleRange } = config;
|
|
13
15
|
const sampling = !(labelAutoHide || labelAutoRotate || labelAutoLimit);
|
|
16
|
+
const onlyMeasureId = 0 === (encoding.x || []).filter((v)=>v !== MeasureId).length;
|
|
14
17
|
const bandAxis = {
|
|
15
18
|
visible,
|
|
16
19
|
type: 'band',
|
|
@@ -79,6 +82,14 @@ const xBand = (spec, context)=>{
|
|
|
79
82
|
0.1
|
|
80
83
|
]
|
|
81
84
|
};
|
|
85
|
+
if (onlyMeasureId && bandAxis.label) {
|
|
86
|
+
const allDatasetReshapeInfo = pivotAllDatasetReshapeInfo || datasetReshapeInfo;
|
|
87
|
+
const colorIdMap = allDatasetReshapeInfo.reduce((prev, cur)=>({
|
|
88
|
+
...prev,
|
|
89
|
+
...cur.unfoldInfo.colorIdMap
|
|
90
|
+
}), {});
|
|
91
|
+
bandAxis.label.formatMethod = (text)=>isArray(text) ? text : colorIdMap[String(text)]?.alias ?? text;
|
|
92
|
+
}
|
|
82
93
|
result.axes = [
|
|
83
94
|
...result.axes,
|
|
84
95
|
bandAxis
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pipeline/spec/chart/pipes/axes/xBand.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/chart/pipes/axes/xBand.ts"],"sourcesContent":["import type { ICartesianBandAxisSpec, ISpec } from '@visactor/vchart'\nimport type { VChartSpecPipe, XBandAxis } from 'src/types'\nimport { defaultTitleText } from './title/defaultTitleText'\nimport { AXIS_LABEL_SPACE } from 'src/pipeline/utils'\n\nexport const xBand: VChartSpecPipe = (spec, context) => {\n const result = { ...spec } as ISpec\n const { advancedVSeed, vseed } = context\n const { chartType } = vseed\n const { measures, dimensions, encoding } = advancedVSeed\n const config = (advancedVSeed.config?.[chartType as 'column']?.xAxis ?? {}) as XBandAxis\n\n if (!result.axes) {\n result.axes = []\n }\n\n const {\n visible = true,\n label,\n tick,\n title,\n grid,\n line,\n labelAutoHide,\n labelAutoHideGap,\n labelAutoLimit,\n labelAutoLimitLength = 80,\n labelAutoRotate,\n labelAutoRotateAngleRange,\n } = config\n\n const sampling = !(labelAutoHide || labelAutoRotate || labelAutoLimit)\n\n const bandAxis = {\n visible,\n type: 'band',\n orient: 'bottom',\n maxHeight: labelAutoLimitLength + 60,\n sampling,\n hover: true,\n label: {\n visible: label?.visible,\n flush: true,\n space: AXIS_LABEL_SPACE,\n style: {\n maxLineWidth: labelAutoLimitLength,\n fill: label?.labelColor,\n angle: label?.labelAngle,\n fontSize: label?.labelFontSize,\n fontWeight: label?.labelFontWeight,\n },\n\n // 防重叠相关\n minGap: labelAutoHideGap,\n autoHide: labelAutoHide,\n autoHideMethod: 'greedy',\n autoHideSeparation: labelAutoHideGap,\n autoLimit: labelAutoLimit,\n autoRotate: labelAutoRotate,\n autoRotateAngle: labelAutoRotateAngleRange,\n lastVisible: true,\n },\n title: {\n visible: title?.visible,\n text: title?.titleText || defaultTitleText(measures, dimensions, encoding.x as string[]),\n style: {\n fill: title?.titleColor,\n fontSize: title?.titleFontSize,\n fontWeight: title?.titleFontWeight,\n },\n },\n tick: {\n visible: tick?.visible,\n tickSize: tick?.tickSize,\n inside: tick?.tickInside,\n style: {\n stroke: tick?.tickColor,\n },\n },\n grid: {\n visible: grid?.visible,\n style: {\n lineWidth: grid?.gridWidth,\n stroke: grid?.gridColor,\n lineDash: grid?.gridLineDash,\n },\n },\n domainLine: {\n visible: line?.visible,\n style: {\n lineWidth: line?.lineWidth,\n stroke: line?.lineColor,\n },\n },\n paddingInner: [0.15, 0.1],\n paddingOuter: [0.075, 0.1],\n } as ICartesianBandAxisSpec\n\n result.axes = [...result.axes, bandAxis] as ISpec['axes']\n return result\n}\n"],"names":["xBand","spec","context","result","advancedVSeed","vseed","chartType","measures","dimensions","encoding","config","visible","label","tick","title","grid","line","labelAutoHide","labelAutoHideGap","labelAutoLimit","labelAutoLimitLength","labelAutoRotate","labelAutoRotateAngleRange","sampling","bandAxis","AXIS_LABEL_SPACE","defaultTitleText"],"mappings":"
|
|
1
|
+
{"version":3,"file":"pipeline/spec/chart/pipes/axes/xBand.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/chart/pipes/axes/xBand.ts"],"sourcesContent":["import type { ICartesianBandAxisSpec, ISpec } from '@visactor/vchart'\nimport type { VChartSpecPipe, XBandAxis } from 'src/types'\nimport { defaultTitleText } from './title/defaultTitleText'\nimport { AXIS_LABEL_SPACE } from 'src/pipeline/utils'\nimport { MeasureId } from 'src/dataReshape'\nimport { isArray } from '@visactor/vutils'\n\nexport const xBand: VChartSpecPipe = (spec, context) => {\n const result = { ...spec } as ISpec\n const { advancedVSeed, vseed } = context\n const { chartType } = vseed\n const { measures, dimensions, encoding, datasetReshapeInfo, pivotAllDatasetReshapeInfo } = advancedVSeed\n const config = (advancedVSeed.config?.[chartType as 'column']?.xAxis ?? {}) as XBandAxis\n\n if (!result.axes) {\n result.axes = []\n }\n\n const {\n visible = true,\n label,\n tick,\n title,\n grid,\n line,\n labelAutoHide,\n labelAutoHideGap,\n labelAutoLimit,\n labelAutoLimitLength = 80,\n labelAutoRotate,\n labelAutoRotateAngleRange,\n } = config\n\n const sampling = !(labelAutoHide || labelAutoRotate || labelAutoLimit)\n const onlyMeasureId = (encoding.x || []).filter((v) => v !== MeasureId).length === 0\n\n const bandAxis = {\n visible,\n type: 'band',\n orient: 'bottom',\n maxHeight: labelAutoLimitLength + 60,\n sampling,\n hover: true,\n label: {\n visible: label?.visible,\n flush: true,\n space: AXIS_LABEL_SPACE,\n style: {\n maxLineWidth: labelAutoLimitLength,\n fill: label?.labelColor,\n angle: label?.labelAngle,\n fontSize: label?.labelFontSize,\n fontWeight: label?.labelFontWeight,\n },\n\n // 防重叠相关\n minGap: labelAutoHideGap,\n autoHide: labelAutoHide,\n autoHideMethod: 'greedy',\n autoHideSeparation: labelAutoHideGap,\n autoLimit: labelAutoLimit,\n autoRotate: labelAutoRotate,\n autoRotateAngle: labelAutoRotateAngleRange,\n lastVisible: true,\n },\n title: {\n visible: title?.visible,\n text: title?.titleText || defaultTitleText(measures, dimensions, encoding.x as string[]),\n style: {\n fill: title?.titleColor,\n fontSize: title?.titleFontSize,\n fontWeight: title?.titleFontWeight,\n },\n },\n tick: {\n visible: tick?.visible,\n tickSize: tick?.tickSize,\n inside: tick?.tickInside,\n style: {\n stroke: tick?.tickColor,\n },\n },\n grid: {\n visible: grid?.visible,\n style: {\n lineWidth: grid?.gridWidth,\n stroke: grid?.gridColor,\n lineDash: grid?.gridLineDash,\n },\n },\n domainLine: {\n visible: line?.visible,\n style: {\n lineWidth: line?.lineWidth,\n stroke: line?.lineColor,\n },\n },\n paddingInner: [0.15, 0.1],\n paddingOuter: [0.075, 0.1],\n } as ICartesianBandAxisSpec\n if (onlyMeasureId && bandAxis.label) {\n const allDatasetReshapeInfo = pivotAllDatasetReshapeInfo || datasetReshapeInfo\n const colorIdMap = allDatasetReshapeInfo.reduce<Record<string, { id: string; alias: string }>>((prev, cur) => {\n return { ...prev, ...cur.unfoldInfo.colorIdMap }\n }, {})\n\n bandAxis.label.formatMethod = (text: string | string[]) => {\n return isArray(text) ? text : (colorIdMap[String(text)]?.alias ?? text)\n }\n }\n\n result.axes = [...result.axes, bandAxis] as ISpec['axes']\n return result\n}\n"],"names":["xBand","spec","context","result","advancedVSeed","vseed","chartType","measures","dimensions","encoding","datasetReshapeInfo","pivotAllDatasetReshapeInfo","config","visible","label","tick","title","grid","line","labelAutoHide","labelAutoHideGap","labelAutoLimit","labelAutoLimitLength","labelAutoRotate","labelAutoRotateAngleRange","sampling","onlyMeasureId","v","MeasureId","bandAxis","AXIS_LABEL_SPACE","defaultTitleText","allDatasetReshapeInfo","colorIdMap","prev","cur","text","isArray","String"],"mappings":";;;;AAOO,MAAMA,QAAwB,CAACC,MAAMC;IAC1C,MAAMC,SAAS;QAAE,GAAGF,IAAI;IAAC;IACzB,MAAM,EAAEG,aAAa,EAAEC,KAAK,EAAE,GAAGH;IACjC,MAAM,EAAEI,SAAS,EAAE,GAAGD;IACtB,MAAM,EAAEE,QAAQ,EAAEC,UAAU,EAAEC,QAAQ,EAAEC,kBAAkB,EAAEC,0BAA0B,EAAE,GAAGP;IAC3F,MAAMQ,SAAUR,cAAc,MAAM,EAAE,CAACE,UAAsB,EAAE,SAAS,CAAC;IAEzE,IAAI,CAACH,OAAO,IAAI,EACdA,OAAO,IAAI,GAAG,EAAE;IAGlB,MAAM,EACJU,UAAU,IAAI,EACdC,KAAK,EACLC,IAAI,EACJC,KAAK,EACLC,IAAI,EACJC,IAAI,EACJC,aAAa,EACbC,gBAAgB,EAChBC,cAAc,EACdC,uBAAuB,EAAE,EACzBC,eAAe,EACfC,yBAAyB,EAC1B,GAAGZ;IAEJ,MAAMa,WAAW,CAAEN,CAAAA,iBAAiBI,mBAAmBF,cAAa;IACpE,MAAMK,gBAAiBjB,AAA4D,MAA5DA,AAAAA,CAAAA,SAAS,CAAC,IAAI,EAAC,EAAG,MAAM,CAAC,CAACkB,IAAMA,MAAMC,WAAW,MAAM;IAE9E,MAAMC,WAAW;QACfhB;QACA,MAAM;QACN,QAAQ;QACR,WAAWS,uBAAuB;QAClCG;QACA,OAAO;QACP,OAAO;YACL,SAASX,OAAO;YAChB,OAAO;YACP,OAAOgB;YACP,OAAO;gBACL,cAAcR;gBACd,MAAMR,OAAO;gBACb,OAAOA,OAAO;gBACd,UAAUA,OAAO;gBACjB,YAAYA,OAAO;YACrB;YAGA,QAAQM;YACR,UAAUD;YACV,gBAAgB;YAChB,oBAAoBC;YACpB,WAAWC;YACX,YAAYE;YACZ,iBAAiBC;YACjB,aAAa;QACf;QACA,OAAO;YACL,SAASR,OAAO;YAChB,MAAMA,OAAO,aAAae,iBAAiBxB,UAAUC,YAAYC,SAAS,CAAC;YAC3E,OAAO;gBACL,MAAMO,OAAO;gBACb,UAAUA,OAAO;gBACjB,YAAYA,OAAO;YACrB;QACF;QACA,MAAM;YACJ,SAASD,MAAM;YACf,UAAUA,MAAM;YAChB,QAAQA,MAAM;YACd,OAAO;gBACL,QAAQA,MAAM;YAChB;QACF;QACA,MAAM;YACJ,SAASE,MAAM;YACf,OAAO;gBACL,WAAWA,MAAM;gBACjB,QAAQA,MAAM;gBACd,UAAUA,MAAM;YAClB;QACF;QACA,YAAY;YACV,SAASC,MAAM;YACf,OAAO;gBACL,WAAWA,MAAM;gBACjB,QAAQA,MAAM;YAChB;QACF;QACA,cAAc;YAAC;YAAM;SAAI;QACzB,cAAc;YAAC;YAAO;SAAI;IAC5B;IACA,IAAIQ,iBAAiBG,SAAS,KAAK,EAAE;QACnC,MAAMG,wBAAwBrB,8BAA8BD;QAC5D,MAAMuB,aAAaD,sBAAsB,MAAM,CAAgD,CAACE,MAAMC,MAC7F;gBAAE,GAAGD,IAAI;gBAAE,GAAGC,IAAI,UAAU,CAAC,UAAU;YAAC,IAC9C,CAAC;QAEJN,SAAS,KAAK,CAAC,YAAY,GAAG,CAACO,OACtBC,QAAQD,QAAQA,OAAQH,UAAU,CAACK,OAAOF,MAAM,EAAE,SAASA;IAEtE;IAEAjC,OAAO,IAAI,GAAG;WAAIA,OAAO,IAAI;QAAE0B;KAAS;IACxC,OAAO1B;AACT"}
|
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
import { defaultTitleText } from "./title/defaultTitleText.js";
|
|
2
2
|
import { AXIS_LABEL_SPACE } from "../../../../utils/index.js";
|
|
3
|
+
import { MeasureId } from "../../../../../dataReshape/index.js";
|
|
4
|
+
import { isArray } from "@visactor/vutils";
|
|
3
5
|
const yBand = (spec, context)=>{
|
|
4
6
|
const result = {
|
|
5
7
|
...spec
|
|
6
8
|
};
|
|
7
9
|
const { advancedVSeed, vseed } = context;
|
|
8
10
|
const { chartType } = vseed;
|
|
9
|
-
const { measures, dimensions, encoding } = advancedVSeed;
|
|
11
|
+
const { measures, dimensions, encoding, datasetReshapeInfo, pivotAllDatasetReshapeInfo } = advancedVSeed;
|
|
10
12
|
const config = advancedVSeed.config?.[chartType]?.yAxis ?? {};
|
|
11
13
|
if (!result.axes) result.axes = [];
|
|
12
14
|
const { visible = true, label, tick, title, grid, line, labelAutoHide, labelAutoHideGap, labelAutoLimit, labelAutoLimitLength = 80, labelAutoRotate, labelAutoRotateAngleRange } = config;
|
|
13
15
|
const sampling = !(labelAutoHide || labelAutoRotate || labelAutoLimit);
|
|
16
|
+
const onlyMeasureId = 0 === (encoding.y || []).filter((v)=>v !== MeasureId).length;
|
|
14
17
|
const bandAxis = {
|
|
15
18
|
visible,
|
|
16
19
|
type: 'band',
|
|
@@ -80,6 +83,14 @@ const yBand = (spec, context)=>{
|
|
|
80
83
|
0.1
|
|
81
84
|
]
|
|
82
85
|
};
|
|
86
|
+
if (onlyMeasureId && bandAxis.label) {
|
|
87
|
+
const allDatasetReshapeInfo = pivotAllDatasetReshapeInfo || datasetReshapeInfo;
|
|
88
|
+
const colorIdMap = allDatasetReshapeInfo.reduce((prev, cur)=>({
|
|
89
|
+
...prev,
|
|
90
|
+
...cur.unfoldInfo.colorIdMap
|
|
91
|
+
}), {});
|
|
92
|
+
bandAxis.label.formatMethod = (text)=>isArray(text) ? text : colorIdMap[String(text)]?.alias ?? text;
|
|
93
|
+
}
|
|
83
94
|
result.axes = [
|
|
84
95
|
...result.axes,
|
|
85
96
|
bandAxis
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pipeline/spec/chart/pipes/axes/yBand.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/chart/pipes/axes/yBand.ts"],"sourcesContent":["import type { ICartesianBandAxisSpec, ISpec } from '@visactor/vchart'\nimport type { VChartSpecPipe, XBandAxis } from 'src/types'\nimport { defaultTitleText } from './title/defaultTitleText'\nimport { AXIS_LABEL_SPACE } from 'src/pipeline/utils'\n\nexport const yBand: VChartSpecPipe = (spec, context) => {\n const result = { ...spec } as ISpec\n const { advancedVSeed, vseed } = context\n const { chartType } = vseed\n const { measures, dimensions, encoding } = advancedVSeed\n const config = (advancedVSeed.config?.[chartType as 'bar']?.yAxis ?? {}) as XBandAxis\n\n if (!result.axes) {\n result.axes = []\n }\n\n const {\n visible = true,\n label,\n tick,\n title,\n grid,\n line,\n labelAutoHide,\n labelAutoHideGap,\n labelAutoLimit,\n labelAutoLimitLength = 80,\n labelAutoRotate,\n labelAutoRotateAngleRange,\n } = config\n\n const sampling = !(labelAutoHide || labelAutoRotate || labelAutoLimit)\n\n const bandAxis = {\n visible,\n type: 'band',\n orient: 'left',\n maxWidth: labelAutoLimitLength + 60,\n sampling,\n hover: true,\n label: {\n visible: label?.visible,\n flush: true,\n containerAlign: 'right',\n space: AXIS_LABEL_SPACE,\n style: {\n maxLineWidth: labelAutoLimitLength,\n fill: label?.labelColor,\n angle: label?.labelAngle,\n fontSize: label?.labelFontSize,\n fontWeight: label?.labelFontWeight,\n },\n // 防重叠相关\n minGap: labelAutoHideGap,\n autoHide: labelAutoHide,\n autoHideMethod: 'greedy',\n autoHideSeparation: labelAutoHideGap,\n autoLimit: labelAutoLimit,\n autoRotate: labelAutoRotate,\n autoRotateAngle: labelAutoRotateAngleRange,\n lastVisible: true,\n },\n title: {\n visible: title?.visible,\n text: title?.titleText || defaultTitleText(measures, dimensions, encoding.y as string[]),\n style: {\n fill: title?.titleColor,\n fontSize: title?.titleFontSize,\n fontWeight: title?.titleFontWeight,\n },\n },\n tick: {\n visible: tick?.visible,\n tickSize: tick?.tickSize,\n inside: tick?.tickInside,\n style: {\n stroke: tick?.tickColor,\n },\n },\n grid: {\n visible: grid?.visible,\n style: {\n lineWidth: grid?.gridWidth,\n stroke: grid?.gridColor,\n lineDash: grid?.gridLineDash,\n },\n },\n domainLine: {\n visible: line?.visible,\n style: {\n lineWidth: line?.lineWidth,\n stroke: line?.lineColor,\n },\n },\n paddingInner: [0.15, 0.1],\n paddingOuter: [0.075, 0.1],\n } as ICartesianBandAxisSpec\n\n result.axes = [...result.axes, bandAxis] as ISpec['axes']\n return result\n}\n"],"names":["yBand","spec","context","result","advancedVSeed","vseed","chartType","measures","dimensions","encoding","config","visible","label","tick","title","grid","line","labelAutoHide","labelAutoHideGap","labelAutoLimit","labelAutoLimitLength","labelAutoRotate","labelAutoRotateAngleRange","sampling","bandAxis","AXIS_LABEL_SPACE","defaultTitleText"],"mappings":"
|
|
1
|
+
{"version":3,"file":"pipeline/spec/chart/pipes/axes/yBand.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/chart/pipes/axes/yBand.ts"],"sourcesContent":["import type { ICartesianBandAxisSpec, ISpec } from '@visactor/vchart'\nimport type { VChartSpecPipe, XBandAxis } from 'src/types'\nimport { defaultTitleText } from './title/defaultTitleText'\nimport { AXIS_LABEL_SPACE } from 'src/pipeline/utils'\nimport { MeasureId } from 'src/dataReshape'\nimport { isArray } from '@visactor/vutils'\n\nexport const yBand: VChartSpecPipe = (spec, context) => {\n const result = { ...spec } as ISpec\n const { advancedVSeed, vseed } = context\n const { chartType } = vseed\n const { measures, dimensions, encoding, datasetReshapeInfo, pivotAllDatasetReshapeInfo } = advancedVSeed\n const config = (advancedVSeed.config?.[chartType as 'bar']?.yAxis ?? {}) as XBandAxis\n\n if (!result.axes) {\n result.axes = []\n }\n\n const {\n visible = true,\n label,\n tick,\n title,\n grid,\n line,\n labelAutoHide,\n labelAutoHideGap,\n labelAutoLimit,\n labelAutoLimitLength = 80,\n labelAutoRotate,\n labelAutoRotateAngleRange,\n } = config\n\n const sampling = !(labelAutoHide || labelAutoRotate || labelAutoLimit)\n const onlyMeasureId = (encoding.y || []).filter((v) => v !== MeasureId).length === 0\n\n const bandAxis = {\n visible,\n type: 'band',\n orient: 'left',\n maxWidth: labelAutoLimitLength + 60,\n sampling,\n hover: true,\n label: {\n visible: label?.visible,\n flush: true,\n containerAlign: 'right',\n space: AXIS_LABEL_SPACE,\n style: {\n maxLineWidth: labelAutoLimitLength,\n fill: label?.labelColor,\n angle: label?.labelAngle,\n fontSize: label?.labelFontSize,\n fontWeight: label?.labelFontWeight,\n },\n // 防重叠相关\n minGap: labelAutoHideGap,\n autoHide: labelAutoHide,\n autoHideMethod: 'greedy',\n autoHideSeparation: labelAutoHideGap,\n autoLimit: labelAutoLimit,\n autoRotate: labelAutoRotate,\n autoRotateAngle: labelAutoRotateAngleRange,\n lastVisible: true,\n },\n title: {\n visible: title?.visible,\n text: title?.titleText || defaultTitleText(measures, dimensions, encoding.y as string[]),\n style: {\n fill: title?.titleColor,\n fontSize: title?.titleFontSize,\n fontWeight: title?.titleFontWeight,\n },\n },\n tick: {\n visible: tick?.visible,\n tickSize: tick?.tickSize,\n inside: tick?.tickInside,\n style: {\n stroke: tick?.tickColor,\n },\n },\n grid: {\n visible: grid?.visible,\n style: {\n lineWidth: grid?.gridWidth,\n stroke: grid?.gridColor,\n lineDash: grid?.gridLineDash,\n },\n },\n domainLine: {\n visible: line?.visible,\n style: {\n lineWidth: line?.lineWidth,\n stroke: line?.lineColor,\n },\n },\n paddingInner: [0.15, 0.1],\n paddingOuter: [0.075, 0.1],\n } as ICartesianBandAxisSpec\n if (onlyMeasureId && bandAxis.label) {\n const allDatasetReshapeInfo = pivotAllDatasetReshapeInfo || datasetReshapeInfo\n const colorIdMap = allDatasetReshapeInfo.reduce<Record<string, { id: string; alias: string }>>((prev, cur) => {\n return { ...prev, ...cur.unfoldInfo.colorIdMap }\n }, {})\n\n bandAxis.label.formatMethod = (text: string | string[]) => {\n return isArray(text) ? text : (colorIdMap[String(text)]?.alias ?? text)\n }\n }\n\n result.axes = [...result.axes, bandAxis] as ISpec['axes']\n return result\n}\n"],"names":["yBand","spec","context","result","advancedVSeed","vseed","chartType","measures","dimensions","encoding","datasetReshapeInfo","pivotAllDatasetReshapeInfo","config","visible","label","tick","title","grid","line","labelAutoHide","labelAutoHideGap","labelAutoLimit","labelAutoLimitLength","labelAutoRotate","labelAutoRotateAngleRange","sampling","onlyMeasureId","v","MeasureId","bandAxis","AXIS_LABEL_SPACE","defaultTitleText","allDatasetReshapeInfo","colorIdMap","prev","cur","text","isArray","String"],"mappings":";;;;AAOO,MAAMA,QAAwB,CAACC,MAAMC;IAC1C,MAAMC,SAAS;QAAE,GAAGF,IAAI;IAAC;IACzB,MAAM,EAAEG,aAAa,EAAEC,KAAK,EAAE,GAAGH;IACjC,MAAM,EAAEI,SAAS,EAAE,GAAGD;IACtB,MAAM,EAAEE,QAAQ,EAAEC,UAAU,EAAEC,QAAQ,EAAEC,kBAAkB,EAAEC,0BAA0B,EAAE,GAAGP;IAC3F,MAAMQ,SAAUR,cAAc,MAAM,EAAE,CAACE,UAAmB,EAAE,SAAS,CAAC;IAEtE,IAAI,CAACH,OAAO,IAAI,EACdA,OAAO,IAAI,GAAG,EAAE;IAGlB,MAAM,EACJU,UAAU,IAAI,EACdC,KAAK,EACLC,IAAI,EACJC,KAAK,EACLC,IAAI,EACJC,IAAI,EACJC,aAAa,EACbC,gBAAgB,EAChBC,cAAc,EACdC,uBAAuB,EAAE,EACzBC,eAAe,EACfC,yBAAyB,EAC1B,GAAGZ;IAEJ,MAAMa,WAAW,CAAEN,CAAAA,iBAAiBI,mBAAmBF,cAAa;IACpE,MAAMK,gBAAiBjB,AAA4D,MAA5DA,AAAAA,CAAAA,SAAS,CAAC,IAAI,EAAC,EAAG,MAAM,CAAC,CAACkB,IAAMA,MAAMC,WAAW,MAAM;IAE9E,MAAMC,WAAW;QACfhB;QACA,MAAM;QACN,QAAQ;QACR,UAAUS,uBAAuB;QACjCG;QACA,OAAO;QACP,OAAO;YACL,SAASX,OAAO;YAChB,OAAO;YACP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izontalCrosshairLine = (spec, context)=>{
|
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
};
|
|
43
|
+
const yAxisConfig = result.axes?.find((v)=>'left' === v.orient);
|
|
44
|
+
const yAxisFormatter = yAxisConfig?.label?.formatMethod;
|
|
45
|
+
if (yAxisFormatter) crosshair.yField.label.formatMethod = (text)=>yAxisFormatter(text);
|
|
43
46
|
return result;
|
|
44
47
|
};
|
|
45
48
|
export { horizontalCrosshairLine };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pipeline/spec/chart/pipes/crosshair/horizontalCrosshairLine.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/chart/pipes/crosshair/horizontalCrosshairLine.ts"],"sourcesContent":["import type { ICartesianCrosshairSpec, ILineChartSpec } from '@visactor/vchart'\nimport type { VChartSpecPipe } from 'src/types'\n\nexport const horizontalCrosshairLine: VChartSpecPipe = (spec, context) => {\n const result = { ...spec } as ILineChartSpec\n const { advancedVSeed, vseed } = context\n const { chartType } = vseed\n\n const config = advancedVSeed.config?.[chartType as 'line']?.crosshairLine\n if (!config) {\n return result\n }\n\n if (!result.crosshair) {\n result.crosshair = {}\n }\n\n const visible = config.visible || true\n const lineColor = config.lineColor || undefined\n const labelColor = config.labelColor || undefined\n const labelVisible = config.labelVisible || undefined\n const labelBackgroundColor = config.labelBackgroundColor || undefined\n\n const crosshair = result.crosshair as ICartesianCrosshairSpec\n crosshair.yField = {\n visible,\n line: {\n type: 'line',\n style: {\n lineWidth: 1,\n opacity: 1,\n stroke: lineColor,\n lineDash: config.lineDash ?? [4, 2],\n },\n },\n label: {\n visible: labelVisible,\n labelBackground: {\n visible: labelVisible,\n style: {\n fill: labelBackgroundColor,\n },\n },\n style: {\n fill: labelColor,\n },\n },\n }\n\n return result\n}\n"],"names":["horizontalCrosshairLine","spec","context","result","advancedVSeed","vseed","chartType","config","visible","lineColor","undefined","labelColor","labelVisible","labelBackgroundColor","crosshair"],"mappings":"AAGO,MAAMA,0BAA0C,CAACC,MAAMC;IAC5D,MAAMC,SAAS;QAAE,GAAGF,IAAI;IAAC;IACzB,MAAM,EAAEG,aAAa,EAAEC,KAAK,EAAE,GAAGH;IACjC,MAAM,EAAEI,SAAS,EAAE,GAAGD;IAEtB,MAAME,SAASH,cAAc,MAAM,EAAE,CAACE,UAAoB,EAAE;IAC5D,IAAI,CAACC,QACH,OAAOJ;IAGT,IAAI,CAACA,OAAO,SAAS,EACnBA,OAAO,SAAS,GAAG,CAAC;IAGtB,MAAMK,UAAUD,OAAO,OAAO,IAAI;IAClC,MAAME,YAAYF,OAAO,SAAS,IAAIG;IACtC,MAAMC,aAAaJ,OAAO,UAAU,IAAIG;IACxC,MAAME,eAAeL,OAAO,YAAY,IAAIG;IAC5C,MAAMG,uBAAuBN,OAAO,oBAAoB,IAAIG;IAE5D,MAAMI,YAAYX,OAAO,SAAS;IAClCW,UAAU,MAAM,GAAG;QACjBN;QACA,MAAM;YACJ,MAAM;YACN,OAAO;gBACL,WAAW;gBACX,SAAS;gBACT,QAAQC;gBACR,UAAUF,OAAO,QAAQ,IAAI;oBAAC;oBAAG;iBAAE;YACrC;QACF;QACA,OAAO;YACL,SAASK;YACT,iBAAiB;gBACf,SAASA;gBACT,OAAO;oBACL,MAAMC;gBACR;YACF;YACA,OAAO;gBACL,MAAMF;YACR;QACF;IACF;
|
|
1
|
+
{"version":3,"file":"pipeline/spec/chart/pipes/crosshair/horizontalCrosshairLine.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/chart/pipes/crosshair/horizontalCrosshairLine.ts"],"sourcesContent":["import type { ICartesianCrosshairSpec, ILineChartSpec } from '@visactor/vchart'\nimport type { VChartSpecPipe } from 'src/types'\n\nexport const horizontalCrosshairLine: VChartSpecPipe = (spec, context) => {\n const result = { ...spec } as ILineChartSpec\n const { advancedVSeed, vseed } = context\n const { chartType } = vseed\n\n const config = advancedVSeed.config?.[chartType as 'line']?.crosshairLine\n if (!config) {\n return result\n }\n\n if (!result.crosshair) {\n result.crosshair = {}\n }\n\n const visible = config.visible || true\n const lineColor = config.lineColor || undefined\n const labelColor = config.labelColor || undefined\n const labelVisible = config.labelVisible || undefined\n const labelBackgroundColor = config.labelBackgroundColor || undefined\n\n const crosshair = result.crosshair as ICartesianCrosshairSpec\n crosshair.yField = {\n visible,\n line: {\n type: 'line',\n style: {\n lineWidth: 1,\n opacity: 1,\n stroke: lineColor,\n lineDash: config.lineDash ?? [4, 2],\n },\n },\n label: {\n visible: labelVisible,\n labelBackground: {\n visible: labelVisible,\n style: {\n fill: labelBackgroundColor,\n },\n },\n style: {\n fill: labelColor,\n },\n },\n }\n const yAxisConfig = result.axes?.find((v) => v.orient === 'left')\n const yAxisFormatter = yAxisConfig?.label?.formatMethod\n if (yAxisFormatter) {\n ;(crosshair.yField.label!.formatMethod as any) = (text: string | string[]) => yAxisFormatter(text)\n }\n\n return result\n}\n"],"names":["horizontalCrosshairLine","spec","context","result","advancedVSeed","vseed","chartType","config","visible","lineColor","undefined","labelColor","labelVisible","labelBackgroundColor","crosshair","yAxisConfig","v","yAxisFormatter","text"],"mappings":"AAGO,MAAMA,0BAA0C,CAACC,MAAMC;IAC5D,MAAMC,SAAS;QAAE,GAAGF,IAAI;IAAC;IACzB,MAAM,EAAEG,aAAa,EAAEC,KAAK,EAAE,GAAGH;IACjC,MAAM,EAAEI,SAAS,EAAE,GAAGD;IAEtB,MAAME,SAASH,cAAc,MAAM,EAAE,CAACE,UAAoB,EAAE;IAC5D,IAAI,CAACC,QACH,OAAOJ;IAGT,IAAI,CAACA,OAAO,SAAS,EACnBA,OAAO,SAAS,GAAG,CAAC;IAGtB,MAAMK,UAAUD,OAAO,OAAO,IAAI;IAClC,MAAME,YAAYF,OAAO,SAAS,IAAIG;IACtC,MAAMC,aAAaJ,OAAO,UAAU,IAAIG;IACxC,MAAME,eAAeL,OAAO,YAAY,IAAIG;IAC5C,MAAMG,uBAAuBN,OAAO,oBAAoB,IAAIG;IAE5D,MAAMI,YAAYX,OAAO,SAAS;IAClCW,UAAU,MAAM,GAAG;QACjBN;QACA,MAAM;YACJ,MAAM;YACN,OAAO;gBACL,WAAW;gBACX,SAAS;gBACT,QAAQC;gBACR,UAAUF,OAAO,QAAQ,IAAI;oBAAC;oBAAG;iBAAE;YACrC;QACF;QACA,OAAO;YACL,SAASK;YACT,iBAAiB;gBACf,SAASA;gBACT,OAAO;oBACL,MAAMC;gBACR;YACF;YACA,OAAO;gBACL,MAAMF;YACR;QACF;IACF;IACA,MAAMI,cAAcZ,OAAO,IAAI,EAAE,KAAK,CAACa,IAAMA,AAAa,WAAbA,EAAE,MAAM;IACrD,MAAMC,iBAAiBF,aAAa,OAAO;IAC3C,IAAIE,gBACAH,UAAU,MAAM,CAAC,KAAK,CAAE,YAAY,GAAW,CAACI,OAA4BD,eAAeC;IAG/F,OAAOf;AACT"}
|
|
@@ -36,6 +36,9 @@ const horizontalCrosshairRect = (spec, context)=>{
|
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
38
|
};
|
|
39
|
+
const yAxisConfig = result.axes?.find((v)=>'left' === v.orient);
|
|
40
|
+
const yAxisFormatter = yAxisConfig?.label?.formatMethod;
|
|
41
|
+
if (yAxisFormatter) crosshair.yField.label.formatMethod = (text)=>yAxisFormatter(text);
|
|
39
42
|
return result;
|
|
40
43
|
};
|
|
41
44
|
export { horizontalCrosshairRect };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pipeline/spec/chart/pipes/crosshair/horizontalCrosshairRect.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/chart/pipes/crosshair/horizontalCrosshairRect.ts"],"sourcesContent":["import type { ICartesianCrosshairSpec, ILineChartSpec } from '@visactor/vchart'\nimport type { VChartSpecPipe } from 'src/types'\n\nexport const horizontalCrosshairRect: VChartSpecPipe = (spec, context) => {\n const result = { ...spec } as ILineChartSpec\n const { advancedVSeed, vseed } = context\n const { chartType } = vseed\n\n const config = advancedVSeed.config?.[chartType as 'column']?.crosshairRect\n if (!config) {\n return result\n }\n\n if (!result.crosshair) {\n result.crosshair = {}\n }\n\n const visible = config.visible || true\n const rectColor = config.rectColor || undefined\n const labelColor = config.labelColor || undefined\n const labelVisible = config.labelVisible || false\n const labelBackgroundColor = config.labelBackgroundColor || undefined\n\n const crosshair = result.crosshair as ICartesianCrosshairSpec\n crosshair.yField = {\n visible,\n line: {\n type: 'rect',\n style: {\n lineWidth: 0,\n opacity: 0.2,\n fill: rectColor,\n },\n },\n label: {\n visible: labelVisible,\n labelBackground: {\n visible: labelVisible,\n style: {\n fill: labelBackgroundColor,\n },\n },\n style: {\n fill: labelColor,\n },\n },\n }\n\n return result\n}\n"],"names":["horizontalCrosshairRect","spec","context","result","advancedVSeed","vseed","chartType","config","visible","rectColor","undefined","labelColor","labelVisible","labelBackgroundColor","crosshair"],"mappings":"AAGO,MAAMA,0BAA0C,CAACC,MAAMC;IAC5D,MAAMC,SAAS;QAAE,GAAGF,IAAI;IAAC;IACzB,MAAM,EAAEG,aAAa,EAAEC,KAAK,EAAE,GAAGH;IACjC,MAAM,EAAEI,SAAS,EAAE,GAAGD;IAEtB,MAAME,SAASH,cAAc,MAAM,EAAE,CAACE,UAAsB,EAAE;IAC9D,IAAI,CAACC,QACH,OAAOJ;IAGT,IAAI,CAACA,OAAO,SAAS,EACnBA,OAAO,SAAS,GAAG,CAAC;IAGtB,MAAMK,UAAUD,OAAO,OAAO,IAAI;IAClC,MAAME,YAAYF,OAAO,SAAS,IAAIG;IACtC,MAAMC,aAAaJ,OAAO,UAAU,IAAIG;IACxC,MAAME,eAAeL,OAAO,YAAY,IAAI;IAC5C,MAAMM,uBAAuBN,OAAO,oBAAoB,IAAIG;IAE5D,MAAMI,YAAYX,OAAO,SAAS;IAClCW,UAAU,MAAM,GAAG;QACjBN;QACA,MAAM;YACJ,MAAM;YACN,OAAO;gBACL,WAAW;gBACX,SAAS;gBACT,MAAMC;YACR;QACF;QACA,OAAO;YACL,SAASG;YACT,iBAAiB;gBACf,SAASA;gBACT,OAAO;oBACL,MAAMC;gBACR;YACF;YACA,OAAO;gBACL,MAAMF;YACR;QACF;IACF;
|
|
1
|
+
{"version":3,"file":"pipeline/spec/chart/pipes/crosshair/horizontalCrosshairRect.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/chart/pipes/crosshair/horizontalCrosshairRect.ts"],"sourcesContent":["import type { ICartesianCrosshairSpec, ILineChartSpec } from '@visactor/vchart'\nimport type { VChartSpecPipe } from 'src/types'\n\nexport const horizontalCrosshairRect: VChartSpecPipe = (spec, context) => {\n const result = { ...spec } as ILineChartSpec\n const { advancedVSeed, vseed } = context\n const { chartType } = vseed\n\n const config = advancedVSeed.config?.[chartType as 'column']?.crosshairRect\n if (!config) {\n return result\n }\n\n if (!result.crosshair) {\n result.crosshair = {}\n }\n\n const visible = config.visible || true\n const rectColor = config.rectColor || undefined\n const labelColor = config.labelColor || undefined\n const labelVisible = config.labelVisible || false\n const labelBackgroundColor = config.labelBackgroundColor || undefined\n\n const crosshair = result.crosshair as ICartesianCrosshairSpec\n crosshair.yField = {\n visible,\n line: {\n type: 'rect',\n style: {\n lineWidth: 0,\n opacity: 0.2,\n fill: rectColor,\n },\n },\n label: {\n visible: labelVisible,\n labelBackground: {\n visible: labelVisible,\n style: {\n fill: labelBackgroundColor,\n },\n },\n style: {\n fill: labelColor,\n },\n },\n }\n const yAxisConfig = result.axes?.find((v) => v.orient === 'left')\n const yAxisFormatter = yAxisConfig?.label?.formatMethod\n if (yAxisFormatter) {\n ;(crosshair.yField.label!.formatMethod as any) = (text: string | string[]) => yAxisFormatter(text)\n }\n return result\n}\n"],"names":["horizontalCrosshairRect","spec","context","result","advancedVSeed","vseed","chartType","config","visible","rectColor","undefined","labelColor","labelVisible","labelBackgroundColor","crosshair","yAxisConfig","v","yAxisFormatter","text"],"mappings":"AAGO,MAAMA,0BAA0C,CAACC,MAAMC;IAC5D,MAAMC,SAAS;QAAE,GAAGF,IAAI;IAAC;IACzB,MAAM,EAAEG,aAAa,EAAEC,KAAK,EAAE,GAAGH;IACjC,MAAM,EAAEI,SAAS,EAAE,GAAGD;IAEtB,MAAME,SAASH,cAAc,MAAM,EAAE,CAACE,UAAsB,EAAE;IAC9D,IAAI,CAACC,QACH,OAAOJ;IAGT,IAAI,CAACA,OAAO,SAAS,EACnBA,OAAO,SAAS,GAAG,CAAC;IAGtB,MAAMK,UAAUD,OAAO,OAAO,IAAI;IAClC,MAAME,YAAYF,OAAO,SAAS,IAAIG;IACtC,MAAMC,aAAaJ,OAAO,UAAU,IAAIG;IACxC,MAAME,eAAeL,OAAO,YAAY,IAAI;IAC5C,MAAMM,uBAAuBN,OAAO,oBAAoB,IAAIG;IAE5D,MAAMI,YAAYX,OAAO,SAAS;IAClCW,UAAU,MAAM,GAAG;QACjBN;QACA,MAAM;YACJ,MAAM;YACN,OAAO;gBACL,WAAW;gBACX,SAAS;gBACT,MAAMC;YACR;QACF;QACA,OAAO;YACL,SAASG;YACT,iBAAiB;gBACf,SAASA;gBACT,OAAO;oBACL,MAAMC;gBACR;YACF;YACA,OAAO;gBACL,MAAMF;YACR;QACF;IACF;IACA,MAAMI,cAAcZ,OAAO,IAAI,EAAE,KAAK,CAACa,IAAMA,AAAa,WAAbA,EAAE,MAAM;IACrD,MAAMC,iBAAiBF,aAAa,OAAO;IAC3C,IAAIE,gBACAH,UAAU,MAAM,CAAC,KAAK,CAAE,YAAY,GAAW,CAACI,OAA4BD,eAAeC;IAE/F,OAAOf;AACT"}
|
|
@@ -40,6 +40,9 @@ const verticalCrosshairLine = (spec, context)=>{
|
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
};
|
|
43
|
+
const xAxisConfig = result.axes?.find((v)=>'bottom' === v.orient);
|
|
44
|
+
const xAxisFormatter = xAxisConfig?.label?.formatMethod;
|
|
45
|
+
if (xAxisFormatter) crosshair.xField.label.formatMethod = (text)=>xAxisFormatter(text);
|
|
43
46
|
return result;
|
|
44
47
|
};
|
|
45
48
|
export { verticalCrosshairLine };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pipeline/spec/chart/pipes/crosshair/verticalCrosshairLine.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/chart/pipes/crosshair/verticalCrosshairLine.ts"],"sourcesContent":["import type { ICartesianCrosshairSpec, ILineChartSpec } from '@visactor/vchart'\nimport type { VChartSpecPipe } from 'src/types'\n\nexport const verticalCrosshairLine: VChartSpecPipe = (spec, context) => {\n const result = { ...spec } as ILineChartSpec\n const { advancedVSeed, vseed } = context\n const { chartType } = vseed\n\n const config = advancedVSeed.config?.[chartType as 'line']?.crosshairLine\n if (!config) {\n return result\n }\n\n if (!result.crosshair) {\n result.crosshair = {}\n }\n\n const visible = config.visible || true\n const lineColor = config.lineColor || undefined\n const labelColor = config.labelColor || undefined\n const labelVisible = config.labelVisible || undefined\n const labelBackgroundColor = config.labelBackgroundColor || undefined\n\n const crosshair = result.crosshair as ICartesianCrosshairSpec\n crosshair.xField = {\n visible,\n line: {\n type: 'line',\n style: {\n lineWidth: 1,\n opacity: 1,\n stroke: lineColor,\n lineDash: config.lineDash ?? [4, 2],\n },\n },\n label: {\n visible: labelVisible,\n labelBackground: {\n visible: labelVisible,\n style: {\n fill: labelBackgroundColor,\n },\n },\n style: {\n fill: labelColor,\n },\n },\n }\n\n return result\n}\n"],"names":["verticalCrosshairLine","spec","context","result","advancedVSeed","vseed","chartType","config","visible","lineColor","undefined","labelColor","labelVisible","labelBackgroundColor","crosshair"],"mappings":"AAGO,MAAMA,wBAAwC,CAACC,MAAMC;IAC1D,MAAMC,SAAS;QAAE,GAAGF,IAAI;IAAC;IACzB,MAAM,EAAEG,aAAa,EAAEC,KAAK,EAAE,GAAGH;IACjC,MAAM,EAAEI,SAAS,EAAE,GAAGD;IAEtB,MAAME,SAASH,cAAc,MAAM,EAAE,CAACE,UAAoB,EAAE;IAC5D,IAAI,CAACC,QACH,OAAOJ;IAGT,IAAI,CAACA,OAAO,SAAS,EACnBA,OAAO,SAAS,GAAG,CAAC;IAGtB,MAAMK,UAAUD,OAAO,OAAO,IAAI;IAClC,MAAME,YAAYF,OAAO,SAAS,IAAIG;IACtC,MAAMC,aAAaJ,OAAO,UAAU,IAAIG;IACxC,MAAME,eAAeL,OAAO,YAAY,IAAIG;IAC5C,MAAMG,uBAAuBN,OAAO,oBAAoB,IAAIG;IAE5D,MAAMI,YAAYX,OAAO,SAAS;IAClCW,UAAU,MAAM,GAAG;QACjBN;QACA,MAAM;YACJ,MAAM;YACN,OAAO;gBACL,WAAW;gBACX,SAAS;gBACT,QAAQC;gBACR,UAAUF,OAAO,QAAQ,IAAI;oBAAC;oBAAG;iBAAE;YACrC;QACF;QACA,OAAO;YACL,SAASK;YACT,iBAAiB;gBACf,SAASA;gBACT,OAAO;oBACL,MAAMC;gBACR;YACF;YACA,OAAO;gBACL,MAAMF;YACR;QACF;IACF;
|
|
1
|
+
{"version":3,"file":"pipeline/spec/chart/pipes/crosshair/verticalCrosshairLine.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/chart/pipes/crosshair/verticalCrosshairLine.ts"],"sourcesContent":["import type { ICartesianCrosshairSpec, ILineChartSpec } from '@visactor/vchart'\nimport type { VChartSpecPipe } from 'src/types'\n\nexport const verticalCrosshairLine: VChartSpecPipe = (spec, context) => {\n const result = { ...spec } as ILineChartSpec\n const { advancedVSeed, vseed } = context\n const { chartType } = vseed\n\n const config = advancedVSeed.config?.[chartType as 'line']?.crosshairLine\n if (!config) {\n return result\n }\n\n if (!result.crosshair) {\n result.crosshair = {}\n }\n\n const visible = config.visible || true\n const lineColor = config.lineColor || undefined\n const labelColor = config.labelColor || undefined\n const labelVisible = config.labelVisible || undefined\n const labelBackgroundColor = config.labelBackgroundColor || undefined\n\n const crosshair = result.crosshair as ICartesianCrosshairSpec\n crosshair.xField = {\n visible,\n line: {\n type: 'line',\n style: {\n lineWidth: 1,\n opacity: 1,\n stroke: lineColor,\n lineDash: config.lineDash ?? [4, 2],\n },\n },\n label: {\n visible: labelVisible,\n labelBackground: {\n visible: labelVisible,\n style: {\n fill: labelBackgroundColor,\n },\n },\n style: {\n fill: labelColor,\n },\n },\n }\n const xAxisConfig = result.axes?.find((v) => v.orient === 'bottom')\n const xAxisFormatter = xAxisConfig?.label?.formatMethod\n if (xAxisFormatter) {\n ;(crosshair.xField.label!.formatMethod as any) = (text: string | string[]) => xAxisFormatter(text)\n }\n\n return result\n}\n"],"names":["verticalCrosshairLine","spec","context","result","advancedVSeed","vseed","chartType","config","visible","lineColor","undefined","labelColor","labelVisible","labelBackgroundColor","crosshair","xAxisConfig","v","xAxisFormatter","text"],"mappings":"AAGO,MAAMA,wBAAwC,CAACC,MAAMC;IAC1D,MAAMC,SAAS;QAAE,GAAGF,IAAI;IAAC;IACzB,MAAM,EAAEG,aAAa,EAAEC,KAAK,EAAE,GAAGH;IACjC,MAAM,EAAEI,SAAS,EAAE,GAAGD;IAEtB,MAAME,SAASH,cAAc,MAAM,EAAE,CAACE,UAAoB,EAAE;IAC5D,IAAI,CAACC,QACH,OAAOJ;IAGT,IAAI,CAACA,OAAO,SAAS,EACnBA,OAAO,SAAS,GAAG,CAAC;IAGtB,MAAMK,UAAUD,OAAO,OAAO,IAAI;IAClC,MAAME,YAAYF,OAAO,SAAS,IAAIG;IACtC,MAAMC,aAAaJ,OAAO,UAAU,IAAIG;IACxC,MAAME,eAAeL,OAAO,YAAY,IAAIG;IAC5C,MAAMG,uBAAuBN,OAAO,oBAAoB,IAAIG;IAE5D,MAAMI,YAAYX,OAAO,SAAS;IAClCW,UAAU,MAAM,GAAG;QACjBN;QACA,MAAM;YACJ,MAAM;YACN,OAAO;gBACL,WAAW;gBACX,SAAS;gBACT,QAAQC;gBACR,UAAUF,OAAO,QAAQ,IAAI;oBAAC;oBAAG;iBAAE;YACrC;QACF;QACA,OAAO;YACL,SAASK;YACT,iBAAiB;gBACf,SAASA;gBACT,OAAO;oBACL,MAAMC;gBACR;YACF;YACA,OAAO;gBACL,MAAMF;YACR;QACF;IACF;IACA,MAAMI,cAAcZ,OAAO,IAAI,EAAE,KAAK,CAACa,IAAMA,AAAa,aAAbA,EAAE,MAAM;IACrD,MAAMC,iBAAiBF,aAAa,OAAO;IAC3C,IAAIE,gBACAH,UAAU,MAAM,CAAC,KAAK,CAAE,YAAY,GAAW,CAACI,OAA4BD,eAAeC;IAG/F,OAAOf;AACT"}
|
|
@@ -36,6 +36,9 @@ const verticalCrosshairRect = (spec, context)=>{
|
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
38
|
};
|
|
39
|
+
const xAxisConfig = result.axes?.find((v)=>'bottom' === v.orient);
|
|
40
|
+
const xAxisFormatter = xAxisConfig?.label?.formatMethod;
|
|
41
|
+
if (xAxisFormatter) crosshair.xField.label.formatMethod = (text)=>xAxisFormatter(text);
|
|
39
42
|
return result;
|
|
40
43
|
};
|
|
41
44
|
export { verticalCrosshairRect };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pipeline/spec/chart/pipes/crosshair/verticalCrosshairRect.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/chart/pipes/crosshair/verticalCrosshairRect.ts"],"sourcesContent":["import type { ICartesianCrosshairSpec, ILineChartSpec } from '@visactor/vchart'\nimport type { VChartSpecPipe } from 'src/types'\n\nexport const verticalCrosshairRect: VChartSpecPipe = (spec, context) => {\n const result = { ...spec } as ILineChartSpec\n const { advancedVSeed, vseed } = context\n const { chartType } = vseed\n\n const config = advancedVSeed.config?.[chartType as 'column']?.crosshairRect\n if (!config) {\n return result\n }\n\n if (!result.crosshair) {\n result.crosshair = {}\n }\n\n const visible = config.visible || true\n const rectColor = config.rectColor || undefined\n const labelColor = config.labelColor || undefined\n const labelVisible = config.labelVisible || false\n const labelBackgroundColor = config.labelBackgroundColor || undefined\n\n const crosshair = result.crosshair as ICartesianCrosshairSpec\n crosshair.xField = {\n visible,\n line: {\n type: 'rect',\n style: {\n lineWidth: 0,\n opacity: 0.2,\n fill: rectColor,\n },\n },\n label: {\n visible: labelVisible,\n labelBackground: {\n visible: labelVisible,\n style: {\n fill: labelBackgroundColor,\n },\n },\n style: {\n fill: labelColor,\n },\n },\n }\n\n return result\n}\n"],"names":["verticalCrosshairRect","spec","context","result","advancedVSeed","vseed","chartType","config","visible","rectColor","undefined","labelColor","labelVisible","labelBackgroundColor","crosshair"],"mappings":"AAGO,MAAMA,wBAAwC,CAACC,MAAMC;IAC1D,MAAMC,SAAS;QAAE,GAAGF,IAAI;IAAC;IACzB,MAAM,EAAEG,aAAa,EAAEC,KAAK,EAAE,GAAGH;IACjC,MAAM,EAAEI,SAAS,EAAE,GAAGD;IAEtB,MAAME,SAASH,cAAc,MAAM,EAAE,CAACE,UAAsB,EAAE;IAC9D,IAAI,CAACC,QACH,OAAOJ;IAGT,IAAI,CAACA,OAAO,SAAS,EACnBA,OAAO,SAAS,GAAG,CAAC;IAGtB,MAAMK,UAAUD,OAAO,OAAO,IAAI;IAClC,MAAME,YAAYF,OAAO,SAAS,IAAIG;IACtC,MAAMC,aAAaJ,OAAO,UAAU,IAAIG;IACxC,MAAME,eAAeL,OAAO,YAAY,IAAI;IAC5C,MAAMM,uBAAuBN,OAAO,oBAAoB,IAAIG;IAE5D,MAAMI,YAAYX,OAAO,SAAS;IAClCW,UAAU,MAAM,GAAG;QACjBN;QACA,MAAM;YACJ,MAAM;YACN,OAAO;gBACL,WAAW;gBACX,SAAS;gBACT,MAAMC;YACR;QACF;QACA,OAAO;YACL,SAASG;YACT,iBAAiB;gBACf,SAASA;gBACT,OAAO;oBACL,MAAMC;gBACR;YACF;YACA,OAAO;gBACL,MAAMF;YACR;QACF;IACF;
|
|
1
|
+
{"version":3,"file":"pipeline/spec/chart/pipes/crosshair/verticalCrosshairRect.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/chart/pipes/crosshair/verticalCrosshairRect.ts"],"sourcesContent":["import type { ICartesianCrosshairSpec, ILineChartSpec } from '@visactor/vchart'\nimport type { VChartSpecPipe } from 'src/types'\n\nexport const verticalCrosshairRect: VChartSpecPipe = (spec, context) => {\n const result = { ...spec } as ILineChartSpec\n const { advancedVSeed, vseed } = context\n const { chartType } = vseed\n\n const config = advancedVSeed.config?.[chartType as 'column']?.crosshairRect\n if (!config) {\n return result\n }\n\n if (!result.crosshair) {\n result.crosshair = {}\n }\n\n const visible = config.visible || true\n const rectColor = config.rectColor || undefined\n const labelColor = config.labelColor || undefined\n const labelVisible = config.labelVisible || false\n const labelBackgroundColor = config.labelBackgroundColor || undefined\n\n const crosshair = result.crosshair as ICartesianCrosshairSpec\n crosshair.xField = {\n visible,\n line: {\n type: 'rect',\n style: {\n lineWidth: 0,\n opacity: 0.2,\n fill: rectColor,\n },\n },\n label: {\n visible: labelVisible,\n labelBackground: {\n visible: labelVisible,\n style: {\n fill: labelBackgroundColor,\n },\n },\n style: {\n fill: labelColor,\n },\n },\n }\n const xAxisConfig = result.axes?.find((v) => v.orient === 'bottom')\n const xAxisFormatter = xAxisConfig?.label?.formatMethod\n if (xAxisFormatter) {\n ;(crosshair.xField.label!.formatMethod as any) = (text: string | string[]) => xAxisFormatter(text)\n }\n\n return result\n}\n"],"names":["verticalCrosshairRect","spec","context","result","advancedVSeed","vseed","chartType","config","visible","rectColor","undefined","labelColor","labelVisible","labelBackgroundColor","crosshair","xAxisConfig","v","xAxisFormatter","text"],"mappings":"AAGO,MAAMA,wBAAwC,CAACC,MAAMC;IAC1D,MAAMC,SAAS;QAAE,GAAGF,IAAI;IAAC;IACzB,MAAM,EAAEG,aAAa,EAAEC,KAAK,EAAE,GAAGH;IACjC,MAAM,EAAEI,SAAS,EAAE,GAAGD;IAEtB,MAAME,SAASH,cAAc,MAAM,EAAE,CAACE,UAAsB,EAAE;IAC9D,IAAI,CAACC,QACH,OAAOJ;IAGT,IAAI,CAACA,OAAO,SAAS,EACnBA,OAAO,SAAS,GAAG,CAAC;IAGtB,MAAMK,UAAUD,OAAO,OAAO,IAAI;IAClC,MAAME,YAAYF,OAAO,SAAS,IAAIG;IACtC,MAAMC,aAAaJ,OAAO,UAAU,IAAIG;IACxC,MAAME,eAAeL,OAAO,YAAY,IAAI;IAC5C,MAAMM,uBAAuBN,OAAO,oBAAoB,IAAIG;IAE5D,MAAMI,YAAYX,OAAO,SAAS;IAClCW,UAAU,MAAM,GAAG;QACjBN;QACA,MAAM;YACJ,MAAM;YACN,OAAO;gBACL,WAAW;gBACX,SAAS;gBACT,MAAMC;YACR;QACF;QACA,OAAO;YACL,SAASG;YACT,iBAAiB;gBACf,SAASA;gBACT,OAAO;oBACL,MAAMC;gBACR;YACF;YACA,OAAO;gBACL,MAAMF;YACR;QACF;IACF;IACA,MAAMI,cAAcZ,OAAO,IAAI,EAAE,KAAK,CAACa,IAAMA,AAAa,aAAbA,EAAE,MAAM;IACrD,MAAMC,iBAAiBF,aAAa,OAAO;IAC3C,IAAIE,gBACAH,UAAU,MAAM,CAAC,KAAK,CAAE,YAAY,GAAW,CAACI,OAA4BD,eAAeC;IAG/F,OAAOf;AACT"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { isNullish } from "remeda";
|
|
2
|
+
const defaultScatterFormatter = (val)=>{
|
|
3
|
+
if (isNullish(val)) return '';
|
|
4
|
+
if ('string' == typeof val) return val;
|
|
5
|
+
if (0 === val) return '0';
|
|
6
|
+
if (Math.abs(val) < 1) return val.toFixed(2);
|
|
7
|
+
return val === Math.floor(val) ? `${val}` : val.toFixed(1);
|
|
8
|
+
};
|
|
9
|
+
const dimensionLinkage = (spec, context)=>{
|
|
10
|
+
const { advancedVSeed, vseed } = context;
|
|
11
|
+
const { chartType } = vseed;
|
|
12
|
+
const config = advancedVSeed.config?.[chartType]?.dimensionLinkage ?? {};
|
|
13
|
+
if (false === config.enable) return spec;
|
|
14
|
+
const indicators = spec.indicators;
|
|
15
|
+
const labelHoverOnAxis = {};
|
|
16
|
+
const chartSpec = indicators?.[0]?.chartSpec;
|
|
17
|
+
const crosshair = chartSpec?.crosshair;
|
|
18
|
+
if (crosshair?.xField) labelHoverOnAxis.bottom = {
|
|
19
|
+
visible: config.showLabel ?? crosshair.xField.label?.visible ?? true,
|
|
20
|
+
background: crosshair.xField.label?.labelBackground,
|
|
21
|
+
textStyle: crosshair.xField.label?.style,
|
|
22
|
+
formatMethod: 'scatter' === chartType ? defaultScatterFormatter : void 0
|
|
23
|
+
};
|
|
24
|
+
if (crosshair?.yField) labelHoverOnAxis.left = {
|
|
25
|
+
visible: config.showLabel ?? crosshair.yField.label?.visible ?? true,
|
|
26
|
+
background: crosshair.yField.label?.labelBackground,
|
|
27
|
+
textStyle: crosshair.yField.label?.style,
|
|
28
|
+
formatMethod: 'scatter' === chartType ? defaultScatterFormatter : void 0
|
|
29
|
+
};
|
|
30
|
+
if (indicators && indicators.length) indicators.forEach((ind)=>{
|
|
31
|
+
const crosshair = ind?.chartSpec?.crosshair;
|
|
32
|
+
if (crosshair?.xField) crosshair.xField.label = {
|
|
33
|
+
visible: false
|
|
34
|
+
};
|
|
35
|
+
if (crosshair?.yField) crosshair.yField.label = {
|
|
36
|
+
visible: false
|
|
37
|
+
};
|
|
38
|
+
});
|
|
39
|
+
spec.chartDimensionLinkage = {
|
|
40
|
+
showTooltip: config.showTooltip ?? chartSpec?.tooltip?.dimension?.visible ?? true,
|
|
41
|
+
heightLimitToShowTooltipForLastRow: 60,
|
|
42
|
+
widthLimitToShowTooltipForLastColumn: 90,
|
|
43
|
+
labelHoverOnAxis
|
|
44
|
+
};
|
|
45
|
+
return spec;
|
|
46
|
+
};
|
|
47
|
+
export { dimensionLinkage };
|
|
48
|
+
|
|
49
|
+
//# sourceMappingURL=dimensionLinkage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pipeline/spec/chart/pipes/pivotChart/dimensionLinkage.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/chart/pipes/pivotChart/dimensionLinkage.ts"],"sourcesContent":["import type { ICartesianCrosshairSpec, ILineChartSpec } from '@visactor/vchart'\nimport { isNullish } from 'remeda'\nimport type { DimensionLinkage, PivotChartSpecPipe } from 'src/types'\n\nconst defaultScatterFormatter = (val: number | string) => {\n if (isNullish(val)) {\n return ''\n }\n if (typeof val === 'string') {\n return val\n }\n\n if (val === 0) {\n return '0'\n }\n if (Math.abs(val) < 1) {\n return val.toFixed(2)\n }\n\n return val === Math.floor(val) ? `${val}` : val.toFixed(1)\n}\n\nexport const dimensionLinkage: PivotChartSpecPipe = (spec, context) => {\n const { advancedVSeed, vseed } = context\n const { chartType } = vseed\n\n const config = (advancedVSeed.config?.[chartType as 'line']?.dimensionLinkage ?? {}) as DimensionLinkage\n\n if (config.enable === false) {\n return spec\n }\n\n const indicators = spec.indicators\n const labelHoverOnAxis = {}\n const chartSpec = (indicators as any)?.[0]?.chartSpec as ILineChartSpec\n const crosshair = chartSpec?.crosshair as ICartesianCrosshairSpec\n\n if (crosshair?.xField) {\n ;(labelHoverOnAxis as any).bottom = {\n visible: config.showLabel ?? crosshair.xField.label?.visible ?? true,\n background: crosshair.xField.label?.labelBackground,\n textStyle: crosshair.xField.label?.style,\n formatMethod: chartType === 'scatter' ? defaultScatterFormatter : undefined,\n }\n }\n if (crosshair?.yField) {\n ;(labelHoverOnAxis as any).left = {\n visible: config.showLabel ?? crosshair.yField.label?.visible ?? true,\n background: crosshair.yField.label?.labelBackground,\n textStyle: crosshair.yField.label?.style,\n formatMethod: chartType === 'scatter' ? defaultScatterFormatter : undefined,\n }\n }\n\n if (indicators && indicators.length) {\n indicators.forEach((ind) => {\n const crosshair = (ind as any)?.chartSpec?.crosshair as ICartesianCrosshairSpec\n\n if (crosshair?.xField) {\n crosshair.xField.label = { visible: false }\n }\n\n if (crosshair?.yField) {\n crosshair.yField.label = { visible: false }\n }\n })\n }\n\n spec.chartDimensionLinkage = {\n showTooltip: config.showTooltip ?? (chartSpec?.tooltip?.dimension?.visible as boolean) ?? true,\n heightLimitToShowTooltipForLastRow: 60,\n widthLimitToShowTooltipForLastColumn: 90,\n labelHoverOnAxis,\n }\n\n return spec\n}\n"],"names":["defaultScatterFormatter","val","isNullish","Math","dimensionLinkage","spec","context","advancedVSeed","vseed","chartType","config","indicators","labelHoverOnAxis","chartSpec","crosshair","undefined","ind"],"mappings":";AAIA,MAAMA,0BAA0B,CAACC;IAC/B,IAAIC,UAAUD,MACZ,OAAO;IAET,IAAI,AAAe,YAAf,OAAOA,KACT,OAAOA;IAGT,IAAIA,AAAQ,MAARA,KACF,OAAO;IAET,IAAIE,KAAK,GAAG,CAACF,OAAO,GAClB,OAAOA,IAAI,OAAO,CAAC;IAGrB,OAAOA,QAAQE,KAAK,KAAK,CAACF,OAAO,GAAGA,KAAK,GAAGA,IAAI,OAAO,CAAC;AAC1D;AAEO,MAAMG,mBAAuC,CAACC,MAAMC;IACzD,MAAM,EAAEC,aAAa,EAAEC,KAAK,EAAE,GAAGF;IACjC,MAAM,EAAEG,SAAS,EAAE,GAAGD;IAEtB,MAAME,SAAUH,cAAc,MAAM,EAAE,CAACE,UAAoB,EAAE,oBAAoB,CAAC;IAElF,IAAIC,AAAkB,UAAlBA,OAAO,MAAM,EACf,OAAOL;IAGT,MAAMM,aAAaN,KAAK,UAAU;IAClC,MAAMO,mBAAmB,CAAC;IAC1B,MAAMC,YAAaF,YAAoB,CAAC,EAAE,EAAE;IAC5C,MAAMG,YAAYD,WAAW;IAE7B,IAAIC,WAAW,QACXF,iBAAyB,MAAM,GAAG;QAClC,SAASF,OAAO,SAAS,IAAII,UAAU,MAAM,CAAC,KAAK,EAAE,WAAW;QAChE,YAAYA,UAAU,MAAM,CAAC,KAAK,EAAE;QACpC,WAAWA,UAAU,MAAM,CAAC,KAAK,EAAE;QACnC,cAAcL,AAAc,cAAdA,YAA0BT,0BAA0Be;IACpE;IAEF,IAAID,WAAW,QACXF,iBAAyB,IAAI,GAAG;QAChC,SAASF,OAAO,SAAS,IAAII,UAAU,MAAM,CAAC,KAAK,EAAE,WAAW;QAChE,YAAYA,UAAU,MAAM,CAAC,KAAK,EAAE;QACpC,WAAWA,UAAU,MAAM,CAAC,KAAK,EAAE;QACnC,cAAcL,AAAc,cAAdA,YAA0BT,0BAA0Be;IACpE;IAGF,IAAIJ,cAAcA,WAAW,MAAM,EACjCA,WAAW,OAAO,CAAC,CAACK;QAClB,MAAMF,YAAaE,KAAa,WAAW;QAE3C,IAAIF,WAAW,QACbA,UAAU,MAAM,CAAC,KAAK,GAAG;YAAE,SAAS;QAAM;QAG5C,IAAIA,WAAW,QACbA,UAAU,MAAM,CAAC,KAAK,GAAG;YAAE,SAAS;QAAM;IAE9C;IAGFT,KAAK,qBAAqB,GAAG;QAC3B,aAAaK,OAAO,WAAW,IAAKG,WAAW,SAAS,WAAW,WAAuB;QAC1F,oCAAoC;QACpC,sCAAsC;QACtCD;IACF;IAEA,OAAOP;AACT"}
|
|
@@ -6,3 +6,4 @@ export { pivotRowDimensions } from './pivotRowDimensions';
|
|
|
6
6
|
export { pivotHideIndicatorName } from './pivotHideIndicatorName';
|
|
7
7
|
export { pivotAxisStyle } from './pivotAxisStyle';
|
|
8
8
|
export { pivotTitle } from './pivotTitle';
|
|
9
|
+
export { dimensionLinkage } from './dimensionLinkage';
|
|
@@ -6,4 +6,5 @@ import { pivotRowDimensions } from "./pivotRowDimensions.js";
|
|
|
6
6
|
import { pivotHideIndicatorName } from "./pivotHideIndicatorName.js";
|
|
7
7
|
import { pivotAxisStyle } from "./pivotAxisStyle.js";
|
|
8
8
|
import { pivotTitle } from "./pivotTitle.js";
|
|
9
|
-
|
|
9
|
+
import { dimensionLinkage } from "./dimensionLinkage.js";
|
|
10
|
+
export { dimensionLinkage, pivotAdapter, pivotAxisStyle, pivotColumnDimensions, pivotGridStyle, pivotHideIndicatorName, pivotIndicators, pivotIndicatorsAsCol, pivotIndicatorsAsRow, pivotRowDimensions, pivotTitle };
|
|
@@ -208,6 +208,21 @@ const pivotGridStyle = (spec, context)=>{
|
|
|
208
208
|
borderColor,
|
|
209
209
|
cornerRadius: frameCornerRadius,
|
|
210
210
|
borderLineWidth: outlineBorderLineWidth
|
|
211
|
+
},
|
|
212
|
+
axisStyle: {
|
|
213
|
+
leftAxisStyle: {
|
|
214
|
+
cellPaddingLeft: 10
|
|
215
|
+
},
|
|
216
|
+
bottomAxisStyle: {
|
|
217
|
+
cellPaddingBottom: 4
|
|
218
|
+
},
|
|
219
|
+
rightAxisStyle: {
|
|
220
|
+
cellPaddingRight: 4
|
|
221
|
+
}
|
|
222
|
+
},
|
|
223
|
+
scrollStyle: {
|
|
224
|
+
visible: 'scrolling',
|
|
225
|
+
hoverOn: false
|
|
211
226
|
}
|
|
212
227
|
}
|
|
213
228
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pipeline/spec/chart/pipes/pivotChart/pivotGridStyle.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/chart/pipes/pivotChart/pivotGridStyle.ts"],"sourcesContent":["import type { PivotChartConstructorOptions } from '@visactor/vtable'\nimport { isCombination, isPivot } from 'src/pipeline/utils'\nimport type { Config, PivotChartSpecPipe } from 'src/types'\nimport { isNullish } from 'remeda'\n\nexport const pivotGridStyle: PivotChartSpecPipe = (spec, context) => {\n const { vseed, advancedVSeed } = context\n const { config, chartType } = advancedVSeed\n const themConfig = (config?.[chartType] as Config['line'])?.pivotGrid ?? {}\n\n const onlyCombination = !isPivot(vseed) && isCombination(vseed)\n\n const result = { ...spec } as PivotChartConstructorOptions\n const transparent = 'rgba(0,0,0,0)'\n\n const borderColor = themConfig.borderColor ?? '#e3e5eb'\n const bodyFontColor = themConfig.bodyFontColor ?? '#141414'\n const headerFontColor = themConfig.headerFontColor ?? '#21252c'\n const headerBackgroundColor = themConfig.headerBackgroundColor ?? 'rgba(0,0,0,0)'\n const hoverHeaderBackgroundColor = onlyCombination\n ? transparent\n : (themConfig.hoverHeaderBackgroundColor ?? '#D9DDE4')\n const hoverHeaderInlineBackgroundColor = onlyCombination\n ? transparent\n : (themConfig.hoverHeaderInlineBackgroundColor ?? '#D9DDE455')\n const outlineBorderLineWidth = themConfig.outlineBorderLineWidth ?? 0\n const frameCornerRadius = themConfig.frameCornerRadius ?? 0\n\n if (!isNullish(themConfig.minChartWidth)) {\n result.defaultColWidth = themConfig.minChartWidth\n }\n\n if (!isNullish(themConfig.minChartHeight)) {\n result.defaultRowHeight = themConfig.minChartHeight\n }\n\n return {\n ...result,\n theme: {\n underlayBackgroundColor: transparent,\n bodyStyle: {\n borderColor,\n color: bodyFontColor,\n borderLineWidth: (arg: { row: number; col: number }) => {\n const noYAxis =\n chartType === 'pie' ||\n chartType === 'rose' ||\n chartType === 'donut' ||\n chartType === 'funnel' ||\n chartType === 'radar' ||\n chartType === 'roseParallel'\n\n return [\n arg.row === 0 ? outlineBorderLineWidth : 1,\n outlineBorderLineWidth,\n 0,\n arg.col === 0 || (noYAxis && arg.col === 1) ? outlineBorderLineWidth : 1,\n ]\n },\n bgColor: transparent,\n hover: {\n cellBgColor: 'transparent',\n },\n },\n headerStyle: {\n borderColor,\n fontSize: 12,\n // borderLineWidth: [outlineBorderLineWidth, outlineBorderLineWidth, 1, 1],\n borderLineWidth: (arg: { row: number; col: number }) => {\n return [outlineBorderLineWidth, outlineBorderLineWidth, 1, arg.col === 0 ? outlineBorderLineWidth : 1]\n },\n color: headerFontColor,\n textAlign: 'center',\n bgColor: headerBackgroundColor,\n hover: {\n cellBgColor: hoverHeaderBackgroundColor,\n inlineRowBgColor: hoverHeaderInlineBackgroundColor || undefined,\n inlineColumnBgColor: hoverHeaderInlineBackgroundColor || undefined,\n },\n },\n rowHeaderStyle: {\n borderColor,\n fontSize: 12,\n color: headerFontColor,\n padding: [0, 12, 0, 4],\n borderLineWidth: (arg: { row: number }) => {\n return [arg.row === 0 ? outlineBorderLineWidth : 1, 1, 0, outlineBorderLineWidth]\n },\n bgColor: headerBackgroundColor,\n hover: {\n cellBgColor: hoverHeaderBackgroundColor,\n inlineRowBgColor: hoverHeaderInlineBackgroundColor || undefined,\n inlineColumnBgColor: hoverHeaderInlineBackgroundColor || undefined,\n },\n },\n cornerHeaderStyle: {\n borderColor,\n textAlign: 'center',\n fontSize: 12,\n color: headerFontColor,\n padding: [0, 12, 0, 4],\n fontWeight: 'bold',\n borderLineWidth: [outlineBorderLineWidth, 1, 1, outlineBorderLineWidth],\n bgColor: headerBackgroundColor,\n frameStyle: {\n borderColor,\n },\n hover: {\n cellBgColor: hoverHeaderBackgroundColor,\n inlineRowBgColor: hoverHeaderInlineBackgroundColor || undefined,\n inlineColumnBgColor: hoverHeaderInlineBackgroundColor || undefined,\n },\n },\n cornerLeftBottomCellStyle: {\n borderColor,\n borderLineWidth: [outlineBorderLineWidth, 0, outlineBorderLineWidth, outlineBorderLineWidth],\n bgColor: headerBackgroundColor,\n frameStyle: {\n borderColor,\n borderLineWidth: [1, 0, outlineBorderLineWidth, outlineBorderLineWidth],\n },\n hover: {\n cellBgColor: hoverHeaderBackgroundColor,\n },\n },\n cornerRightTopCellStyle: {\n borderColor,\n borderLineWidth: [outlineBorderLineWidth, outlineBorderLineWidth, 1, 1],\n frameStyle: {\n borderColor,\n borderLineWidth: 0,\n },\n bgColor: headerBackgroundColor,\n hover: {\n cellBgColor: hoverHeaderBackgroundColor,\n },\n },\n rightFrozenStyle: {\n borderColor,\n bgColor: headerBackgroundColor,\n borderLineWidth: (arg: { row: number }) => {\n return [arg.row === 0 ? outlineBorderLineWidth : 1, outlineBorderLineWidth, 0, 1]\n },\n frameStyle: {\n borderLineWidth: 0,\n },\n hover: {\n borderLineWidth: 0,\n cellBgColor: hoverHeaderBackgroundColor,\n },\n },\n cornerRightBottomCellStyle: {\n borderColor,\n bgColor: headerBackgroundColor,\n borderLineWidth: [1, outlineBorderLineWidth, outlineBorderLineWidth, 1],\n frameStyle: {\n borderColor,\n borderLineWidth: [1, outlineBorderLineWidth, outlineBorderLineWidth, 1],\n },\n hover: {\n cellBgColor: hoverHeaderBackgroundColor,\n },\n },\n\n bottomFrozenStyle: {\n borderColor,\n borderLineWidth: [1, outlineBorderLineWidth, outlineBorderLineWidth, 1],\n bgColor: headerBackgroundColor,\n hover: {\n cellBgColor: hoverHeaderBackgroundColor,\n },\n },\n selectionStyle: {\n cellBgColor: '',\n cellBorderColor: '',\n },\n frameStyle: {\n borderColor,\n cornerRadius: frameCornerRadius,\n borderLineWidth: outlineBorderLineWidth,\n },\n },\n }\n}\n"],"names":["pivotGridStyle","spec","context","vseed","advancedVSeed","config","chartType","themConfig","onlyCombination","isPivot","isCombination","result","transparent","borderColor","bodyFontColor","headerFontColor","headerBackgroundColor","hoverHeaderBackgroundColor","hoverHeaderInlineBackgroundColor","outlineBorderLineWidth","frameCornerRadius","isNullish","arg","noYAxis","undefined"],"mappings":";;AAKO,MAAMA,iBAAqC,CAACC,MAAMC;IACvD,MAAM,EAAEC,KAAK,EAAEC,aAAa,EAAE,GAAGF;IACjC,MAAM,EAAEG,MAAM,EAAEC,SAAS,EAAE,GAAGF;IAC9B,MAAMG,aAAcF,QAAQ,CAACC,UAAU,EAAqB,aAAa,CAAC;IAE1E,MAAME,kBAAkB,CAACC,QAAQN,UAAUO,cAAcP;IAEzD,MAAMQ,SAAS;QAAE,GAAGV,IAAI;IAAC;IACzB,MAAMW,cAAc;IAEpB,MAAMC,cAAcN,WAAW,WAAW,IAAI;IAC9C,MAAMO,gBAAgBP,WAAW,aAAa,IAAI;IAClD,MAAMQ,kBAAkBR,WAAW,eAAe,IAAI;IACtD,MAAMS,wBAAwBT,WAAW,qBAAqB,IAAI;IAClE,MAAMU,6BAA6BT,kBAC/BI,cACCL,WAAW,0BAA0B,IAAI;IAC9C,MAAMW,mCAAmCV,kBACrCI,cACCL,WAAW,gCAAgC,IAAI;IACpD,MAAMY,yBAAyBZ,WAAW,sBAAsB,IAAI;IACpE,MAAMa,oBAAoBb,WAAW,iBAAiB,IAAI;IAE1D,IAAI,CAACc,UAAUd,WAAW,aAAa,GACrCI,OAAO,eAAe,GAAGJ,WAAW,aAAa;IAGnD,IAAI,CAACc,UAAUd,WAAW,cAAc,GACtCI,OAAO,gBAAgB,GAAGJ,WAAW,cAAc;IAGrD,OAAO;QAC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;oBACb,kBAAkBC,oCAAoCM;oBACtD,qBAAqBN,oCAAoCM;gBAC3D;YACF;YACA,2BAA2B;gBACzBX;gBACA,iBAAiB;oBAACM;oBAAwB;oBAAGA;oBAAwBA;iBAAuB;gBAC5F,SAASH;gBACT,YAAY;oBACVH;oBACA,iBAAiB;wBAAC;wBAAG;wBAAGM;wBAAwBA;qBAAuB;gBACzE;gBACA,OAAO;oBACL,aAAaF;gBACf;YACF;YACA,yBAAyB;gBACvBJ;gBACA,iBAAiB;oBAACM;oBAAwBA;oBAAwB;oBAAG;iBAAE;gBACvE,YAAY;oBACVN;oBACA,iBAAiB;gBACnB;gBACA,SAASG;gBACT,OAAO;oBACL,aAAaC;gBACf;YACF;YACA,kBAAkB;gBAChBJ;gBACA,SAASG;gBACT,iBAAiB,CAACM,MACT;wBAAa,MAAZA,IAAI,GAAG,GAASH,yBAAyB;wBAAGA;wBAAwB;wBAAG;qBAAE;gBAEnF,YAAY;oBACV,iBAAiB;gBACnB;gBACA,OAAO;oBACL,iBAAiB;oBACjB,aAAaF;gBACf;YACF;YACA,4BAA4B;gBAC1BJ;gBACA,SAASG;gBACT,iBAAiB;oBAAC;oBAAGG;oBAAwBA;oBAAwB;iBAAE;gBACvE,YAAY;oBACVN;oBACA,iBAAiB;wBAAC;wBAAGM;wBAAwBA;wBAAwB;qBAAE;gBACzE;gBACA,OAAO;oBACL,aAAaF;gBACf;YACF;YAEA,mBAAmB;gBACjBJ;gBACA,iBAAiB;oBAAC;oBAAGM;oBAAwBA;oBAAwB;iBAAE;gBACvE,SAASH;gBACT,OAAO;oBACL,aAAaC;gBACf;YACF;YACA,gBAAgB;gBACd,aAAa;gBACb,iBAAiB;YACnB;YACA,YAAY;gBACVJ;gBACA,cAAcO;gBACd,iBAAiBD;YACnB;QACF;IACF;AACF"}
|
|
1
|
+
{"version":3,"file":"pipeline/spec/chart/pipes/pivotChart/pivotGridStyle.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/chart/pipes/pivotChart/pivotGridStyle.ts"],"sourcesContent":["import type { PivotChartConstructorOptions } from '@visactor/vtable'\nimport { isCombination, isPivot } from 'src/pipeline/utils'\nimport type { Config, PivotChartSpecPipe } from 'src/types'\nimport { isNullish } from 'remeda'\n\nexport const pivotGridStyle: PivotChartSpecPipe = (spec, context) => {\n const { vseed, advancedVSeed } = context\n const { config, chartType } = advancedVSeed\n const themConfig = (config?.[chartType] as Config['line'])?.pivotGrid ?? {}\n\n const onlyCombination = !isPivot(vseed) && isCombination(vseed)\n\n const result = { ...spec } as PivotChartConstructorOptions\n const transparent = 'rgba(0,0,0,0)'\n\n const borderColor = themConfig.borderColor ?? '#e3e5eb'\n const bodyFontColor = themConfig.bodyFontColor ?? '#141414'\n const headerFontColor = themConfig.headerFontColor ?? '#21252c'\n const headerBackgroundColor = themConfig.headerBackgroundColor ?? 'rgba(0,0,0,0)'\n const hoverHeaderBackgroundColor = onlyCombination\n ? transparent\n : (themConfig.hoverHeaderBackgroundColor ?? '#D9DDE4')\n const hoverHeaderInlineBackgroundColor = onlyCombination\n ? transparent\n : (themConfig.hoverHeaderInlineBackgroundColor ?? '#D9DDE455')\n const outlineBorderLineWidth = themConfig.outlineBorderLineWidth ?? 0\n const frameCornerRadius = themConfig.frameCornerRadius ?? 0\n\n if (!isNullish(themConfig.minChartWidth)) {\n result.defaultColWidth = themConfig.minChartWidth\n }\n\n if (!isNullish(themConfig.minChartHeight)) {\n result.defaultRowHeight = themConfig.minChartHeight\n }\n\n return {\n ...result,\n theme: {\n underlayBackgroundColor: transparent,\n bodyStyle: {\n borderColor,\n color: bodyFontColor,\n borderLineWidth: (arg: { row: number; col: number }) => {\n const noYAxis =\n chartType === 'pie' ||\n chartType === 'rose' ||\n chartType === 'donut' ||\n chartType === 'funnel' ||\n chartType === 'radar' ||\n chartType === 'roseParallel'\n\n return [\n arg.row === 0 ? outlineBorderLineWidth : 1,\n outlineBorderLineWidth,\n 0,\n arg.col === 0 || (noYAxis && arg.col === 1) ? outlineBorderLineWidth : 1,\n ]\n },\n bgColor: transparent,\n hover: {\n cellBgColor: 'transparent',\n },\n },\n headerStyle: {\n borderColor,\n fontSize: 12,\n // borderLineWidth: [outlineBorderLineWidth, outlineBorderLineWidth, 1, 1],\n borderLineWidth: (arg: { row: number; col: number }) => {\n return [outlineBorderLineWidth, outlineBorderLineWidth, 1, arg.col === 0 ? outlineBorderLineWidth : 1]\n },\n color: headerFontColor,\n textAlign: 'center',\n bgColor: headerBackgroundColor,\n hover: {\n cellBgColor: hoverHeaderBackgroundColor,\n inlineRowBgColor: hoverHeaderInlineBackgroundColor || undefined,\n inlineColumnBgColor: hoverHeaderInlineBackgroundColor || undefined,\n },\n },\n rowHeaderStyle: {\n borderColor,\n fontSize: 12,\n color: headerFontColor,\n padding: [0, 12, 0, 4],\n borderLineWidth: (arg: { row: number }) => {\n return [arg.row === 0 ? outlineBorderLineWidth : 1, 1, 0, outlineBorderLineWidth]\n },\n bgColor: headerBackgroundColor,\n hover: {\n cellBgColor: hoverHeaderBackgroundColor,\n inlineRowBgColor: hoverHeaderInlineBackgroundColor || undefined,\n inlineColumnBgColor: hoverHeaderInlineBackgroundColor || undefined,\n },\n },\n cornerHeaderStyle: {\n borderColor,\n textAlign: 'center',\n fontSize: 12,\n color: headerFontColor,\n padding: [0, 12, 0, 4],\n fontWeight: 'bold',\n borderLineWidth: [outlineBorderLineWidth, 1, 1, outlineBorderLineWidth],\n bgColor: headerBackgroundColor,\n frameStyle: {\n borderColor,\n },\n hover: {\n cellBgColor: hoverHeaderBackgroundColor,\n inlineRowBgColor: hoverHeaderInlineBackgroundColor || undefined,\n inlineColumnBgColor: hoverHeaderInlineBackgroundColor || undefined,\n },\n },\n cornerLeftBottomCellStyle: {\n borderColor,\n borderLineWidth: [outlineBorderLineWidth, 0, outlineBorderLineWidth, outlineBorderLineWidth],\n bgColor: headerBackgroundColor,\n frameStyle: {\n borderColor,\n borderLineWidth: [1, 0, outlineBorderLineWidth, outlineBorderLineWidth],\n },\n hover: {\n cellBgColor: hoverHeaderBackgroundColor,\n },\n },\n cornerRightTopCellStyle: {\n borderColor,\n borderLineWidth: [outlineBorderLineWidth, outlineBorderLineWidth, 1, 1],\n frameStyle: {\n borderColor,\n borderLineWidth: 0,\n },\n bgColor: headerBackgroundColor,\n hover: {\n cellBgColor: hoverHeaderBackgroundColor,\n },\n },\n rightFrozenStyle: {\n borderColor,\n bgColor: headerBackgroundColor,\n borderLineWidth: (arg: { row: number }) => {\n return [arg.row === 0 ? outlineBorderLineWidth : 1, outlineBorderLineWidth, 0, 1]\n },\n frameStyle: {\n borderLineWidth: 0,\n },\n hover: {\n borderLineWidth: 0,\n cellBgColor: hoverHeaderBackgroundColor,\n },\n },\n cornerRightBottomCellStyle: {\n borderColor,\n bgColor: headerBackgroundColor,\n borderLineWidth: [1, outlineBorderLineWidth, outlineBorderLineWidth, 1],\n frameStyle: {\n borderColor,\n borderLineWidth: [1, outlineBorderLineWidth, outlineBorderLineWidth, 1],\n },\n hover: {\n cellBgColor: hoverHeaderBackgroundColor,\n },\n },\n\n bottomFrozenStyle: {\n borderColor,\n borderLineWidth: [1, outlineBorderLineWidth, outlineBorderLineWidth, 1],\n bgColor: headerBackgroundColor,\n hover: {\n cellBgColor: hoverHeaderBackgroundColor,\n },\n },\n selectionStyle: {\n cellBgColor: '',\n cellBorderColor: '',\n },\n frameStyle: {\n borderColor,\n cornerRadius: frameCornerRadius,\n borderLineWidth: outlineBorderLineWidth,\n },\n\n axisStyle: {\n leftAxisStyle: {\n cellPaddingLeft: 10,\n },\n bottomAxisStyle: {\n cellPaddingBottom: 4,\n },\n rightAxisStyle: {\n cellPaddingRight: 4,\n },\n },\n scrollStyle: {\n visible: 'scrolling',\n hoverOn: false,\n },\n },\n }\n}\n"],"names":["pivotGridStyle","spec","context","vseed","advancedVSeed","config","chartType","themConfig","onlyCombination","isPivot","isCombination","result","transparent","borderColor","bodyFontColor","headerFontColor","headerBackgroundColor","hoverHeaderBackgroundColor","hoverHeaderInlineBackground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iB;oBAACM;oBAAwBA;oBAAwB;oBAAG;iBAAE;gBACvE,YAAY;oBACVN;oBACA,iBAAiB;gBACnB;gBACA,SAASG;gBACT,OAAO;oBACL,aAAaC;gBACf;YACF;YACA,kBAAkB;gBAChBJ;gBACA,SAASG;gBACT,iBAAiB,CAACM,MACT;wBAAa,MAAZA,IAAI,GAAG,GAASH,yBAAyB;wBAAGA;wBAAwB;wBAAG;qBAAE;gBAEnF,YAAY;oBACV,iBAAiB;gBACnB;gBACA,OAAO;oBACL,iBAAiB;oBACjB,aAAaF;gBACf;YACF;YACA,4BAA4B;gBAC1BJ;gBACA,SAASG;gBACT,iBAAiB;oBAAC;oBAAGG;oBAAwBA;oBAAwB;iBAAE;gBACvE,YAAY;oBACVN;oBACA,iBAAiB;wBAAC;wBAAGM;wBAAwBA;wBAAwB;qBAAE;gBACzE;gBACA,OAAO;oBACL,aAAaF;gBACf;YACF;YAEA,mBAAmB;gBACjBJ;gBACA,iBAAiB;oBAAC;oBAAGM;oBAAwBA;oBAAwB;iBAAE;gBACvE,SAASH;gBACT,OAAO;oBACL,aAAaC;gBACf;YACF;YACA,gBAAgB;gBACd,aAAa;gBACb,iBAAiB;YACnB;YACA,YAAY;gBACVJ;gBACA,cAAcO;gBACd,iBAAiBD;YACnB;YAEA,WAAW;gBACT,eAAe;oBACb,iBAAiB;gBACnB;gBACA,iBAAiB;oBACf,mBAAmB;gBACrB;gBACA,gBAAgB;oBACd,kBAAkB;gBACpB;YACF;YACA,aAAa;gBACX,SAAS;gBACT,SAAS;YACX;QACF;IACF;AACF"}
|
|
@@ -26,6 +26,7 @@ const pivotIndicators = (chartPipeline)=>(spec, context)=>{
|
|
|
26
26
|
...context,
|
|
27
27
|
advancedVSeed: {
|
|
28
28
|
...advancedVSeed,
|
|
29
|
+
pivotAllDatasetReshapeInfo: datasetReshapeInfo,
|
|
29
30
|
datasetReshapeInfo: newDatasetReshapeInfo,
|
|
30
31
|
encoding: Object.keys(encoding).reduce((res, key)=>{
|
|
31
32
|
res[key] = encoding[key]?.filter((e)=>!invalideMeasuresIds.includes(e));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pipeline/spec/chart/pipes/pivotChart/pivotIndicators.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/chart/pipes/pivotChart/pivotIndicators.ts"],"sourcesContent":["import type { PivotChartConstructorOptions } from '@visactor/vtable'\nimport { execPipeline } from '../../../../utils'\nimport type {\n Dataset,\n Encoding,\n MeasureGroup,\n PivotChartSpecPipe,\n SpecPipelineContext,\n VChartSpecPipe,\n} from 'src/types'\nimport { unique } from 'remeda'\n\nexport const pivotIndicators =\n (chartPipeline: VChartSpecPipe[]): PivotChartSpecPipe =>\n (spec, context): Partial<PivotChartConstructorOptions> => {\n const result = { ...spec } as PivotChartConstructorOptions\n const { advancedVSeed } = context\n const { measures, datasetReshapeInfo, dataset, encoding } = advancedVSeed\n\n const colorItems = unique(datasetReshapeInfo.flatMap((d) => d.unfoldInfo.colorItems))\n const allMeasureIds = unique(datasetReshapeInfo.flatMap((d) => Object.keys(d.foldInfo.foldMap || {})))\n\n const indicators = datasetReshapeInfo.map((reshapeInfo, index) => {\n const measureGroup = measures?.find((d) => d.id === reshapeInfo.id) as MeasureGroup\n const subMeasuresId = (measureGroup?.children || []).map((d) => d.id)\n const invalideMeasuresIds = allMeasureIds.filter((id) => !subMeasuresId.includes(id))\n\n const newDataset = dataset[index] as Dataset\n const newDatasetReshapeInfo = [\n {\n ...reshapeInfo,\n unfoldInfo: { ...reshapeInfo.unfoldInfo, colorItems },\n },\n ]\n const newContext: SpecPipelineContext = {\n ...context,\n advancedVSeed: {\n ...advancedVSeed,\n datasetReshapeInfo: newDatasetReshapeInfo,\n encoding: Object.keys(encoding).reduce((res, key) => {\n res[key as keyof Encoding] = encoding[key as keyof Encoding]?.filter((e) => {\n return !invalideMeasuresIds.includes(e)\n }) as string[]\n\n return res\n }, {} as Encoding),\n dataset: newDataset,\n },\n }\n\n const chartSpec = execPipeline(chartPipeline, newContext, {})\n return {\n indicatorKey: reshapeInfo.id,\n title: measureGroup?.alias,\n cellType: 'chart',\n chartModule: 'vchart',\n chartSpec: chartSpec,\n style: {\n padding: [1, 1, 0, 1],\n },\n }\n })\n\n return {\n ...result,\n indicators: indicators,\n } as Partial<PivotChartConstructorOptions>\n }\n\nexport const pivotIndicatorsAsRow: PivotChartSpecPipe = (spec) => {\n const result = { ...spec } as PivotChartConstructorOptions\n\n return {\n ...result,\n indicatorsAsCol: false,\n }\n}\n\nexport const pivotIndicatorsAsCol: PivotChartSpecPipe = (spec) => {\n const result = { ...spec } as PivotChartConstructorOptions\n\n return {\n ...result,\n indicatorsAsCol: true,\n }\n}\n"],"names":["pivotIndicators","chartPipeline","spec","context","result","advancedVSeed","measures","datasetReshapeInfo","dataset","encoding","colorItems","unique","d","allMeasureIds","Object","indicators","reshapeInfo","index","measureGroup","subMeasuresId","invalideMeasuresIds","id","newDataset","newDatasetReshapeInfo","newContext","res","key","e","chartSpec","execPipeline","pivotIndicatorsAsRow","pivotIndicatorsAsCol"],"mappings":";;AAYO,MAAMA,kBACX,CAACC,gBACD,CAACC,MAAMC;QACL,MAAMC,SAAS;YAAE,GAAGF,IAAI;QAAC;QACzB,MAAM,EAAEG,aAAa,EAAE,GAAGF;QAC1B,MAAM,EAAEG,QAAQ,EAAEC,kBAAkB,EAAEC,OAAO,EAAEC,QAAQ,EAAE,GAAGJ;QAE5D,MAAMK,aAAaC,OAAOJ,mBAAmB,OAAO,CAAC,CAACK,IAAMA,EAAE,UAAU,CAAC,UAAU;QACnF,MAAMC,gBAAgBF,OAAOJ,mBAAmB,OAAO,CAAC,CAACK,IAAME,OAAO,IAAI,CAACF,EAAE,QAAQ,CAAC,OAAO,IAAI,CAAC;QAElG,MAAMG,aAAaR,mBAAmB,GAAG,CAAC,CAACS,aAAaC;YACtD,MAAMC,eAAeZ,UAAU,KAAK,CAACM,IAAMA,EAAE,EAAE,KAAKI,YAAY,EAAE;YAClE,MAAMG,gBAAiBD,AAAAA,CAAAA,cAAc,YAAY,EAAC,EAAG,GAAG,CAAC,CAACN,IAAMA,EAAE,EAAE;YACpE,MAAMQ,sBAAsBP,cAAc,MAAM,CAAC,CAACQ,KAAO,CAACF,cAAc,QAAQ,CAACE;YAEjF,MAAMC,aAAad,OAAO,CAACS,MAAM;YACjC,MAAMM,wBAAwB;gBAC5B;oBACE,GAAGP,WAAW;oBACd,YAAY;wBAAE,GAAGA,YAAY,UAAU;wBAAEN;oBAAW;gBACtD;aACD;YACD,MAAMc,aAAkC;gBACtC,GAAGrB,OAAO;gBACV,eAAe;oBACb,GAAGE,aAAa;oBAChB,
|
|
1
|
+
{"version":3,"file":"pipeline/spec/chart/pipes/pivotChart/pivotIndicators.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/chart/pipes/pivotChart/pivotIndicators.ts"],"sourcesContent":["import type { PivotChartConstructorOptions } from '@visactor/vtable'\nimport { execPipeline } from '../../../../utils'\nimport type {\n Dataset,\n Encoding,\n MeasureGroup,\n PivotChartSpecPipe,\n SpecPipelineContext,\n VChartSpecPipe,\n} from 'src/types'\nimport { unique } from 'remeda'\n\nexport const pivotIndicators =\n (chartPipeline: VChartSpecPipe[]): PivotChartSpecPipe =>\n (spec, context): Partial<PivotChartConstructorOptions> => {\n const result = { ...spec } as PivotChartConstructorOptions\n const { advancedVSeed } = context\n const { measures, datasetReshapeInfo, dataset, encoding } = advancedVSeed\n\n const colorItems = unique(datasetReshapeInfo.flatMap((d) => d.unfoldInfo.colorItems))\n const allMeasureIds = unique(datasetReshapeInfo.flatMap((d) => Object.keys(d.foldInfo.foldMap || {})))\n\n const indicators = datasetReshapeInfo.map((reshapeInfo, index) => {\n const measureGroup = measures?.find((d) => d.id === reshapeInfo.id) as MeasureGroup\n const subMeasuresId = (measureGroup?.children || []).map((d) => d.id)\n const invalideMeasuresIds = allMeasureIds.filter((id) => !subMeasuresId.includes(id))\n\n const newDataset = dataset[index] as Dataset\n const newDatasetReshapeInfo = [\n {\n ...reshapeInfo,\n unfoldInfo: { ...reshapeInfo.unfoldInfo, colorItems },\n },\n ]\n const newContext: SpecPipelineContext = {\n ...context,\n advancedVSeed: {\n ...advancedVSeed,\n pivotAllDatasetReshapeInfo: datasetReshapeInfo,\n datasetReshapeInfo: newDatasetReshapeInfo,\n encoding: Object.keys(encoding).reduce((res, key) => {\n res[key as keyof Encoding] = encoding[key as keyof Encoding]?.filter((e) => {\n return !invalideMeasuresIds.includes(e)\n }) as string[]\n\n return res\n }, {} as Encoding),\n dataset: newDataset,\n },\n }\n\n const chartSpec = execPipeline(chartPipeline, newContext, {})\n return {\n indicatorKey: reshapeInfo.id,\n title: measureGroup?.alias,\n cellType: 'chart',\n chartModule: 'vchart',\n chartSpec: chartSpec,\n style: {\n padding: [1, 1, 0, 1],\n },\n }\n })\n\n return {\n ...result,\n indicators: indicators,\n } as Partial<PivotChartConstructorOptions>\n }\n\nexport const pivotIndicatorsAsRow: PivotChartSpecPipe = (spec) => {\n const result = { ...spec } as PivotChartConstructorOptions\n\n return {\n ...result,\n indicatorsAsCol: false,\n }\n}\n\nexport const pivotIndicatorsAsCol: PivotChartSpecPipe = (spec) => {\n const result = { ...spec } as PivotChartConstructorOptions\n\n return {\n ...result,\n indicatorsAsCol: true,\n }\n}\n"],"names":["pivotIndicators","chartPipeline","spec","context","result","advancedVSeed","measures","datasetReshapeInfo","dataset","encoding","colorItems","unique","d","allMeasureIds","Object","indicators","reshapeInfo","index","measureGroup","subMeasuresId","invalideMeasuresIds","id","newDataset","newDatasetReshapeInfo","newContext","res","key","e","chartSpec","execPipeline","pivotIndicatorsAsRow","pivotIndicatorsAsCol"],"mappings":";;AAYO,MAAMA,kBACX,CAACC,gBACD,CAACC,MAAMC;QACL,MAAMC,SAAS;YAAE,GAAGF,IAAI;QAAC;QACzB,MAAM,EAAEG,aAAa,EAAE,GAAGF;QAC1B,MAAM,EAAEG,QAAQ,EAAEC,kBAAkB,EAAEC,OAAO,EAAEC,QAAQ,EAA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E;gBACvB;YACF;QACF;QAEA,OAAO;YACL,GAAGxB,MAAM;YACT,YAAYW;QACd;IACF;AAEK,MAAMe,uBAA2C,CAAC5B;IACvD,MAAME,SAAS;QAAE,GAAGF,IAAI;IAAC;IAEzB,OAAO;QACL,GAAGE,MAAM;QACT,iBAAiB;IACnB;AACF;AAEO,MAAM2B,uBAA2C,CAAC7B;IACvD,MAAME,SAAS;QAAE,GAAGF,IAAI;IAAC;IAEzB,OAAO;QACL,GAAGE,MAAM;QACT,iBAAiB;IACnB;AACF"}
|
|
@@ -10,16 +10,18 @@ const columnPolynomialRegressionLine = (spec, context)=>{
|
|
|
10
10
|
const lineTheme = advancedVSeed.config[chartType]?.regressionLine;
|
|
11
11
|
if (!regressionLine || !regressionLine.polynomialRegressionLine) return result;
|
|
12
12
|
const lineList = array(regressionLine.polynomialRegressionLine);
|
|
13
|
-
if (!result.
|
|
13
|
+
if (!result.extensionMark) result.extensionMark = [];
|
|
14
14
|
lineList.forEach((line, lineIndex)=>{
|
|
15
|
+
if (false === line.enable) return;
|
|
15
16
|
const theme = lineTheme.linearRegressionLine ?? {};
|
|
16
17
|
const { color, lineWidth, lineDash, text, textColor, textFontSize, textFontWeight, confidenceIntervalOpacity, confidenceIntervalVisible = theme.confidenceIntervalVisible } = line;
|
|
17
18
|
const childrenMarks = [];
|
|
18
|
-
result.
|
|
19
|
+
result.extensionMark.push({
|
|
19
20
|
type: 'group',
|
|
20
21
|
interactive: false,
|
|
21
22
|
zIndex: 500,
|
|
22
23
|
name: `polynomialRegressionLine-${lineIndex}`,
|
|
24
|
+
dataId: spec.data?.id,
|
|
23
25
|
style: {
|
|
24
26
|
data: (datum, ctx)=>{
|
|
25
27
|
const vchart = ctx.vchart;
|
|
@@ -28,8 +30,7 @@ const columnPolynomialRegressionLine = (spec, context)=>{
|
|
|
28
30
|
if (s) {
|
|
29
31
|
const rect = s.getRegion().getLayoutRect();
|
|
30
32
|
if (0 === rect.width || 0 === rect.height) return null;
|
|
31
|
-
const
|
|
32
|
-
const yClamper = clamper(start.y, start.y + rect.height);
|
|
33
|
+
const yClamper = clamper(0, 0 + rect.height);
|
|
33
34
|
const data = s.getViewData()?.latestData;
|
|
34
35
|
const fieldX = s.fieldX?.[0];
|
|
35
36
|
const fieldY = s.fieldY?.[0];
|
|
@@ -54,8 +55,8 @@ const columnPolynomialRegressionLine = (spec, context)=>{
|
|
|
54
55
|
[fieldY]: datum.y
|
|
55
56
|
};
|
|
56
57
|
return {
|
|
57
|
-
x: s.dataToPositionX(d) +
|
|
58
|
-
y: yClamper(s.dataToPositionY(d)
|
|
58
|
+
x: s.dataToPositionX(d) + halfBandWidth,
|
|
59
|
+
y: yClamper(s.dataToPositionY(d))
|
|
59
60
|
};
|
|
60
61
|
});
|
|
61
62
|
const result = {
|
|
@@ -70,11 +71,11 @@ const columnPolynomialRegressionLine = (spec, context)=>{
|
|
|
70
71
|
[fieldY]: datum.lower
|
|
71
72
|
};
|
|
72
73
|
return {
|
|
73
|
-
x: s.dataToPositionX(d) +
|
|
74
|
-
y: yClamper(s.dataToPositionY(d)
|
|
74
|
+
x: s.dataToPositionX(d) + halfBandWidth,
|
|
75
|
+
y: yClamper(s.dataToPositionY(d)),
|
|
75
76
|
y1: yClamper(s.dataToPositionY({
|
|
76
77
|
[fieldY]: datum.upper
|
|
77
|
-
})
|
|
78
|
+
}))
|
|
78
79
|
};
|
|
79
80
|
});
|
|
80
81
|
}
|
|
@@ -89,6 +90,7 @@ const columnPolynomialRegressionLine = (spec, context)=>{
|
|
|
89
90
|
type: 'area',
|
|
90
91
|
interactive: false,
|
|
91
92
|
zIndex: 500,
|
|
93
|
+
dataId: spec.data?.id,
|
|
92
94
|
style: {
|
|
93
95
|
lineWidth: lineWidth ?? theme.lineWidth,
|
|
94
96
|
lineDash: lineDash ?? theme.lineDash,
|
|
@@ -105,6 +107,7 @@ const columnPolynomialRegressionLine = (spec, context)=>{
|
|
|
105
107
|
type: 'line',
|
|
106
108
|
interactive: false,
|
|
107
109
|
zIndex: 500,
|
|
110
|
+
dataId: spec.data?.id,
|
|
108
111
|
style: {
|
|
109
112
|
lineWidth: lineWidth ?? theme.lineWidth,
|
|
110
113
|
lineDash: lineDash ?? theme.lineDash,
|
|
@@ -120,6 +123,7 @@ const columnPolynomialRegressionLine = (spec, context)=>{
|
|
|
120
123
|
type: 'text',
|
|
121
124
|
interactive: false,
|
|
122
125
|
zIndex: 500,
|
|
126
|
+
dataId: spec.data?.id,
|
|
123
127
|
style: {
|
|
124
128
|
textAlign: 'end',
|
|
125
129
|
fill: textColor ?? theme.textColor,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pipeline/spec/chart/pipes/regressionLine/columnRegressionLine.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/chart/pipes/regressionLine/columnRegressionLine.ts"],"sourcesContent":["import type { IBarChartSpec, ICartesianSeries, IChart, IVChart } from '@visactor/vchart'\nimport { isNullish } from 'remeda'\nimport { array, clamper, regressionPolynomial } from '@visactor/vutils'\nimport type {\n Datum,\n VChartSpecPipe,\n RegressionLineConfig,\n LinearRegressionLine,\n PolynomialRegressionLine,\n} from 'src/types'\nimport { defaultRegressionLineColor } from './common'\n\nexport const columnPolynomialRegressionLine: VChartSpecPipe = (spec, context): Partial<IBarChartSpec> => {\n const result = { ...spec } as Partial<IBarChartSpec>\n const { advancedVSeed } = context\n const { chartType, regressionLine } = advancedVSeed\n const lineTheme = advancedVSeed.config[chartType as 'scatter']?.regressionLine as RegressionLineConfig\n\n if (!regressionLine || !regressionLine.polynomialRegressionLine) {\n return result\n }\n\n const lineList = array(regressionLine.polynomialRegressionLine)\n\n if (!result.customMark) {\n result.customMark = []\n }\n\n lineList.forEach((line, lineIndex) => {\n const theme = (lineTheme.linearRegressionLine ?? {}) as LinearRegressionLine\n const {\n color,\n lineWidth,\n lineDash,\n text,\n textColor,\n textFontSize,\n textFontWeight,\n confidenceIntervalOpacity,\n confidenceIntervalVisible = theme.confidenceIntervalVisible,\n } = line as LinearRegressionLine\n\n const childrenMarks: any[] = []\n\n ;(result.customMark as any[]).push({\n type: 'group',\n interactive: false,\n zIndex: 500,\n name: `polynomialRegressionLine-${lineIndex}`,\n style: {\n data: (datum: any, ctx: any) => {\n const vchart = ctx.vchart as IVChart\n const chart = vchart.getChart() as IChart\n const s = chart.getAllSeries()[0] as ICartesianSeries\n\n if (s) {\n const rect = s.getRegion().getLayoutRect()\n\n if (rect.width === 0 || rect.height === 0) {\n return null\n }\n\n const start = s.getRegion().getLayoutStartPoint()\n const yClamper = clamper(start.y, start.y + rect.height)\n const data = s.getViewData()?.latestData as Datum[]\n const fieldX = s.fieldX?.[0]\n const fieldY = s.fieldY?.[0]\n const xValues = s.getRawDataStatisticsByField(fieldX).values as string[]\n\n if (!fieldX || !fieldY || !data || data.length <= 2 || xValues.length <= 2) {\n return null\n }\n\n // eslint-disable-next-line @typescript-eslint/unbound-method\n const { confidenceInterval, evaluateGrid } = regressionPolynomial(\n xValues.map((xVal, index: number) => {\n const filteredData = data.filter((d) => d[fieldX] === xVal)\n\n return {\n x: index,\n y: Math.max(...filteredData.map((d) => d[fieldY] as number)),\n }\n }),\n undefined,\n undefined,\n {\n degree: (line as PolynomialRegressionLine).degree ?? 2,\n },\n )\n const N = xValues.length\n const xAxisHelper = s.getXAxisHelper()\n const halfBandWidth = xAxisHelper ? xAxisHelper.getBandwidth!(0) / 2 : 0\n const lineData = evaluateGrid(N)\n const linePoints = lineData.map((datum: Datum, index: number) => {\n const d = { [fieldX]: xValues[index], [fieldY]: datum.y }\n return {\n x: s.dataToPositionX(d)! + start.x + halfBandWidth,\n y: yClamper(s.dataToPositionY(d)! + start.y),\n }\n })\n const result: {\n linePoints: { x: number; y: number }[]\n areaPoints?: { x: number; y: number; y1: number }[]\n color: string\n } = {\n linePoints,\n color: s.getOption().globalScale.getScale('color')?.scale(s.getSeriesKeys()[0]),\n }\n\n if (confidenceIntervalVisible) {\n const intervalData = confidenceInterval(N)\n\n result.areaPoints = intervalData.map((datum: Datum, index: number) => {\n const d = { [fieldX]: xValues[index], [fieldY]: datum.lower }\n return {\n x: s.dataToPositionX(d)! + start.x + halfBandWidth,\n y: yClamper(s.dataToPositionY(d)! + start.y),\n y1: yClamper(s.dataToPositionY({ [fieldY]: datum.upper })! + start.y),\n }\n })\n }\n\n return result\n }\n return null\n },\n },\n children: childrenMarks,\n })\n\n if (confidenceIntervalVisible) {\n childrenMarks.push({\n type: 'area',\n interactive: false,\n zIndex: 500,\n style: {\n lineWidth: lineWidth ?? theme.lineWidth,\n lineDash: lineDash ?? theme.lineDash,\n fillOpacity: confidenceIntervalOpacity ?? theme.confidenceIntervalOpacity,\n fill: color ?? defaultRegressionLineColor,\n points: (datum: any, ctx: any, opt: any) => {\n const parentNode = opt.mark?._product?.parent\n\n if (parentNode?.attribute?.data) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n return parentNode.attribute.data.areaPoints\n }\n\n return []\n },\n },\n })\n }\n\n childrenMarks.push({\n type: 'line',\n interactive: false,\n zIndex: 500,\n style: {\n lineWidth: lineWidth ?? theme.lineWidth,\n lineDash: lineDash ?? theme.lineDash,\n stroke: color ?? defaultRegressionLineColor,\n points: (datum: any, ctx: any, opt: any) => {\n const parentNode = opt.mark?._product?.parent\n\n if (parentNode?.attribute?.data) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n return parentNode.attribute.data.linePoints\n }\n\n return []\n },\n },\n })\n\n if (!isNullish(text)) {\n childrenMarks.push({\n type: 'text',\n interactive: false,\n zIndex: 500,\n style: {\n textAlign: 'end',\n fill: textColor ?? theme.textColor,\n fontSize: textFontSize ?? theme.textFontSize,\n fontWeight: textFontWeight ?? theme.textFontWeight,\n text: text,\n x: (datum: any, ctx: any, opt: any) => {\n const parentNode = opt.mark?._product?.parent\n\n if (parentNode?.attribute?.data?.linePoints) {\n const points = parentNode.attribute.data.linePoints\n return points[points.length - 1]?.x\n }\n\n return undefined\n },\n y: (datum: any, ctx: any, opt: any) => {\n const parentNode = opt.mark?._product?.parent\n\n if (parentNode?.attribute?.data?.linePoints) {\n const points = parentNode.attribute.data.linePoints\n return points[points.length - 1]?.y\n }\n\n return undefined\n },\n },\n })\n }\n })\n\n return result\n}\n"],"names":["columnPolynomialRegressionLine","spec","context","result","advancedVSeed","chartType","regressionLine","lineTheme","lineList","array","line","lineIndex","theme","color","lineWidth","lineDash","text","textColor","textFontSize","textFontWeight","confidenceIntervalOpacity","confidenceIntervalVisible","childrenMarks","datum","ctx","vchart","chart","s","rect","start","yClamper","clamper","data","fieldX","fieldY","xValues","confidenceInterval","evaluateGrid","regressionPolynomial","xVal","index","filteredData","d","Math","undefined","N","xAxisHelper","halfBandWidth","lineData","linePoints","intervalData","defaultRegressionLineColor","opt","parentNode","isNullish","points"],"mappings":";;;AAYO,MAAMA,iCAAiD,CAACC,MAAMC;IACnE,MAAMC,SAAS;QAAE,GAAGF,IAAI;IAAC;IACzB,MAAM,EAAEG,aAAa,EAAE,GAAGF;IAC1B,MAAM,EAAEG,SAAS,EAAEC,cAAc,EAAE,GAAGF;IACtC,MAAMG,YAAYH,cAAc,MAAM,CAACC,UAAuB,EAAE;IAEhE,IAAI,CAACC,kBAAkB,CAACA,eAAe,wBAAwB,EAC7D,OAAOH;IAGT,MAAMK,WAAWC,MAAMH,eAAe,wBAAwB;IAE9D,IAAI,CAACH,OAAO,UAAU,EACpBA,OAAO,UAAU,GAAG,EAAE;IAGxBK,SAAS,OAAO,CAAC,CAACE,MAAMC;QACtB,MAAMC,QAASL,UAAU,oBAAoB,IAAI,CAAC;QAClD,MAAM,EACJM,KAAK,EACLC,SAAS,EACTC,QAAQ,EACRC,IAAI,EACJC,SAAS,EACTC,YAAY,EACZC,cAAc,EACdC,yBAAyB,EACzBC,4BAA4BT,MAAM,yBAAyB,EAC5D,GAAGF;QAEJ,MAAMY,gBAAuB,EAAE;QAE7BnB,OAAO,UAAU,CAAW,IAAI,CAAC;YACjC,MAAM;YACN,aAAa;YACb,QAAQ;YACR,MAAM,C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I,CAAC,UAAU;wBACnD,OAAOE,MAAM,CAACA,OAAO,MAAM,GAAG,EAAE,EAAE;oBACpC;gBAGF;YACF;QACF;IAEJ;IAEA,OAAOpD;AACT"}
|
|
1
|
+
{"version":3,"file":"pipeline/spec/chart/pipes/regressionLine/columnRegressionLine.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/chart/pipes/regressionLine/columnRegressionLine.ts"],"sourcesContent":["import type { IBarChartSpec, ICartesianSeries, IChart, IVChart } from '@visactor/vchart'\nimport { isNullish } from 'remeda'\nimport { array, clamper, regressionPolynomial } from '@visactor/vutils'\nimport type {\n Datum,\n VChartSpecPipe,\n RegressionLineConfig,\n LinearRegressionLine,\n PolynomialRegressionLine,\n} from 'src/types'\nimport { defaultRegressionLineColor } from './common'\n\nexport const columnPolynomialRegressionLine: VChartSpecPipe = (spec, context): Partial<IBarChartSpec> => {\n const result = { ...spec } as Partial<IBarChartSpec>\n const { advancedVSeed } = context\n const { chartType, regressionLine } = advancedVSeed\n const lineTheme = advancedVSeed.config[chartType as 'scatter']?.regressionLine as RegressionLineConfig\n\n if (!regressionLine || !regressionLine.polynomialRegressionLine) {\n return result\n }\n\n const lineList = array(regressionLine.polynomialRegressionLine)\n\n if (!result.extensionMark) {\n result.extensionMark = []\n }\n\n lineList.forEach((line, lineIndex) => {\n if (line.enable === false) {\n return\n }\n const theme = (lineTheme.linearRegressionLine ?? {}) as LinearRegressionLine\n const {\n color,\n lineWidth,\n lineDash,\n text,\n textColor,\n textFontSize,\n textFontWeight,\n confidenceIntervalOpacity,\n confidenceIntervalVisible = theme.confidenceIntervalVisible,\n } = line as LinearRegressionLine\n\n const childrenMarks: any[] = []\n\n ;(result.extensionMark as any[]).push({\n type: 'group',\n interactive: false,\n zIndex: 500,\n name: `polynomialRegressionLine-${lineIndex}`,\n dataId: (spec.data as any)?.id,\n style: {\n data: (datum: any, ctx: any) => {\n const vchart = ctx.vchart as IVChart\n const chart = vchart.getChart() as IChart\n const s = chart.getAllSeries()[0] as ICartesianSeries\n\n if (s) {\n const rect = s.getRegion().getLayoutRect()\n\n if (rect.width === 0 || rect.height === 0) {\n return null\n }\n\n const yClamper = clamper(0, 0 + rect.height)\n const data = s.getViewData()?.latestData as Datum[]\n const fieldX = s.fieldX?.[0]\n const fieldY = s.fieldY?.[0]\n const xValues = s.getRawDataStatisticsByField(fieldX).values as string[]\n\n if (!fieldX || !fieldY || !data || data.length <= 2 || xValues.length <= 2) {\n return null\n }\n\n // eslint-disable-next-line @typescript-eslint/unbound-method\n const { confidenceInterval, evaluateGrid } = regressionPolynomial(\n xValues.map((xVal, index: number) => {\n const filteredData = data.filter((d) => d[fieldX] === xVal)\n\n return {\n x: index,\n y: Math.max(...filteredData.map((d) => d[fieldY] as number)),\n }\n }),\n undefined,\n undefined,\n {\n degree: (line as PolynomialRegressionLine).degree ?? 2,\n },\n )\n const N = xValues.length\n const xAxisHelper = s.getXAxisHelper()\n const halfBandWidth = xAxisHelper ? xAxisHelper.getBandwidth!(0) / 2 : 0\n const lineData = evaluateGrid(N)\n const linePoints = lineData.map((datum: Datum, index: number) => {\n const d = { [fieldX]: xValues[index], [fieldY]: datum.y }\n return {\n x: s.dataToPositionX(d)! + halfBandWidth,\n y: yClamper(s.dataToPositionY(d)!),\n }\n })\n const result: {\n linePoints: { x: number; y: number }[]\n areaPoints?: { x: number; y: number; y1: number }[]\n color: string\n } = {\n linePoints,\n color: s.getOption().globalScale.getScale('color')?.scale(s.getSeriesKeys()[0]),\n }\n\n if (confidenceIntervalVisible) {\n const intervalData = confidenceInterval(N)\n\n result.areaPoints = intervalData.map((datum: Datum, index: number) => {\n const d = { [fieldX]: xValues[index], [fieldY]: datum.lower }\n return {\n x: s.dataToPositionX(d)! + halfBandWidth,\n y: yClamper(s.dataToPositionY(d)!),\n y1: yClamper(s.dataToPositionY({ [fieldY]: datum.upper })!),\n }\n })\n }\n\n return result\n }\n return null\n },\n },\n children: childrenMarks,\n })\n\n if (confidenceIntervalVisible) {\n childrenMarks.push({\n type: 'area',\n interactive: false,\n zIndex: 500,\n dataId: (spec.data as any)?.id,\n style: {\n lineWidth: lineWidth ?? theme.lineWidth,\n lineDash: lineDash ?? theme.lineDash,\n fillOpacity: confidenceIntervalOpacity ?? theme.confidenceIntervalOpacity,\n fill: color ?? defaultRegressionLineColor,\n points: (datum: any, ctx: any, opt: any) => {\n const parentNode = opt.mark?._product?.parent\n\n if (parentNode?.attribute?.data) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n return parentNode.attribute.data.areaPoints\n }\n\n return []\n },\n },\n })\n }\n\n childrenMarks.push({\n type: 'line',\n interactive: false,\n zIndex: 500,\n dataId: (spec.data as any)?.id,\n style: {\n lineWidth: lineWidth ?? theme.lineWidth,\n lineDash: lineDash ?? theme.lineDash,\n stroke: color ?? defaultRegressionLineColor,\n points: (datum: any, ctx: any, opt: any) => {\n const parentNode = opt.mark?._product?.parent\n\n if (parentNode?.attribute?.data) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n return parentNode.attribute.data.linePoints\n }\n\n return []\n },\n },\n })\n\n if (!isNullish(text)) {\n childrenMarks.push({\n type: 'text',\n interactive: false,\n zIndex: 500,\n dataId: (spec.data as any)?.id,\n style: {\n textAlign: 'end',\n fill: textColor ?? theme.textColor,\n fontSize: textFontSize ?? theme.textFontSize,\n fontWeight: textFontWeight ?? theme.textFontWeight,\n text: text,\n x: (datum: any, ctx: any, opt: any) => {\n const parentNode = opt.mark?._product?.parent\n\n if (parentNode?.attribute?.data?.linePoints) {\n const points = parentNode.attribute.data.linePoints\n return points[points.length - 1]?.x\n }\n\n return undefined\n },\n y: (datum: any, ctx: any, opt: any) => {\n const parentNode = opt.mark?._product?.parent\n\n if (parentNode?.attribute?.data?.linePoints) {\n const points = parentNode.attribute.data.linePoints\n return points[points.length - 1]?.y\n }\n\n return undefined\n },\n },\n })\n }\n })\n\n return result\n}\n"],"names":["columnPolynomialRegressionLine","spec","context","result","advancedVSeed","chartType","regressionLine","lineTheme","lineList","array","line","lineIndex","theme","color","lineWidth","lineDash","text","textColor","textFontSize","textFontWeight","confidenceIntervalOpacity","confidenceIntervalVisible","childrenMarks","datum","ctx","vchart","chart","s","rect","yClamper","clamper","data","fieldX","fieldY","xValues","confidenceInterval","evaluateGrid","regressionPolynomial","xVal","index","filteredData","d","Math","undefined","N","xAxisHelper","halfBandWidth","lineData","linePoints","intervalData","defaultRegressionLineColor","opt","parentNode","isNullish","points"],"mappings":";;;AAYO,MAAMA,iCAAiD,CAACC,MAAMC;IACnE,MAAMC,SAAS;QAAE,GAAGF,IAAI;IAAC;IACzB,MAAM,EAAEG,aAAa,EAAE,GAAGF;IAC1B,MAAM,EAAEG,SAAS,EAAEC,cAAc,EAAE,GAAGF;IACtC,MAAMG,YAAYH,cAAc,MAAM,CAACC,UAAuB,EAAE;IAEhE,IAAI,CAACC,kBAAkB,CAACA,eAAe,wBAAwB,EAC7D,OAAOH;IAGT,MAAMK,WAAWC,MAAMH,eAAe,wBAAwB;IAE9D,IAAI,CAACH,OAAO,aAAa,EACvBA,OAAO,aAAa,GAAG,EAAE;IAG3BK,SAAS,OAAO,CAAC,CAACE,MAAMC;QACtB,IAAID,AAAgB,UAAhBA,KAAK,MAAM,EACb;QAEF,MAAME,QAASL,UAAU,oBAAoB,IAAI,CAAC;QAClD,MAAM,EACJM,KAAK,EACLC,SAAS,EACTC,QAAQ,EACRC,IAAI,EACJC,SAAS,EACTC,YAAY,EACZC,cAAc,EACdC,yBAAyB,EACzBC,4BAA4BT,MAAM,yBAAyB,EAC5D,GAAGF;QAEJ,MAAMY,gBAAuB,EAAE;QAE7BnB,OAAO,aAAa,CAAW,IAAI,CAAC;YACpC,MAAM;YACN,aAAa;YACb,QAAQ;YACR,MAAM,CAAC,yBAAyB,EAAEQ,WAAW;YAC7C,QAASV,KAAK,IAAI,EAAU;YAC5B,OAAO;gBACL,MAAM,CAACsB,OAAYC;oBACjB,MAAMC,SAASD,IAAI,MAAM;oBACzB,MAAME,QAAQD,OA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