@visactor/vseed 0.1.41 → 0.1.42
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/builder.d.ts +360 -0
- package/dist/esm/pipeline/advanced/chart/pipes/analysis/common.d.ts +3 -0
- package/dist/esm/pipeline/advanced/chart/pipes/analysis/common.js +22 -0
- package/dist/esm/pipeline/advanced/chart/pipes/analysis/common.js.map +1 -0
- package/dist/esm/pipeline/advanced/chart/pipes/analysis/index.d.ts +1 -0
- package/dist/esm/pipeline/advanced/chart/pipes/analysis/index.js +1 -0
- package/dist/esm/pipeline/advanced/chart/pipes/analysis/sortLegend.js +1 -19
- package/dist/esm/pipeline/advanced/chart/pipes/analysis/sortLegend.js.map +1 -1
- package/dist/esm/pipeline/advanced/chart/pipes/analysis/sortXBand.d.ts +1 -2
- package/dist/esm/pipeline/advanced/chart/pipes/analysis/sortXBand.js +2 -20
- package/dist/esm/pipeline/advanced/chart/pipes/analysis/sortXBand.js.map +1 -1
- package/dist/esm/pipeline/advanced/chart/pipes/analysis/sortYBand.js +1 -1
- package/dist/esm/pipeline/advanced/chart/pipes/analysis/sortYBand.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipeline/area.js +7 -4
- 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 +4 -2
- package/dist/esm/pipeline/spec/chart/pipeline/bar.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipeline/barParallel.js +4 -2
- package/dist/esm/pipeline/spec/chart/pipeline/barParallel.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipeline/barPercent.js +4 -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 +4 -2
- package/dist/esm/pipeline/spec/chart/pipeline/column.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipeline/columnParallel.js +4 -2
- package/dist/esm/pipeline/spec/chart/pipeline/columnParallel.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipeline/columnPercent.js +4 -2
- package/dist/esm/pipeline/spec/chart/pipeline/columnPercent.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipeline/donut.js +3 -1
- package/dist/esm/pipeline/spec/chart/pipeline/donut.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipeline/dualAxis.js +3 -2
- package/dist/esm/pipeline/spec/chart/pipeline/dualAxis.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipeline/funnel.js +2 -1
- package/dist/esm/pipeline/spec/chart/pipeline/funnel.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipeline/heatmap.js +3 -2
- package/dist/esm/pipeline/spec/chart/pipeline/heatmap.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 +7 -4
- package/dist/esm/pipeline/spec/chart/pipeline/line.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipeline/pie.js +4 -2
- package/dist/esm/pipeline/spec/chart/pipeline/pie.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipeline/radar.js +3 -1
- package/dist/esm/pipeline/spec/chart/pipeline/radar.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipeline/rose.js +3 -1
- package/dist/esm/pipeline/spec/chart/pipeline/rose.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipeline/roseParallel.js +3 -1
- package/dist/esm/pipeline/spec/chart/pipeline/roseParallel.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/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/splitLine.d.ts +2 -0
- package/dist/esm/pipeline/spec/chart/pipes/annotation/splitLine.js +172 -0
- package/dist/esm/pipeline/spec/chart/pipes/annotation/splitLine.js.map +1 -0
- package/dist/esm/pipeline/spec/chart/pipes/index.d.ts +1 -0
- package/dist/esm/pipeline/spec/chart/pipes/index.js +1 -0
- package/dist/esm/pipeline/spec/chart/pipes/init/pivot.js +1 -1
- package/dist/esm/pipeline/spec/chart/pipes/init/pivot.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipes/pivotChart/index.d.ts +2 -0
- package/dist/esm/pipeline/spec/chart/pipes/pivotChart/index.js +3 -1
- package/dist/esm/pipeline/spec/chart/pipes/pivotChart/pivotAxisStyle.d.ts +2 -0
- package/dist/esm/pipeline/spec/chart/pipes/pivotChart/pivotAxisStyle.js +13 -0
- package/dist/esm/pipeline/spec/chart/pipes/pivotChart/pivotAxisStyle.js.map +1 -0
- package/dist/esm/pipeline/spec/chart/pipes/pivotChart/pivotGridStyle.js +38 -32
- package/dist/esm/pipeline/spec/chart/pipes/pivotChart/pivotGridStyle.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipes/pivotChart/pivotTitle.d.ts +2 -0
- package/dist/esm/pipeline/spec/chart/pipes/pivotChart/pivotTitle.js +28 -0
- package/dist/esm/pipeline/spec/chart/pipes/pivotChart/pivotTitle.js.map +1 -0
- package/dist/esm/pipeline/spec/chart/pipes/region/addRegionPadding.d.ts +2 -0
- package/dist/esm/pipeline/spec/chart/pipes/region/addRegionPadding.js +10 -0
- package/dist/esm/pipeline/spec/chart/pipes/region/addRegionPadding.js.map +1 -0
- package/dist/esm/pipeline/spec/chart/pipes/region/index.d.ts +1 -0
- package/dist/esm/pipeline/spec/chart/pipes/region/index.js +1 -0
- package/dist/esm/pipeline/spec/chart/pipes/tooltip/tooltip.d.ts +2 -2
- package/dist/esm/pipeline/spec/chart/pipes/tooltip/tooltip.js +5 -5
- package/dist/esm/pipeline/spec/chart/pipes/tooltip/tooltip.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipes/tooltip/tooltipDualAxis.js +2 -2
- package/dist/esm/pipeline/spec/chart/pipes/tooltip/tooltipDualAxis.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipes/tooltip/tooltipScatter.d.ts +1 -1
- package/dist/esm/pipeline/spec/chart/pipes/tooltip/tooltipScatter.js +1 -6
- package/dist/esm/pipeline/spec/chart/pipes/tooltip/tooltipScatter.js.map +1 -1
- package/dist/esm/theme/common/color.d.ts +4 -0
- package/dist/esm/theme/common/color.js +6 -2
- package/dist/esm/theme/common/color.js.map +1 -1
- package/dist/esm/theme/common/table.d.ts +6 -0
- package/dist/esm/theme/common/table.js +4 -1
- package/dist/esm/theme/common/table.js.map +1 -1
- package/dist/esm/theme/dark/dark.js +2 -2
- package/dist/esm/theme/dark/dark.js.map +1 -1
- package/dist/esm/theme/light/light.js +2 -2
- package/dist/esm/theme/light/light.js.map +1 -1
- package/dist/esm/types/advancedVSeed.d.ts +120 -0
- package/dist/esm/types/properties/annotation/annotationHorizontalLine.d.ts +13 -0
- package/dist/esm/types/properties/config/area.d.ts +6 -0
- package/dist/esm/types/properties/config/bar.d.ts +9 -0
- package/dist/esm/types/properties/config/boxplot.d.ts +3 -0
- package/dist/esm/types/properties/config/color/color.d.ts +8 -0
- package/dist/esm/types/properties/config/color/color.js.map +1 -1
- package/dist/esm/types/properties/config/column.d.ts +9 -0
- package/dist/esm/types/properties/config/config.d.ts +60 -0
- package/dist/esm/types/properties/config/dualAxis.d.ts +3 -0
- package/dist/esm/types/properties/config/funnel.d.ts +3 -0
- package/dist/esm/types/properties/config/heatmap.d.ts +3 -0
- package/dist/esm/types/properties/config/histogram.d.ts +3 -0
- package/dist/esm/types/properties/config/line.d.ts +3 -0
- package/dist/esm/types/properties/config/pie.d.ts +9 -0
- package/dist/esm/types/properties/config/pivotGrid/pivotGrid.d.ts +3 -0
- package/dist/esm/types/properties/config/pivotGrid/pivotGrid.js +4 -1
- package/dist/esm/types/properties/config/pivotGrid/pivotGrid.js.map +1 -1
- package/dist/esm/types/properties/config/rose.d.ts +6 -0
- package/dist/esm/types/properties/config/scatter.d.ts +3 -0
- package/dist/esm/types/properties/theme/customTheme.d.ts +120 -0
- package/dist/umd/index.js +722 -125
- package/dist/umd/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/esm/pipeline/advanced/chart/pipes/analysis/sort.d.ts +0 -0
- package/dist/esm/pipeline/advanced/chart/pipes/analysis/sort.js +0 -0
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import { Color, array } from "@visactor/vutils";
|
|
2
|
+
import { isNullish, isNumber, isPlainObject } from "remeda";
|
|
3
|
+
const splitLine = (spec, context)=>{
|
|
4
|
+
const { advancedVSeed } = context;
|
|
5
|
+
const { annotation, chartType, datasetReshapeInfo } = advancedVSeed;
|
|
6
|
+
if (!annotation || !annotation.annotationHorizontalLine) return spec;
|
|
7
|
+
const baseConfig = advancedVSeed.config[chartType];
|
|
8
|
+
const splitLineConfig = array(annotation.annotationHorizontalLine).find((item)=>!!item.splitLine);
|
|
9
|
+
const splitValue = +splitLineConfig?.yValue;
|
|
10
|
+
if (Number.isNaN(splitValue) || !isNumber(splitValue)) return spec;
|
|
11
|
+
const result = {
|
|
12
|
+
...spec
|
|
13
|
+
};
|
|
14
|
+
const colorTheme = baseConfig?.color ?? {};
|
|
15
|
+
const colorConfig = {
|
|
16
|
+
positiveColor: colorTheme.positiveColor || 'red',
|
|
17
|
+
negativeColor: colorTheme.negativeColor || 'green',
|
|
18
|
+
...isPlainObject(splitLineConfig?.splitLine) ? splitLineConfig?.splitLine : {}
|
|
19
|
+
};
|
|
20
|
+
const groupMark = {
|
|
21
|
+
type: 'group',
|
|
22
|
+
name: 'annotationHorizontalLine-splitLine',
|
|
23
|
+
zIndex: 300,
|
|
24
|
+
style: {
|
|
25
|
+
splitConfig: (datum, ctx)=>{
|
|
26
|
+
const vchart = ctx.vchart;
|
|
27
|
+
const chart = vchart.getChart();
|
|
28
|
+
const lineSeries = chart.getAllSeries().find((s)=>'line' === s.type || 'area' === s.type);
|
|
29
|
+
if (!lineSeries) return;
|
|
30
|
+
const lineMark = lineSeries.getMarkInName('line') ?? lineSeries.getMarkInName('area');
|
|
31
|
+
if (!lineMark) return;
|
|
32
|
+
const lineGraphics = lineMark.getGraphics();
|
|
33
|
+
if (!lineGraphics || 1 !== lineGraphics.length || !lineGraphics[0]) return;
|
|
34
|
+
const points = lineGraphics[0].attribute.points ?? [];
|
|
35
|
+
if (lineGraphics[0].attribute.segments?.length) lineGraphics[0].attribute.segments.forEach((seg)=>{
|
|
36
|
+
seg.points.forEach((pt)=>{
|
|
37
|
+
points.push({
|
|
38
|
+
x: pt.x,
|
|
39
|
+
y: pt.y
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
if (!points || !points.length) return;
|
|
44
|
+
const splitCoordinate = lineSeries.getYAxisHelper().getScale(0).scale(splitValue);
|
|
45
|
+
const minY = Math.min(...points.map((p)=>p.y));
|
|
46
|
+
const maxY = Math.max(...points.map((p)=>p.y));
|
|
47
|
+
const ratio = (splitCoordinate - minY) / (maxY - minY);
|
|
48
|
+
const lineStroke = {
|
|
49
|
+
gradient: 'linear',
|
|
50
|
+
x0: 0,
|
|
51
|
+
x1: 0,
|
|
52
|
+
y0: 0,
|
|
53
|
+
y1: 1,
|
|
54
|
+
stops: [
|
|
55
|
+
{
|
|
56
|
+
color: colorConfig.positiveColor,
|
|
57
|
+
offset: 0
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
color: colorConfig.positiveColor,
|
|
61
|
+
offset: ratio
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
color: colorConfig.negativeColor,
|
|
65
|
+
offset: ratio + 0.0000001
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
color: colorConfig.negativeColor,
|
|
69
|
+
offset: 1
|
|
70
|
+
}
|
|
71
|
+
]
|
|
72
|
+
};
|
|
73
|
+
const areaFill = {
|
|
74
|
+
gradient: 'linear',
|
|
75
|
+
x0: 0,
|
|
76
|
+
x1: 0,
|
|
77
|
+
y0: 0,
|
|
78
|
+
y1: 1,
|
|
79
|
+
stops: [
|
|
80
|
+
{
|
|
81
|
+
color: colorConfig.positiveColor,
|
|
82
|
+
offset: 0
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
color: new Color(colorConfig.positiveColor).setOpacity(0).toRGBA(),
|
|
86
|
+
offset: ratio
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
offset: ratio + 0.0000001,
|
|
90
|
+
color: new Color(colorConfig.negativeColor).setOpacity(0).toRGBA()
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
color: colorConfig.negativeColor,
|
|
94
|
+
offset: 1
|
|
95
|
+
}
|
|
96
|
+
]
|
|
97
|
+
};
|
|
98
|
+
const attrs = {
|
|
99
|
+
segments: null,
|
|
100
|
+
points
|
|
101
|
+
};
|
|
102
|
+
if ('area' === lineGraphics[0].type) {
|
|
103
|
+
attrs.stroke = lineStroke;
|
|
104
|
+
attrs.fill = areaFill;
|
|
105
|
+
} else attrs.stroke = lineStroke;
|
|
106
|
+
lineGraphics[0].setAttributes(attrs);
|
|
107
|
+
lineGraphics[0].setFinalAttributes?.(attrs);
|
|
108
|
+
const start = lineSeries.getRegion().getLayoutStartPoint();
|
|
109
|
+
return {
|
|
110
|
+
points: points.map((entry)=>({
|
|
111
|
+
x: entry.x + start.x,
|
|
112
|
+
y: entry.y + start.y
|
|
113
|
+
})),
|
|
114
|
+
splitCoordinate,
|
|
115
|
+
areaFill,
|
|
116
|
+
lineStroke
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
children: [
|
|
121
|
+
{
|
|
122
|
+
type: 'area',
|
|
123
|
+
interactive: false,
|
|
124
|
+
zIndex: 500,
|
|
125
|
+
style: {
|
|
126
|
+
fillOpacity: 0.5,
|
|
127
|
+
points: (datum, ctx, opt)=>{
|
|
128
|
+
const parentNode = opt.mark?._product?.parent;
|
|
129
|
+
if (parentNode?.attribute?.splitConfig) {
|
|
130
|
+
const { points, splitCoordinate } = parentNode.attribute.splitConfig;
|
|
131
|
+
return points.map((entry)=>({
|
|
132
|
+
...entry,
|
|
133
|
+
y1: splitCoordinate
|
|
134
|
+
}));
|
|
135
|
+
}
|
|
136
|
+
return [];
|
|
137
|
+
},
|
|
138
|
+
fill: (datum, ctx, opt)=>{
|
|
139
|
+
const parentNode = opt.mark?._product?.parent;
|
|
140
|
+
if (parentNode?.attribute?.splitConfig) {
|
|
141
|
+
const { areaFill } = parentNode.attribute.splitConfig;
|
|
142
|
+
return areaFill;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
]
|
|
148
|
+
};
|
|
149
|
+
if (!result.customMark) result.customMark = [];
|
|
150
|
+
result.customMark.push(groupMark);
|
|
151
|
+
const seriesSpec = 'line' === result.type || 'area' === result.type ? result : result.series?.find((s)=>'line' === s.type || 'area' === s.type);
|
|
152
|
+
if (seriesSpec) {
|
|
153
|
+
if (!seriesSpec.point) seriesSpec.point = {};
|
|
154
|
+
if (!seriesSpec.line) seriesSpec.line = {};
|
|
155
|
+
if (!seriesSpec.point.style) seriesSpec.point.style = {};
|
|
156
|
+
if (!seriesSpec.line.style) seriesSpec.line.style = {};
|
|
157
|
+
const measureValueKey = datasetReshapeInfo[0].foldInfo.measureValue;
|
|
158
|
+
seriesSpec.point.style.fill = (datum)=>{
|
|
159
|
+
console.log(datum);
|
|
160
|
+
return datum?.[measureValueKey] >= splitValue ? colorConfig.positiveColor : colorConfig.negativeColor;
|
|
161
|
+
};
|
|
162
|
+
seriesSpec.line.style.stroke = (datum)=>datum?.[measureValueKey] >= splitValue ? colorConfig.positiveColor : colorConfig.negativeColor;
|
|
163
|
+
if (seriesSpec.label && seriesSpec.label.visible && isNullish(seriesSpec.label.style?.fill)) seriesSpec.label.style = {
|
|
164
|
+
...seriesSpec.label.style,
|
|
165
|
+
fill: (datum)=>datum?.[measureValueKey] >= splitValue ? colorConfig.positiveColor : colorConfig.negativeColor
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
return result;
|
|
169
|
+
};
|
|
170
|
+
export { splitLine };
|
|
171
|
+
|
|
172
|
+
//# sourceMappingURL=splitLine.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pipeline/spec/chart/pipes/annotation/splitLine.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/chart/pipes/annotation/splitLine.ts"],"sourcesContent":["import type { ICartesianSeries, IChart, ILineChartSpec, IVChart } from '@visactor/vchart'\nimport { array, Color as VUtilColor } from '@visactor/vutils'\nimport { isNullish, isNumber, isPlainObject } from 'remeda'\nimport type { AnnotationHorizontalLine, SpecPipe, Color } from 'src/types'\n\ninterface SplitConfig {\n points: { x: number; y: number }[]\n splitCoordinate: number\n lineStroke: {\n gradient: string\n x0: number\n x1: number\n y0: number\n y1: number\n stops: {\n color: string\n offset: number\n }[]\n }\n areaFill: {\n gradient: string\n x0: number\n x1: number\n y0: number\n y1: number\n stops: {\n color: string\n offset: number\n }[]\n }\n}\n\nexport const splitLine: SpecPipe = (spec, context) => {\n const { advancedVSeed } = context\n const { annotation, chartType, datasetReshapeInfo } = advancedVSeed\n\n if (!annotation || !annotation.annotationHorizontalLine) {\n return spec\n }\n const baseConfig = advancedVSeed.config[chartType] as { color: Color }\n\n const splitLineConfig = array(annotation.annotationHorizontalLine).find(\n (item) => !!(item as AnnotationHorizontalLine).splitLine,\n ) as AnnotationHorizontalLine | undefined\n\n const splitValue = +(splitLineConfig?.yValue as number | string)\n\n if (Number.isNaN(splitValue) || !isNumber(splitValue)) {\n return spec\n }\n const result = { ...spec } as Partial<ILineChartSpec>\n const colorTheme = baseConfig?.color ?? {}\n const colorConfig = {\n positiveColor: colorTheme.positiveColor || 'red',\n negativeColor: colorTheme.negativeColor || 'green',\n ...(isPlainObject(splitLineConfig?.splitLine) ? splitLineConfig?.splitLine : {}),\n }\n\n const groupMark = {\n type: 'group',\n name: 'annotationHorizontalLine-splitLine',\n zIndex: 300,\n style: {\n splitConfig: (datum: any, ctx: any) => {\n const vchart = ctx.vchart as IVChart\n const chart = vchart.getChart() as IChart\n const lineSeries = chart.getAllSeries().find((s) => s.type === 'line' || s.type === 'area') as ICartesianSeries\n\n if (!lineSeries) {\n return\n }\n const lineMark = lineSeries.getMarkInName('line') ?? lineSeries.getMarkInName('area')\n\n if (!lineMark) {\n return\n }\n const lineGraphics = lineMark.getGraphics()\n\n if (!lineGraphics || lineGraphics.length !== 1 || !lineGraphics[0]) {\n return\n }\n const points = ((lineGraphics[0].attribute as any).points ?? []) as { x: number; y: number }[]\n\n if ((lineGraphics[0].attribute as any).segments?.length) {\n ;((lineGraphics[0].attribute as any).segments as any[]).forEach(\n (seg: { points: { x: number; y: number }[] }) => {\n seg.points.forEach((pt: { x: number; y: number }) => {\n points.push({ x: pt.x, y: pt.y })\n })\n },\n )\n }\n\n if (!points || !points.length) {\n return\n }\n const splitCoordinate = lineSeries.getYAxisHelper().getScale!(0).scale(splitValue)\n const minY = Math.min(...points.map((p) => p.y))\n const maxY = Math.max(...points.map((p) => p.y))\n const ratio = (splitCoordinate - minY) / (maxY - minY)\n const lineStroke = {\n gradient: 'linear',\n x0: 0,\n x1: 0,\n y0: 0,\n y1: 1,\n stops: [\n {\n color: colorConfig.positiveColor,\n offset: 0,\n },\n {\n color: colorConfig.positiveColor,\n offset: ratio,\n },\n {\n color: colorConfig.negativeColor,\n offset: ratio + 0.0000001,\n },\n {\n color: colorConfig.negativeColor,\n offset: 1,\n },\n ],\n }\n const areaFill = {\n gradient: 'linear',\n x0: 0,\n x1: 0,\n y0: 0,\n y1: 1,\n stops: [\n {\n color: colorConfig.positiveColor,\n offset: 0,\n },\n {\n color: new VUtilColor(colorConfig.positiveColor).setOpacity(0).toRGBA(),\n offset: ratio,\n },\n {\n offset: ratio + 0.0000001,\n color: new VUtilColor(colorConfig.negativeColor).setOpacity(0).toRGBA(),\n },\n {\n color: colorConfig.negativeColor,\n offset: 1,\n },\n ],\n }\n const attrs: any = {\n segments: null,\n points,\n }\n\n if (lineGraphics[0].type === 'area') {\n attrs.stroke = lineStroke\n attrs.fill = areaFill\n } else {\n attrs.stroke = lineStroke\n }\n\n lineGraphics[0].setAttributes(attrs as unknown as Record<string, any>)\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call\n lineGraphics[0].setFinalAttributes?.(attrs)\n const start = lineSeries.getRegion().getLayoutStartPoint()\n\n return {\n points: points.map((entry) => ({ x: entry.x + start.x, y: entry.y + start.y })),\n splitCoordinate,\n areaFill,\n lineStroke,\n } as SplitConfig\n },\n },\n children: [\n {\n type: 'area',\n interactive: false,\n zIndex: 500,\n style: {\n fillOpacity: 0.5,\n points: (datum: any, ctx: any, opt: any) => {\n const parentNode = opt.mark?._product?.parent\n\n if (parentNode?.attribute?.splitConfig) {\n const { points, splitCoordinate } = parentNode.attribute.splitConfig as SplitConfig\n\n return points.map((entry: { x: number; y: number }) => {\n return {\n ...entry,\n y1: splitCoordinate,\n }\n })\n }\n\n return []\n },\n fill: (datum: any, ctx: any, opt: any) => {\n const parentNode = opt.mark?._product?.parent\n\n if (parentNode?.attribute?.splitConfig) {\n const { areaFill } = parentNode.attribute.splitConfig as SplitConfig\n\n return areaFill\n }\n\n return\n },\n },\n },\n ],\n }\n\n if (!result.customMark) {\n result.customMark = []\n }\n\n ;(result.customMark as any[]).push(groupMark)\n\n const seriesSpec =\n result.type === 'line' || result.type === 'area'\n ? result\n : result.series?.find((s) => s.type === 'line' || s.type === 'area')\n\n if (seriesSpec) {\n if (!seriesSpec.point) {\n seriesSpec.point = {}\n }\n if (!seriesSpec.line) {\n seriesSpec.line = {}\n }\n\n if (!seriesSpec.point.style) {\n seriesSpec.point.style = {}\n }\n if (!seriesSpec.line.style) {\n seriesSpec.line.style = {}\n }\n\n const measureValueKey = datasetReshapeInfo[0].foldInfo.measureValue\n\n seriesSpec.point.style.fill = (datum) => {\n console.log(datum)\n return datum?.[measureValueKey] >= splitValue ? colorConfig.positiveColor : colorConfig.negativeColor\n }\n seriesSpec.line.style.stroke = (datum) => {\n return datum?.[measureValueKey] >= splitValue ? colorConfig.positiveColor : colorConfig.negativeColor\n }\n if (seriesSpec.label && (seriesSpec.label as any).visible && isNullish((seriesSpec.label as any).style?.fill)) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n ;(seriesSpec.label as any).style = {\n ...(seriesSpec.label as any).style,\n fill: (datum: any) => {\n return datum?.[measureValueKey] >= splitValue ? colorConfig.positiveColor : colorConfig.negativeColor\n },\n }\n }\n }\n\n return result\n}\n"],"names":["splitLine","spec","context","advancedVSeed","annotation","chartType","datasetReshapeInfo","baseConfig","splitLineConfig","array","item","splitValue","Number","isNumber","result","colorTheme","colorConfig","isPlainObject","groupMark","datum","ctx","vchart","chart","lineSeries","s","lineMark","lineGraphics","points","seg","pt","splitCoordinate","minY","Math","p","maxY","ratio","lineStroke","areaFill","VUtilColor","attrs","start","entry","opt","parentNode","seriesSpec","measureValueKey","console","isNullish"],"mappings":";;AAgCO,MAAMA,YAAsB,CAACC,MAAMC;IACxC,MAAM,EAAEC,aAAa,EAAE,GAAGD;IAC1B,MAAM,EAAEE,UAAU,EAAEC,SAAS,EAAEC,kBAAkB,EAAE,GAAGH;IAEtD,IAAI,CAACC,cAAc,CAACA,WAAW,wBAAwB,EACrD,OAAOH;IAET,MAAMM,aAAaJ,cAAc,MAAM,CAACE,UAAU;IAElD,MAAMG,kBAAkBC,MAAML,WAAW,w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init/pivot.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/chart/pipes/init/pivot.ts"],"sourcesContent":["import type { PivotChartConstructorOptions } from '@visactor/vtable'\nimport type { SpecPipe } from 'src/types'\n\nexport const initPivot: SpecPipe = (spec) => {\n const result = { ...spec } as PivotChartConstructorOptions\n\n return {\n ...result,\n animation: true,\n rows: [],\n columns: [],\n indicators: [],\n records: [],\n widthMode: 'standard',\n autoFillWidth: true,\n defaultHeaderColWidth: 'auto',\n defaultColWidth: 200,\n\n heightMode: 'standard',\n autoFillHeight: true,\n defaultRowHeight: 100,\n defaultHeaderRowHeight: 'auto',\n\n indicatorsAsCol: false,\n select: {\n highlightMode: 'cell',\n headerSelectMode: 'inline',\n },\n hover: {\n highlightMode: 'cross',\n },\n tooltip: {\n isShowOverflowTextTooltip: true,\n },\n corner: {\n titleOnDimension: '
|
|
1
|
+
{"version":3,"file":"pipeline/spec/chart/pipes/init/pivot.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/chart/pipes/init/pivot.ts"],"sourcesContent":["import type { PivotChartConstructorOptions } from '@visactor/vtable'\nimport type { SpecPipe } from 'src/types'\n\nexport const initPivot: SpecPipe = (spec) => {\n const result = { ...spec } as PivotChartConstructorOptions\n\n return {\n ...result,\n animation: true,\n rows: [],\n columns: [],\n indicators: [],\n records: [],\n widthMode: 'standard',\n autoFillWidth: true,\n defaultHeaderColWidth: 'auto',\n defaultColWidth: 200,\n\n heightMode: 'standard',\n autoFillHeight: true,\n defaultRowHeight: 100,\n defaultHeaderRowHeight: 'auto',\n\n indicatorsAsCol: false,\n select: {\n highlightMode: 'cell',\n headerSelectMode: 'inline',\n },\n hover: {\n highlightMode: 'cross',\n },\n tooltip: {\n isShowOverflowTextTooltip: true,\n },\n corner: {\n titleOnDimension: 'row',\n },\n animationAppear: {\n duration: 600,\n type: 'all',\n direction: 'row',\n },\n }\n}\n"],"names":["initPivot","spec","result"],"mappings":"AAGO,MAAMA,YAAsB,CAACC;IAClC,MAAMC,SAAS;QAAE,GAAGD,IAAI;IAAC;IAEzB,OAAO;QACL,GAAGC,MAAM;QACT,WAAW;QACX,MAAM,EAAE;QACR,SAAS,EAAE;QACX,YAAY,EAAE;QACd,SAAS,EAAE;QACX,WAAW;QACX,eAAe;QACf,uBAAuB;QACvB,iBAAiB;QAEjB,YAAY;QACZ,gBAAgB;QAChB,kBAAkB;QAClB,wBAAwB;QAExB,iBAAiB;QACjB,QAAQ;YACN,eAAe;YACf,kBAAkB;QACpB;QACA,OAAO;YACL,eAAe;QACjB;QACA,SAAS;YACP,2BAA2B;QAC7B;QACA,QAAQ;YACN,kBAAkB;QACpB;QACA,iBAAiB;YACf,UAAU;YACV,MAAM;YACN,WAAW;QACb;IACF;AACF"}
|
|
@@ -4,3 +4,5 @@ export { pivotGridStyle } from './pivotGridStyle';
|
|
|
4
4
|
export { pivotColumnDimensions } from './pivotColumnDimensions';
|
|
5
5
|
export { pivotRowDimensions } from './pivotRowDimensions';
|
|
6
6
|
export { pivotHideIndicatorName } from './pivotHideIndicatorName';
|
|
7
|
+
export { pivotAxisStyle } from './pivotAxisStyle';
|
|
8
|
+
export { pivotTitle } from './pivotTitle';
|
|
@@ -4,4 +4,6 @@ import { pivotGridStyle } from "./pivotGridStyle.js";
|
|
|
4
4
|
import { pivotColumnDimensions } from "./pivotColumnDimensions.js";
|
|
5
5
|
import { pivotRowDimensions } from "./pivotRowDimensions.js";
|
|
6
6
|
import { pivotHideIndicatorName } from "./pivotHideIndicatorName.js";
|
|
7
|
-
|
|
7
|
+
import { pivotAxisStyle } from "./pivotAxisStyle.js";
|
|
8
|
+
import { pivotTitle } from "./pivotTitle.js";
|
|
9
|
+
export { pivotAdapter, pivotAxisStyle, pivotColumnDimensions, pivotGridStyle, pivotHideIndicatorName, pivotIndicators, pivotIndicatorsAsCol, pivotIndicatorsAsRow, pivotRowDimensions, pivotTitle };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
const pivotAxisStyle = (axisStyle)=>(spec, context)=>{
|
|
2
|
+
const result = axisStyle(spec, context);
|
|
3
|
+
if (result.axes) result.axes.forEach((axis)=>{
|
|
4
|
+
axis.domainLine = {
|
|
5
|
+
visible: false
|
|
6
|
+
};
|
|
7
|
+
if (axis.grid && axis.grid.visible && axis.grid.style) axis.grid.style.strokeOpacity = 0.3;
|
|
8
|
+
});
|
|
9
|
+
return result;
|
|
10
|
+
};
|
|
11
|
+
export { pivotAxisStyle };
|
|
12
|
+
|
|
13
|
+
//# sourceMappingURL=pivotAxisStyle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pipeline/spec/chart/pipes/pivotChart/pivotAxisStyle.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/chart/pipes/pivotChart/pivotAxisStyle.ts"],"sourcesContent":["import type { ILineChartSpec } from '@visactor/vchart'\nimport type { SpecPipe } from 'src/types'\n\nexport const pivotAxisStyle = (axisStyle: SpecPipe): SpecPipe => {\n return (spec, context) => {\n const result = axisStyle(spec, context) as ILineChartSpec\n\n if (result.axes) {\n result.axes.forEach((axis: any) => {\n axis.domainLine = {\n visible: false,\n }\n\n if (axis.grid && axis.grid.visible && axis.grid.style) {\n axis.grid.style.strokeOpacity = 0.3\n }\n })\n }\n\n return result\n }\n}\n"],"names":["pivotAxisStyle","axisStyle","spec","context","result","axis"],"mappings":"AAGO,MAAMA,iBAAiB,CAACC,YACtB,CAACC,MAAMC;QACZ,MAAMC,SAASH,UAAUC,MAAMC;QAE/B,IAAIC,OAAO,IAAI,EACbA,OAAO,IAAI,CAAC,OAAO,CAAC,CAACC;YACnBA,KAAK,UAAU,GAAG;gBAChB,SAAS;YACX;YAEA,IAAIA,KAAK,IAAI,IAAIA,KAAK,IAAI,CAAC,OAAO,IAAIA,KAAK,IAAI,CAAC,KAAK,EACnDA,KAAK,IAAI,CAAC,KAAK,CAAC,aAAa,GAAG;QAEpC;QAGF,OAAOD;IACT"}
|
|
@@ -2,13 +2,14 @@ import { isCombination, isPivot } from "../../../../utils/index.js";
|
|
|
2
2
|
import { isNullish } from "remeda";
|
|
3
3
|
const pivotGridStyle = (spec, context)=>{
|
|
4
4
|
const { vseed, advancedVSeed } = context;
|
|
5
|
-
const { config, chartType } = advancedVSeed;
|
|
5
|
+
const { config, chartType, dimensions } = advancedVSeed;
|
|
6
6
|
const themConfig = config?.[chartType]?.pivotGrid ?? {};
|
|
7
7
|
const onlyCombination = !isPivot(vseed) && isCombination(vseed);
|
|
8
8
|
const result = {
|
|
9
9
|
...spec
|
|
10
10
|
};
|
|
11
11
|
const transparent = 'rgba(0,0,0,0)';
|
|
12
|
+
const hasColumnDimension = dimensions.some((dim)=>'column' === dim.encoding);
|
|
12
13
|
const borderColor = themConfig.borderColor ?? '#e3e5eb';
|
|
13
14
|
const bodyFontColor = themConfig.bodyFontColor ?? '#141414';
|
|
14
15
|
const headerFontColor = themConfig.headerFontColor ?? '#21252c';
|
|
@@ -26,12 +27,12 @@ const pivotGridStyle = (spec, context)=>{
|
|
|
26
27
|
bodyStyle: {
|
|
27
28
|
borderColor,
|
|
28
29
|
color: bodyFontColor,
|
|
29
|
-
borderLineWidth: [
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
30
|
+
borderLineWidth: (arg)=>[
|
|
31
|
+
0 === arg.row ? outlineBorderLineWidth : 1,
|
|
32
|
+
outlineBorderLineWidth,
|
|
33
|
+
0,
|
|
34
|
+
0 === arg.col ? outlineBorderLineWidth : 1
|
|
35
|
+
],
|
|
35
36
|
bgColor: transparent,
|
|
36
37
|
hover: {
|
|
37
38
|
cellBgColor: 'transparent'
|
|
@@ -40,12 +41,12 @@ const pivotGridStyle = (spec, context)=>{
|
|
|
40
41
|
headerStyle: {
|
|
41
42
|
borderColor,
|
|
42
43
|
fontSize: 12,
|
|
43
|
-
borderLineWidth: [
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
44
|
+
borderLineWidth: (arg)=>[
|
|
45
|
+
outlineBorderLineWidth,
|
|
46
|
+
outlineBorderLineWidth,
|
|
47
|
+
1,
|
|
48
|
+
0 === arg.col ? outlineBorderLineWidth : 1
|
|
49
|
+
],
|
|
49
50
|
color: headerFontColor,
|
|
50
51
|
textAlign: 'center',
|
|
51
52
|
bgColor: headerBackgroundColor,
|
|
@@ -65,12 +66,12 @@ const pivotGridStyle = (spec, context)=>{
|
|
|
65
66
|
0,
|
|
66
67
|
4
|
|
67
68
|
],
|
|
68
|
-
borderLineWidth: [
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
69
|
+
borderLineWidth: (arg)=>[
|
|
70
|
+
0 === arg.row ? outlineBorderLineWidth : 1,
|
|
71
|
+
1,
|
|
72
|
+
0,
|
|
73
|
+
outlineBorderLineWidth
|
|
74
|
+
],
|
|
74
75
|
bgColor: headerBackgroundColor,
|
|
75
76
|
hover: {
|
|
76
77
|
cellBgColor: hoverHeaderBackgroundColor,
|
|
@@ -98,13 +99,7 @@ const pivotGridStyle = (spec, context)=>{
|
|
|
98
99
|
],
|
|
99
100
|
bgColor: headerBackgroundColor,
|
|
100
101
|
frameStyle: {
|
|
101
|
-
borderColor
|
|
102
|
-
borderLineWidth: [
|
|
103
|
-
outlineBorderLineWidth,
|
|
104
|
-
0,
|
|
105
|
-
0,
|
|
106
|
-
outlineBorderLineWidth
|
|
107
|
-
]
|
|
102
|
+
borderColor
|
|
108
103
|
},
|
|
109
104
|
hover: {
|
|
110
105
|
cellBgColor: hoverHeaderBackgroundColor,
|
|
@@ -118,9 +113,9 @@ const pivotGridStyle = (spec, context)=>{
|
|
|
118
113
|
frameStyle: {
|
|
119
114
|
borderColor,
|
|
120
115
|
borderLineWidth: [
|
|
116
|
+
outlineBorderLineWidth,
|
|
121
117
|
outlineBorderLineWidth,
|
|
122
118
|
1,
|
|
123
|
-
0,
|
|
124
119
|
1
|
|
125
120
|
]
|
|
126
121
|
},
|
|
@@ -132,7 +127,7 @@ const pivotGridStyle = (spec, context)=>{
|
|
|
132
127
|
cornerLeftBottomCellStyle: {
|
|
133
128
|
borderColor,
|
|
134
129
|
borderLineWidth: [
|
|
135
|
-
|
|
130
|
+
outlineBorderLineWidth,
|
|
136
131
|
0,
|
|
137
132
|
outlineBorderLineWidth,
|
|
138
133
|
outlineBorderLineWidth
|
|
@@ -153,14 +148,19 @@ const pivotGridStyle = (spec, context)=>{
|
|
|
153
148
|
},
|
|
154
149
|
cornerRightBottomCellStyle: {
|
|
155
150
|
borderColor,
|
|
156
|
-
borderLineWidth: 0,
|
|
157
151
|
bgColor: headerBackgroundColor,
|
|
152
|
+
borderLineWidth: [
|
|
153
|
+
1,
|
|
154
|
+
outlineBorderLineWidth,
|
|
155
|
+
outlineBorderLineWidth,
|
|
156
|
+
1
|
|
157
|
+
],
|
|
158
158
|
frameStyle: {
|
|
159
159
|
borderColor,
|
|
160
160
|
borderLineWidth: [
|
|
161
161
|
1,
|
|
162
|
-
|
|
163
|
-
|
|
162
|
+
outlineBorderLineWidth,
|
|
163
|
+
outlineBorderLineWidth,
|
|
164
164
|
1
|
|
165
165
|
]
|
|
166
166
|
},
|
|
@@ -170,9 +170,15 @@ const pivotGridStyle = (spec, context)=>{
|
|
|
170
170
|
},
|
|
171
171
|
rightFrozenStyle: {
|
|
172
172
|
borderColor,
|
|
173
|
-
borderLineWidth: 1,
|
|
174
173
|
bgColor: headerBackgroundColor,
|
|
174
|
+
borderLineWidth: (arg)=>[
|
|
175
|
+
0 === arg.row || hasColumnDimension && 1 === arg.row ? outlineBorderLineWidth : 1,
|
|
176
|
+
outlineBorderLineWidth,
|
|
177
|
+
0,
|
|
178
|
+
1
|
|
179
|
+
],
|
|
175
180
|
hover: {
|
|
181
|
+
borderLineWidth: 0,
|
|
176
182
|
cellBgColor: hoverHeaderBackgroundColor
|
|
177
183
|
}
|
|
178
184
|
},
|
|
@@ -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, SpecPipe } from 'src/types'\nimport { isNullish } from 'remeda'\n\nexport const pivotGridStyle: SpecPipe = (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: [
|
|
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, Dimension, SpecPipe } from 'src/types'\nimport { isNullish } from 'remeda'\n\nexport const pivotGridStyle: SpecPipe = (spec, context) => {\n const { vseed, advancedVSeed } = context\n const { config, chartType, dimensions } = 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 const hasColumnDimension = dimensions.some((dim: Dimension) => dim.encoding === 'column')\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 return [\n arg.row === 0 ? outlineBorderLineWidth : 1,\n outlineBorderLineWidth,\n 0,\n arg.col === 0 ? 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, 4, 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, 4, 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 cornerRightTopCellStyle: {\n borderColor,\n borderLineWidth: 0,\n frameStyle: {\n borderColor,\n borderLineWidth: [outlineBorderLineWidth, outlineBorderLineWidth, 1, 1],\n },\n bgColor: headerBackgroundColor,\n hover: {\n cellBgColor: hoverHeaderBackgroundColor,\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 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 rightFrozenStyle: {\n borderColor,\n bgColor: headerBackgroundColor,\n borderLineWidth: (arg: { row: number }) => {\n return [\n arg.row === 0 || (hasColumnDimension && arg.row === 1) ? outlineBorderLineWidth : 1,\n outlineBorderLineWidth,\n 0,\n 1,\n ]\n },\n hover: {\n borderLineWidth: 0,\n cellBgColor: hoverHeaderBackgroundColor,\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","dimensions","themConfig","onlyCombination","isPivot","isCombination","result","transparent","hasColumnDimension","dim","borderColor","bodyFontColor","headerFontColor","headerBackgroundColor","hoverHeaderBackgroundColor","hoverHeaderInlineBackgroundColor","outlineBorderLineWidth","frameCornerRadius","isNullish","arg","undefined"],"mappings":";;AAKO,MAAMA,iBAA2B,CAACC,MAAMC;IAC7C,MAAM,EAAEC,KAAK,EAAEC,aAAa,EAAE,GAAGF;IACjC,MAAM,EAAEG,MAAM,EAAEC,SAAS,EAAEC,UAAU,EAAE,GAAGH;IAC1C,MAAMI,aAAcH,QAAQ,CAACC,UAAU,EAAqB,aAAa,CAAC;IAE1E,MAAMG,kB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,SAASG;gBACT,iBAAiB,CAACM,MACT;wBACO,MAAZA,IAAI,GAAG,IAAWX,sBAAsBW,AAAY,MAAZA,IAAI,GAAG,GAAUH,yBAAyB;wBAClFA;wBACA;wBACA;qBACD;gBAEH,OAAO;oBACL,iBAAiB;oBACjB,aAAaF;gBACf;YACF;YACA,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"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
const pivotTitle = (spec, context)=>{
|
|
2
|
+
const result = {
|
|
3
|
+
...spec
|
|
4
|
+
};
|
|
5
|
+
const { advancedVSeed } = context;
|
|
6
|
+
const { config, chartType } = advancedVSeed;
|
|
7
|
+
const themConfig = config?.[chartType]?.pivotGrid ?? {};
|
|
8
|
+
if (result.columns && result.columns.length > 0) result.title = {
|
|
9
|
+
text: spec.columns.map((entry)=>entry.title).join('/'),
|
|
10
|
+
align: 'center',
|
|
11
|
+
orient: 'top',
|
|
12
|
+
padding: [
|
|
13
|
+
2,
|
|
14
|
+
0,
|
|
15
|
+
0,
|
|
16
|
+
0
|
|
17
|
+
],
|
|
18
|
+
textStyle: {
|
|
19
|
+
fontSize: themConfig.titleFontSize ?? 12,
|
|
20
|
+
fill: themConfig.titleFontColor ?? '#000',
|
|
21
|
+
fontWeight: themConfig.titleFontWeight ?? 'bold'
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
return result;
|
|
25
|
+
};
|
|
26
|
+
export { pivotTitle };
|
|
27
|
+
|
|
28
|
+
//# sourceMappingURL=pivotTitle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pipeline/spec/chart/pipes/pivotChart/pivotTitle.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/chart/pipes/pivotChart/pivotTitle.ts"],"sourcesContent":["import type { PivotChartConstructorOptions } from '@visactor/vtable'\nimport type { SpecPipe, Config } from 'src/types'\n\nexport const pivotTitle: SpecPipe = (spec, context): Partial<PivotChartConstructorOptions> => {\n const result = { ...spec } as PivotChartConstructorOptions\n const { advancedVSeed } = context\n const { config, chartType } = advancedVSeed\n const themConfig = (config?.[chartType] as Config['line'])?.pivotGrid ?? {}\n\n if (result.columns && result.columns.length > 0) {\n result.title = {\n text: (spec as unknown as { columns: { title: string }[] }).columns.map((entry) => entry.title).join('/'),\n align: 'center',\n orient: 'top',\n padding: [2, 0, 0, 0],\n textStyle: {\n fontSize: themConfig.titleFontSize ?? 12,\n fill: themConfig.titleFontColor ?? '#000',\n fontWeight: themConfig.titleFontWeight ?? 'bold',\n },\n }\n }\n\n return result\n}\n"],"names":["pivotTitle","spec","context","result","advancedVSeed","config","chartType","themConfig","entry"],"mappings":"AAGO,MAAMA,aAAuB,CAACC,MAAMC;IACzC,MAAMC,SAAS;QAAE,GAAGF,IAAI;IAAC;IACzB,MAAM,EAAEG,aAAa,EAAE,GAAGF;IAC1B,MAAM,EAAEG,MAAM,EAAEC,SAAS,EAAE,GAAGF;IAC9B,MAAMG,aAAcF,QAAQ,CAACC,UAAU,EAAqB,aAAa,CAAC;IAE1E,IAAIH,OAAO,OAAO,IAAIA,OAAO,OAAO,CAAC,MAAM,GAAG,GAC5CA,OAAO,KAAK,GAAG;QACb,MAAOF,KAAqD,OAAO,CAAC,GAAG,CAAC,CAACO,QAAUA,MAAM,KAAK,EAAE,IAAI,CAAC;QACrG,OAAO;QACP,QAAQ;QACR,SAAS;YAAC;YAAG;YAAG;YAAG;SAAE;QACrB,WAAW;YACT,UAAUD,WAAW,aAAa,IAAI;YACtC,MAAMA,WAAW,cAAc,IAAI;YACnC,YAAYA,WAAW,eAAe,IAAI;QAC5C;IACF;IAGF,OAAOJ;AACT"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pipeline/spec/chart/pipes/region/addRegionPadding.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/chart/pipes/region/addRegionPadding.ts"],"sourcesContent":["import type { IPieChartSpec } from '@visactor/vchart'\nimport type { SpecPipe } from 'src/types'\n\nexport const addRegionPadding: SpecPipe = (spec) => {\n const result = { ...spec } as IPieChartSpec\n\n if (result.region && result.region.length > 0) {\n result.region[0].padding = 10\n }\n\n return result\n}\n"],"names":["addRegionPadding","spec","result"],"mappings":"AAGO,MAAMA,mBAA6B,CAACC;IACzC,MAAMC,SAAS;QAAE,GAAGD,IAAI;IAAC;IAEzB,IAAIC,OAAO,MAAM,IAAIA,OAAO,MAAM,CAAC,MAAM,GAAG,GAC1CA,OAAO,MAAM,CAAC,EAAE,CAAC,OAAO,GAAG;IAG7B,OAAOA;AACT"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './addRegionPadding';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./addRegionPadding.js";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { Dimensions, FoldInfo, Measures, SpecPipe, UnfoldInfo } from '../../../../../types';
|
|
2
2
|
export declare const tooltip: SpecPipe;
|
|
3
|
-
export declare const createDimensionContent: (measures: Measures, foldInfo: FoldInfo, unfoldInfo: UnfoldInfo) => {
|
|
3
|
+
export declare const createDimensionContent: (dimensions: Dimensions, measures: Measures, foldInfo: FoldInfo, unfoldInfo: UnfoldInfo) => {
|
|
4
4
|
visible: boolean;
|
|
5
5
|
shapeType: string;
|
|
6
6
|
hasShape: boolean;
|
|
7
|
-
key: (v: unknown) => string;
|
|
7
|
+
key: string | ((v: unknown) => string) | undefined;
|
|
8
8
|
value: (v: unknown) => string;
|
|
9
9
|
}[];
|
|
10
10
|
export declare const createMarkContent: (tooltip: string[], dimensions: Dimensions, measures: Measures, foldInfo: FoldInfo, unfoldInfo: UnfoldInfo) => ({
|
|
@@ -25,23 +25,23 @@ const tooltip_tooltip = (spec, context)=>{
|
|
|
25
25
|
title: {
|
|
26
26
|
visible: true
|
|
27
27
|
},
|
|
28
|
-
content: createDimensionContent(measures, foldInfo, unfoldInfo)
|
|
28
|
+
content: createDimensionContent(dimensions, measures, foldInfo, unfoldInfo)
|
|
29
29
|
}
|
|
30
30
|
};
|
|
31
31
|
return result;
|
|
32
32
|
};
|
|
33
|
-
const createDimensionContent = (measures, foldInfo, unfoldInfo)=>{
|
|
34
|
-
const { measureId, measureValue } = foldInfo;
|
|
33
|
+
const createDimensionContent = (dimensions, measures, foldInfo, unfoldInfo)=>{
|
|
34
|
+
const { measureId, measureValue, foldMap } = foldInfo;
|
|
35
35
|
const { encodingColor } = unfoldInfo;
|
|
36
36
|
return [
|
|
37
37
|
{
|
|
38
38
|
visible: true,
|
|
39
39
|
shapeType: 'rectRound',
|
|
40
40
|
hasShape: true,
|
|
41
|
-
key: (v)=>{
|
|
41
|
+
key: dimensions.some((d)=>'color' === d.encoding) ? (v)=>{
|
|
42
42
|
const datum = v;
|
|
43
43
|
return datum && datum[encodingColor] || '';
|
|
44
|
-
},
|
|
44
|
+
} : Object.values(foldMap)[0],
|
|
45
45
|
value: (v)=>{
|
|
46
46
|
const datum = v;
|
|
47
47
|
if (!datum) return '';
|