@visactor/vseed 0.1.22 → 0.1.24
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/pipeline/area.js +2 -1
- package/dist/esm/pipeline/advanced/chart/pipeline/area.js.map +1 -1
- package/dist/esm/pipeline/advanced/chart/pipeline/areaPercent.js +2 -1
- package/dist/esm/pipeline/advanced/chart/pipeline/areaPercent.js.map +1 -1
- package/dist/esm/pipeline/advanced/chart/pipeline/bar.js +2 -1
- package/dist/esm/pipeline/advanced/chart/pipeline/bar.js.map +1 -1
- package/dist/esm/pipeline/advanced/chart/pipeline/barParallel.js +2 -1
- package/dist/esm/pipeline/advanced/chart/pipeline/barParallel.js.map +1 -1
- package/dist/esm/pipeline/advanced/chart/pipeline/barPercent.js +2 -1
- package/dist/esm/pipeline/advanced/chart/pipeline/barPercent.js.map +1 -1
- package/dist/esm/pipeline/advanced/chart/pipeline/column.js +2 -1
- package/dist/esm/pipeline/advanced/chart/pipeline/column.js.map +1 -1
- package/dist/esm/pipeline/advanced/chart/pipeline/columnParallel.js +2 -1
- package/dist/esm/pipeline/advanced/chart/pipeline/columnParallel.js.map +1 -1
- package/dist/esm/pipeline/advanced/chart/pipeline/columnPercent.js +2 -1
- package/dist/esm/pipeline/advanced/chart/pipeline/columnPercent.js.map +1 -1
- package/dist/esm/pipeline/advanced/chart/pipeline/donut.js +2 -1
- package/dist/esm/pipeline/advanced/chart/pipeline/donut.js.map +1 -1
- package/dist/esm/pipeline/advanced/chart/pipeline/dualAxis.js +2 -1
- package/dist/esm/pipeline/advanced/chart/pipeline/dualAxis.js.map +1 -1
- package/dist/esm/pipeline/advanced/chart/pipeline/funnel.js +2 -1
- package/dist/esm/pipeline/advanced/chart/pipeline/funnel.js.map +1 -1
- package/dist/esm/pipeline/advanced/chart/pipeline/line.js +2 -1
- package/dist/esm/pipeline/advanced/chart/pipeline/line.js.map +1 -1
- package/dist/esm/pipeline/advanced/chart/pipeline/pie.js +2 -1
- package/dist/esm/pipeline/advanced/chart/pipeline/pie.js.map +1 -1
- package/dist/esm/pipeline/advanced/chart/pipeline/radar.js +2 -1
- package/dist/esm/pipeline/advanced/chart/pipeline/radar.js.map +1 -1
- package/dist/esm/pipeline/advanced/chart/pipeline/rose.js +2 -1
- package/dist/esm/pipeline/advanced/chart/pipeline/rose.js.map +1 -1
- package/dist/esm/pipeline/advanced/chart/pipeline/roseParallel.js +2 -1
- package/dist/esm/pipeline/advanced/chart/pipeline/roseParallel.js.map +1 -1
- package/dist/esm/pipeline/advanced/chart/pipes/reshape/pivotReshapeWithDualEncoding.js +2 -2
- package/dist/esm/pipeline/advanced/chart/pipes/reshape/pivotReshapeWithDualEncoding.js.map +1 -1
- package/dist/esm/pipeline/advanced/chart/pipes/reshape/pivotReshapeWithEncoding.js +1 -1
- package/dist/esm/pipeline/advanced/chart/pipes/reshape/pivotReshapeWithEncoding.js.map +1 -1
- package/dist/esm/pipeline/advanced/chart/pipes/reshape/pivotReshapeWithScatterEncoding.js +2 -2
- package/dist/esm/pipeline/advanced/chart/pipes/reshape/pivotReshapeWithScatterEncoding.js.map +1 -1
- package/dist/esm/pipeline/advanced/chart/pipes/reshape/reshapeWithDualEncoding.js +2 -2
- package/dist/esm/pipeline/advanced/chart/pipes/reshape/reshapeWithDualEncoding.js.map +1 -1
- package/dist/esm/pipeline/advanced/chart/pipes/reshape/reshapeWithEncoding.js +2 -1
- package/dist/esm/pipeline/advanced/chart/pipes/reshape/reshapeWithEncoding.js.map +1 -1
- package/dist/esm/pipeline/advanced/chart/pipes/reshape/reshapeWithScatterEncoding.js +2 -2
- package/dist/esm/pipeline/advanced/chart/pipes/reshape/reshapeWithScatterEncoding.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipes/axes/format/linearFormat.d.ts +1 -0
- package/dist/esm/pipeline/spec/chart/pipes/axes/format/linearFormat.js +7 -1
- package/dist/esm/pipeline/spec/chart/pipes/axes/format/linearFormat.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipes/axes/radarAngle.js +1 -4
- package/dist/esm/pipeline/spec/chart/pipes/axes/radarAngle.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipes/axes/radarRadius.js +1 -4
- package/dist/esm/pipeline/spec/chart/pipes/axes/radarRadius.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipes/axes/radius.js +1 -4
- package/dist/esm/pipeline/spec/chart/pipes/axes/radius.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipes/axes/xBand.js +0 -11
- package/dist/esm/pipeline/spec/chart/pipes/axes/xBand.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipes/axes/xLinear.js +9 -15
- package/dist/esm/pipeline/spec/chart/pipes/axes/xLinear.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipes/axes/yBand.js +0 -11
- package/dist/esm/pipeline/spec/chart/pipes/axes/yBand.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipes/axes/yLinear.js +9 -15
- package/dist/esm/pipeline/spec/chart/pipes/axes/yLinear.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipes/axes/yLinearPrimary.js +0 -13
- package/dist/esm/pipeline/spec/chart/pipes/axes/yLinearPrimary.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipes/axes/yLinearSecondary.js +0 -14
- package/dist/esm/pipeline/spec/chart/pipes/axes/yLinearSecondary.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipes/color/colorAdapter.d.ts +3 -3
- package/dist/esm/pipeline/spec/chart/pipes/color/colorAdapter.js +8 -6
- package/dist/esm/pipeline/spec/chart/pipes/color/colorAdapter.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipes/color/colorAreaStyleFill.js +2 -2
- package/dist/esm/pipeline/spec/chart/pipes/color/colorAreaStyleFill.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipes/color/colorBarStyleFill.js +2 -2
- package/dist/esm/pipeline/spec/chart/pipes/color/colorBarStyleFill.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipes/color/colorCellStyleFill.js +2 -2
- package/dist/esm/pipeline/spec/chart/pipes/color/colorCellStyleFill.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipes/color/colorFunnelStyleFill.js +2 -2
- package/dist/esm/pipeline/spec/chart/pipes/color/colorFunnelStyleFill.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipes/color/colorLineStyleFill.js +2 -2
- package/dist/esm/pipeline/spec/chart/pipes/color/colorLineStyleFill.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipes/color/colorPieStyleFill.js +2 -2
- package/dist/esm/pipeline/spec/chart/pipes/color/colorPieStyleFill.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipes/color/colorPointStyleFill.js +2 -2
- package/dist/esm/pipeline/spec/chart/pipes/color/colorPointStyleFill.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipes/color/colorRoseStyleFill.js +2 -2
- package/dist/esm/pipeline/spec/chart/pipes/color/colorRoseStyleFill.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipes/init/area.js +2 -2
- package/dist/esm/pipeline/spec/chart/pipes/init/area.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipes/init/dualAxis.js +2 -2
- package/dist/esm/pipeline/spec/chart/pipes/init/dualAxis.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipes/init/line.js +2 -2
- package/dist/esm/pipeline/spec/chart/pipes/init/line.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipes/init/radar.js +2 -2
- package/dist/esm/pipeline/spec/chart/pipes/init/radar.js.map +1 -1
- package/dist/esm/pipeline/utils/chatType.d.ts +4 -1
- package/dist/esm/pipeline/utils/chatType.js +8 -5
- package/dist/esm/pipeline/utils/chatType.js.map +1 -1
- package/dist/esm/pipeline/utils/constant.d.ts +22 -0
- package/dist/esm/pipeline/utils/constant.js +23 -1
- package/dist/esm/pipeline/utils/constant.js.map +1 -1
- package/dist/esm/pipeline/utils/format/createNumFormatter.js +2 -1
- package/dist/esm/pipeline/utils/format/createNumFormatter.js.map +1 -1
- package/dist/esm/pipeline/utils/index.d.ts +1 -0
- package/dist/esm/pipeline/utils/index.js +1 -0
- package/dist/esm/theme/light.js +3 -12
- package/dist/esm/theme/light.js.map +1 -1
- package/dist/esm/types/properties/chartType/chartType.d.ts +0 -22
- package/dist/esm/types/properties/chartType/chartType.js +1 -23
- package/dist/esm/types/properties/chartType/chartType.js.map +1 -1
- package/dist/umd/index.js +267 -283
- package/dist/umd/index.js.map +1 -1
- package/package.json +3 -3
@@ -9,9 +9,10 @@ const reshapeWithEncoding = (advancedVSeed, context)=>{
|
|
9
9
|
const { vseed } = context;
|
10
10
|
const { dataset, chartType } = vseed;
|
11
11
|
const { dimensions = [], measures = [], encoding } = advancedVSeed;
|
12
|
+
const colorMeasureId = getColorMeasureId(advancedVSeed, vseed);
|
12
13
|
const { dataset: newDatasets, foldInfo, unfoldInfo } = dataReshapeByEncoding(dataset, uniqueBy(dimensions, (item)=>item.id), uniqueBy(findAllMeasures(measures), (item)=>item.id), encoding, {
|
13
14
|
colorItemAsId: false,
|
14
|
-
colorMeasureId
|
15
|
+
colorMeasureId
|
15
16
|
});
|
16
17
|
return {
|
17
18
|
...result,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"pipeline/advanced/chart/pipes/reshape/reshapeWithEncoding.js","sources":["webpack://@visactor/vseed/./src/pipeline/advanced/chart/pipes/reshape/reshapeWithEncoding.ts"],"sourcesContent":["import { uniqueBy } from 'remeda'\nimport { dataReshapeByEncoding } from 'src/dataReshape'\nimport { getColorMeasureId } from 'src/pipeline/spec/chart/pipes'\nimport { findAllMeasures } from 'src/pipeline/utils'\nimport type { AdvancedPipe, AdvancedVSeed, ColumnParallel, Encoding } from 'src/types'\n\nexport const reshapeWithEncoding: AdvancedPipe = (advancedVSeed, context) => {\n const result = { ...advancedVSeed }\n const { vseed } = context\n const { dataset, chartType } = vseed as ColumnParallel\n const { dimensions = [], measures = [], encoding } = advancedVSeed\n\n const {\n dataset: newDatasets,\n foldInfo,\n unfoldInfo,\n } = dataReshapeByEncoding(\n dataset,\n uniqueBy(dimensions, (item) => item.id),\n uniqueBy(findAllMeasures(measures), (item) => item.id),\n encoding as Encoding,\n {\n colorItemAsId: false,\n colorMeasureId
|
1
|
+
{"version":3,"file":"pipeline/advanced/chart/pipes/reshape/reshapeWithEncoding.js","sources":["webpack://@visactor/vseed/./src/pipeline/advanced/chart/pipes/reshape/reshapeWithEncoding.ts"],"sourcesContent":["import { uniqueBy } from 'remeda'\nimport { dataReshapeByEncoding } from 'src/dataReshape'\nimport { getColorMeasureId } from 'src/pipeline/spec/chart/pipes'\nimport { findAllMeasures } from 'src/pipeline/utils'\nimport type { AdvancedPipe, AdvancedVSeed, ColumnParallel, Encoding } from 'src/types'\n\nexport const reshapeWithEncoding: AdvancedPipe = (advancedVSeed, context) => {\n const result = { ...advancedVSeed }\n const { vseed } = context\n const { dataset, chartType } = vseed as ColumnParallel\n const { dimensions = [], measures = [], encoding } = advancedVSeed\n\n const colorMeasureId = getColorMeasureId(advancedVSeed as AdvancedVSeed, vseed)\n const {\n dataset: newDatasets,\n foldInfo,\n unfoldInfo,\n } = dataReshapeByEncoding(\n dataset,\n uniqueBy(dimensions, (item) => item.id),\n uniqueBy(findAllMeasures(measures), (item) => item.id),\n encoding as Encoding,\n {\n colorItemAsId: false,\n colorMeasureId,\n },\n )\n\n return {\n ...result,\n dataset: newDatasets,\n datasetReshapeInfo: [\n {\n id: String(chartType),\n index: 0,\n foldInfo,\n unfoldInfo,\n },\n ],\n dimensions,\n measures,\n }\n}\n"],"names":["reshapeWithEncoding","advancedVSeed","context","result","vseed","dataset","chartType","dimensions","measures","encoding","colorMeasureId","getColorMeasureId","newDatasets","foldInfo","unfoldInfo","dataReshapeByEncoding","uniqueBy","item","findAllMeasures","String"],"mappings":";;;;AAMO,MAAMA,sBAAoC,CAACC,eAAeC;IAC/D,MAAMC,SAAS;QAAE,GAAGF,aAAa;IAAC;IAClC,MAAM,EAAEG,KAAK,EAAE,GAAGF;IAClB,MAAM,EAAEG,OAAO,EAAEC,SAAS,EAAE,GAAGF;IAC/B,MAAM,EAAEG,aAAa,EAAE,EAAEC,WAAW,EAAE,EAAEC,QAAQ,EAAE,GAAGR;IAErD,MAAMS,iBAAiBC,kBAAkBV,eAAgCG;IACzE,MAAM,EACJ,SAASQ,WAAW,EACpBC,QAAQ,EACRC,UAAU,EACX,GAAGC,sBACFV,SACAW,SAAST,YAAY,CAACU,OAASA,KAAK,EAAE,GACtCD,SAASE,gBAAgBV,WAAW,CAACS,OAASA,KAAK,EAAE,GACrDR,UACA;QACE,eAAe;QACfC;IACF;IAGF,OAAO;QACL,GAAGP,MAAM;QACT,SAASS;QACT,oBAAoB;YAClB;gBACE,IAAIO,OAAOb;gBACX,OAAO;gBACPO;gBACAC;YACF;SACD;QACDP;QACAC;IACF;AACF"}
|
@@ -19,7 +19,7 @@ const reshapeWithScatterEncoding = (advancedVSeed, context)=>{
|
|
19
19
|
foldMeasureValue: FoldXMeasureValue,
|
20
20
|
foldMeasureId: FoldXMeasureId,
|
21
21
|
colorItemAsId: true,
|
22
|
-
colorMeasureId: getColorMeasureId(advancedVSeed)
|
22
|
+
colorMeasureId: getColorMeasureId(advancedVSeed, vseed)
|
23
23
|
});
|
24
24
|
datasets.push(newDataset);
|
25
25
|
foldInfoList.push(foldInfo);
|
@@ -30,7 +30,7 @@ const reshapeWithScatterEncoding = (advancedVSeed, context)=>{
|
|
30
30
|
foldMeasureValue: FoldYMeasureValue,
|
31
31
|
foldMeasureId: FoldYMeasureId,
|
32
32
|
colorItemAsId: true,
|
33
|
-
colorMeasureId: getColorMeasureId(advancedVSeed)
|
33
|
+
colorMeasureId: getColorMeasureId(advancedVSeed, vseed)
|
34
34
|
});
|
35
35
|
datasets[0] = newDataset;
|
36
36
|
foldInfoList.push(foldInfo);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"pipeline/advanced/chart/pipes/reshape/reshapeWithScatterEncoding.js","sources":["webpack://@visactor/vseed/./src/pipeline/advanced/chart/pipes/reshape/reshapeWithScatterEncoding.ts"],"sourcesContent":["import { uniqueBy } from 'remeda'\nimport {\n dataReshapeByEncoding,\n FoldXMeasureId,\n FoldXMeasureValue,\n FoldYMeasureId,\n FoldYMeasureValue,\n} from 'src/dataReshape'\nimport { getColorMeasureId } from 'src/pipeline/spec/chart/pipes'\nimport type {\n AdvancedPipe,\n AdvancedVSeed,\n ColumnParallel,\n Dataset,\n Encoding,\n FoldInfo,\n MeasureGroup,\n UnfoldInfo,\n} from 'src/types'\n\nexport const reshapeWithScatterEncoding: AdvancedPipe = (advancedVSeed, context) => {\n const result = { ...advancedVSeed }\n const { vseed } = context\n const { dataset } = vseed as ColumnParallel\n const { dimensions = [], measures = [], encoding, chartType } = advancedVSeed\n\n if (measures.length > 2) {\n throw new Error('measures can not be more than 2 groups in scatter')\n }\n const foldInfoList: FoldInfo[] = []\n const unfoldInfoList: UnfoldInfo[] = []\n\n const datasets: Dataset[] = []\n const xMeasures = measures[0] as MeasureGroup\n const yMeasures = (measures[1] || xMeasures) as MeasureGroup\n\n if (xMeasures && xMeasures.children) {\n const {\n dataset: newDataset,\n foldInfo,\n unfoldInfo,\n } = dataReshapeByEncoding(\n dataset,\n uniqueBy(dimensions, (d) => d.id),\n uniqueBy(xMeasures.children, (d) => d.id),\n encoding as Encoding,\n {\n foldMeasureValue: FoldXMeasureValue,\n foldMeasureId: FoldXMeasureId,\n colorItemAsId: true,\n colorMeasureId: getColorMeasureId(advancedVSeed as AdvancedVSeed),\n },\n )\n\n datasets.push(newDataset)\n foldInfoList.push(foldInfo)\n unfoldInfoList.push(unfoldInfo)\n }\n\n if (yMeasures && yMeasures.children) {\n const {\n dataset: newDataset,\n foldInfo,\n unfoldInfo,\n } = dataReshapeByEncoding(\n datasets[0],\n uniqueBy(dimensions, (d) => d.id),\n uniqueBy(yMeasures.children, (d) => d.id),\n encoding as Encoding,\n {\n foldMeasureValue: FoldYMeasureValue,\n foldMeasureId: FoldYMeasureId,\n colorItemAsId: true,\n colorMeasureId: getColorMeasureId(advancedVSeed as AdvancedVSeed),\n },\n )\n\n datasets[0] = newDataset\n foldInfoList.push(foldInfo)\n unfoldInfoList.push(unfoldInfo)\n }\n\n const unfoldInfo: UnfoldInfo = {\n ...unfoldInfoList[0],\n colorItems: unfoldInfoList.flatMap((d) => d.colorItems),\n colorIdMap: unfoldInfoList.reduce((prev, cur) => ({ ...prev, ...cur.colorIdMap }), {}),\n }\n\n return {\n ...result,\n dataset: datasets[0],\n\n datasetReshapeInfo: [\n {\n id: String(chartType),\n index: 0,\n foldInfo: foldInfoList[0],\n foldInfoList: foldInfoList,\n unfoldInfo: unfoldInfo,\n },\n ],\n }\n}\n"],"names":["reshapeWithScatterEncoding","advancedVSeed","context","result","vseed","dataset","dimensions","measures","encoding","chartType","Error","foldInfoList","unfoldInfoList","datasets","xMeasures","yMeasures","newDataset","foldInfo","unfoldInfo","dataReshapeByEncoding","uniqueBy","d","FoldXMeasureValue","FoldXMeasureId","getColorMeasureId","FoldYMeasureValue","FoldYMeasureId","prev","cur","String"],"mappings":";;;AAoBO,MAAMA,6BAA2C,CAACC,eAAeC;IACtE,MAAMC,SAAS;QAAE,GAAGF,aAAa;IAAC;IAClC,MAAM,EAAEG,KAAK,EAAE,GAAGF;IAClB,MAAM,EAAEG,OAAO,EAAE,GAAGD;IACpB,MAAM,EAAEE,aAAa,EAAE,EAAEC,WAAW,EAAE,EAAEC,QAAQ,EAAEC,SAAS,EAAE,GAAGR;IAEhE,IAAIM,SAAS,MAAM,GAAG,GACpB,MAAM,IAAIG,MAAM;IAElB,MAAMC,eAA2B,EAAE;IACnC,MAAMC,iBAA+B,EAAE;IAEvC,MAAMC,WAAsB,EAAE;IAC9B,MAAMC,YAAYP,QAAQ,CAAC,EAAE;IAC7B,MAAMQ,YAAaR,QAAQ,CAAC,EAAE,IAAIO;IAElC,IAAIA,aAAaA,UAAU,QAAQ,EAAE;QACnC,MAAM,EACJ,SAASE,UAAU,EACnBC,QAAQ,EACRC,UAAU,EACX,GAAGC,sBACFd,SACAe,SAASd,YAAY,CAACe,IAAMA,EAAE,EAAE,GAChCD,SAASN,UAAU,QAAQ,EAAE,CAACO,IAAMA,EAAE,EAAE,GACxCb,UACA;YACE,kBAAkBc;YAClB,eAAeC;YACf,eAAe;YACf,gBAAgBC,kBAAkBvB;
|
1
|
+
{"version":3,"file":"pipeline/advanced/chart/pipes/reshape/reshapeWithScatterEncoding.js","sources":["webpack://@visactor/vseed/./src/pipeline/advanced/chart/pipes/reshape/reshapeWithScatterEncoding.ts"],"sourcesContent":["import { uniqueBy } from 'remeda'\nimport {\n dataReshapeByEncoding,\n FoldXMeasureId,\n FoldXMeasureValue,\n FoldYMeasureId,\n FoldYMeasureValue,\n} from 'src/dataReshape'\nimport { getColorMeasureId } from 'src/pipeline/spec/chart/pipes'\nimport type {\n AdvancedPipe,\n AdvancedVSeed,\n ColumnParallel,\n Dataset,\n Encoding,\n FoldInfo,\n MeasureGroup,\n UnfoldInfo,\n} from 'src/types'\n\nexport const reshapeWithScatterEncoding: AdvancedPipe = (advancedVSeed, context) => {\n const result = { ...advancedVSeed }\n const { vseed } = context\n const { dataset } = vseed as ColumnParallel\n const { dimensions = [], measures = [], encoding, chartType } = advancedVSeed\n\n if (measures.length > 2) {\n throw new Error('measures can not be more than 2 groups in scatter')\n }\n const foldInfoList: FoldInfo[] = []\n const unfoldInfoList: UnfoldInfo[] = []\n\n const datasets: Dataset[] = []\n const xMeasures = measures[0] as MeasureGroup\n const yMeasures = (measures[1] || xMeasures) as MeasureGroup\n\n if (xMeasures && xMeasures.children) {\n const {\n dataset: newDataset,\n foldInfo,\n unfoldInfo,\n } = dataReshapeByEncoding(\n dataset,\n uniqueBy(dimensions, (d) => d.id),\n uniqueBy(xMeasures.children, (d) => d.id),\n encoding as Encoding,\n {\n foldMeasureValue: FoldXMeasureValue,\n foldMeasureId: FoldXMeasureId,\n colorItemAsId: true,\n colorMeasureId: getColorMeasureId(advancedVSeed as AdvancedVSeed, vseed),\n },\n )\n\n datasets.push(newDataset)\n foldInfoList.push(foldInfo)\n unfoldInfoList.push(unfoldInfo)\n }\n\n if (yMeasures && yMeasures.children) {\n const {\n dataset: newDataset,\n foldInfo,\n unfoldInfo,\n } = dataReshapeByEncoding(\n datasets[0],\n uniqueBy(dimensions, (d) => d.id),\n uniqueBy(yMeasures.children, (d) => d.id),\n encoding as Encoding,\n {\n foldMeasureValue: FoldYMeasureValue,\n foldMeasureId: FoldYMeasureId,\n colorItemAsId: true,\n colorMeasureId: getColorMeasureId(advancedVSeed as AdvancedVSeed, vseed),\n },\n )\n\n datasets[0] = newDataset\n foldInfoList.push(foldInfo)\n unfoldInfoList.push(unfoldInfo)\n }\n\n const unfoldInfo: UnfoldInfo = {\n ...unfoldInfoList[0],\n colorItems: unfoldInfoList.flatMap((d) => d.colorItems),\n colorIdMap: unfoldInfoList.reduce((prev, cur) => ({ ...prev, ...cur.colorIdMap }), {}),\n }\n\n return {\n ...result,\n dataset: datasets[0],\n\n datasetReshapeInfo: [\n {\n id: String(chartType),\n index: 0,\n foldInfo: foldInfoList[0],\n foldInfoList: foldInfoList,\n unfoldInfo: unfoldInfo,\n },\n ],\n }\n}\n"],"names":["reshapeWithScatterEncoding","advancedVSeed","context","result","vseed","dataset","dimensions","measures","encoding","chartType","Error","foldInfoList","unfoldInfoList","datasets","xMeasures","yMeasures","newDataset","foldInfo","unfoldInfo","dataReshapeByEncoding","uniqueBy","d","FoldXMeasureValue","FoldXMeasureId","getColorMeasureId","FoldYMeasureValue","FoldYMeasureId","prev","cur","String"],"mappings":";;;AAoBO,MAAMA,6BAA2C,CAACC,eAAeC;IACtE,MAAMC,SAAS;QAAE,GAAGF,aAAa;IAAC;IAClC,MAAM,EAAEG,KAAK,EAAE,GAAGF;I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e,OAAO,CAAC,CAACS,IAAMA,EAAE,UAAU;QACtD,YAAYT,eAAe,MAAM,CAAC,CAACe,MAAMC,MAAS;gBAAE,GAAGD,IAAI;gBAAE,GAAGC,IAAI,UAAU;YAAC,IAAI,CAAC;IACtF;IAEA,OAAO;QACL,GAAGzB,MAAM;QACT,SAASU,QAAQ,CAAC,EAAE;QAEpB,oBAAoB;YAClB;gBACE,IAAIgB,OAAOpB;gBACX,OAAO;gBACP,UAAUE,YAAY,CAAC,EAAE;gBACzB,cAAcA;gBACd,YAAYO;YACd;SACD;IACH;AACF"}
|
@@ -1,2 +1,3 @@
|
|
1
1
|
import type { Formatter, NumFormat } from '../../../../../../types';
|
2
2
|
export declare const createLinearFormat: (value: string | number, autoFormat: boolean | undefined, numFormat: NumFormat, formatter: Formatter) => string;
|
3
|
+
export declare const createLinearPercentFormat: (value: string | number, autoFormat: boolean | undefined, numFormat: NumFormat, formatter: Formatter, percentFormatter: Formatter) => string;
|
@@ -6,6 +6,12 @@ const createLinearFormat = (value, autoFormat, numFormat, formatter)=>{
|
|
6
6
|
if (!isEmpty(numFormat)) return formatter(value);
|
7
7
|
return String(value);
|
8
8
|
};
|
9
|
-
|
9
|
+
const createLinearPercentFormat = (value, autoFormat, numFormat, formatter, percentFormatter)=>{
|
10
|
+
if (isNullish(autoFormat) && isEmpty(numFormat)) return percentFormatter(value);
|
11
|
+
if (true === autoFormat) return percentFormatter(value);
|
12
|
+
if (!isEmpty(numFormat)) return formatter(value);
|
13
|
+
return String(value);
|
14
|
+
};
|
15
|
+
export { createLinearFormat, createLinearPercentFormat };
|
10
16
|
|
11
17
|
//# sourceMappingURL=linearFormat.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"pipeline/spec/chart/pipes/axes/format/linearFormat.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/chart/pipes/axes/format/linearFormat.ts"],"sourcesContent":["import { isEmpty, isNullish } from 'remeda'\nimport { autoFormatter } from 'src/pipeline/utils'\nimport type { Formatter, NumFormat } from 'src/types'\n\nexport const createLinearFormat = (\n value: string | number,\n autoFormat: boolean | undefined,\n numFormat: NumFormat,\n formatter: Formatter,\n) => {\n if (isNullish(autoFormat) && isEmpty(numFormat)) {\n return autoFormatter(value)\n }\n\n if (autoFormat === true) {\n return autoFormatter(value)\n }\n\n if (!isEmpty(numFormat)) {\n return formatter(value)\n }\n\n return String(value)\n}\n"],"names":["createLinearFormat","value","autoFormat","numFormat","formatter","isNullish","isEmpty","autoFormatter","String"],"mappings":";;AAIO,MAAMA,qBAAqB,CAChCC,OACAC,YACAC,WACAC;IAEA,IAAIC,UAAUH,eAAeI,QAAQH,YACnC,OAAOI,cAAcN;IAGvB,IAAIC,AAAe,SAAfA,YACF,OAAOK,cAAcN;IAGvB,IAAI,CAACK,QAAQH,YACX,OAAOC,UAAUH;IAGnB,OAAOO,OAAOP;AAChB"}
|
1
|
+
{"version":3,"file":"pipeline/spec/chart/pipes/axes/format/linearFormat.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/chart/pipes/axes/format/linearFormat.ts"],"sourcesContent":["import { isEmpty, isNullish } from 'remeda'\nimport { autoFormatter } from 'src/pipeline/utils'\nimport type { Formatter, NumFormat } from 'src/types'\n\nexport const createLinearFormat = (\n value: string | number,\n autoFormat: boolean | undefined,\n numFormat: NumFormat,\n formatter: Formatter,\n) => {\n if (isNullish(autoFormat) && isEmpty(numFormat)) {\n return autoFormatter(value)\n }\n\n if (autoFormat === true) {\n return autoFormatter(value)\n }\n\n if (!isEmpty(numFormat)) {\n return formatter(value)\n }\n\n return String(value)\n}\n\nexport const createLinearPercentFormat = (\n value: string | number,\n autoFormat: boolean | undefined,\n numFormat: NumFormat,\n formatter: Formatter,\n percentFormatter: Formatter,\n) => {\n if (isNullish(autoFormat) && isEmpty(numFormat)) {\n return percentFormatter(value)\n }\n\n if (autoFormat === true) {\n return percentFormatter(value)\n }\n\n if (!isEmpty(numFormat)) {\n return formatter(value)\n }\n\n return String(value)\n}\n"],"names":["createLinearFormat","value","autoFormat","numFormat","formatter","isNullish","isEmpty","autoFormatter","String","createLinearPercentFormat","percentFormatter"],"mappings":";;AAIO,MAAMA,qBAAqB,CAChCC,OACAC,YACAC,WACAC;IAEA,IAAIC,UAAUH,eAAeI,QAAQH,YACnC,OAAOI,cAAcN;IAGvB,IAAIC,AAAe,SAAfA,YACF,OAAOK,cAAcN;IAGvB,IAAI,CAACK,QAAQH,YACX,OAAOC,UAAUH;IAGnB,OAAOO,OAAOP;AAChB;AAEO,MAAMQ,4BAA4B,CACvCR,OACAC,YACAC,WACAC,WACAM;IAEA,IAAIL,UAAUH,eAAeI,QAAQH,YACnC,OAAOO,iBAAiBT;IAG1B,IAAIC,AAAe,SAAfA,YACF,OAAOQ,iBAAiBT;IAG1B,IAAI,CAACK,QAAQH,YACX,OAAOC,UAAUH;IAGnB,OAAOO,OAAOP;AAChB"}
|
@@ -1,10 +1,7 @@
|
|
1
|
-
const radarAngleAxis = (spec
|
1
|
+
const radarAngleAxis = (spec)=>{
|
2
2
|
const result = {
|
3
3
|
...spec
|
4
4
|
};
|
5
|
-
const { advancedVSeed } = context;
|
6
|
-
const { dimensions, measures } = advancedVSeed;
|
7
|
-
if (!dimensions || !measures) return result;
|
8
5
|
if (!result.axes) result.axes = [];
|
9
6
|
result.axes.push({
|
10
7
|
orient: 'angle',
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"pipeline/spec/chart/pipes/axes/radarAngle.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/chart/pipes/axes/radarAngle.ts"],"sourcesContent":["import type { IRoseChartSpec } from '@visactor/vchart'\nimport type { SpecPipe } from 'src/types'\n\nexport const radarAngleAxis: SpecPipe = (spec
|
1
|
+
{"version":3,"file":"pipeline/spec/chart/pipes/axes/radarAngle.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/chart/pipes/axes/radarAngle.ts"],"sourcesContent":["import type { IRoseChartSpec } from '@visactor/vchart'\nimport type { SpecPipe } from 'src/types'\n\nexport const radarAngleAxis: SpecPipe = (spec) => {\n const result = { ...spec } as IRoseChartSpec\n\n if (!result.axes) {\n result.axes = []\n }\n\n result.axes.push({\n orient: 'angle',\n visible: true,\n zero: true,\n nice: true,\n grid: {\n visible: true,\n },\n domainLine: {\n visible: true,\n },\n tick: {\n visible: true,\n },\n })\n\n return result\n}\n"],"names":["radarAngleAxis","spec","result"],"mappings":"AAGO,MAAMA,iBAA2B,CAACC;IACvC,MAAMC,SAAS;QAAE,GAAGD,IAAI;IAAC;IAEzB,IAAI,CAACC,OAAO,IAAI,EACdA,OAAO,IAAI,GAAG,EAAE;IAGlBA,OAAO,IAAI,CAAC,IAAI,CAAC;QACf,QAAQ;QACR,SAAS;QACT,MAAM;QACN,MAAM;QACN,MAAM;YACJ,SAAS;QACX;QACA,YAAY;YACV,SAAS;QACX;QACA,MAAM;YACJ,SAAS;QACX;IACF;IAEA,OAAOA;AACT"}
|
@@ -1,10 +1,7 @@
|
|
1
|
-
const radarRadiusAxis = (spec
|
1
|
+
const radarRadiusAxis = (spec)=>{
|
2
2
|
const result = {
|
3
3
|
...spec
|
4
4
|
};
|
5
|
-
const { advancedVSeed } = context;
|
6
|
-
const { dimensions, measures } = advancedVSeed;
|
7
|
-
if (!dimensions || !measures) return result;
|
8
5
|
if (!result.axes) result.axes = [];
|
9
6
|
result.axes.push({
|
10
7
|
orient: 'radius',
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"pipeline/spec/chart/pipes/axes/radarRadius.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/chart/pipes/axes/radarRadius.ts"],"sourcesContent":["import type { IRoseChartSpec } from '@visactor/vchart'\nimport type { SpecPipe } from 'src/types'\n\nexport const radarRadiusAxis: SpecPipe = (spec
|
1
|
+
{"version":3,"file":"pipeline/spec/chart/pipes/axes/radarRadius.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/chart/pipes/axes/radarRadius.ts"],"sourcesContent":["import type { IRoseChartSpec } from '@visactor/vchart'\nimport type { SpecPipe } from 'src/types'\n\nexport const radarRadiusAxis: SpecPipe = (spec) => {\n const result = { ...spec } as IRoseChartSpec\n\n if (!result.axes) {\n result.axes = []\n }\n\n result.axes.push({\n orient: 'radius',\n visible: true,\n zero: true,\n nice: true,\n grid: {\n visible: true,\n },\n tick: {\n visible: true,\n },\n label: {\n visible: true,\n },\n domainLine: {\n visible: true,\n },\n })\n\n return result\n}\n"],"names":["radarRadiusAxis","spec","result"],"mappings":"AAGO,MAAMA,kBAA4B,CAACC;IACxC,MAAMC,SAAS;QAAE,GAAGD,IAAI;IAAC;IAEzB,IAAI,CAACC,OAAO,IAAI,EACdA,OAAO,IAAI,GAAG,EAAE;IAGlBA,OAAO,IAAI,CAAC,IAAI,CAAC;QACf,QAAQ;QACR,SAAS;QACT,MAAM;QACN,MAAM;QACN,MAAM;YACJ,SAAS;QACX;QACA,MAAM;YACJ,SAAS;QACX;QACA,OAAO;YACL,SAAS;QACX;QACA,YAAY;YACV,SAAS;QACX;IACF;IAEA,OAAOA;AACT"}
|
@@ -1,10 +1,7 @@
|
|
1
|
-
const radiusAxis = (spec
|
1
|
+
const radiusAxis = (spec)=>{
|
2
2
|
const result = {
|
3
3
|
...spec
|
4
4
|
};
|
5
|
-
const { advancedVSeed } = context;
|
6
|
-
const { dimensions, measures } = advancedVSeed;
|
7
|
-
if (!dimensions || !measures) return result;
|
8
5
|
if (!result.axes) result.axes = [];
|
9
6
|
result.axes.push({
|
10
7
|
type: 'linear',
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"pipeline/spec/chart/pipes/axes/radius.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/chart/pipes/axes/radius.ts"],"sourcesContent":["import type { IRoseChartSpec } from '@visactor/vchart'\nimport type { SpecPipe } from 'src/types'\n\nexport const radiusAxis: SpecPipe = (spec
|
1
|
+
{"version":3,"file":"pipeline/spec/chart/pipes/axes/radius.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/chart/pipes/axes/radius.ts"],"sourcesContent":["import type { IRoseChartSpec } from '@visactor/vchart'\nimport type { SpecPipe } from 'src/types'\n\nexport const radiusAxis: SpecPipe = (spec) => {\n const result = { ...spec } as IRoseChartSpec\n\n if (!result.axes) {\n result.axes = []\n }\n\n result.axes.push({\n type: 'linear',\n orient: 'radius',\n visible: false,\n zero: true,\n nice: false,\n })\n\n return result\n}\n"],"names":["radiusAxis","spec","result"],"mappings":"AAGO,MAAMA,aAAuB,CAACC;IACnC,MAAMC,SAAS;QAAE,GAAGD,IAAI;IAAC;IAEzB,IAAI,CAACC,OAAO,IAAI,EACdA,OAAO,IAAI,GAAG,EAAE;IAGlBA,OAAO,IAAI,CAAC,IAAI,CAAC;QACf,MAAM;QACN,QAAQ;QACR,SAAS;QACT,MAAM;QACN,MAAM;IACR;IAEA,OAAOA;AACT"}
|
@@ -8,17 +8,6 @@ const xBand = (spec, context)=>{
|
|
8
8
|
const { measures, dimensions, encoding } = advancedVSeed;
|
9
9
|
const config = advancedVSeed.config?.[chartType]?.xAxis;
|
10
10
|
if (!result.axes) result.axes = [];
|
11
|
-
if (!config) {
|
12
|
-
result.axes = [
|
13
|
-
...result.axes,
|
14
|
-
{
|
15
|
-
visible: true,
|
16
|
-
type: 'band',
|
17
|
-
orient: 'bottom'
|
18
|
-
}
|
19
|
-
];
|
20
|
-
return result;
|
21
|
-
}
|
22
11
|
const { visible = true, label, tick, title, grid, line, labelAutoHide, labelAutoHideGap, labelAutoLimit, labelAutoLimitLength = 80, labelAutoRotate, labelAutoRotateAngleRange } = config;
|
23
12
|
const sampling = !(labelAutoHide || labelAutoRotate || labelAutoLimit);
|
24
13
|
const bandAxis = {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"pipeline/spec/chart/pipes/axes/xBand.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/chart/pipes/axes/xBand.ts"],"sourcesContent":["import type { ICartesianBandAxisSpec, ISpec } from '@visactor/vchart'\nimport type { SpecPipe, XBandAxis } from 'src/types'\nimport { defaultTitleText } from './title/defaultTitleText'\n\nexport const xBand: SpecPipe = (spec, context) => {\n const result = { ...spec } as ISpec\n const { advancedVSeed, vseed } = context\n const { chartType } = vseed\n const { measures, dimensions, encoding } = advancedVSeed\n const config = advancedVSeed.config?.[chartType as 'column']?.xAxis as XBandAxis\n\n if (!result.axes) {\n result.axes = []\n }\n\n
|
1
|
+
{"version":3,"file":"pipeline/spec/chart/pipes/axes/xBand.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/chart/pipes/axes/xBand.ts"],"sourcesContent":["import type { ICartesianBandAxisSpec, ISpec } from '@visactor/vchart'\nimport type { SpecPipe, XBandAxis } from 'src/types'\nimport { defaultTitleText } from './title/defaultTitleText'\n\nexport const xBand: SpecPipe = (spec, context) => {\n const result = { ...spec } as ISpec\n const { advancedVSeed, vseed } = context\n const { chartType } = vseed\n const { measures, dimensions, encoding } = advancedVSeed\n const config = advancedVSeed.config?.[chartType as 'column']?.xAxis as XBandAxis\n\n if (!result.axes) {\n result.axes = []\n }\n\n const {\n visible = true,\n label,\n tick,\n title,\n grid,\n line,\n labelAutoHide,\n labelAutoHideGap,\n labelAutoLimit,\n labelAutoLimitLength = 80,\n labelAutoRotate,\n labelAutoRotateAngleRange,\n } = config\n\n const sampling = !(labelAutoHide || labelAutoRotate || labelAutoLimit)\n\n const bandAxis = {\n visible,\n type: 'band',\n orient: 'bottom',\n maxHeight: labelAutoLimitLength + 60,\n sampling,\n hover: true,\n label: {\n visible: label?.visible,\n flush: true,\n space: 8,\n style: {\n maxLineWidth: labelAutoLimitLength,\n fill: label?.labelColor,\n angle: label?.labelAngle,\n fontSize: label?.labelFontSize,\n fontWeight: label?.labelFontWeight,\n },\n\n // 防重叠相关\n minGap: labelAutoHideGap,\n autoHide: labelAutoHide,\n autoHideMethod: 'greedy',\n autoHideSeparation: labelAutoHideGap,\n autoLimit: labelAutoLimit,\n autoRotate: labelAutoRotate,\n autoRotateAngle: labelAutoRotateAngleRange,\n lastVisible: true,\n },\n title: {\n visible: title?.visible,\n text: title?.titleText || defaultTitleText(measures, dimensions, encoding.x as string[]),\n style: {\n fill: title?.titleColor,\n fontSize: title?.titleFontSize,\n fontWeight: title?.titleFontWeight,\n },\n },\n tick: {\n visible: tick?.visible,\n tickSize: tick?.tickSize,\n inside: tick?.tickInside,\n style: {\n stroke: tick?.tickColor,\n },\n },\n grid: {\n visible: grid?.visible,\n style: {\n lineWidth: grid?.gridWidth,\n stroke: grid?.gridColor,\n },\n },\n domainLine: {\n visible: line?.visible,\n style: {\n lineWidth: line?.lineWidth,\n stroke: line?.lineColor,\n },\n },\n paddingInner: [0.15, 0.1],\n paddingOuter: [0.075, 0.1],\n } as ICartesianBandAxisSpec\n\n result.axes = [...result.axes, bandAxis] as ISpec['axes']\n return result\n}\n"],"names":["xBand","spec","context","result","advancedVSeed","vseed","chartType","measures","dimensions","encoding","config","visible","label","tick","title","grid","line","labelAutoHide","labelAutoHideGap","labelAutoLimit","labelAutoLimitLength","labelAutoRotate","labelAutoRotateAngleRange","sampling","bandAxis","defaultTitleText"],"mappings":";AAIO,MAAMA,QAAkB,CAACC,MAAMC;IACpC,MAAMC,SAAS;QAAE,GAAGF,IAAI;IAAC;IACzB,MAAM,EAAEG,aAAa,EAAEC,KAAK,EAAE,GAAGH;IACjC,MAAM,EAAEI,SAAS,EAAE,GAAGD;IACtB,MAAM,EAAEE,QAAQ,EAAEC,UAAU,EAAEC,QAAQ,EAAE,GAAGL;IAC3C,MAAMM,SAASN,cAAc,MAAM,EAAE,CAACE,UAAsB,EAAE;IAE9D,IAAI,CAACH,OAAO,IAAI,EACdA,OAAO,IAAI,GAAG,EAAE;IAGlB,MAAM,EACJQ,UAAU,IAAI,EACdC,KAAK,EACLC,IAAI,EACJC,KAAK,EACLC,IAAI,EACJC,IAAI,EACJC,aAAa,EACbC,gBAAgB,EAChBC,cAAc,EACdC,uBAAuB,EAAE,EACzBC,eAAe,EACfC,yBAAyB,EAC1B,GAAGZ;IAEJ,MAAMa,WAAW,CAAEN,CAAAA,iBAAiBI,mBAAmBF,cAAa;IAEpE,MAAMK,WAAW;QACfb;QACA,MAAM;QACN,QAAQ;QACR,WAAWS,uBAAuB;QAClCG;QACA,OAAO;QACP,OAAO;YACL,SAASX,OAAO;YAChB,OAAO;YACP,OAAO;YACP,OAAO;gBACL,cAAcQ;gBACd,MAAMR,OAAO;gBACb,OAAOA,OAAO;gBACd,UAAUA,OAAO;gBACjB,YAAYA,OAAO;YACrB;YAGA,QAAQM;YACR,UAAUD;YACV,gBAAgB;YAChB,oBAAoBC;YACpB,WAAWC;YACX,YAAYE;YACZ,iBAAiBC;YACjB,aAAa;QACf;QACA,OAAO;YACL,SAASR,OAAO;YAChB,MAAMA,OAAO,aAAaW,iBAAiBlB,UAAUC,YAAYC,SAAS,CAAC;YAC3E,OAAO;gBACL,MAAMK,OAAO;gBACb,UAAUA,OAAO;gBACjB,YAAYA,OAAO;YACrB;QACF;QACA,MAAM;YACJ,SAASD,MAAM;YACf,UAAUA,MAAM;YAChB,QAAQA,MAAM;YACd,OAAO;gBACL,QAAQA,MAAM;YAChB;QACF;QACA,MAAM;YACJ,SAASE,MAAM;YACf,OAAO;gBACL,WAAWA,MAAM;gBACjB,QAAQA,MAAM;YAChB;QACF;QACA,YAAY;YACV,SAASC,MAAM;YACf,OAAO;gBACL,WAAWA,MAAM;gBACjB,QAAQA,MAAM;YAChB;QACF;QACA,cAAc;YAAC;YAAM;SAAI;QACzB,cAAc;YAAC;YAAO;SAAI;IAC5B;IAEAb,OAAO,IAAI,GAAG;WAAIA,OAAO,IAAI;QAAEqB;KAAS;IACxC,OAAOrB;AACT"}
|
@@ -1,6 +1,5 @@
|
|
1
|
-
import { LINEAR_AXIS_INNER_OFFSET_TOP } from "../../../../utils/
|
2
|
-
import {
|
3
|
-
import { createLinearFormat } from "./format/linearFormat.js";
|
1
|
+
import { LINEAR_AXIS_INNER_OFFSET_TOP, createNumFormatter, isAreaPercent, isBarPercent, isColumnPercent } from "../../../../utils/index.js";
|
2
|
+
import { createLinearFormat, createLinearPercentFormat } from "./format/linearFormat.js";
|
4
3
|
import { defaultTitleText } from "./title/defaultTitleText.js";
|
5
4
|
const xLinear = (spec, context)=>{
|
6
5
|
const result = {
|
@@ -11,19 +10,11 @@ const xLinear = (spec, context)=>{
|
|
11
10
|
const { chartType } = vseed;
|
12
11
|
const config = advancedVSeed.config?.[chartType]?.xAxis;
|
13
12
|
if (!result.axes) result.axes = [];
|
14
|
-
if (!config) {
|
15
|
-
result.axes = [
|
16
|
-
...result.axes,
|
17
|
-
{
|
18
|
-
visible: true,
|
19
|
-
type: 'linear',
|
20
|
-
orient: 'bottom'
|
21
|
-
}
|
22
|
-
];
|
23
|
-
return result;
|
24
|
-
}
|
25
13
|
const { visible = true, label, tick, title, grid, line, zero, nice, inverse, max, min, log, logBase = 10, autoFormat, numFormat = {} } = config;
|
26
14
|
const formatter = createNumFormatter(numFormat);
|
15
|
+
const percentFormatter = createNumFormatter({
|
16
|
+
type: 'percent'
|
17
|
+
});
|
27
18
|
const linearAxis = {
|
28
19
|
visible,
|
29
20
|
type: log ? 'log' : 'linear',
|
@@ -36,7 +27,10 @@ const xLinear = (spec, context)=>{
|
|
36
27
|
min,
|
37
28
|
label: {
|
38
29
|
visible: label?.visible,
|
39
|
-
formatMethod: (value)=>
|
30
|
+
formatMethod: (value)=>{
|
31
|
+
if (isBarPercent(vseed) || isColumnPercent(vseed) || isAreaPercent(vseed)) return createLinearPercentFormat(value, autoFormat, numFormat, formatter, percentFormatter);
|
32
|
+
return createLinearFormat(value, autoFormat, numFormat, formatter);
|
33
|
+
},
|
40
34
|
style: {
|
41
35
|
fill: label?.labelColor,
|
42
36
|
angle: label?.labelAngle,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"pipeline/spec/chart/pipes/axes/xLinear.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/chart/pipes/axes/xLinear.ts"],"sourcesContent":["import type { ISpec } from '@visactor/vchart'\nimport
|
1
|
+
{"version":3,"file":"pipeline/spec/chart/pipes/axes/xLinear.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/chart/pipes/axes/xLinear.ts"],"sourcesContent":["import type { ISpec } from '@visactor/vchart'\nimport type { SpecPipe, XLinearAxis } from 'src/types'\nimport {\n createNumFormatter,\n isAreaPercent,\n isBarPercent,\n isColumnPercent,\n LINEAR_AXIS_INNER_OFFSET_TOP,\n} from 'src/pipeline/utils'\nimport { createLinearFormat, createLinearPercentFormat } from './format/linearFormat'\nimport { defaultTitleText } from './title/defaultTitleText'\n\nexport const xLinear: SpecPipe = (spec, context) => {\n const result = { ...spec } as ISpec\n const { advancedVSeed, vseed } = context\n const { encoding, dimensions, measures } = advancedVSeed\n const { chartType } = vseed\n const config = advancedVSeed.config?.[chartType as 'bar']?.xAxis as XLinearAxis\n\n if (!result.axes) {\n result.axes = []\n }\n\n const {\n visible = true,\n label,\n tick,\n title,\n grid,\n line,\n\n zero,\n nice,\n inverse,\n max,\n min,\n log,\n logBase = 10,\n autoFormat,\n numFormat = {},\n } = config\n\n const formatter = createNumFormatter(numFormat)\n const percentFormatter = createNumFormatter({\n type: 'percent',\n })\n\n const linearAxis = {\n visible,\n type: log ? 'log' : 'linear',\n base: logBase,\n orient: 'bottom',\n nice,\n zero: log ? false : zero,\n inverse,\n max,\n min,\n label: {\n visible: label?.visible,\n formatMethod: (value: string) => {\n if (isBarPercent(vseed) || isColumnPercent(vseed) || isAreaPercent(vseed)) {\n return createLinearPercentFormat(value, autoFormat, numFormat, formatter, percentFormatter)\n }\n return createLinearFormat(value, autoFormat, numFormat, formatter)\n },\n style: {\n fill: label?.labelColor,\n angle: label?.labelAngle,\n fontSize: label?.labelFontSize,\n fontWeight: label?.labelFontWeight,\n },\n },\n title: {\n visible: title?.visible,\n text: title?.titleText || defaultTitleText(measures, dimensions, encoding.x as string[]),\n style: {\n fill: title?.titleColor,\n fontSize: title?.titleFontSize,\n fontWeight: title?.titleFontWeight,\n },\n },\n tick: {\n visible: tick?.visible,\n tickSize: tick?.tickSize,\n inside: tick?.tickInside,\n style: {\n stroke: tick?.tickColor,\n },\n },\n grid: {\n visible: grid?.visible,\n style: {\n lineWidth: grid?.gridWidth,\n stroke: grid?.gridColor,\n },\n },\n domainLine: {\n visible: line?.visible,\n style: {\n lineWidth: line?.lineWidth,\n stroke: line?.lineColor,\n },\n },\n innerOffset: {\n right: LINEAR_AXIS_INNER_OFFSET_TOP,\n // left: LINEAR_AXIS_INNER_OFFSET_TOP,\n },\n }\n\n result.axes = [...result.axes, linearAxis] as ISpec['axes']\n\n return result\n}\n"],"names":["xLinear","spec","context","result","advancedVSeed","vseed","encoding","dimensions","measures","chartType","config","visible","label","tick","title","grid","line","zero","nice","inverse","max","min","log","logBase","autoFormat","numFormat","formatter","createNumFormatter","percentFormatter","linearAxis","value","isBarPercent","isColumnPercent","isAreaPercent","createLinearPercentFormat","createLinearFormat","defaultTitleText","LINEAR_AXIS_INNER_OFFSET_TOP"],"mappings":";;;AAYO,MAAMA,UAAoB,CAACC,MAAMC;IACtC,MAAMC,SAAS;QAAE,GAAGF,IAAI;IAAC;IACzB,MAAM,EAAEG,aAAa,EAAEC,KAAK,EAAE,GAAGH;IACjC,MAAM,EAAEI,QAAQ,EAAEC,UAAU,EAAEC,QAAQ,EAAE,GAAGJ;IAC3C,MAAM,EAAEK,SAAS,EAAE,GAAGJ;IACtB,MAAMK,SAASN,cAAc,MAAM,EAAE,CAACK,UAAmB,EAAE;IAE3D,IAAI,CAACN,OAAO,IAAI,EACdA,OAAO,IAAI,GAAG,EAAE;IAGlB,MAAM,EACJQ,UAAU,IAAI,EACdC,KAAK,EACLC,IAAI,EACJC,KAAK,EACLC,IAAI,EACJC,IAAI,EAEJC,IAAI,EACJC,IAAI,EACJC,OAAO,EACPC,GAAG,EACHC,GAAG,EACHC,GAAG,EACHC,UAAU,EAAE,EACZC,UAAU,EACVC,YAAY,CAAC,CAAC,EACf,GAAGf;IAEJ,MAAMgB,YAAYC,mBAAmBF;IACrC,MAAMG,mBAAmBD,mBAAmB;QAC1C,MAAM;IACR;IAEA,MAAME,aAAa;QACjBlB;QACA,MAAMW,MAAM,QAAQ;QACpB,MAAMC;QACN,QAAQ;QACRL;QACA,MAAMI,MAAM,QAAQL;QACpBE;QACAC;QACAC;QACA,OAAO;YACL,SAAST,OAAO;YAChB,cAAc,CAACkB;gBACb,IAAIC,aAAa1B,UAAU2B,gBAAgB3B,UAAU4B,cAAc5B,QACjE,OAAO6B,0BAA0BJ,OAAON,YAAYC,WAAWC,WAAWE;gBAE5E,OAAOO,mBAAmBL,OAAON,YAAYC,WAAWC;YAC1D;YACA,OAAO;gBACL,MAAMd,OAAO;gBACb,OAAOA,OAAO;gBACd,UAAUA,OAAO;gBACjB,YAAYA,OAAO;YACrB;QACF;QACA,OAAO;YACL,SAASE,OAAO;YAChB,MAAMA,OAAO,aAAasB,iBAAiB5B,UAAUD,YAAYD,SAAS,CAAC;YAC3E,OAAO;gBACL,MAAMQ,OAAO;gBACb,UAAUA,OAAO;gBACjB,YAAYA,OAAO;YACrB;QACF;QACA,MAAM;YACJ,SAASD,MAAM;YACf,UAAUA,MAAM;YAChB,QAAQA,MAAM;YACd,OAAO;gBACL,QAAQA,MAAM;YAChB;QACF;QACA,MAAM;YACJ,SAASE,MAAM;YACf,OAAO;gBACL,WAAWA,MAAM;gBACjB,QAAQA,MAAM;YAChB;QACF;QACA,YAAY;YACV,SAASC,MAAM;YACf,OAAO;gBACL,WAAWA,MAAM;gBACjB,QAAQA,MAAM;YAChB;QACF;QACA,aAAa;YACX,OAAOqB;QAET;IACF;IAEAlC,OAAO,IAAI,GAAG;WAAIA,OAAO,IAAI;QAAE0B;KAAW;IAE1C,OAAO1B;AACT"}
|
@@ -8,17 +8,6 @@ const yBand = (spec, context)=>{
|
|
8
8
|
const { measures, dimensions, encoding } = advancedVSeed;
|
9
9
|
const config = advancedVSeed.config?.[chartType]?.yAxis;
|
10
10
|
if (!result.axes) result.axes = [];
|
11
|
-
if (!config) {
|
12
|
-
result.axes = [
|
13
|
-
...result.axes,
|
14
|
-
{
|
15
|
-
visible: true,
|
16
|
-
type: 'band',
|
17
|
-
orient: 'left'
|
18
|
-
}
|
19
|
-
];
|
20
|
-
return result;
|
21
|
-
}
|
22
11
|
const { visible = true, label, tick, title, grid, line, labelAutoHide, labelAutoHideGap, labelAutoLimit, labelAutoLimitLength = 80, labelAutoRotate, labelAutoRotateAngleRange } = config;
|
23
12
|
const sampling = !(labelAutoHide || labelAutoRotate || labelAutoLimit);
|
24
13
|
const bandAxis = {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"pipeline/spec/chart/pipes/axes/yBand.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/chart/pipes/axes/yBand.ts"],"sourcesContent":["import type { ICartesianBandAxisSpec, ISpec } from '@visactor/vchart'\nimport type { SpecPipe, XBandAxis } from 'src/types'\nimport { defaultTitleText } from './title/defaultTitleText'\n\nexport const yBand: SpecPipe = (spec, context) => {\n const result = { ...spec } as ISpec\n const { advancedVSeed, vseed } = context\n const { chartType } = vseed\n const { measures, dimensions, encoding } = advancedVSeed\n const config = advancedVSeed.config?.[chartType as 'bar']?.yAxis as XBandAxis\n\n if (!result.axes) {\n result.axes = []\n }\n\n
|
1
|
+
{"version":3,"file":"pipeline/spec/chart/pipes/axes/yBand.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/chart/pipes/axes/yBand.ts"],"sourcesContent":["import type { ICartesianBandAxisSpec, ISpec } from '@visactor/vchart'\nimport type { SpecPipe, XBandAxis } from 'src/types'\nimport { defaultTitleText } from './title/defaultTitleText'\n\nexport const yBand: SpecPipe = (spec, context) => {\n const result = { ...spec } as ISpec\n const { advancedVSeed, vseed } = context\n const { chartType } = vseed\n const { measures, dimensions, encoding } = advancedVSeed\n const config = advancedVSeed.config?.[chartType as 'bar']?.yAxis as XBandAxis\n\n if (!result.axes) {\n result.axes = []\n }\n\n const {\n visible = true,\n label,\n tick,\n title,\n grid,\n line,\n labelAutoHide,\n labelAutoHideGap,\n labelAutoLimit,\n labelAutoLimitLength = 80,\n labelAutoRotate,\n labelAutoRotateAngleRange,\n } = config\n\n const sampling = !(labelAutoHide || labelAutoRotate || labelAutoLimit)\n\n const bandAxis = {\n visible,\n type: 'band',\n orient: 'left',\n maxWidth: labelAutoLimitLength + 60,\n sampling,\n hover: true,\n label: {\n visible: label?.visible,\n flush: true,\n containerAlign: 'right',\n space: 8,\n style: {\n maxLineWidth: labelAutoLimitLength,\n fill: label?.labelColor,\n angle: label?.labelAngle,\n fontSize: label?.labelFontSize,\n fontWeight: label?.labelFontWeight,\n },\n // 防重叠相关\n minGap: labelAutoHideGap,\n autoHide: labelAutoHide,\n autoHideMethod: 'greedy',\n autoHideSeparation: labelAutoHideGap,\n autoLimit: labelAutoLimit,\n autoRotate: labelAutoRotate,\n autoRotateAngle: labelAutoRotateAngleRange,\n lastVisible: true,\n },\n title: {\n visible: title?.visible,\n text: title?.titleText || defaultTitleText(measures, dimensions, encoding.y as string[]),\n style: {\n fill: title?.titleColor,\n fontSize: title?.titleFontSize,\n fontWeight: title?.titleFontWeight,\n },\n },\n tick: {\n visible: tick?.visible,\n tickSize: tick?.tickSize,\n inside: tick?.tickInside,\n style: {\n stroke: tick?.tickColor,\n },\n },\n grid: {\n visible: grid?.visible,\n style: {\n lineWidth: grid?.gridWidth,\n stroke: grid?.gridColor,\n },\n },\n domainLine: {\n visible: line?.visible,\n style: {\n lineWidth: line?.lineWidth,\n stroke: line?.lineColor,\n },\n },\n paddingInner: [0.15, 0.1],\n paddingOuter: [0.075, 0.1],\n } as ICartesianBandAxisSpec\n\n result.axes = [...result.axes, bandAxis] as ISpec['axes']\n return result\n}\n"],"names":["yBand","spec","context","result","advancedVSeed","vseed","chartType","measures","dimensions","encoding","config","visible","label","tick","title","grid","line","labelAutoHide","labelAutoHideGap","labelAutoLimit","labelAutoLimitLength","labelAutoRotate","labelAutoRotateAngleRange","sampling","bandAxis","defaultTitleText"],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;YACd,OAAO;gBACL,QAAQA,MAAM;YAChB;QACF;QACA,MAAM;YACJ,SAASE,MAAM;YACf,OAAO;gBACL,WAAWA,MAAM;gBACjB,QAAQA,MAAM;YAChB;QACF;QACA,YAAY;YACV,SAASC,MAAM;YACf,OAAO;gBACL,WAAWA,MAAM;gBACjB,QAAQA,MAAM;YAChB;QACF;QACA,cAAc;YAAC;YAAM;SAAI;QACzB,cAAc;YAAC;YAAO;SAAI;IAC5B;IAEAb,OAAO,IAAI,GAAG;WAAIA,OAAO,IAAI;QAAEqB;KAAS;IACxC,OAAOrB;AACT"}
|
@@ -1,6 +1,5 @@
|
|
1
|
-
import { LINEAR_AXIS_INNER_OFFSET_TOP } from "../../../../utils/
|
2
|
-
import {
|
3
|
-
import { createLinearFormat } from "./format/linearFormat.js";
|
1
|
+
import { LINEAR_AXIS_INNER_OFFSET_TOP, createNumFormatter, isAreaPercent, isBarPercent, isColumnPercent } from "../../../../utils/index.js";
|
2
|
+
import { createLinearFormat, createLinearPercentFormat } from "./format/linearFormat.js";
|
4
3
|
import { defaultTitleText } from "./title/defaultTitleText.js";
|
5
4
|
const yLinear = (spec, context)=>{
|
6
5
|
const result = {
|
@@ -11,19 +10,11 @@ const yLinear = (spec, context)=>{
|
|
11
10
|
const { measures, dimensions, encoding } = advancedVSeed;
|
12
11
|
const config = advancedVSeed.config?.[chartType]?.yAxis;
|
13
12
|
if (!result.axes) result.axes = [];
|
14
|
-
if (!config) {
|
15
|
-
result.axes = [
|
16
|
-
...result.axes,
|
17
|
-
{
|
18
|
-
visible: true,
|
19
|
-
type: 'linear',
|
20
|
-
orient: 'left'
|
21
|
-
}
|
22
|
-
];
|
23
|
-
return result;
|
24
|
-
}
|
25
13
|
const { visible = true, label, tick, title, grid, line, zero, nice, inverse, max, min, log, logBase = 10, autoFormat, numFormat = {} } = config;
|
26
14
|
const formatter = createNumFormatter(numFormat);
|
15
|
+
const percentFormatter = createNumFormatter({
|
16
|
+
type: 'percent'
|
17
|
+
});
|
27
18
|
const linearAxis = {
|
28
19
|
visible,
|
29
20
|
type: log ? 'log' : 'linear',
|
@@ -36,7 +27,10 @@ const yLinear = (spec, context)=>{
|
|
36
27
|
min,
|
37
28
|
label: {
|
38
29
|
visible: label?.visible,
|
39
|
-
formatMethod: (value)=>
|
30
|
+
formatMethod: (value)=>{
|
31
|
+
if (isBarPercent(vseed) || isColumnPercent(vseed) || isAreaPercent(vseed)) return createLinearPercentFormat(value, autoFormat, numFormat, formatter, percentFormatter);
|
32
|
+
return createLinearFormat(value, autoFormat, numFormat, formatter);
|
33
|
+
},
|
40
34
|
style: {
|
41
35
|
fill: label?.labelColor,
|
42
36
|
angle: label?.labelAngle,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"pipeline/spec/chart/pipes/axes/yLinear.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/chart/pipes/axes/yLinear.ts"],"sourcesContent":["import type { ISpec } from '@visactor/vchart'\nimport {
|
1
|
+
{"version":3,"file":"pipeline/spec/chart/pipes/axes/yLinear.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/chart/pipes/axes/yLinear.ts"],"sourcesContent":["import type { ISpec } from '@visactor/vchart'\nimport {\n createNumFormatter,\n isAreaPercent,\n isBarPercent,\n isColumnPercent,\n LINEAR_AXIS_INNER_OFFSET_TOP,\n} from 'src/pipeline/utils'\nimport type { SpecPipe, YLinearAxis } from 'src/types'\nimport { createLinearFormat, createLinearPercentFormat } from './format/linearFormat'\nimport { defaultTitleText } from './title/defaultTitleText'\n\nexport const yLinear: SpecPipe = (spec, context) => {\n const result = { ...spec } as ISpec\n const { advancedVSeed, vseed } = context\n const { chartType } = vseed\n const { measures, dimensions, encoding } = advancedVSeed\n const config = advancedVSeed.config?.[chartType as 'column']?.yAxis as YLinearAxis\n\n if (!result.axes) {\n result.axes = []\n }\n\n const {\n visible = true,\n label,\n tick,\n title,\n grid,\n line,\n\n zero,\n nice,\n inverse,\n max,\n min,\n log,\n logBase = 10,\n autoFormat,\n numFormat = {},\n } = config\n\n const formatter = createNumFormatter(numFormat)\n const percentFormatter = createNumFormatter({\n type: 'percent',\n })\n\n const linearAxis = {\n visible,\n type: log ? 'log' : 'linear',\n base: logBase,\n orient: 'left',\n nice,\n zero: log ? false : zero,\n inverse,\n max,\n min,\n label: {\n visible: label?.visible,\n formatMethod: (value: string) => {\n if (isBarPercent(vseed) || isColumnPercent(vseed) || isAreaPercent(vseed)) {\n return createLinearPercentFormat(value, autoFormat, numFormat, formatter, percentFormatter)\n }\n return createLinearFormat(value, autoFormat, numFormat, formatter)\n },\n style: {\n fill: label?.labelColor,\n angle: label?.labelAngle,\n fontSize: label?.labelFontSize,\n fontWeight: label?.labelFontWeight,\n },\n },\n title: {\n visible: title?.visible,\n text: title?.titleText || defaultTitleText(measures, dimensions, encoding.y as string[]),\n style: {\n fill: title?.titleColor,\n fontSize: title?.titleFontSize,\n fontWeight: title?.titleFontWeight,\n },\n },\n tick: {\n visible: tick?.visible,\n tickSize: tick?.tickSize,\n inside: tick?.tickInside,\n style: {\n stroke: tick?.tickColor,\n },\n },\n grid: {\n visible: grid?.visible,\n style: {\n lineWidth: grid?.gridWidth,\n stroke: grid?.gridColor,\n },\n },\n domainLine: {\n visible: line?.visible,\n style: {\n lineWidth: line?.lineWidth,\n stroke: line?.lineColor,\n },\n },\n innerOffset: {\n top: LINEAR_AXIS_INNER_OFFSET_TOP,\n // bottom: LINEAR_AXIS_INNER_OFFSET_TOP,\n },\n }\n\n result.axes = [...result.axes, linearAxis] as ISpec['axes']\n\n return result\n}\n"],"names":["yLinear","spec","context","result","advancedVSeed","vseed","chartType","measures","dimensions","encoding","config","visible","label","tick","title","grid","line","zero","nice","inverse","max","min","log","logBase","autoFormat","numFormat","formatter","createNumFormatter","percentFormatter","linearAxis","value","isBarPercent","isColumnPercent","isAreaPercent","createLinearPercentFormat","createLinearFormat","defaultTitleText","LINEAR_AXIS_INNER_OFFSET_TOP"],"mappings":";;;AAYO,MAAMA,UAAoB,C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jB,YAAYA,OAAO;YACrB;QACF;QACA,MAAM;YACJ,SAASD,MAAM;YACf,UAAUA,MAAM;YAChB,QAAQA,MAAM;YACd,OAAO;gBACL,QAAQA,MAAM;YAChB;QACF;QACA,MAAM;YACJ,SAASE,MAAM;YACf,OAAO;gBACL,WAAWA,MAAM;gBACjB,QAAQA,MAAM;YAChB;QACF;QACA,YAAY;YACV,SAASC,MAAM;YACf,OAAO;gBACL,WAAWA,MAAM;gBACjB,QAAQA,MAAM;YAChB;QACF;QACA,aAAa;YACX,KAAKqB;QAEP;IACF;IAEAlC,OAAO,IAAI,GAAG;WAAIA,OAAO,IAAI;QAAE0B;KAAW;IAE1C,OAAO1B;AACT"}
|
@@ -24,19 +24,6 @@ const yLinearPrimary = (spec, context)=>{
|
|
24
24
|
];
|
25
25
|
const seriesId = alignTicksConfig ? seriesIds : seriesIds[0];
|
26
26
|
if (!result.axes) result.axes = [];
|
27
|
-
if (!yAxisConfig) {
|
28
|
-
result.axes = [
|
29
|
-
...result.axes,
|
30
|
-
{
|
31
|
-
visible: true,
|
32
|
-
id,
|
33
|
-
seriesId,
|
34
|
-
type: 'linear',
|
35
|
-
orient: 'left'
|
36
|
-
}
|
37
|
-
];
|
38
|
-
return result;
|
39
|
-
}
|
40
27
|
const { visible = true, label, tick, title, grid, line, zero, nice, inverse, max, min, log, logBase = 10, autoFormat, numFormat = {} } = yAxisConfig;
|
41
28
|
const formatter = createNumFormatter(numFormat);
|
42
29
|
const linearAxis = {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"pipeline/spec/chart/pipes/axes/yLinearPrimary.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/chart/pipes/axes/yLinearPrimary.ts"],"sourcesContent":["import type { ISpec } from '@visactor/vchart'\nimport { LINEAR_AXIS_INNER_OFFSET_TOP } from '../../../../utils/constant'\nimport { createNumFormatter } from '../../../../utils'\nimport type { SpecPipe, YLinearAxis } from 'src/types'\nimport { isEmpty, isNullish } from 'remeda'\nimport { createLinearFormat } from './format/linearFormat'\nimport { defaultTitleText } from './title/defaultTitleText'\n\nexport const yLinearPrimary: SpecPipe = (spec, context) => {\n const result = { ...spec } as ISpec\n const { advancedVSeed, vseed } = context\n const { chartType } = vseed\n const { datasetReshapeInfo, encoding, measures, dimensions } = advancedVSeed\n const { index, id: reshapeInfoId, foldInfoList } = datasetReshapeInfo[0]\n // TODO: default config missing\n const primaryYAxis = advancedVSeed.config?.[chartType as 'dualAxis']?.primaryYAxis as YLinearAxis | YLinearAxis[]\n const yAxisConfig = Array.isArray(primaryYAxis) ? primaryYAxis[index] || primaryYAxis[0] : primaryYAxis\n const alignTicks = advancedVSeed.config?.[chartType as 'dualAxis']?.alignTicks as boolean | boolean[]\n const alignTicksConfig = Array.isArray(alignTicks) ? alignTicks[index] || alignTicks[0] : alignTicks\n\n if (isNullish(foldInfoList?.[0])) {\n return result\n }\n\n const isEmptySecondary = isEmpty(foldInfoList?.[0].foldMap)\n\n const id = `${reshapeInfoId}-primary-axis`\n const seriesIds = [`${reshapeInfoId}-primary-series`, `${reshapeInfoId}-secondary-series`]\n const seriesId = alignTicksConfig ? seriesIds : seriesIds[0]\n\n if (!result.axes) {\n result.axes = []\n }\n\n
|
1
|
+
{"version":3,"file":"pipeline/spec/chart/pipes/axes/yLinearPrimary.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/chart/pipes/axes/yLinearPrimary.ts"],"sourcesContent":["import type { ISpec } from '@visactor/vchart'\nimport { LINEAR_AXIS_INNER_OFFSET_TOP } from '../../../../utils/constant'\nimport { createNumFormatter } from '../../../../utils'\nimport type { SpecPipe, YLinearAxis } from 'src/types'\nimport { isEmpty, isNullish } from 'remeda'\nimport { createLinearFormat } from './format/linearFormat'\nimport { defaultTitleText } from './title/defaultTitleText'\n\nexport const yLinearPrimary: SpecPipe = (spec, context) => {\n const result = { ...spec } as ISpec\n const { advancedVSeed, vseed } = context\n const { chartType } = vseed\n const { datasetReshapeInfo, encoding, measures, dimensions } = advancedVSeed\n const { index, id: reshapeInfoId, foldInfoList } = datasetReshapeInfo[0]\n // TODO: default config missing\n const primaryYAxis = advancedVSeed.config?.[chartType as 'dualAxis']?.primaryYAxis as YLinearAxis | YLinearAxis[]\n const yAxisConfig = Array.isArray(primaryYAxis) ? primaryYAxis[index] || primaryYAxis[0] : primaryYAxis\n const alignTicks = advancedVSeed.config?.[chartType as 'dualAxis']?.alignTicks as boolean | boolean[]\n const alignTicksConfig = Array.isArray(alignTicks) ? alignTicks[index] || alignTicks[0] : alignTicks\n\n if (isNullish(foldInfoList?.[0])) {\n return result\n }\n\n const isEmptySecondary = isEmpty(foldInfoList?.[0].foldMap)\n\n const id = `${reshapeInfoId}-primary-axis`\n const seriesIds = [`${reshapeInfoId}-primary-series`, `${reshapeInfoId}-secondary-series`]\n const seriesId = alignTicksConfig ? seriesIds : seriesIds[0]\n\n if (!result.axes) {\n result.axes = []\n }\n\n const {\n visible = true,\n label,\n tick,\n title,\n grid,\n line,\n\n zero,\n nice,\n inverse,\n max,\n min,\n log,\n logBase = 10,\n\n autoFormat,\n numFormat = {},\n } = yAxisConfig\n\n const formatter = createNumFormatter(numFormat)\n\n const linearAxis = {\n visible: isEmptySecondary ? false : visible,\n id,\n seriesId,\n\n type: log ? 'log' : 'linear',\n base: logBase,\n orient: 'left',\n nice,\n zero: log ? false : zero,\n inverse,\n max,\n min,\n label: {\n visible: label?.visible,\n formatMethod: (value: string) => {\n return createLinearFormat(value, autoFormat, numFormat, formatter)\n },\n style: {\n fill: label?.labelColor,\n angle: label?.labelAngle,\n fontSize: label?.labelFontSize,\n fontWeight: label?.labelFontWeight,\n },\n },\n title: {\n visible: title?.visible,\n text: title?.titleText || defaultTitleText(measures, dimensions, encoding.y as string[]),\n style: {\n fill: title?.titleColor,\n fontSize: title?.titleFontSize,\n fontWeight: title?.titleFontWeight,\n },\n },\n tick: {\n visible: tick?.visible,\n tickSize: tick?.tickSize,\n inside: tick?.tickInside,\n style: {\n stroke: tick?.tickColor,\n },\n },\n grid: {\n visible: grid?.visible,\n style: {\n lineWidth: grid?.gridWidth,\n stroke: grid?.gridColor,\n },\n },\n domainLine: {\n visible: line?.visible,\n style: {\n lineWidth: line?.lineWidth,\n stroke: line?.lineColor,\n },\n },\n innerOffset: {\n top: LINEAR_AXIS_INNER_OFFSET_TOP,\n // bottom: LINEAR_AXIS_INNER_OFFSET_TOP,\n },\n }\n\n result.axes = [...result.axes, linearAxis] as ISpec['axes']\n\n return result\n}\n"],"names":["yLinearPrimary","spec","context","result","advancedVSeed","vseed","chartType","datasetReshapeInfo","encoding","measures","dimensions","index","reshapeInfoId","foldInfoList","primaryYAxis","yAxisConfig","Array","alignTicks","alignTicksConfig","isNullish","isEmptySecondary","isEmpty","id","seriesIds","seriesId","visible","label","tick","title","grid","line","zero","nice","inverse","max","min","log","logBase","autoFormat","numFormat","formatter","createNumFormatter","linearAxis","value","createLinearFormat","defaultTitleText","LINEAR_AXIS_INNER_OFFSET_TOP"],"mappings":";;;;;AAQO,MAAMA,iBAA2B,CAACC,MAAMC;IAC7C,MAAMC,SAAS;QAAE,GAAGF,IAAI;IAAC;IACzB,MAAM,EAAEG,aAAa,EAAEC,KAAK,EAAE,GAAGH;IACjC,MAAM,EAAEI,SAAS,EAAE,GAAGD;IACtB,MAAM,EAAEE,kBAAkB,EAAEC,QAAQ,EAAEC,QAAQ,EAAEC,UAAU,EAAE,GAAGN;IAC/D,MAAM,EAAEO,KAAK,EAAE,IAAIC,aAAa,EAAEC,YAAY,EAAE,GAAGN,kBAAkB,CAAC,EAAE;IAExE,MAAMO,eAAeV,cAAc,MAAM,EAAE,CAACE,UAAwB,EAAE;IACtE,MAAMS,cAAcC,MAAM,OAAO,CAACF,gBAAgBA,YAAY,CAACH,MAAM,IAAIG,YAAY,CAAC,EAAE,GAAGA;IAC3F,MAAMG,aAAab,cAAc,MAAM,EAAE,CAACE,UAAwB,EAAE;IACpE,MAAMY,mBAAmBF,MAAM,OAAO,CAACC,cAAcA,UAAU,CAACN,MA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AUA,MAAM;YAChB,QAAQA,MAAM;YACd,OAAO;gBACL,QAAQA,MAAM;YAChB;QACF;QACA,MAAM;YACJ,SAASE,MAAM;YACf,OAAO;gBACL,WAAWA,MAAM;gBACjB,QAAQA,MAAM;YAChB;QACF;QACA,YAAY;YACV,SAASC,MAAM;YACf,OAAO;gBACL,WAAWA,MAAM;gBACjB,QAAQA,MAAM;YAChB;QACF;QACA,aAAa;YACX,KAAKgB;QAEP;IACF;IAEA3C,OAAO,IAAI,GAAG;WAAIA,OAAO,IAAI;QAAEuC;KAAW;IAE1C,OAAOvC;AACT"}
|
@@ -29,20 +29,6 @@ const yLinearSecondary = (spec, context)=>{
|
|
29
29
|
];
|
30
30
|
const seriesId = alignTicksConfig ? seriesIds : seriesIds[1];
|
31
31
|
if (!result.axes) result.axes = [];
|
32
|
-
if (!yAxisConfig) {
|
33
|
-
result.axes = [
|
34
|
-
...result.axes,
|
35
|
-
{
|
36
|
-
visible: true,
|
37
|
-
id,
|
38
|
-
seriesId,
|
39
|
-
type: 'linear',
|
40
|
-
orient: 'right',
|
41
|
-
sync
|
42
|
-
}
|
43
|
-
];
|
44
|
-
return result;
|
45
|
-
}
|
46
32
|
const { visible = true, label, tick, title, grid, line, zero, nice, inverse, max, min, log, logBase = 10, numFormat = {}, autoFormat } = yAxisConfig;
|
47
33
|
const formatter = createNumFormatter(numFormat);
|
48
34
|
const linearAxis = {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"pipeline/spec/chart/pipes/axes/yLinearSecondary.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/chart/pipes/axes/yLinearSecondary.ts"],"sourcesContent":["import type { ISpec } from '@visactor/vchart'\nimport { LINEAR_AXIS_INNER_OFFSET_TOP } from '../../../../utils/constant'\nimport { createNumFormatter } from '../../../../utils'\nimport type { SpecPipe, YLinearAxis } from 'src/types'\nimport { isEmpty, isNullish } from 'remeda'\nimport { createLinearFormat } from './format/linearFormat'\nimport { defaultTitleText } from './title/defaultTitleText'\n\nexport const yLinearSecondary: SpecPipe = (spec, context) => {\n const result = { ...spec } as ISpec\n const { advancedVSeed, vseed } = context\n const { chartType } = vseed\n const { datasetReshapeInfo, measures, dimensions, encoding } = advancedVSeed\n const { index, id: reshapeInfoId, foldInfoList } = datasetReshapeInfo[0]\n // TODO: default config missing\n const secondaryYAxis = advancedVSeed.config?.[chartType as 'dualAxis']?.secondaryYAxis as YLinearAxis | YLinearAxis[]\n const yAxisConfig = Array.isArray(secondaryYAxis) ? secondaryYAxis[index] || secondaryYAxis[0] : secondaryYAxis\n const alignTicks = advancedVSeed.config?.[chartType as 'dualAxis']?.alignTicks as boolean | boolean[]\n const alignTicksConfig = Array.isArray(alignTicks) ? alignTicks[index] || alignTicks[0] : alignTicks\n\n if (isNullish(foldInfoList?.[1])) {\n return result\n }\n\n const isEmptySecondary = isEmpty(foldInfoList?.[1].foldMap)\n const onlySecondary = isEmpty(foldInfoList?.[0].foldMap) && !isEmptySecondary\n\n const sync = {\n axisId: `${reshapeInfoId}-primary-axis`,\n zeroAlign: true,\n }\n\n const id = `${reshapeInfoId}-secondary-axis`\n const seriesIds = [`${reshapeInfoId}-primary-series`, `${reshapeInfoId}-secondary-series`]\n const seriesId = alignTicksConfig ? seriesIds : seriesIds[1]\n if (!result.axes) {\n result.axes = []\n }\n\n
|
1
|
+
{"version":3,"file":"pipeline/spec/chart/pipes/axes/yLinearSecondary.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/chart/pipes/axes/yLinearSecondary.ts"],"sourcesContent":["import type { ISpec } from '@visactor/vchart'\nimport { LINEAR_AXIS_INNER_OFFSET_TOP } from '../../../../utils/constant'\nimport { createNumFormatter } from '../../../../utils'\nimport type { SpecPipe, YLinearAxis } from 'src/types'\nimport { isEmpty, isNullish } from 'remeda'\nimport { createLinearFormat } from './format/linearFormat'\nimport { defaultTitleText } from './title/defaultTitleText'\n\nexport const yLinearSecondary: SpecPipe = (spec, context) => {\n const result = { ...spec } as ISpec\n const { advancedVSeed, vseed } = context\n const { chartType } = vseed\n const { datasetReshapeInfo, measures, dimensions, encoding } = advancedVSeed\n const { index, id: reshapeInfoId, foldInfoList } = datasetReshapeInfo[0]\n // TODO: default config missing\n const secondaryYAxis = advancedVSeed.config?.[chartType as 'dualAxis']?.secondaryYAxis as YLinearAxis | YLinearAxis[]\n const yAxisConfig = Array.isArray(secondaryYAxis) ? secondaryYAxis[index] || secondaryYAxis[0] : secondaryYAxis\n const alignTicks = advancedVSeed.config?.[chartType as 'dualAxis']?.alignTicks as boolean | boolean[]\n const alignTicksConfig = Array.isArray(alignTicks) ? alignTicks[index] || alignTicks[0] : alignTicks\n\n if (isNullish(foldInfoList?.[1])) {\n return result\n }\n\n const isEmptySecondary = isEmpty(foldInfoList?.[1].foldMap)\n const onlySecondary = isEmpty(foldInfoList?.[0].foldMap) && !isEmptySecondary\n\n const sync = {\n axisId: `${reshapeInfoId}-primary-axis`,\n zeroAlign: true,\n }\n\n const id = `${reshapeInfoId}-secondary-axis`\n const seriesIds = [`${reshapeInfoId}-primary-series`, `${reshapeInfoId}-secondary-series`]\n const seriesId = alignTicksConfig ? seriesIds : seriesIds[1]\n if (!result.axes) {\n result.axes = []\n }\n\n const {\n visible = true,\n label,\n tick,\n title,\n grid,\n line,\n\n zero,\n nice,\n inverse,\n max,\n min,\n log,\n logBase = 10,\n numFormat = {},\n autoFormat,\n } = yAxisConfig\n\n const formatter = createNumFormatter(numFormat)\n\n const linearAxis = {\n visible: isEmptySecondary ? false : visible,\n id,\n seriesId,\n sync,\n type: log ? 'log' : 'linear',\n base: logBase,\n orient: 'right',\n nice,\n zero: log ? false : zero,\n inverse,\n max,\n min,\n label: {\n visible: label?.visible,\n formatMethod: (value: string) => {\n return createLinearFormat(value, autoFormat, numFormat, formatter)\n },\n style: {\n fill: label?.labelColor,\n angle: label?.labelAngle,\n fontSize: label?.labelFontSize,\n fontWeight: label?.labelFontWeight,\n },\n },\n title: {\n visible: title?.visible,\n text: title?.titleText || defaultTitleText(measures, dimensions, encoding.y as string[]),\n style: {\n fill: title?.titleColor,\n fontSize: title?.titleFontSize,\n fontWeight: title?.titleFontWeight,\n },\n },\n tick: {\n visible: tick?.visible,\n tickSize: tick?.tickSize,\n inside: tick?.tickInside,\n style: {\n stroke: tick?.tickColor,\n },\n },\n grid: {\n visible: onlySecondary ? true : grid?.visible,\n style: {\n lineWidth: grid?.gridWidth,\n stroke: grid?.gridColor,\n },\n },\n domainLine: {\n visible: line?.visible,\n style: {\n lineWidth: line?.lineWidth,\n stroke: line?.lineColor,\n },\n },\n innerOffset: {\n top: LINEAR_AXIS_INNER_OFFSET_TOP,\n // bottom: LINEAR_AXIS_INNER_OFFSET_TOP,\n },\n }\n\n result.axes = [...result.axes, linearAxis] as ISpec['axes']\n\n return result\n}\n"],"names":["yLinearSecondary","spec","context","result","advancedVSeed","vseed","chartType","datasetReshapeInfo","measures","dimensions","encoding","index","reshapeInfoId","foldInfoList","secondaryYAxis","yAxisConfig","Array","alignTicks","alignTicksConfig","isNullish","isEmptySecondary","isEmpty","onlySecondary","sync","id","seriesIds","seriesId","visible","label","tick","title","grid","line","zero","nice","inverse","max","min","log","logBase","numFormat","autoFormat","formatter","createNumFormatter","linearAxis","value","createLinearFormat","defaultTitleText","LINEAR_AXIS_INNER_OFFSET_TOP"],"mappings":";;;;;AAQO,MAAMA,mBAA6B,CAACC,MAAMC;IAC/C,MAAMC,SAAS;QAAE,GAAGF,IAAI;IAAC;IACzB,MAAM,EAAEG,aAAa,EAAEC,KAAK,EAAE,GAAGH;IACjC,MAAM,EAAEI,SAAS,EAAE,GAAGD;IACtB,MAAM,EAAEE,kBAAkB,EAAEC,QAAQ,EAAEC,UAAU,EAAEC,QAAQ,EAAE,GAAGN;IAC/D,MAAM,EAAEO,KAAK,EAAE,IAAIC,aAAa,EAAEC,YAAY,EAAE,GAAGN,kBAAkB,CAAC,EAAE;IAExE,MAAMO,iBAAiBV,cAAc,MAAM,EAAE,CAACE,UAAwB,EAAE;IACxE,MAAMS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NC,mBAAmBD,OAAOJ,YAAYD,WAAWE;YAE1D,OAAO;gBACL,MAAMd,OAAO;gBACb,OAAOA,OAAO;gBACd,UAAUA,OAAO;gBACjB,YAAYA,OAAO;YACrB;QACF;QACA,OAAO;YACL,SAASE,OAAO;YAChB,MAAMA,OAAO,aAAaiB,iBAAiBvC,UAAUC,YAAYC,SAAS,CAAC;YAC3E,OAAO;gBACL,MAAMoB,OAAO;gBACb,UAAUA,OAAO;gBACjB,YAAYA,OAAO;YACrB;QACF;QACA,MAAM;YACJ,SAASD,MAAM;YACf,UAAUA,MAAM;YAChB,QAAQA,MAAM;YACd,OAAO;gBACL,QAAQA,MAAM;YAChB;QACF;QACA,MAAM;YACJ,SAASP,gBAAgB,OAAOS,MAAM;YACtC,OAAO;gBACL,WAAWA,MAAM;gBACjB,QAAQA,MAAM;YAChB;QACF;QACA,YAAY;YACV,SAASC,MAAM;YACf,OAAO;gBACL,WAAWA,MAAM;gBACjB,QAAQA,MAAM;YAChB;QACF;QACA,aAAa;YACX,KAAKgB;QAEP;IACF;IAEA7C,OAAO,IAAI,GAAG;WAAIA,OAAO,IAAI;QAAEyC;KAAW;IAE1C,OAAOzC;AACT"}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import type { AdvancedVSeed, SpecPipe } from '../../../../../types';
|
1
|
+
import type { AdvancedVSeed, SpecPipe, VSeed } from '../../../../../types';
|
2
2
|
export declare const colorAdapter: (ordinalPipe: SpecPipe, linearPipe: SpecPipe) => SpecPipe;
|
3
|
-
export declare const isLinearColor: <T extends AdvancedVSeed>(advancedVSeed: T) => boolean;
|
4
|
-
export declare const getColorMeasureId: <T extends AdvancedVSeed>(advancedVSeed: T) => string | undefined;
|
3
|
+
export declare const isLinearColor: <T extends AdvancedVSeed, U extends VSeed>(advancedVSeed: T, vseed: U) => boolean;
|
4
|
+
export declare const getColorMeasureId: <T extends AdvancedVSeed, U extends VSeed>(advancedVSeed: T, vseed: U) => string | undefined;
|
@@ -1,17 +1,19 @@
|
|
1
1
|
import { findAllMeasures } from "../../../../utils/index.js";
|
2
2
|
const colorAdapter = (ordinalPipe, linearPipe)=>(spec, context)=>{
|
3
|
-
const { advancedVSeed } = context;
|
4
|
-
if (isLinearColor(advancedVSeed)) return linearPipe(spec, context);
|
3
|
+
const { advancedVSeed, vseed } = context;
|
4
|
+
if (isLinearColor(advancedVSeed, vseed)) return linearPipe(spec, context);
|
5
5
|
return ordinalPipe(spec, context);
|
6
6
|
};
|
7
|
-
const isLinearColor = (advancedVSeed)=>{
|
8
|
-
|
7
|
+
const isLinearColor = (advancedVSeed, vseed)=>{
|
8
|
+
console.log(vseed);
|
9
|
+
const { encoding } = advancedVSeed;
|
10
|
+
const measures = vseed.measures || advancedVSeed.measures;
|
9
11
|
const measureIdList = findAllMeasures(measures).map((measure)=>measure.id);
|
10
12
|
const { color } = encoding;
|
11
13
|
return color?.length === 1 && measureIdList.includes(color[0]);
|
12
14
|
};
|
13
|
-
const getColorMeasureId = (advancedVSeed)=>{
|
14
|
-
if (isLinearColor(advancedVSeed)) {
|
15
|
+
const getColorMeasureId = (advancedVSeed, vseed)=>{
|
16
|
+
if (isLinearColor(advancedVSeed, vseed)) {
|
15
17
|
const { encoding } = advancedVSeed;
|
16
18
|
const { color } = encoding;
|
17
19
|
return color?.[0];
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"pipeline/spec/chart/pipes/color/colorAdapter.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/chart/pipes/color/colorAdapter.ts"],"sourcesContent":["import { findAllMeasures } from 'src/pipeline/utils'\nimport type { AdvancedVSeed, SpecPipe } from 'src/types'\n\nexport const colorAdapter = (ordinalPipe: SpecPipe, linearPipe: SpecPipe): SpecPipe => {\n return (spec, context) => {\n const { advancedVSeed } = context\n if (isLinearColor(advancedVSeed)) {\n return linearPipe(spec, context)\n }\n return ordinalPipe(spec, context)\n }\n}\n\nexport const isLinearColor = <T extends AdvancedVSeed>(advancedVSeed: T) => {\n const { encoding
|
1
|
+
{"version":3,"file":"pipeline/spec/chart/pipes/color/colorAdapter.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/chart/pipes/color/colorAdapter.ts"],"sourcesContent":["import { findAllMeasures } from 'src/pipeline/utils'\nimport type { AdvancedVSeed, SpecPipe, VSeed } from 'src/types'\n\nexport const colorAdapter = (ordinalPipe: SpecPipe, linearPipe: SpecPipe): SpecPipe => {\n return (spec, context) => {\n const { advancedVSeed, vseed } = context\n if (isLinearColor(advancedVSeed, vseed)) {\n return linearPipe(spec, context)\n }\n return ordinalPipe(spec, context)\n }\n}\n\nexport const isLinearColor = <T extends AdvancedVSeed, U extends VSeed>(advancedVSeed: T, vseed: U) => {\n console.log(vseed)\n const { encoding } = advancedVSeed\n const measures = vseed.measures || advancedVSeed.measures\n const measureIdList = findAllMeasures(measures).map((measure) => measure.id)\n const { color } = encoding\n return color?.length === 1 && measureIdList.includes(color[0])\n}\n\nexport const getColorMeasureId = <T extends AdvancedVSeed, U extends VSeed>(\n advancedVSeed: T,\n vseed: U,\n): string | undefined => {\n if (isLinearColor(advancedVSeed, vseed)) {\n const { encoding } = advancedVSeed\n const { color } = encoding\n return color?.[0]\n }\n return undefined\n}\n"],"names":["colorAdapter","ordinalPipe","linearPipe","spec","context","advancedVSeed","vseed","isLinearColor","console","encoding","measures","measureIdList","findAllMeasures","measure","color","getColorMeasureId"],"mappings":";AAGO,MAAMA,eAAe,CAACC,aAAuBC,aAC3C,CAACC,MAAMC;QACZ,MAAM,EAAEC,aAAa,EAAEC,KAAK,EAAE,GAAGF;QACjC,IAAIG,cAAcF,eAAeC,QAC/B,OAAOJ,WAAWC,MAAMC;QAE1B,OAAOH,YAAYE,MAAMC;IAC3B;AAGK,MAAMG,gBAAgB,CAA2CF,eAAkBC;IACxFE,QAAQ,GAAG,CAACF;IACZ,MAAM,EAAEG,QAAQ,EAAE,GAAGJ;IACrB,MAAMK,WAAWJ,MAAM,QAAQ,IAAID,cAAc,QAAQ;IACzD,MAAMM,gBAAgBC,gBAAgBF,UAAU,GAAG,CAAC,CAACG,UAAYA,QAAQ,EAAE;IAC3E,MAAM,EAAEC,KAAK,EAAE,GAAGL;IAClB,OAAOK,OAAO,WAAW,KAAKH,cAAc,QAAQ,CAACG,KAAK,CAAC,EAAE;AAC/D;AAEO,MAAMC,oBAAoB,CAC/BV,eACAC;IAEA,IAAIC,cAAcF,eAAeC,QAAQ;QACvC,MAAM,EAAEG,QAAQ,EAAE,GAAGJ;QACrB,MAAM,EAAES,KAAK,EAAE,GAAGL;QAClB,OAAOK,OAAO,CAAC,EAAE;IACnB;AAEF"}
|
@@ -1,10 +1,10 @@
|
|
1
1
|
import { isLinearColor } from "./colorAdapter.js";
|
2
2
|
const colorAreaStyleFill = (stylePipe)=>(spec, context)=>{
|
3
3
|
const result = stylePipe(spec, context);
|
4
|
-
const { advancedVSeed } = context;
|
4
|
+
const { advancedVSeed, vseed } = context;
|
5
5
|
const { datasetReshapeInfo } = advancedVSeed;
|
6
6
|
const { unfoldInfo } = datasetReshapeInfo[0];
|
7
|
-
if (isLinearColor(advancedVSeed)) {
|
7
|
+
if (isLinearColor(advancedVSeed, vseed)) {
|
8
8
|
if (result?.area?.style) result.area.style.fill = {
|
9
9
|
field: unfoldInfo.encodingColor,
|
10
10
|
scale: 'color'
|