@visactor/vseed 0.4.25 → 0.4.27
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 +2 -2
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/esm/pipeline/advanced/chart/pipes/config/column.js +1 -0
- package/dist/esm/pipeline/advanced/chart/pipes/config/column.js.map +1 -1
- package/dist/esm/pipeline/advanced/chart/pipes/config/line.js +1 -0
- package/dist/esm/pipeline/advanced/chart/pipes/config/line.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipeline/area.js +5 -1
- package/dist/esm/pipeline/spec/chart/pipeline/area.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipeline/areaPercent.js +3 -1
- package/dist/esm/pipeline/spec/chart/pipeline/areaPercent.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipeline/bar.js +3 -1
- package/dist/esm/pipeline/spec/chart/pipeline/bar.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipeline/barParallel.js +3 -1
- package/dist/esm/pipeline/spec/chart/pipeline/barParallel.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipeline/barPercent.js +3 -1
- package/dist/esm/pipeline/spec/chart/pipeline/barPercent.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipeline/column.js +3 -1
- package/dist/esm/pipeline/spec/chart/pipeline/column.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipeline/columnParallel.js +3 -1
- package/dist/esm/pipeline/spec/chart/pipeline/columnParallel.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipeline/columnPercent.js +3 -1
- package/dist/esm/pipeline/spec/chart/pipeline/columnPercent.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipeline/line.js +5 -1
- package/dist/esm/pipeline/spec/chart/pipeline/line.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipes/annotation/annotationDifferenceLine.js +220 -73
- package/dist/esm/pipeline/spec/chart/pipes/annotation/annotationDifferenceLine.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipes/annotation/annotationDifferenceLineCommon.d.ts +21 -5
- package/dist/esm/pipeline/spec/chart/pipes/annotation/annotationDifferenceLineCommon.js +67 -14
- package/dist/esm/pipeline/spec/chart/pipes/annotation/annotationDifferenceLineCommon.js.map +1 -1
- 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/region/regionPadding.d.ts +2 -0
- package/dist/esm/pipeline/spec/chart/pipes/region/regionPadding.js +20 -0
- package/dist/esm/pipeline/spec/chart/pipes/region/regionPadding.js.map +1 -0
- package/dist/esm/types/chartType/area/area.d.ts +11 -1
- package/dist/esm/types/chartType/area/zArea.d.ts +309 -0
- package/dist/esm/types/chartType/area/zArea.js +3 -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 +6 -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 +6 -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 +6 -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 +6 -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/column/column.d.ts +6 -1
- package/dist/esm/types/chartType/column/zColumn.d.ts +6 -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 +6 -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 +6 -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/line/line.d.ts +11 -1
- package/dist/esm/types/chartType/line/zLine.d.ts +309 -0
- package/dist/esm/types/chartType/line/zLine.js +3 -1
- package/dist/esm/types/chartType/line/zLine.js.map +1 -1
- package/dist/esm/types/properties/config/area.d.ts +12 -0
- package/dist/esm/types/properties/config/area.js +2 -0
- package/dist/esm/types/properties/config/area.js.map +1 -1
- package/dist/esm/types/properties/config/bar.d.ts +18 -0
- package/dist/esm/types/properties/config/bar.js +2 -0
- package/dist/esm/types/properties/config/bar.js.map +1 -1
- package/dist/esm/types/properties/config/column.d.ts +18 -0
- package/dist/esm/types/properties/config/column.js +2 -0
- package/dist/esm/types/properties/config/column.js.map +1 -1
- package/dist/esm/types/properties/config/config.d.ts +66 -0
- package/dist/esm/types/properties/config/line.d.ts +6 -0
- package/dist/esm/types/properties/config/line.js +2 -0
- package/dist/esm/types/properties/config/line.js.map +1 -1
- package/dist/esm/types/properties/config/race.d.ts +12 -0
- package/dist/esm/types/properties/index.d.ts +1 -0
- package/dist/esm/types/properties/index.js +1 -0
- package/dist/esm/types/properties/regionPadding/index.d.ts +2 -0
- package/dist/esm/types/properties/regionPadding/index.js +1 -0
- package/dist/esm/types/properties/regionPadding/regionPadding.d.ts +6 -0
- package/dist/esm/types/properties/regionPadding/regionPadding.js +0 -0
- package/dist/esm/types/properties/regionPadding/zRegionPadding.d.ts +7 -0
- package/dist/esm/types/properties/regionPadding/zRegionPadding.js +11 -0
- package/dist/esm/types/properties/regionPadding/zRegionPadding.js.map +1 -0
- package/dist/esm/types/properties/theme/customTheme.d.ts +132 -0
- package/dist/umd/index.js +552 -291
- package/dist/umd/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pipeline/spec/chart/pipes/annotation/annotationDifferenceLineCommon.js","sources":["../../../../../../../src/pipeline/spec/chart/pipes/annotation/annotationDifferenceLineCommon.ts"],"sourcesContent":["import type { IBarChartSpec, ICartesianSeries } from '@visactor/vchart'\nimport {\n isDimensionSelector,\n isFieldSelector,\n isMeasureSelector,\n isPartialDatumSelector,\n isValueSelector,\n selector,\n} from '../../../../../dataSelector'\nimport { hasMultipleMeasureInSingleView, isBarLikeChart } from 'src/pipeline/utils'\nimport type { AdvancedVSeed, Datum, Selector, Selectors, VSeed } from 'src/types'\nimport { isSubset } from './utils'\n\ntype DifferenceSelectorLabel = 'start' | 'end'\n\nexport type ResolvedDifferenceAnchor = {\n selectorLabel: DifferenceSelectorLabel\n coordinateDatum: Datum\n matchedDatum?: Datum\n stackGroupDatum?: Datum\n value: number\n}\n\nconst toArray = <T>(value: T | T[] | undefined | null): T[] => {\n if (Array.isArray(value)) {\n return value\n }\n\n return value === undefined || value === null ? [] : [value]\n}\n\nconst getDifferenceBandFields = (spec: IBarChartSpec): string[] => {\n return toArray((spec.direction === 'horizontal' ? spec.yField : spec.xField) as string | string[] | undefined)\n}\n\nconst getDifferenceValueField = (spec: IBarChartSpec): string => {\n const valueField = toArray(\n (spec.direction === 'horizontal' ? spec.xField : spec.yField) as string | string[] | undefined,\n )[0]\n\n if (!valueField) {\n throw new Error('annotationDifferenceLine requires a value field in the target chart spec')\n }\n\n return valueField\n}\n\nconst normalizeDifferenceValue = (value: unknown, selectorLabel: DifferenceSelectorLabel, field: string): number => {\n const numberValue = Number(value)\n\n if (Number.isNaN(numberValue)) {\n throw new Error(\n `annotationDifferenceLine ${selectorLabel} selector resolved to a non-numeric value on field \"${field}\"`,\n )\n }\n\n return numberValue\n}\n\nconst buildStackGroupDatum = (datum: Datum, bandFields: string[]) => {\n return Object.fromEntries(bandFields.map((field) => [field, datum[field]])) as Datum\n}\n\nconst buildFallbackSelectorDatum = (selectorValue: Selector | Selectors): Datum | undefined => {\n const selectorList = Array.isArray(selectorValue) ? selectorValue : [selectorValue]\n const fallbackDatum: Datum = {}\n\n for (const currentSelector of selectorList) {\n if (isValueSelector(currentSelector) || isFieldSelector(currentSelector)) {\n return undefined\n }\n\n if (isMeasureSelector(currentSelector)) {\n const operator = currentSelector.operator || currentSelector.op\n const selectorValues = Array.isArray(currentSelector.value) ? currentSelector.value : [currentSelector.value]\n\n if (!['=', '=='].includes(operator as string) || selectorValues.length !== 1) {\n return undefined\n }\n\n fallbackDatum[currentSelector.field] = selectorValues[0]\n continue\n }\n\n if (isDimensionSelector(currentSelector)) {\n const operator = currentSelector.operator || currentSelector.op\n const selectorValues = Array.isArray(currentSelector.value) ? currentSelector.value : [currentSelector.value]\n\n if (operator !== 'in' || selectorValues.length !== 1) {\n return undefined\n }\n\n fallbackDatum[currentSelector.field] = selectorValues[0]\n continue\n }\n\n if (isPartialDatumSelector(currentSelector)) {\n Object.assign(fallbackDatum, currentSelector)\n continue\n }\n\n return undefined\n }\n\n return Object.keys(fallbackDatum).length > 0 ? fallbackDatum : undefined\n}\n\nconst inferFallbackValue = (fallbackDatum: Datum, valueField: string, bandFields: string[]) => {\n if (valueField in fallbackDatum) {\n return fallbackDatum[valueField]\n }\n\n const numericCandidateKeys = Object.keys(fallbackDatum).filter((key) => {\n if (key === valueField || bandFields.includes(key)) {\n return false\n }\n\n return typeof fallbackDatum[key] === 'number'\n })\n\n if (numericCandidateKeys.length !== 1) {\n return undefined\n }\n\n return fallbackDatum[numericCandidateKeys[0]]\n}\n\nconst resolveFallbackAnchor = (options: {\n selectorLabel: DifferenceSelectorLabel\n selectorValue: Selector | Selectors\n valueField: string\n bandFields: string[]\n}): ResolvedDifferenceAnchor | undefined => {\n const { selectorLabel, selectorValue, valueField, bandFields } = options\n const fallbackDatum = buildFallbackSelectorDatum(selectorValue)\n\n if (!fallbackDatum) {\n return undefined\n }\n\n const inferredValue = inferFallbackValue(fallbackDatum, valueField, bandFields)\n\n if (inferredValue === undefined) {\n return undefined\n }\n\n const coordinateDatum = {\n ...fallbackDatum,\n [valueField]: inferredValue,\n }\n\n try {\n return {\n selectorLabel,\n coordinateDatum,\n matchedDatum: fallbackDatum,\n value: normalizeDifferenceValue(inferredValue, selectorLabel, valueField),\n }\n } catch {\n return undefined\n }\n}\n\nconst hasMixedSigns = (values: number[]) => {\n const nonZeroValues = values.filter((value) => value !== 0)\n\n return nonZeroValues.some((value) => value > 0) && nonZeroValues.some((value) => value < 0)\n}\n\nexport const isDifferenceLineStacked = (vseed: VSeed, advancedVSeed: AdvancedVSeed) => {\n return (\n (vseed.chartType === 'column' || vseed.chartType === 'bar') &&\n hasMultipleMeasureInSingleView(advancedVSeed.reshapeMeasures ?? [])\n )\n}\n\nexport const resolveDifferenceAnchor = (options: {\n dataset: Datum[]\n selectorLabel: DifferenceSelectorLabel\n selectorValue: Selector | Selectors\n spec: IBarChartSpec\n isStacked: boolean\n}): ResolvedDifferenceAnchor | undefined => {\n const { dataset, selectorLabel, selectorValue, spec, isStacked } = options\n const matches = dataset.filter((datum) => selector(datum, selectorValue))\n const valueField = getDifferenceValueField(spec)\n const bandFields = getDifferenceBandFields(spec)\n\n if (matches.length === 0) {\n return isStacked ? undefined : resolveFallbackAnchor({ selectorLabel, selectorValue, valueField, bandFields })\n }\n\n if (!isStacked) {\n if (matches.length !== 1) {\n throw new Error(\n `annotationDifferenceLine ${selectorLabel} selector must resolve to exactly one datum, got ${matches.length}`,\n )\n }\n\n return {\n selectorLabel,\n coordinateDatum: matches[0],\n matchedDatum: matches[0],\n value: normalizeDifferenceValue(matches[0][valueField], selectorLabel, valueField),\n }\n }\n const stackGroups = new Map<string, Datum>()\n\n matches.forEach((datum) => {\n const stackGroupDatum = buildStackGroupDatum(datum, bandFields)\n stackGroups.set(JSON.stringify(stackGroupDatum), stackGroupDatum)\n })\n\n if (stackGroups.size !== 1) {\n throw new Error(\n `annotationDifferenceLine ${selectorLabel} selector must resolve to exactly one stack group, got ${stackGroups.size}`,\n )\n }\n\n const stackGroupDatum = Array.from(stackGroups.values())[0]\n const groupRows = dataset.filter((datum) => isSubset(stackGroupDatum, datum))\n const groupValues = groupRows.map((datum) => normalizeDifferenceValue(datum[valueField], selectorLabel, valueField))\n\n if (hasMixedSigns(groupValues)) {\n throw new Error('annotationDifferenceLine does not support mixed-sign stack totals in v1')\n }\n\n return {\n selectorLabel,\n coordinateDatum: stackGroupDatum,\n matchedDatum: matches[0],\n stackGroupDatum,\n value: groupValues.reduce((sum, value) => sum + value, 0),\n }\n}\n\nexport const getStackRuntimeTotal = (runtimeMatches: Datum[]) => {\n const stackEndValues = runtimeMatches.map((datum) => Number(datum.__VCHART_STACK_END))\n\n if (stackEndValues.some((value) => Number.isNaN(value))) {\n return undefined\n }\n\n if (hasMixedSigns(stackEndValues)) {\n throw new Error('annotationDifferenceLine does not support mixed-sign runtime stack totals in v1')\n }\n\n return stackEndValues.some((value) => value < 0) ? Math.min(...stackEndValues) : Math.max(...stackEndValues)\n}\n\nexport const buildDifferenceCoordinateDatum = (options: {\n anchor: ResolvedDifferenceAnchor\n seriesData: Datum[]\n relativeSeries: ICartesianSeries\n}) => {\n const { anchor, seriesData, relativeSeries } = options\n\n if (!anchor.stackGroupDatum) {\n const runtimeMatches = anchor.matchedDatum\n ? seriesData.filter((datum) => isSubset(anchor.matchedDatum as Datum, datum))\n : []\n\n return runtimeMatches[0] ?? anchor.coordinateDatum\n }\n\n const runtimeMatches = seriesData.filter((datum) => isSubset(anchor.stackGroupDatum as Datum, datum))\n const runtimeStackTotal = getStackRuntimeTotal(runtimeMatches)\n\n return {\n ...(runtimeMatches[0] ?? anchor.coordinateDatum),\n [relativeSeries.getStackValueField()]: runtimeStackTotal ?? anchor.value,\n }\n}\n\nexport const buildDifferenceText = (\n startValue: number,\n endValue: number,\n differenceType: 'absolute' | 'percent' = 'absolute',\n) => {\n if (differenceType === 'percent') {\n if (startValue === 0) {\n throw new Error('annotationDifferenceLine percent difference cannot be computed because start value is 0')\n }\n\n return `${(((endValue - startValue) / startValue) * 100).toFixed(0)}%`\n }\n\n return `${endValue - startValue}`\n}\n\nexport const inferDifferenceConnectDirection = (vseed: VSeed, values: [number, number]) => {\n const isNegativeSide = values.every((value) => value < 0)\n\n if (isBarLikeChart(vseed)) {\n return isNegativeSide ? 'left' : 'right'\n }\n\n return isNegativeSide ? 'bottom' : 'top'\n}\n"],"names":["toArray","value","Array","getDifferenceBandFields","spec","getDifferenceValueField","valueField","Error","normalizeDifferenceValue","selectorLabel","field","numberValue","Number","buildStackGroupDatum","datum","bandFields","Object","buildFallbackSelectorDatum","selectorValue","selectorList","fallbackDatum","currentSelector","isValueSelector","isFieldSelector","isMeasureSelector","operator","selectorValues","isDimensionSelector","isPartialDatumSelector","undefined","inferFallbackValue","numericCandidateKeys","key","resolveFallbackAnchor","options","inferredValue","coordinateDatum","hasMixedSigns","values","nonZeroValues","isDifferenceLineStacked","vseed","advancedVSeed","hasMultipleMeasureInSingleView","resolveDifferenceAnchor","dataset","isStacked","matches","selector","stackGroups","Map","stackGroupDatum","JSON","groupRows","isSubset","groupValues","sum","getStackRuntimeTotal","runtimeMatches","stackEndValues","Math","buildDifferenceCoordinateDatum","anchor","seriesData","relativeSeries","runtimeStackTotal","buildDifferenceText","startValue","endValue","differenceType","inferDifferenceConnectDirection","isNegativeSide","isBarLikeChart"],"mappings":";;;AAuBA,MAAMA,UAAU,CAAIC;IACl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UAAU,EAAEC,cAAc,EAAE,GAAG9B;IAE/C,IAAI,CAAC4B,OAAO,eAAe,EAAE;QAC3B,MAAMJ,iBAAiBI,OAAO,YAAY,GACtCC,WAAW,MAAM,CAAC,CAACjD,QAAUwC,SAASQ,OAAO,YAAY,EAAWhD,UACpE,EAAE;QAEN,OAAO4C,cAAc,CAAC,EAAE,IAAII,OAAO,eAAe;IACpD;IAEA,MAAMJ,iBAAiBK,WAAW,MAAM,CAAC,CAACjD,QAAUwC,SAASQ,OAAO,eAAe,EAAWhD;IAC9F,MAAMmD,oBAAoBR,qBAAqBC;IAE/C,OAAO;QACL,GAAIA,cAAc,CAAC,EAAE,IAAII,OAAO,eAAe;QAC/C,CAACE,eAAe,kBAAkB,GAAG,EAAEC,qBAAqBH,OAAO,KAAK;IAC1E;AACF;AAEO,MAAMI,sBAAsB,CACjCC,YACAC,UACAC,iBAAyC,UAAU;IAEnD,IAAIA,AAAmB,cAAnBA,gBAA8B;QAChC,IAAIF,AAAe,MAAfA,YACF,MAAM,IAAI5D,MAAM;QAGlB,OAAO,GAAI,AAAE6D,CAAAA,CAAAA,WAAWD,UAAS,IAAKA,aAAc,GAAE,EAAG,OAAO,CAAC,GAAG,CAAC,CAAC;IACxE;IAEA,OAAO,GAAGC,WAAWD,YAAY;AACnC;AAEO,MAAMG,kCAAkC,CAAC7B,OAAcH;IAC5D,MAAMiC,iBAAiBjC,OAAO,KAAK,CAAC,CAACrC,QAAUA,QAAQ;IAEvD,IAAIuE,eAAe/B,QACjB,OAAO8B,iBAAiB,SAAS;IAGnC,OAAOA,iBAAiB,WAAW;AACrC"}
|
|
1
|
+
{"version":3,"file":"pipeline/spec/chart/pipes/annotation/annotationDifferenceLineCommon.js","sources":["../../../../../../../src/pipeline/spec/chart/pipes/annotation/annotationDifferenceLineCommon.ts"],"sourcesContent":["import type { IAreaChartSpec, IBarChartSpec, ICartesianSeries, ILineChartSpec } from '@visactor/vchart'\nimport {\n isDimensionSelector,\n isFieldSelector,\n isMeasureSelector,\n isPartialDatumSelector,\n isValueSelector,\n selector,\n} from '../../../../../dataSelector'\nimport { hasMultipleMeasureInSingleView, isBarLikeChart } from 'src/pipeline/utils'\nimport type { AdvancedVSeed, Datum, Selector, Selectors, VSeed } from 'src/types'\nimport { isSubset } from './utils'\n\ntype DifferenceSelectorLabel = 'start' | 'end'\ntype DifferenceChartSpec = IBarChartSpec | ILineChartSpec | IAreaChartSpec\nexport type DifferenceStackResolveMode = 'none' | 'stackTotal' | 'auto'\nexport type DifferenceAnchorMode = 'element' | 'stackTotal'\n\nexport type ResolvedDifferenceAnchor = {\n mode: DifferenceAnchorMode\n selectorLabel: DifferenceSelectorLabel\n coordinateDatum: Datum\n matchedDatum?: Datum\n stackGroupDatum?: Datum\n bandDatum: Datum\n bandIndex?: number\n value: number\n}\n\nconst STACK_END_FIELD = '__VCHART_STACK_END'\n\nconst toArray = <T>(value: T | T[] | undefined | null): T[] => {\n if (Array.isArray(value)) {\n return value\n }\n\n return value === undefined || value === null ? [] : [value]\n}\n\nconst getDifferenceBandFields = (spec: DifferenceChartSpec): string[] => {\n return toArray((spec.direction === 'horizontal' ? spec.yField : spec.xField) as string | string[] | undefined)\n}\n\nconst getDifferenceValueField = (spec: DifferenceChartSpec): string => {\n const valueField = toArray(\n (spec.direction === 'horizontal' ? spec.xField : spec.yField) as string | string[] | undefined,\n )[0]\n\n if (!valueField) {\n throw new Error('annotationDifferenceLine requires a value field in the target chart spec')\n }\n\n return valueField\n}\n\nconst normalizeDifferenceValue = (value: unknown, selectorLabel: DifferenceSelectorLabel, field: string): number => {\n const numberValue = Number(value)\n\n if (Number.isNaN(numberValue)) {\n throw new Error(\n `annotationDifferenceLine ${selectorLabel} selector resolved to a non-numeric value on field \"${field}\"`,\n )\n }\n\n return numberValue\n}\n\nconst buildStackGroupDatum = (datum: Datum, bandFields: string[]) => {\n return Object.fromEntries(bandFields.map((field) => [field, datum[field]])) as Datum\n}\n\nconst resolveBandIndex = (dataset: Datum[], bandDatum: Datum) => {\n const bandIndex = dataset.findIndex((datum) => isSubset(bandDatum, datum))\n\n return bandIndex >= 0 ? bandIndex : undefined\n}\n\nconst buildFallbackSelectorDatum = (selectorValue: Selector | Selectors): Datum | undefined => {\n const selectorList = Array.isArray(selectorValue) ? selectorValue : [selectorValue]\n const fallbackDatum: Datum = {}\n\n for (const currentSelector of selectorList) {\n if (isValueSelector(currentSelector) || isFieldSelector(currentSelector)) {\n return undefined\n }\n\n if (isMeasureSelector(currentSelector)) {\n const operator = currentSelector.operator || currentSelector.op\n const selectorValues = Array.isArray(currentSelector.value) ? currentSelector.value : [currentSelector.value]\n\n if (!['=', '=='].includes(operator as string) || selectorValues.length !== 1) {\n return undefined\n }\n\n fallbackDatum[currentSelector.field] = selectorValues[0]\n continue\n }\n\n if (isDimensionSelector(currentSelector)) {\n const operator = currentSelector.operator || currentSelector.op\n const selectorValues = Array.isArray(currentSelector.value) ? currentSelector.value : [currentSelector.value]\n\n if (operator !== 'in' || selectorValues.length !== 1) {\n return undefined\n }\n\n fallbackDatum[currentSelector.field] = selectorValues[0]\n continue\n }\n\n if (isPartialDatumSelector(currentSelector)) {\n Object.assign(fallbackDatum, currentSelector)\n continue\n }\n\n return undefined\n }\n\n return Object.keys(fallbackDatum).length > 0 ? fallbackDatum : undefined\n}\n\nconst inferFallbackValue = (fallbackDatum: Datum, valueField: string, bandFields: string[]) => {\n if (valueField in fallbackDatum) {\n return fallbackDatum[valueField]\n }\n\n const numericCandidateKeys = Object.keys(fallbackDatum).filter((key) => {\n if (key === valueField || bandFields.includes(key)) {\n return false\n }\n\n return typeof fallbackDatum[key] === 'number'\n })\n\n if (numericCandidateKeys.length !== 1) {\n return undefined\n }\n\n return fallbackDatum[numericCandidateKeys[0]]\n}\n\nconst resolveFallbackAnchor = (options: {\n dataset: Datum[]\n selectorLabel: DifferenceSelectorLabel\n selectorValue: Selector | Selectors\n valueField: string\n bandFields: string[]\n}): ResolvedDifferenceAnchor | undefined => {\n const { dataset, selectorLabel, selectorValue, valueField, bandFields } = options\n const fallbackDatum = buildFallbackSelectorDatum(selectorValue)\n\n if (!fallbackDatum) {\n return undefined\n }\n\n const inferredValue = inferFallbackValue(fallbackDatum, valueField, bandFields)\n\n if (inferredValue === undefined) {\n return undefined\n }\n\n const coordinateDatum = {\n ...fallbackDatum,\n [valueField]: inferredValue,\n }\n const bandDatum = buildStackGroupDatum(coordinateDatum, bandFields)\n\n try {\n return {\n mode: 'element',\n selectorLabel,\n coordinateDatum,\n matchedDatum: fallbackDatum,\n bandDatum,\n bandIndex: resolveBandIndex(dataset, bandDatum),\n value: normalizeDifferenceValue(inferredValue, selectorLabel, valueField),\n }\n } catch {\n return undefined\n }\n}\n\nconst hasMixedSigns = (values: number[]) => {\n const nonZeroValues = values.filter((value) => value !== 0)\n\n return nonZeroValues.some((value) => value > 0) && nonZeroValues.some((value) => value < 0)\n}\n\nexport const getDifferenceLineStackResolveMode = (\n vseed: VSeed,\n advancedVSeed: AdvancedVSeed,\n): DifferenceStackResolveMode => {\n const hasMultipleMeasure = hasMultipleMeasureInSingleView(advancedVSeed.reshapeMeasures ?? [])\n\n if (!hasMultipleMeasure) {\n return 'none'\n }\n\n if (vseed.chartType === 'column') {\n return 'auto'\n }\n\n if (vseed.chartType === 'bar') {\n return 'auto'\n }\n\n return 'none'\n}\n\nexport const usesDifferenceLineElementStackEnd = (vseed: VSeed, advancedVSeed: AdvancedVSeed) => {\n return vseed.chartType === 'area' && hasMultipleMeasureInSingleView(advancedVSeed.reshapeMeasures ?? [])\n}\n\nexport const resolveDifferenceAnchor = (options: {\n dataset: Datum[]\n selectorLabel: DifferenceSelectorLabel\n selectorValue: Selector | Selectors\n spec: DifferenceChartSpec\n stackResolveMode: DifferenceStackResolveMode\n allowSelectorFallback?: boolean\n}): ResolvedDifferenceAnchor | undefined => {\n const { dataset, selectorLabel, selectorValue, spec, stackResolveMode, allowSelectorFallback = true } = options\n const matches = dataset.filter((datum) => selector(datum, selectorValue))\n const valueField = getDifferenceValueField(spec)\n const bandFields = getDifferenceBandFields(spec)\n\n if (matches.length === 0) {\n return stackResolveMode === 'none' && allowSelectorFallback\n ? resolveFallbackAnchor({ dataset, selectorLabel, selectorValue, valueField, bandFields })\n : undefined\n }\n\n if (stackResolveMode === 'none' || (stackResolveMode === 'auto' && matches.length === 1)) {\n if (matches.length !== 1) {\n throw new Error(\n `annotationDifferenceLine ${selectorLabel} selector must resolve to exactly one datum, got ${matches.length}`,\n )\n }\n\n const bandDatum = buildStackGroupDatum(matches[0], bandFields)\n\n return {\n mode: 'element',\n selectorLabel,\n coordinateDatum: matches[0],\n matchedDatum: matches[0],\n bandDatum,\n bandIndex: resolveBandIndex(dataset, bandDatum),\n value: normalizeDifferenceValue(matches[0][valueField], selectorLabel, valueField),\n }\n }\n const stackGroups = new Map<string, Datum>()\n\n matches.forEach((datum) => {\n const stackGroupDatum = buildStackGroupDatum(datum, bandFields)\n stackGroups.set(JSON.stringify(stackGroupDatum), stackGroupDatum)\n })\n\n if (stackGroups.size !== 1) {\n throw new Error(\n `annotationDifferenceLine ${selectorLabel} selector must resolve to exactly one stack group, got ${stackGroups.size}`,\n )\n }\n\n const stackGroupDatum = Array.from(stackGroups.values())[0]\n const groupRows = dataset.filter((datum) => isSubset(stackGroupDatum, datum))\n\n if (stackResolveMode === 'auto' && groupRows.length !== matches.length) {\n throw new Error(\n `annotationDifferenceLine ${selectorLabel} selector must resolve to exactly one stack element or one full stack group`,\n )\n }\n const groupValues = groupRows.map((datum) => normalizeDifferenceValue(datum[valueField], selectorLabel, valueField))\n\n if (hasMixedSigns(groupValues)) {\n throw new Error('annotationDifferenceLine does not support mixed-sign stack totals in v1')\n }\n\n return {\n mode: 'stackTotal',\n selectorLabel,\n coordinateDatum: stackGroupDatum,\n matchedDatum: matches[0],\n stackGroupDatum,\n bandDatum: stackGroupDatum,\n bandIndex: resolveBandIndex(dataset, stackGroupDatum),\n value: groupValues.reduce((sum, value) => sum + value, 0),\n }\n}\n\nexport const getStackRuntimeTotal = (runtimeMatches: Datum[]) => {\n if (runtimeMatches.length === 0) {\n return undefined\n }\n\n const stackEndValues = runtimeMatches.map((datum) => Number(datum[STACK_END_FIELD]))\n\n if (stackEndValues.some((value) => !Number.isFinite(value))) {\n return undefined\n }\n\n if (hasMixedSigns(stackEndValues)) {\n throw new Error('annotationDifferenceLine does not support mixed-sign runtime stack totals in v1')\n }\n\n return stackEndValues.some((value) => value < 0) ? Math.min(...stackEndValues) : Math.max(...stackEndValues)\n}\n\nexport const buildDifferenceCoordinateDatum = (options: {\n anchor: ResolvedDifferenceAnchor\n seriesData: Datum[]\n relativeSeries: ICartesianSeries\n useElementStackEnd?: boolean\n}) => {\n const { anchor, seriesData, relativeSeries, useElementStackEnd = false } = options\n\n if (!anchor.stackGroupDatum) {\n const runtimeMatches = anchor.matchedDatum\n ? seriesData.filter((datum) => isSubset(anchor.matchedDatum as Datum, datum))\n : []\n\n if (!useElementStackEnd) {\n return runtimeMatches[0] ?? anchor.coordinateDatum\n }\n\n const runtimeMatch = runtimeMatches[0]\n const runtimeStackEnd = Number(runtimeMatch?.[STACK_END_FIELD])\n\n return {\n ...(runtimeMatch ?? anchor.coordinateDatum),\n [relativeSeries.getStackValueField()]: Number.isFinite(runtimeStackEnd) ? runtimeStackEnd : anchor.value,\n }\n }\n\n const runtimeMatches = seriesData.filter((datum) => isSubset(anchor.stackGroupDatum as Datum, datum))\n const runtimeStackTotal = getStackRuntimeTotal(runtimeMatches)\n\n return {\n ...(runtimeMatches[0] ?? anchor.coordinateDatum),\n [relativeSeries.getStackValueField()]: runtimeStackTotal ?? anchor.value,\n }\n}\n\nexport const getRuntimeDifferenceValue = (options: {\n anchor: ResolvedDifferenceAnchor\n seriesData: Datum[]\n useElementStackEnd?: boolean\n}) => {\n const { anchor, seriesData, useElementStackEnd = false } = options\n\n if (anchor.stackGroupDatum) {\n const runtimeMatches = seriesData.filter((datum) => isSubset(anchor.stackGroupDatum as Datum, datum))\n return getStackRuntimeTotal(runtimeMatches) ?? anchor.value\n }\n\n if (!useElementStackEnd || !anchor.matchedDatum) {\n return anchor.value\n }\n\n const runtimeMatch = seriesData.find((datum) => isSubset(anchor.matchedDatum as Datum, datum))\n const runtimeStackEnd = Number(runtimeMatch?.[STACK_END_FIELD])\n\n return Number.isFinite(runtimeStackEnd) ? runtimeStackEnd : anchor.value\n}\n\nexport const getDifferenceValue = (\n startValue: number,\n endValue: number,\n differenceType: 'absolute' | 'percent' = 'absolute',\n) => {\n if (differenceType === 'percent') {\n if (startValue === 0) {\n throw new Error('annotationDifferenceLine percent difference cannot be computed because start value is 0')\n }\n\n return (endValue - startValue) / startValue\n }\n\n return endValue - startValue\n}\n\nexport const buildDifferenceText = (\n startValue: number,\n endValue: number,\n differenceType: 'absolute' | 'percent' = 'absolute',\n formatter?: (value: number) => string,\n) => {\n const differenceValue = getDifferenceValue(startValue, endValue, differenceType)\n\n if (formatter) {\n return formatter(differenceValue)\n }\n\n if (differenceType === 'percent') {\n return `${(differenceValue * 100).toFixed(2)}%`\n }\n\n return `${differenceValue}`\n}\n\nexport const inferDifferenceConnectDirection = (vseed: VSeed, values: [number, number]) => {\n const isNegativeSide = values.every((value) => value < 0)\n\n if (isBarLikeChart(vseed)) {\n return isNegativeSide ? 'left' : 'right'\n }\n\n return isNegativeSide ? 'bottom' : 'top'\n}\n\nexport const inferDifferenceBracketDirection = (\n start: ResolvedDifferenceAnchor,\n end: ResolvedDifferenceAnchor,\n): 'left' | 'right' => {\n if (start.bandIndex === undefined || end.bandIndex === undefined) {\n return 'right'\n }\n\n return start.bandIndex <= end.bandIndex ? 'right' : 'left'\n}\n"],"names":["STACK_END_FIELD","toArray","value","Array","getDifferenceBandFields","spec","getDifferenceValueField","valueField","Error","normalizeDifferenceValue","selectorLabel","field","numberValue","Number","buildStackGroupDatum","datum","bandFields","Object","resolveBandIndex","dataset","bandDatum","bandIndex","isSubset","undefined","buildFallbackSelectorDatum","selectorValue","selectorList","fallbackDatum","currentSelector","isValueSelector","isFieldSelector","isMeasureSelector","operator","selectorValues","isDimensionSelector","isPartialDatumSelector","inferFallbackValue","numericCandidateKeys","key","resolveFallbackAnchor","options","inferredValue","coordinateDatum","hasMixedSigns","values","nonZeroValues","getDifferenceLineStackResolveMode","vseed","advancedVSeed","hasMultipleMeasure","hasMultipleMeasureInSingleView","usesDifferenceLineElementStackEnd","resolveDifferenceAnchor","stackResolveMode","allowSelectorFallback","matches","selector","stackGroups","Map","stackGroupDatum","JSON","groupRows","groupValues","sum","getStackRuntimeTotal","runtimeMatches","stackEndValues","Math","buildDifferenceCoordinateDatum","anchor","seriesData","relativeSeries","useElementStackEnd","runtimeMatch","runtimeStackEnd","runtimeStackTotal","getRuntimeDifferenceValue","getDifferenceValue","startValue","endValue","differenceType","buildDifferenceText","formatter","differenceValue","inferDifferenceConnectDirection","isNegativeSide","isBarLikeChart","inferDifferenceBracketDirection","start","end"],"mappings":";;;AA6BA,MAAMA,kBAAkB;AAExB,MAAMC,UAAU,CAAIC;IAClB,IAAIC,MAAM,OAAO,CAACD,QAChB,OAAOA;IAGT,OAAOA,QAAAA,QAAwC,EAAE,GAAG;QAACA;KAAM;AAC7D;AAEA,MAAME,0BAA0B,CAACC,OACxBJ,QAASI,AAAmB,iBAAnBA,KAAK,SAAS,GAAoBA,KAAK,MAAM,GAAGA,KAAK,MAAM;AAG7E,MAAMC,0BAA0B,CAACD;IAC/B,MAAME,aAAaN,QAChBI,AAAmB,iBAAnBA,KAAK,SAAS,GAAoBA,KAAK,MAAM,GAAGA,KAAK,MAAM,CAC7D,CAAC,EAAE;IAEJ,IAAI,CAACE,YACH,MAAM,IAAIC,MAAM;IAGlB,OAAOD;AACT;AAEA,MAAME,2BAA2B,CAACP,OAAgBQ,eAAwCC;IACxF,MAAMC,cAAcC,OAAOX;IAE3B,IAAIW,OAAO,KAAK,CAACD,cACf,MAAM,IAAIJ,MACR,CAAC,yBAAyB,EAAEE,cAAc,oDAAoD,EAAEC,MAAM,CAAC,CAAC;IAI5G,OAAOC;AAC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E,WAAlBkE,IAAI,SAAS,EAChD,OAAO;IAGT,OAAOD,MAAM,SAAS,IAAIC,IAAI,SAAS,GAAG,UAAU;AACtD"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
const regionPadding = (spec, context)=>{
|
|
2
|
+
const chartConfig = context.advancedVSeed.config?.[context.vseed.chartType];
|
|
3
|
+
const padding = chartConfig?.regionPadding;
|
|
4
|
+
if (null == padding || !Array.isArray(spec.region)) return spec;
|
|
5
|
+
const region = spec.region;
|
|
6
|
+
if (0 === region.length) return spec;
|
|
7
|
+
return {
|
|
8
|
+
...spec,
|
|
9
|
+
region: [
|
|
10
|
+
{
|
|
11
|
+
...region[0],
|
|
12
|
+
padding
|
|
13
|
+
},
|
|
14
|
+
...region.slice(1)
|
|
15
|
+
]
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
export { regionPadding };
|
|
19
|
+
|
|
20
|
+
//# sourceMappingURL=regionPadding.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pipeline/spec/chart/pipes/region/regionPadding.js","sources":["../../../../../../../src/pipeline/spec/chart/pipes/region/regionPadding.ts"],"sourcesContent":["import type { RegionPadding, VChartSpecPipe } from 'src/types'\n\ntype RegionPaddingConfig = {\n regionPadding?: RegionPadding\n}\n\nexport const regionPadding: VChartSpecPipe = (spec, context) => {\n const chartConfig = context.advancedVSeed.config?.[context.vseed.chartType] as RegionPaddingConfig | undefined\n const padding = chartConfig?.regionPadding\n\n if (padding == null || !Array.isArray((spec as { region?: unknown }).region)) {\n return spec\n }\n\n const region = (spec as { region: Array<Record<string, unknown>> }).region\n if (region.length === 0) {\n return spec\n }\n\n return {\n ...spec,\n region: [\n {\n ...region[0],\n padding,\n },\n ...region.slice(1),\n ],\n }\n}\n"],"names":["regionPadding","spec","context","chartConfig","padding","Array","region"],"mappings":"AAMO,MAAMA,gBAAgC,CAACC,MAAMC;IAClD,MAAMC,cAAcD,QAAQ,aAAa,CAAC,MAAM,EAAE,CAACA,QAAQ,KAAK,CAAC,SAAS,CAAC;IAC3E,MAAME,UAAUD,aAAa;IAE7B,IAAIC,AAAW,QAAXA,WAAmB,CAACC,MAAM,OAAO,CAAEJ,KAA8B,MAAM,GACzE,OAAOA;IAGT,MAAMK,SAAUL,KAAoD,MAAM;IAC1E,IAAIK,AAAkB,MAAlBA,OAAO,MAAM,EACf,OAAOL;IAGT,OAAO;QACL,GAAGA,IAAI;QACP,QAAQ;YACN;gBACE,GAAGK,MAAM,CAAC,EAAE;gBACZF;YACF;eACGE,OAAO,KAAK,CAAC;SACjB;IACH;AACF"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Locale } from '../../i18n';
|
|
2
|
-
import type { AnnotationArea, AnnotationHorizontalLine, AnnotationPoint, AnnotationVerticalLine, AreaStyle, BackgroundColor, Brush, Color, Dataset, Label, Legend, LineStyle, PointStyle, Theme, Tooltip, XBandAxis, YLinearAxis, CrosshairLine, Sort, SortLegend, DimensionLinkage, ColumnDimension, ColumnMeasure, Page } from '../../properties';
|
|
2
|
+
import type { AnnotationArea, AnnotationDifferenceLine, AnnotationHorizontalLine, AnnotationPoint, AnnotationVerticalLine, AreaStyle, BackgroundColor, Brush, Color, Dataset, Label, Legend, LineStyle, PointStyle, Theme, Tooltip, XBandAxis, YLinearAxis, CrosshairLine, Sort, SortLegend, DimensionLinkage, ColumnDimension, ColumnMeasure, Page, RegionPadding } from '../../properties';
|
|
3
3
|
/**
|
|
4
4
|
* @recommend
|
|
5
5
|
* - 推荐字段配置: `1`个指标, `2`个维度
|
|
@@ -85,6 +85,11 @@ export interface Area {
|
|
|
85
85
|
* @description 图例配置, 用于定义图表的图例, 包括图例的位置, 格式, 样式等.
|
|
86
86
|
*/
|
|
87
87
|
legend?: Legend;
|
|
88
|
+
/**
|
|
89
|
+
* 绘图区内边距
|
|
90
|
+
* @description 映射到 VChart 的 region[0].padding,用于为标注、标签等绘图区外扩元素预留空间。
|
|
91
|
+
*/
|
|
92
|
+
regionPadding?: RegionPadding;
|
|
88
93
|
/**
|
|
89
94
|
* 提示信息
|
|
90
95
|
* @description 提示信息配置, 用于定义图表的提示信息, 包括提示信息的位置, 格式, 样式等.
|
|
@@ -184,6 +189,11 @@ export interface Area {
|
|
|
184
189
|
* @description 标注区域配置, 根据选择的数据, 定义图表的标注区域, 包括标注区域的位置, 样式等.
|
|
185
190
|
*/
|
|
186
191
|
annotationArea?: AnnotationArea | AnnotationArea[];
|
|
192
|
+
/**
|
|
193
|
+
* 差异标注线
|
|
194
|
+
* @description 根据两个选中的数据点,绘制差异标注线并自动计算差异文本。
|
|
195
|
+
*/
|
|
196
|
+
annotationDifferenceLine?: AnnotationDifferenceLine | AnnotationDifferenceLine[];
|
|
187
197
|
/**
|
|
188
198
|
* @description 当图表开启透视功能或者指标组合的是否,是否开启维度联动功能
|
|
189
199
|
* 当hover 到某个维度值时,联动高亮其他图表中相同维度值的数据
|
|
@@ -422,6 +422,12 @@ export declare const zArea: z.ZodObject<{
|
|
|
422
422
|
labelFontSize: z.ZodOptional<z.ZodNullable<z.ZodDefault<z.ZodNumber>>>;
|
|
423
423
|
labelFontWeight: z.ZodOptional<z.ZodNullable<z.ZodDefault<z.ZodUnion<[z.ZodNumber, z.ZodString]>>>>;
|
|
424
424
|
}, z.core.$strip>>>;
|
|
425
|
+
regionPadding: z.ZodOptional<z.ZodNullable<z.ZodUnion<[z.ZodNumber, z.ZodObject<{
|
|
426
|
+
top: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodNumber>>>;
|
|
427
|
+
right: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodNumber>>>;
|
|
428
|
+
bottom: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodNumber>>>;
|
|
429
|
+
left: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodNumber>>>;
|
|
430
|
+
}, z.core.$strip>]>>>;
|
|
425
431
|
tooltip: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
426
432
|
enable: z.ZodOptional<z.ZodNullable<z.ZodDefault<z.ZodBoolean>>>;
|
|
427
433
|
borderColor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
@@ -2357,6 +2363,309 @@ export declare const zArea: z.ZodObject<{
|
|
|
2357
2363
|
areaLineDash: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodNumber>>>;
|
|
2358
2364
|
outerPadding: z.ZodOptional<z.ZodNullable<z.ZodDefault<z.ZodNumber>>>;
|
|
2359
2365
|
}, z.core.$strip>]>>>;
|
|
2366
|
+
annotationDifferenceLine: z.ZodOptional<z.ZodNullable<z.ZodUnion<[z.ZodArray<z.ZodObject<{
|
|
2367
|
+
start: z.ZodObject<{
|
|
2368
|
+
selector: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodRecord<z.ZodUnion<[z.ZodString, z.ZodNumber]>, z.ZodAny>, z.ZodObject<{
|
|
2369
|
+
field: z.ZodString;
|
|
2370
|
+
operator: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
2371
|
+
"=": "=";
|
|
2372
|
+
"==": "==";
|
|
2373
|
+
"!=": "!=";
|
|
2374
|
+
">": ">";
|
|
2375
|
+
"<": "<";
|
|
2376
|
+
">=": ">=";
|
|
2377
|
+
"<=": "<=";
|
|
2378
|
+
between: "between";
|
|
2379
|
+
}>>>;
|
|
2380
|
+
op: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
2381
|
+
"=": "=";
|
|
2382
|
+
"==": "==";
|
|
2383
|
+
"!=": "!=";
|
|
2384
|
+
">": ">";
|
|
2385
|
+
"<": "<";
|
|
2386
|
+
">=": ">=";
|
|
2387
|
+
"<=": "<=";
|
|
2388
|
+
between: "between";
|
|
2389
|
+
}>>>;
|
|
2390
|
+
value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>]>;
|
|
2391
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
2392
|
+
field: z.ZodString;
|
|
2393
|
+
operator: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
2394
|
+
in: "in";
|
|
2395
|
+
"not in": "not in";
|
|
2396
|
+
}>>>;
|
|
2397
|
+
op: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
2398
|
+
in: "in";
|
|
2399
|
+
"not in": "not in";
|
|
2400
|
+
}>>>;
|
|
2401
|
+
value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>]>;
|
|
2402
|
+
}, z.core.$strip>]>, z.ZodArray<z.ZodUnion<readonly [z.ZodRecord<z.ZodUnion<[z.ZodString, z.ZodNumber]>, z.ZodAny>, z.ZodObject<{
|
|
2403
|
+
field: z.ZodString;
|
|
2404
|
+
operator: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
2405
|
+
"=": "=";
|
|
2406
|
+
"==": "==";
|
|
2407
|
+
"!=": "!=";
|
|
2408
|
+
">": ">";
|
|
2409
|
+
"<": "<";
|
|
2410
|
+
">=": ">=";
|
|
2411
|
+
"<=": "<=";
|
|
2412
|
+
between: "between";
|
|
2413
|
+
}>>>;
|
|
2414
|
+
op: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
2415
|
+
"=": "=";
|
|
2416
|
+
"==": "==";
|
|
2417
|
+
"!=": "!=";
|
|
2418
|
+
">": ">";
|
|
2419
|
+
"<": "<";
|
|
2420
|
+
">=": ">=";
|
|
2421
|
+
"<=": "<=";
|
|
2422
|
+
between: "between";
|
|
2423
|
+
}>>>;
|
|
2424
|
+
value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>]>;
|
|
2425
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
2426
|
+
field: z.ZodString;
|
|
2427
|
+
operator: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
2428
|
+
in: "in";
|
|
2429
|
+
"not in": "not in";
|
|
2430
|
+
}>>>;
|
|
2431
|
+
op: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
2432
|
+
in: "in";
|
|
2433
|
+
"not in": "not in";
|
|
2434
|
+
}>>>;
|
|
2435
|
+
value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>]>;
|
|
2436
|
+
}, z.core.$strip>]>>]>;
|
|
2437
|
+
}, z.core.$strip>;
|
|
2438
|
+
end: z.ZodObject<{
|
|
2439
|
+
selector: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodRecord<z.ZodUnion<[z.ZodString, z.ZodNumber]>, z.ZodAny>, z.ZodObject<{
|
|
2440
|
+
field: z.ZodString;
|
|
2441
|
+
operator: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
2442
|
+
"=": "=";
|
|
2443
|
+
"==": "==";
|
|
2444
|
+
"!=": "!=";
|
|
2445
|
+
">": ">";
|
|
2446
|
+
"<": "<";
|
|
2447
|
+
">=": ">=";
|
|
2448
|
+
"<=": "<=";
|
|
2449
|
+
between: "between";
|
|
2450
|
+
}>>>;
|
|
2451
|
+
op: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
2452
|
+
"=": "=";
|
|
2453
|
+
"==": "==";
|
|
2454
|
+
"!=": "!=";
|
|
2455
|
+
">": ">";
|
|
2456
|
+
"<": "<";
|
|
2457
|
+
">=": ">=";
|
|
2458
|
+
"<=": "<=";
|
|
2459
|
+
between: "between";
|
|
2460
|
+
}>>>;
|
|
2461
|
+
value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>]>;
|
|
2462
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
2463
|
+
field: z.ZodString;
|
|
2464
|
+
operator: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
2465
|
+
in: "in";
|
|
2466
|
+
"not in": "not in";
|
|
2467
|
+
}>>>;
|
|
2468
|
+
op: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
2469
|
+
in: "in";
|
|
2470
|
+
"not in": "not in";
|
|
2471
|
+
}>>>;
|
|
2472
|
+
value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>]>;
|
|
2473
|
+
}, z.core.$strip>]>, z.ZodArray<z.ZodUnion<readonly [z.ZodRecord<z.ZodUnion<[z.ZodString, z.ZodNumber]>, z.ZodAny>, z.ZodObject<{
|
|
2474
|
+
field: z.ZodString;
|
|
2475
|
+
operator: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
2476
|
+
"=": "=";
|
|
2477
|
+
"==": "==";
|
|
2478
|
+
"!=": "!=";
|
|
2479
|
+
">": ">";
|
|
2480
|
+
"<": "<";
|
|
2481
|
+
">=": ">=";
|
|
2482
|
+
"<=": "<=";
|
|
2483
|
+
between: "between";
|
|
2484
|
+
}>>>;
|
|
2485
|
+
op: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
2486
|
+
"=": "=";
|
|
2487
|
+
"==": "==";
|
|
2488
|
+
"!=": "!=";
|
|
2489
|
+
">": ">";
|
|
2490
|
+
"<": "<";
|
|
2491
|
+
">=": ">=";
|
|
2492
|
+
"<=": "<=";
|
|
2493
|
+
between: "between";
|
|
2494
|
+
}>>>;
|
|
2495
|
+
value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>]>;
|
|
2496
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
2497
|
+
field: z.ZodString;
|
|
2498
|
+
operator: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
2499
|
+
in: "in";
|
|
2500
|
+
"not in": "not in";
|
|
2501
|
+
}>>>;
|
|
2502
|
+
op: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
2503
|
+
in: "in";
|
|
2504
|
+
"not in": "not in";
|
|
2505
|
+
}>>>;
|
|
2506
|
+
value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>]>;
|
|
2507
|
+
}, z.core.$strip>]>>]>;
|
|
2508
|
+
}, z.core.$strip>;
|
|
2509
|
+
differenceType: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
2510
|
+
percent: "percent";
|
|
2511
|
+
absolute: "absolute";
|
|
2512
|
+
}>>>;
|
|
2513
|
+
textFontSize: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
2514
|
+
textColor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
2515
|
+
textBackgroundColor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
2516
|
+
lineColor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
2517
|
+
}, z.core.$strip>>, z.ZodObject<{
|
|
2518
|
+
start: z.ZodObject<{
|
|
2519
|
+
selector: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodRecord<z.ZodUnion<[z.ZodString, z.ZodNumber]>, z.ZodAny>, z.ZodObject<{
|
|
2520
|
+
field: z.ZodString;
|
|
2521
|
+
operator: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
2522
|
+
"=": "=";
|
|
2523
|
+
"==": "==";
|
|
2524
|
+
"!=": "!=";
|
|
2525
|
+
">": ">";
|
|
2526
|
+
"<": "<";
|
|
2527
|
+
">=": ">=";
|
|
2528
|
+
"<=": "<=";
|
|
2529
|
+
between: "between";
|
|
2530
|
+
}>>>;
|
|
2531
|
+
op: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
2532
|
+
"=": "=";
|
|
2533
|
+
"==": "==";
|
|
2534
|
+
"!=": "!=";
|
|
2535
|
+
">": ">";
|
|
2536
|
+
"<": "<";
|
|
2537
|
+
">=": ">=";
|
|
2538
|
+
"<=": "<=";
|
|
2539
|
+
between: "between";
|
|
2540
|
+
}>>>;
|
|
2541
|
+
value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>]>;
|
|
2542
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
2543
|
+
field: z.ZodString;
|
|
2544
|
+
operator: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
2545
|
+
in: "in";
|
|
2546
|
+
"not in": "not in";
|
|
2547
|
+
}>>>;
|
|
2548
|
+
op: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
2549
|
+
in: "in";
|
|
2550
|
+
"not in": "not in";
|
|
2551
|
+
}>>>;
|
|
2552
|
+
value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>]>;
|
|
2553
|
+
}, z.core.$strip>]>, z.ZodArray<z.ZodUnion<readonly [z.ZodRecord<z.ZodUnion<[z.ZodString, z.ZodNumber]>, z.ZodAny>, z.ZodObject<{
|
|
2554
|
+
field: z.ZodString;
|
|
2555
|
+
operator: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
2556
|
+
"=": "=";
|
|
2557
|
+
"==": "==";
|
|
2558
|
+
"!=": "!=";
|
|
2559
|
+
">": ">";
|
|
2560
|
+
"<": "<";
|
|
2561
|
+
">=": ">=";
|
|
2562
|
+
"<=": "<=";
|
|
2563
|
+
between: "between";
|
|
2564
|
+
}>>>;
|
|
2565
|
+
op: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
2566
|
+
"=": "=";
|
|
2567
|
+
"==": "==";
|
|
2568
|
+
"!=": "!=";
|
|
2569
|
+
">": ">";
|
|
2570
|
+
"<": "<";
|
|
2571
|
+
">=": ">=";
|
|
2572
|
+
"<=": "<=";
|
|
2573
|
+
between: "between";
|
|
2574
|
+
}>>>;
|
|
2575
|
+
value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>]>;
|
|
2576
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
2577
|
+
field: z.ZodString;
|
|
2578
|
+
operator: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
2579
|
+
in: "in";
|
|
2580
|
+
"not in": "not in";
|
|
2581
|
+
}>>>;
|
|
2582
|
+
op: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
2583
|
+
in: "in";
|
|
2584
|
+
"not in": "not in";
|
|
2585
|
+
}>>>;
|
|
2586
|
+
value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>]>;
|
|
2587
|
+
}, z.core.$strip>]>>]>;
|
|
2588
|
+
}, z.core.$strip>;
|
|
2589
|
+
end: z.ZodObject<{
|
|
2590
|
+
selector: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodRecord<z.ZodUnion<[z.ZodString, z.ZodNumber]>, z.ZodAny>, z.ZodObject<{
|
|
2591
|
+
field: z.ZodString;
|
|
2592
|
+
operator: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
2593
|
+
"=": "=";
|
|
2594
|
+
"==": "==";
|
|
2595
|
+
"!=": "!=";
|
|
2596
|
+
">": ">";
|
|
2597
|
+
"<": "<";
|
|
2598
|
+
">=": ">=";
|
|
2599
|
+
"<=": "<=";
|
|
2600
|
+
between: "between";
|
|
2601
|
+
}>>>;
|
|
2602
|
+
op: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
2603
|
+
"=": "=";
|
|
2604
|
+
"==": "==";
|
|
2605
|
+
"!=": "!=";
|
|
2606
|
+
">": ">";
|
|
2607
|
+
"<": "<";
|
|
2608
|
+
">=": ">=";
|
|
2609
|
+
"<=": "<=";
|
|
2610
|
+
between: "between";
|
|
2611
|
+
}>>>;
|
|
2612
|
+
value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>]>;
|
|
2613
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
2614
|
+
field: z.ZodString;
|
|
2615
|
+
operator: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
2616
|
+
in: "in";
|
|
2617
|
+
"not in": "not in";
|
|
2618
|
+
}>>>;
|
|
2619
|
+
op: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
2620
|
+
in: "in";
|
|
2621
|
+
"not in": "not in";
|
|
2622
|
+
}>>>;
|
|
2623
|
+
value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>]>;
|
|
2624
|
+
}, z.core.$strip>]>, z.ZodArray<z.ZodUnion<readonly [z.ZodRecord<z.ZodUnion<[z.ZodString, z.ZodNumber]>, z.ZodAny>, z.ZodObject<{
|
|
2625
|
+
field: z.ZodString;
|
|
2626
|
+
operator: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
2627
|
+
"=": "=";
|
|
2628
|
+
"==": "==";
|
|
2629
|
+
"!=": "!=";
|
|
2630
|
+
">": ">";
|
|
2631
|
+
"<": "<";
|
|
2632
|
+
">=": ">=";
|
|
2633
|
+
"<=": "<=";
|
|
2634
|
+
between: "between";
|
|
2635
|
+
}>>>;
|
|
2636
|
+
op: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
2637
|
+
"=": "=";
|
|
2638
|
+
"==": "==";
|
|
2639
|
+
"!=": "!=";
|
|
2640
|
+
">": ">";
|
|
2641
|
+
"<": "<";
|
|
2642
|
+
">=": ">=";
|
|
2643
|
+
"<=": "<=";
|
|
2644
|
+
between: "between";
|
|
2645
|
+
}>>>;
|
|
2646
|
+
value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>]>;
|
|
2647
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
2648
|
+
field: z.ZodString;
|
|
2649
|
+
operator: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
2650
|
+
in: "in";
|
|
2651
|
+
"not in": "not in";
|
|
2652
|
+
}>>>;
|
|
2653
|
+
op: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
2654
|
+
in: "in";
|
|
2655
|
+
"not in": "not in";
|
|
2656
|
+
}>>>;
|
|
2657
|
+
value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>]>;
|
|
2658
|
+
}, z.core.$strip>]>>]>;
|
|
2659
|
+
}, z.core.$strip>;
|
|
2660
|
+
differenceType: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
2661
|
+
percent: "percent";
|
|
2662
|
+
absolute: "absolute";
|
|
2663
|
+
}>>>;
|
|
2664
|
+
textFontSize: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
2665
|
+
textColor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
2666
|
+
textBackgroundColor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
2667
|
+
lineColor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
2668
|
+
}, z.core.$strip>]>>>;
|
|
2360
2669
|
dimensionLinkage: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
2361
2670
|
enable: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
2362
2671
|
showTooltip: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { zLocale } from "../../i18n/index.js";
|
|
3
|
-
import { zAnnotationArea, zAnnotationHorizontalLine, zAnnotationPoint, zAnnotationVerticalLine, zAreaStyle, zBackgroundColor, zBrush, zColor, zCrosshairLine, zDataset, zDimensionLinkage, zDimensions, zEncoding, zLabel, zLegend, zLineStyle, zMeasures, zPage, zPointStyle, zTheme, zTooltip, zXBandAxis, zYLinearAxis } from "../../properties/index.js";
|
|
3
|
+
import { zAnnotationArea, zAnnotationDifferenceLine, zAnnotationHorizontalLine, zAnnotationPoint, zAnnotationVerticalLine, zAreaStyle, zBackgroundColor, zBrush, zColor, zCrosshairLine, zDataset, zDimensionLinkage, zDimensions, zEncoding, zLabel, zLegend, zLineStyle, zMeasures, zPage, zPointStyle, zRegionPadding, zTheme, zTooltip, zXBandAxis, zYLinearAxis } from "../../properties/index.js";
|
|
4
4
|
const zArea = z.object({
|
|
5
5
|
chartType: z.literal('area'),
|
|
6
6
|
dataset: zDataset.nullish(),
|
|
@@ -12,6 +12,7 @@ const zArea = z.object({
|
|
|
12
12
|
color: zColor.nullish(),
|
|
13
13
|
label: zLabel.nullish(),
|
|
14
14
|
legend: zLegend.nullish(),
|
|
15
|
+
regionPadding: zRegionPadding.nullish(),
|
|
15
16
|
tooltip: zTooltip.nullish(),
|
|
16
17
|
brush: zBrush.nullish(),
|
|
17
18
|
xAxis: zXBandAxis.nullish(),
|
|
@@ -25,6 +26,7 @@ const zArea = z.object({
|
|
|
25
26
|
annotationVerticalLine: z.array(zAnnotationVerticalLine).or(zAnnotationVerticalLine).nullish(),
|
|
26
27
|
annotationHorizontalLine: z.array(zAnnotationHorizontalLine).or(zAnnotationHorizontalLine).nullish(),
|
|
27
28
|
annotationArea: z.array(zAnnotationArea).or(zAnnotationArea).nullish(),
|
|
29
|
+
annotationDifferenceLine: z.array(zAnnotationDifferenceLine).or(zAnnotationDifferenceLine).nullish(),
|
|
28
30
|
dimensionLinkage: zDimensionLinkage.nullish(),
|
|
29
31
|
locale: zLocale.nullish()
|
|
30
32
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types/chartType/area/zArea.js","sources":["../../../../../src/types/chartType/area/zArea.ts"],"sourcesContent":["import { z } from 'zod'\nimport { zLocale } from '../../i18n'\nimport {\n zAnnotationArea,\n zAnnotationHorizontalLine,\n zAnnotationPoint,\n zAnnotationVerticalLine,\n zAreaStyle,\n zBackgroundColor,\n zColor,\n zCrosshairLine,\n zDataset,\n zDimensionLinkage,\n zDimensions,\n zEncoding,\n zLabel,\n zLegend,\n zLineStyle,\n zMeasures,\n zPointStyle,\n zTheme,\n zTooltip,\n zBrush,\n zXBandAxis,\n zYLinearAxis,\n zPage,\n} from '../../properties'\n\nexport const zArea = z.object({\n chartType: z.literal('area'),\n dataset: zDataset.nullish(),\n encoding: zEncoding.nullish(),\n dimensions: zDimensions.nullish(),\n measures: zMeasures.nullish(),\n page: zPage.nullish(),\n\n backgroundColor: zBackgroundColor.nullish(),\n color: zColor.nullish(),\n label: zLabel.nullish(),\n legend: zLegend.nullish(),\n tooltip: zTooltip.nullish(),\n brush: zBrush.nullish(),\n xAxis: zXBandAxis.nullish(),\n yAxis: zYLinearAxis.nullish(),\n crosshairLine: zCrosshairLine.nullish(),\n theme: zTheme.nullish(),\n pointStyle: z.array(zPointStyle).or(zPointStyle).nullish(),\n lineStyle: z.array(zLineStyle).or(zLineStyle).nullish(),\n areaStyle: z.array(zAreaStyle).or(zAreaStyle).nullish(),\n annotationPoint: z.array(zAnnotationPoint).or(zAnnotationPoint).nullish(),\n annotationVerticalLine: z.array(zAnnotationVerticalLine).or(zAnnotationVerticalLine).nullish(),\n annotationHorizontalLine: z.array(zAnnotationHorizontalLine).or(zAnnotationHorizontalLine).nullish(),\n annotationArea: z.array(zAnnotationArea).or(zAnnotationArea).nullish(),\n dimensionLinkage: zDimensionLinkage.nullish(),\n locale: zLocale.nullish(),\n})\n"],"names":["zArea","z","zDataset","zEncoding","zDimensions","zMeasures","zPage","zBackgroundColor","zColor","zLabel","zLegend","zTooltip","zBrush","zXBandAxis","zYLinearAxis","zCrosshairLine","zTheme","zPointStyle","zLineStyle","zAreaStyle","zAnnotationPoint","zAnnotationVerticalLine","zAnnotationHorizontalLine","zAnnotationArea","zDimensionLinkage","zLocale"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"types/chartType/area/zArea.js","sources":["../../../../../src/types/chartType/area/zArea.ts"],"sourcesContent":["import { z } from 'zod'\nimport { zLocale } from '../../i18n'\nimport {\n zAnnotationArea,\n zAnnotationDifferenceLine,\n zAnnotationHorizontalLine,\n zAnnotationPoint,\n zAnnotationVerticalLine,\n zAreaStyle,\n zBackgroundColor,\n zColor,\n zCrosshairLine,\n zDataset,\n zDimensionLinkage,\n zDimensions,\n zEncoding,\n zLabel,\n zLegend,\n zLineStyle,\n zMeasures,\n zPointStyle,\n zRegionPadding,\n zTheme,\n zTooltip,\n zBrush,\n zXBandAxis,\n zYLinearAxis,\n zPage,\n} from '../../properties'\n\nexport const zArea = z.object({\n chartType: z.literal('area'),\n dataset: zDataset.nullish(),\n encoding: zEncoding.nullish(),\n dimensions: zDimensions.nullish(),\n measures: zMeasures.nullish(),\n page: zPage.nullish(),\n\n backgroundColor: zBackgroundColor.nullish(),\n color: zColor.nullish(),\n label: zLabel.nullish(),\n legend: zLegend.nullish(),\n regionPadding: zRegionPadding.nullish(),\n tooltip: zTooltip.nullish(),\n brush: zBrush.nullish(),\n xAxis: zXBandAxis.nullish(),\n yAxis: zYLinearAxis.nullish(),\n crosshairLine: zCrosshairLine.nullish(),\n theme: zTheme.nullish(),\n pointStyle: z.array(zPointStyle).or(zPointStyle).nullish(),\n lineStyle: z.array(zLineStyle).or(zLineStyle).nullish(),\n areaStyle: z.array(zAreaStyle).or(zAreaStyle).nullish(),\n annotationPoint: z.array(zAnnotationPoint).or(zAnnotationPoint).nullish(),\n annotationVerticalLine: z.array(zAnnotationVerticalLine).or(zAnnotationVerticalLine).nullish(),\n annotationHorizontalLine: z.array(zAnnotationHorizontalLine).or(zAnnotationHorizontalLine).nullish(),\n annotationArea: z.array(zAnnotationArea).or(zAnnotationArea).nullish(),\n annotationDifferenceLine: z.array(zAnnotationDifferenceLine).or(zAnnotationDifferenceLine).nullish(),\n dimensionLinkage: zDimensionLinkage.nullish(),\n locale: zLocale.nullish(),\n})\n"],"names":["zArea","z","zDataset","zEncoding","zDimensions","zMeasures","zPage","zBackgroundColor","zColor","zLabel","zLegend","zRegionPadding","zTooltip","zBrush","zXBandAxis","zYLinearAxis","zCrosshairLine","zTheme","zPointStyle","zLineStyle","zAreaStyle","zAnnotationPoint","zAnnotationVerticalLine","zAnnotationHorizontalLine","zAnnotationArea","zAnnotationDifferenceLine","zDimensionLinkage","zLocale"],"mappings":";;;AA8BO,MAAMA,QAAQC,EAAE,MAAM,CAAC;IAC5B,WAAWA,EAAE,OAAO,CAAC;IACrB,SAASC,SAAS,OAAO;IACzB,UAAUC,UAAU,OAAO;IAC3B,YAAYC,YAAY,OAAO;IAC/B,UAAUC,UAAU,OAAO;IAC3B,MAAMC,MAAM,OAAO;IAEnB,iBAAiBC,iBAAiB,OAAO;IACzC,OAAOC,OAAO,OAAO;IACrB,OAAOC,OAAO,OAAO;IACrB,QAAQC,QAAQ,OAAO;IACvB,eAAeC,eAAe,OAAO;IACrC,SAASC,SAAS,OAAO;IACzB,OAAOC,OAAO,OAAO;IACrB,OAAOC,WAAW,OAAO;IACzB,OAAOC,aAAa,OAAO;IAC3B,eAAeC,eAAe,OAAO;IACrC,OAAOC,OAAO,OAAO;IACrB,YAAYhB,EAAE,KAAK,CAACiB,aAAa,EAAE,CAACA,aAAa,OAAO;IACxD,WAAWjB,EAAE,KAAK,CAACkB,YAAY,EAAE,CAACA,YAAY,OAAO;IACrD,WAAWlB,EAAE,KAAK,CAACmB,YAAY,EAAE,CAACA,YAAY,OAAO;IACrD,iBAAiBnB,EAAE,KAAK,CAACoB,kBAAkB,EAAE,CAACA,kBAAkB,OAAO;IACvE,wBAAwBpB,EAAE,KAAK,CAACqB,yBAAyB,EAAE,CAACA,yBAAyB,OAAO;IAC5F,0BAA0BrB,EAAE,KAAK,CAACsB,2BAA2B,EAAE,CAACA,2BAA2B,OAAO;IAClG,gBAAgBtB,EAAE,KAAK,CAACuB,iBAAiB,EAAE,CAACA,iBAAiB,OAAO;IACpE,0BAA0BvB,EAAE,KAAK,CAACwB,2BAA2B,EAAE,CAACA,2BAA2B,OAAO;IAClG,kBAAkBC,kBAAkB,OAAO;IAC3C,QAAQC,QAAQ,OAAO;AACzB"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Locale } from '../../i18n';
|
|
2
|
-
import type { AnnotationArea, AnnotationHorizontalLine, AnnotationPoint, AnnotationVerticalLine, AreaStyle, BackgroundColor, Brush, Color, Dataset, Label, Legend, LineStyle, PointStyle, Theme, Tooltip, XBandAxis, YLinearAxis, CrosshairLine, Sort, SortLegend, DimensionLinkage, ColumnDimension, ColumnMeasure, Page } from '../../properties';
|
|
2
|
+
import type { AnnotationArea, AnnotationHorizontalLine, AnnotationPoint, AnnotationVerticalLine, AreaStyle, BackgroundColor, Brush, Color, Dataset, Label, Legend, LineStyle, PointStyle, Theme, Tooltip, XBandAxis, YLinearAxis, CrosshairLine, Sort, SortLegend, DimensionLinkage, ColumnDimension, ColumnMeasure, Page, RegionPadding } from '../../properties';
|
|
3
3
|
/**
|
|
4
4
|
* @description 百分比面积图,适用于展示多类别占比随时间变化的趋势,Y轴以百分比形式展示占比关系
|
|
5
5
|
* 适用场景:
|
|
@@ -77,6 +77,11 @@ export interface AreaPercent {
|
|
|
77
77
|
* @description 图例配置, 用于定义图表的图例, 包括图例的位置, 格式, 样式等.
|
|
78
78
|
*/
|
|
79
79
|
legend?: Legend;
|
|
80
|
+
/**
|
|
81
|
+
* 绘图区内边距
|
|
82
|
+
* @description 映射到 VChart 的 region[0].padding,用于为标注、标签等绘图区外扩元素预留空间。
|
|
83
|
+
*/
|
|
84
|
+
regionPadding?: RegionPadding;
|
|
80
85
|
/**
|
|
81
86
|
* 提示信息
|
|
82
87
|
* @description 提示信息配置, 用于定义图表的提示信息, 包括提示信息的位置, 格式, 样式等.
|
|
@@ -422,6 +422,12 @@ export declare const zAreaPercent: z.ZodObject<{
|
|
|
422
422
|
labelFontSize: z.ZodOptional<z.ZodNullable<z.ZodDefault<z.ZodNumber>>>;
|
|
423
423
|
labelFontWeight: z.ZodOptional<z.ZodNullable<z.ZodDefault<z.ZodUnion<[z.ZodNumber, z.ZodString]>>>>;
|
|
424
424
|
}, z.core.$strip>>>;
|
|
425
|
+
regionPadding: z.ZodOptional<z.ZodNullable<z.ZodUnion<[z.ZodNumber, z.ZodObject<{
|
|
426
|
+
top: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodNumber>>>;
|
|
427
|
+
right: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodNumber>>>;
|
|
428
|
+
bottom: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodNumber>>>;
|
|
429
|
+
left: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodNumber>>>;
|
|
430
|
+
}, z.core.$strip>]>>>;
|
|
425
431
|
tooltip: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
426
432
|
enable: z.ZodOptional<z.ZodNullable<z.ZodDefault<z.ZodBoolean>>>;
|
|
427
433
|
borderColor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { zLocale } from "../../i18n/index.js";
|
|
2
|
-
import { zAnnotationArea, zAnnotationHorizontalLine, zAnnotationPoint, zAnnotationVerticalLine, zAreaStyle, zBackgroundColor, zBrush, zColor, zCrosshairLine, zDataset, zDimensionLinkage, zDimensions, zEncoding, zLabel, zLegend, zLineStyle, zMeasures, zPage, zPointStyle, zTheme, zTooltip, zXBandAxis, zYLinearAxis } from "../../properties/index.js";
|
|
2
|
+
import { zAnnotationArea, zAnnotationHorizontalLine, zAnnotationPoint, zAnnotationVerticalLine, zAreaStyle, zBackgroundColor, zBrush, zColor, zCrosshairLine, zDataset, zDimensionLinkage, zDimensions, zEncoding, zLabel, zLegend, zLineStyle, zMeasures, zPage, zPointStyle, zRegionPadding, zTheme, zTooltip, zXBandAxis, zYLinearAxis } from "../../properties/index.js";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
const zAreaPercent = z.object({
|
|
5
5
|
chartType: z.literal('areaPercent'),
|
|
@@ -12,6 +12,7 @@ const zAreaPercent = z.object({
|
|
|
12
12
|
color: zColor.nullish(),
|
|
13
13
|
label: zLabel.nullish(),
|
|
14
14
|
legend: zLegend.nullish(),
|
|
15
|
+
regionPadding: zRegionPadding.nullish(),
|
|
15
16
|
tooltip: zTooltip.nullish(),
|
|
16
17
|
brush: zBrush.nullish(),
|
|
17
18
|
xAxis: zXBandAxis.nullish(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types/chartType/areaPercent/zAreaPercent.js","sources":["../../../../../src/types/chartType/areaPercent/zAreaPercent.ts"],"sourcesContent":["import { zLocale } from '../../i18n'\nimport {\n zAnnotationArea,\n zAnnotationHorizontalLine,\n zAnnotationPoint,\n zAnnotationVerticalLine,\n zAreaStyle,\n zBackgroundColor,\n zColor,\n zCrosshairLine,\n zDataset,\n zDimensionLinkage,\n zDimensions,\n zEncoding,\n zLabel,\n zLegend,\n zLineStyle,\n zMeasures,\n zPointStyle,\n zTheme,\n zTooltip,\n zBrush,\n zXBandAxis,\n zYLinearAxis,\n zPage,\n} from '../../properties'\n\nimport { z } from 'zod'\n\nexport const zAreaPercent = z.object({\n chartType: z.literal('areaPercent'),\n dataset: zDataset.nullish(),\n encoding: zEncoding.nullish(),\n dimensions: zDimensions.nullish(),\n measures: zMeasures.nullish(),\n page: zPage.nullish(),\n\n backgroundColor: zBackgroundColor.nullish(),\n color: zColor.nullish(),\n label: zLabel.nullish(),\n legend: zLegend.nullish(),\n tooltip: zTooltip.nullish(),\n brush: zBrush.nullish(),\n xAxis: zXBandAxis.nullish(),\n yAxis: zYLinearAxis.nullish(),\n crosshairLine: zCrosshairLine.nullish(),\n theme: zTheme.nullish(),\n pointStyle: z.array(zPointStyle).or(zPointStyle).nullish(),\n lineStyle: z.array(zLineStyle).or(zLineStyle).nullish(),\n areaStyle: z.array(zAreaStyle).or(zAreaStyle).nullish(),\n annotationPoint: z.array(zAnnotationPoint).or(zAnnotationPoint).nullish(),\n annotationVerticalLine: z.array(zAnnotationVerticalLine).or(zAnnotationVerticalLine).nullish(),\n annotationHorizontalLine: z.array(zAnnotationHorizontalLine).or(zAnnotationHorizontalLine).nullish(),\n annotationArea: z.array(zAnnotationArea).or(zAnnotationArea).nullish(),\n dimensionLinkage: zDimensionLinkage.nullish(),\n locale: zLocale.nullish(),\n})\n"],"names":["zAreaPercent","z","zDataset","zEncoding","zDimensions","zMeasures","zPage","zBackgroundColor","zColor","zLabel","zLegend","zTooltip","zBrush","zXBandAxis","zYLinearAxis","zCrosshairLine","zTheme","zPointStyle","zLineStyle","zAreaStyle","zAnnotationPoint","zAnnotationVerticalLine","zAnnotationHorizontalLine","zAnnotationArea","zDimensionLinkage","zLocale"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"types/chartType/areaPercent/zAreaPercent.js","sources":["../../../../../src/types/chartType/areaPercent/zAreaPercent.ts"],"sourcesContent":["import { zLocale } from '../../i18n'\nimport {\n zAnnotationArea,\n zAnnotationHorizontalLine,\n zAnnotationPoint,\n zAnnotationVerticalLine,\n zAreaStyle,\n zBackgroundColor,\n zColor,\n zCrosshairLine,\n zDataset,\n zDimensionLinkage,\n zDimensions,\n zEncoding,\n zLabel,\n zLegend,\n zLineStyle,\n zMeasures,\n zPointStyle,\n zRegionPadding,\n zTheme,\n zTooltip,\n zBrush,\n zXBandAxis,\n zYLinearAxis,\n zPage,\n} from '../../properties'\n\nimport { z } from 'zod'\n\nexport const zAreaPercent = z.object({\n chartType: z.literal('areaPercent'),\n dataset: zDataset.nullish(),\n encoding: zEncoding.nullish(),\n dimensions: zDimensions.nullish(),\n measures: zMeasures.nullish(),\n page: zPage.nullish(),\n\n backgroundColor: zBackgroundColor.nullish(),\n color: zColor.nullish(),\n label: zLabel.nullish(),\n legend: zLegend.nullish(),\n regionPadding: zRegionPadding.nullish(),\n tooltip: zTooltip.nullish(),\n brush: zBrush.nullish(),\n xAxis: zXBandAxis.nullish(),\n yAxis: zYLinearAxis.nullish(),\n crosshairLine: zCrosshairLine.nullish(),\n theme: zTheme.nullish(),\n pointStyle: z.array(zPointStyle).or(zPointStyle).nullish(),\n lineStyle: z.array(zLineStyle).or(zLineStyle).nullish(),\n areaStyle: z.array(zAreaStyle).or(zAreaStyle).nullish(),\n annotationPoint: z.array(zAnnotationPoint).or(zAnnotationPoint).nullish(),\n annotationVerticalLine: z.array(zAnnotationVerticalLine).or(zAnnotationVerticalLine).nullish(),\n annotationHorizontalLine: z.array(zAnnotationHorizontalLine).or(zAnnotationHorizontalLine).nullish(),\n annotationArea: z.array(zAnnotationArea).or(zAnnotationArea).nullish(),\n dimensionLinkage: zDimensionLinkage.nullish(),\n locale: zLocale.nullish(),\n})\n"],"names":["zAreaPercent","z","zDataset","zEncoding","zDimensions","zMeasures","zPage","zBackgroundColor","zColor","zLabel","zLegend","zRegionPadding","zTooltip","zBrush","zXBandAxis","zYLinearAxis","zCrosshairLine","zTheme","zPointStyle","zLineStyle","zAreaStyle","zAnnotationPoint","zAnnotationVerticalLine","zAnnotationHorizontalLine","zAnnotationArea","zDimensionLinkage","zLocale"],"mappings":";;;AA8BO,MAAMA,eAAeC,EAAE,MAAM,CAAC;IACnC,WAAWA,EAAE,OAAO,CAAC;IACrB,SAASC,SAAS,OAAO;IACzB,UAAUC,UAAU,OAAO;IAC3B,YAAYC,YAAY,OAAO;IAC/B,UAAUC,UAAU,OAAO;IAC3B,MAAMC,MAAM,OAAO;IAEnB,iBAAiBC,iBAAiB,OAAO;IACzC,OAAOC,OAAO,OAAO;IACrB,OAAOC,OAAO,OAAO;IACrB,QAAQC,QAAQ,OAAO;IACvB,eAAeC,eAAe,OAAO;IACrC,SAASC,SAAS,OAAO;IACzB,OAAOC,OAAO,OAAO;IACrB,OAAOC,WAAW,OAAO;IACzB,OAAOC,aAAa,OAAO;IAC3B,eAAeC,eAAe,OAAO;IACrC,OAAOC,OAAO,OAAO;IACrB,YAAYhB,EAAE,KAAK,CAACiB,aAAa,EAAE,CAACA,aAAa,OAAO;IACxD,WAAWjB,EAAE,KAAK,CAACkB,YAAY,EAAE,CAACA,YAAY,OAAO;IACrD,WAAWlB,EAAE,KAAK,CAACmB,YAAY,EAAE,CAACA,YAAY,OAAO;IACrD,iBAAiBnB,EAAE,KAAK,CAACoB,kBAAkB,EAAE,CAACA,kBAAkB,OAAO;IACvE,wBAAwBpB,EAAE,KAAK,CAACqB,yBAAyB,EAAE,CAACA,yBAAyB,OAAO;IAC5F,0BAA0BrB,EAAE,KAAK,CAACsB,2BAA2B,EAAE,CAACA,2BAA2B,OAAO;IAClG,gBAAgBtB,EAAE,KAAK,CAACuB,iBAAiB,EAAE,CAACA,iBAAiB,OAAO;IACpE,kBAAkBC,kBAAkB,OAAO;IAC3C,QAAQC,QAAQ,OAAO;AACzB"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type Locale } from '../../i18n';
|
|
2
|
-
import type { BarDimension, BarMaxWidth, BarMeasure, DimensionLinkage, Sort, SortLegend } from '../../properties';
|
|
2
|
+
import type { BarDimension, BarMaxWidth, BarMeasure, DimensionLinkage, RegionPadding, Sort, SortLegend } from '../../properties';
|
|
3
3
|
import { type AnnotationArea, type AnnotationDifferenceLine, type AnnotationHorizontalLine, type AnnotationPoint, type AnnotationVerticalLine, type BackgroundColor, type Brush, type BarStyle, type Color, type CrosshairRect, type Dataset, type Label, type Legend, type StackCornerRadius, type Theme, type Tooltip, type XLinearAxis, type YBandAxis, type Page } from '../../properties';
|
|
4
4
|
/**
|
|
5
5
|
* @description 条形图,适用于横向数据对比场景,Y轴为类目轴(分类数据),X轴为数值轴(连续数据),柱子横向排列
|
|
@@ -72,6 +72,11 @@ export interface Bar {
|
|
|
72
72
|
* @description 图例配置, 用于定义图表的图例, 包括图例的位置, 格式, 样式等.
|
|
73
73
|
*/
|
|
74
74
|
legend?: Legend;
|
|
75
|
+
/**
|
|
76
|
+
* 绘图区内边距
|
|
77
|
+
* @description 映射到 VChart 的 region[0].padding,用于为标注、标签等绘图区外扩元素预留空间。
|
|
78
|
+
*/
|
|
79
|
+
regionPadding?: RegionPadding;
|
|
75
80
|
/**
|
|
76
81
|
* @description 提示信息配置, 用于定义图表的提示信息, 包括提示信息的位置, 格式, 样式等.
|
|
77
82
|
*/
|