@visactor/vseed 0.1.14 → 0.1.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.cjs +3 -1
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/esm/builder/builder/buildAdvanced.js +1 -1
- package/dist/esm/builder/builder/buildAdvanced.js.map +1 -1
- package/dist/esm/builder/builder/buildSpec.js +2 -3
- package/dist/esm/builder/builder/buildSpec.js.map +1 -1
- package/dist/esm/builder/builder/builder.d.ts +1113 -9
- package/dist/esm/dataReshape/foldMeasures.d.ts +1 -0
- package/dist/esm/dataReshape/foldMeasures.js +5 -1
- package/dist/esm/dataReshape/foldMeasures.js.map +1 -1
- package/dist/esm/pipeline/advanced/chart/pipes/default/defaultDimensions.js +4 -3
- package/dist/esm/pipeline/advanced/chart/pipes/default/defaultDimensions.js.map +1 -1
- package/dist/esm/pipeline/advanced/chart/pipes/default/defaultMeasures.js +12 -9
- package/dist/esm/pipeline/advanced/chart/pipes/default/defaultMeasures.js.map +1 -1
- package/dist/esm/pipeline/advanced/chart/pipes/init/initAdvancedVSeed.js +2 -0
- package/dist/esm/pipeline/advanced/chart/pipes/init/initAdvancedVSeed.js.map +1 -1
- package/dist/esm/pipeline/advanced/chart/pipes/reshape/pivotReshapeWithDualEncoding.js +4 -6
- package/dist/esm/pipeline/advanced/chart/pipes/reshape/pivotReshapeWithDualEncoding.js.map +1 -1
- package/dist/esm/pipeline/advanced/chart/pipes/reshape/pivotReshapeWithEncoding.js +2 -5
- package/dist/esm/pipeline/advanced/chart/pipes/reshape/pivotReshapeWithEncoding.js.map +1 -1
- package/dist/esm/pipeline/advanced/chart/pipes/reshape/pivotReshapeWithScatterEncoding.js +2 -4
- package/dist/esm/pipeline/advanced/chart/pipes/reshape/pivotReshapeWithScatterEncoding.js.map +1 -1
- package/dist/esm/pipeline/advanced/chart/pipes/reshape/reshapeWithDualEncoding.js +4 -6
- package/dist/esm/pipeline/advanced/chart/pipes/reshape/reshapeWithDualEncoding.js.map +1 -1
- package/dist/esm/pipeline/advanced/chart/pipes/reshape/reshapeWithEncoding.js +2 -5
- package/dist/esm/pipeline/advanced/chart/pipes/reshape/reshapeWithEncoding.js.map +1 -1
- package/dist/esm/pipeline/advanced/chart/pipes/reshape/reshapeWithScatterEncoding.js +2 -4
- package/dist/esm/pipeline/advanced/chart/pipes/reshape/reshapeWithScatterEncoding.js.map +1 -1
- package/dist/esm/pipeline/advanced/table/pipes/default/defaultDimensions.js +13 -7
- package/dist/esm/pipeline/advanced/table/pipes/default/defaultDimensions.js.map +1 -1
- package/dist/esm/pipeline/advanced/table/pipes/default/defaultMeasures.js +13 -9
- package/dist/esm/pipeline/advanced/table/pipes/default/defaultMeasures.js.map +1 -1
- package/dist/esm/pipeline/advanced/table/pipes/init/initAdvancedVSeed.js +2 -0
- package/dist/esm/pipeline/advanced/table/pipes/init/initAdvancedVSeed.js.map +1 -1
- package/dist/esm/pipeline/advanced/table/pipes/reshape/reshapePivotTable.js +2 -1
- package/dist/esm/pipeline/advanced/table/pipes/reshape/reshapePivotTable.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipeline/heatmap.js +1 -3
- package/dist/esm/pipeline/spec/chart/pipeline/heatmap.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipeline/scatter.js +3 -3
- package/dist/esm/pipeline/spec/chart/pipeline/scatter.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipes/axes/format/linearFormat.d.ts +2 -0
- package/dist/esm/pipeline/spec/chart/pipes/axes/format/linearFormat.js +11 -0
- package/dist/esm/pipeline/spec/chart/pipes/axes/format/linearFormat.js.map +1 -0
- package/dist/esm/pipeline/spec/chart/pipes/axes/title/defaultTitleText.d.ts +2 -0
- package/dist/esm/pipeline/spec/chart/pipes/axes/title/defaultTitleText.js +14 -0
- package/dist/esm/pipeline/spec/chart/pipes/axes/title/defaultTitleText.js.map +1 -0
- package/dist/esm/pipeline/spec/chart/pipes/axes/xBand.js +3 -1
- package/dist/esm/pipeline/spec/chart/pipes/axes/xBand.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipes/axes/xLinear.js +8 -5
- package/dist/esm/pipeline/spec/chart/pipes/axes/xLinear.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipes/axes/yBand.js +3 -1
- package/dist/esm/pipeline/spec/chart/pipes/axes/yBand.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipes/axes/yLinear.js +8 -5
- package/dist/esm/pipeline/spec/chart/pipes/axes/yLinear.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipes/axes/yLinearPrimary.js +8 -5
- package/dist/esm/pipeline/spec/chart/pipes/axes/yLinearPrimary.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipes/axes/yLinearSecondary.js +8 -5
- package/dist/esm/pipeline/spec/chart/pipes/axes/yLinearSecondary.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipes/label/index.d.ts +1 -1
- package/dist/esm/pipeline/spec/chart/pipes/label/index.js +2 -2
- package/dist/esm/pipeline/spec/chart/pipes/label/label.d.ts +5 -1
- package/dist/esm/pipeline/spec/chart/pipes/label/label.js +41 -33
- package/dist/esm/pipeline/spec/chart/pipes/label/label.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipes/label/labelDualAxis.js +15 -52
- package/dist/esm/pipeline/spec/chart/pipes/label/labelDualAxis.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipes/label/{labelColorInversion.d.ts → labelScatter.d.ts} +1 -1
- package/dist/esm/pipeline/spec/chart/pipes/label/labelScatter.js +19 -0
- package/dist/esm/pipeline/spec/chart/pipes/label/labelScatter.js.map +1 -0
- package/dist/esm/pipeline/spec/chart/pipes/series/series.js +1 -0
- package/dist/esm/pipeline/spec/chart/pipes/series/series.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipes/tooltip/tooltip.d.ts +3 -3
- package/dist/esm/pipeline/spec/chart/pipes/tooltip/tooltip.js +13 -30
- package/dist/esm/pipeline/spec/chart/pipes/tooltip/tooltip.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipes/tooltip/tooltipDualAxis.js +6 -6
- package/dist/esm/pipeline/spec/chart/pipes/tooltip/tooltipDualAxis.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipes/tooltip/tooltipHeatmap.js +6 -18
- package/dist/esm/pipeline/spec/chart/pipes/tooltip/tooltipHeatmap.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipes/tooltip/tooltipScatter.js +6 -18
- package/dist/esm/pipeline/spec/chart/pipes/tooltip/tooltipScatter.js.map +1 -1
- package/dist/esm/pipeline/spec/table/pipes/columns/measuresToColumns.js +8 -11
- package/dist/esm/pipeline/spec/table/pipes/columns/measuresToColumns.js.map +1 -1
- package/dist/esm/pipeline/spec/table/pipes/indicators/pivotIndicators.js +8 -13
- package/dist/esm/pipeline/spec/table/pipes/indicators/pivotIndicators.js.map +1 -1
- package/dist/esm/pipeline/utils/constant.d.ts +1 -0
- package/dist/esm/pipeline/utils/constant.js +2 -1
- package/dist/esm/pipeline/utils/constant.js.map +1 -1
- package/dist/esm/pipeline/utils/format/createFormatter.d.ts +1 -1
- package/dist/esm/pipeline/utils/format/createFormatter.js +3 -2
- package/dist/esm/pipeline/utils/format/createFormatter.js.map +1 -1
- package/dist/esm/pipeline/utils/format/createFormatterByMeasure.d.ts +2 -0
- package/dist/esm/pipeline/utils/format/createFormatterByMeasure.js +14 -0
- package/dist/esm/pipeline/utils/format/createFormatterByMeasure.js.map +1 -0
- package/dist/esm/pipeline/utils/format/createNumFormatter.d.ts +1 -1
- package/dist/esm/pipeline/utils/format/createNumFormatter.js.map +1 -1
- package/dist/esm/pipeline/utils/format/index.d.ts +1 -0
- package/dist/esm/pipeline/utils/format/index.js +1 -0
- package/dist/esm/pipeline/utils/index.d.ts +1 -0
- package/dist/esm/pipeline/utils/index.js +1 -0
- package/dist/esm/pipeline/utils/valid/checkVSeed.d.ts +2 -0
- package/dist/esm/pipeline/utils/valid/checkVSeed.js +11 -0
- package/dist/esm/pipeline/utils/valid/checkVSeed.js.map +1 -0
- package/dist/esm/pipeline/utils/valid/index.d.ts +1 -0
- package/dist/esm/pipeline/utils/valid/index.js +2 -0
- package/dist/esm/theme/dark.js +5 -1
- package/dist/esm/theme/dark.js.map +1 -1
- package/dist/esm/theme/light.js +23 -4
- package/dist/esm/theme/light.js.map +1 -1
- package/dist/esm/types/advancedVSeed.d.ts +947 -17
- package/dist/esm/types/chartType/area/zArea.d.ts +60 -0
- package/dist/esm/types/chartType/areaPercent/zAreaPercent.d.ts +60 -0
- package/dist/esm/types/chartType/bar/zBar.d.ts +60 -0
- package/dist/esm/types/chartType/barParallel/zBarParallel.d.ts +60 -0
- package/dist/esm/types/chartType/barPercent/zBarPercent.d.ts +60 -0
- package/dist/esm/types/chartType/column/zColumn.d.ts +60 -0
- package/dist/esm/types/chartType/columnParallel/zColumnParallel.d.ts +60 -0
- package/dist/esm/types/chartType/columnPercent/zColumnPercent.d.ts +60 -0
- package/dist/esm/types/chartType/donut/zDonut.d.ts +30 -0
- package/dist/esm/types/chartType/dualAxis/zDualAxis.d.ts +270 -0
- package/dist/esm/types/chartType/funnel/zFunnel.d.ts +30 -0
- package/dist/esm/types/chartType/heatmap/zHeatmap.d.ts +30 -0
- package/dist/esm/types/chartType/line/zLine.d.ts +60 -0
- package/dist/esm/types/chartType/pie/zPie.d.ts +30 -0
- package/dist/esm/types/chartType/pivotTable/zPivotTable.d.ts +30 -0
- package/dist/esm/types/chartType/radar/zRadar.d.ts +30 -0
- package/dist/esm/types/chartType/rose/zRose.d.ts +30 -0
- package/dist/esm/types/chartType/roseParallel/zRoseParallel.d.ts +30 -0
- package/dist/esm/types/chartType/scatter/zScatter.d.ts +210 -0
- package/dist/esm/types/chartType/table/zTable.d.ts +30 -0
- package/dist/esm/types/properties/config/axes/bandAxis.d.ts +146 -3
- package/dist/esm/types/properties/config/axes/index.d.ts +0 -2
- package/dist/esm/types/properties/config/axes/index.js +0 -1
- package/dist/esm/types/properties/config/axes/linearAxis.d.ts +149 -3
- package/dist/esm/types/properties/config/axes/zLinearAxis.d.ts +60 -0
- package/dist/esm/types/properties/config/axes/zLinearAxis.js +2 -0
- package/dist/esm/types/properties/config/axes/zLinearAxis.js.map +1 -1
- package/dist/esm/types/properties/config/config.d.ts +916 -16
- package/dist/esm/types/properties/config/label/label.d.ts +3 -3
- package/dist/esm/types/properties/config/label/zLabel.js +1 -1
- package/dist/esm/types/properties/config/label/zLabel.js.map +1 -1
- package/dist/esm/types/properties/format/numFormat.js.map +1 -0
- package/dist/esm/types/properties/index.d.ts +1 -0
- package/dist/esm/types/properties/index.js +1 -0
- package/dist/esm/types/properties/measures/index.d.ts +0 -1
- package/dist/esm/types/properties/measures/index.js +0 -1
- package/dist/esm/types/properties/measures/measures.d.ts +6 -2
- package/dist/esm/types/properties/measures/zDualMeasures.d.ts +240 -0
- package/dist/esm/types/properties/measures/zMeasures.d.ts +90 -0
- package/dist/esm/types/properties/measures/zMeasures.js +2 -1
- package/dist/esm/types/properties/measures/zMeasures.js.map +1 -1
- package/dist/esm/types/properties/measures/zScatterMeasures.d.ts +240 -0
- package/dist/esm/types/properties/theme/customTheme.d.ts +916 -16
- package/dist/esm/types/zVseed.d.ts +1389 -99
- package/dist/umd/index.js +308 -366
- package/dist/umd/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/esm/pipeline/spec/chart/pipes/label/labelColorInversion.js +0 -13
- package/dist/esm/pipeline/spec/chart/pipes/label/labelColorInversion.js.map +0 -1
- package/dist/esm/types/properties/config/axes/axis.d.ts +0 -208
- package/dist/esm/types/properties/config/axes/axis.js +0 -0
- package/dist/esm/types/properties/config/axes/zAxis.d.ts +0 -47
- package/dist/esm/types/properties/config/axes/zAxis.js +0 -54
- package/dist/esm/types/properties/config/axes/zAxis.js.map +0 -1
- package/dist/esm/types/properties/measures/format/numFormat.js.map +0 -1
- /package/dist/esm/types/properties/{measures/format → format}/formatter.d.ts +0 -0
- /package/dist/esm/types/properties/{measures/format → format}/formatter.js +0 -0
- /package/dist/esm/types/properties/{measures/format → format}/index.d.ts +0 -0
- /package/dist/esm/types/properties/{measures/format → format}/index.js +0 -0
- /package/dist/esm/types/properties/{measures/format → format}/numFormat.d.ts +0 -0
- /package/dist/esm/types/properties/{measures/format → format}/numFormat.js +0 -0
@@ -11,7 +11,8 @@ const reshapePivotTable = (advancedVSeed, context)=>{
|
|
11
11
|
const { dataset: newDatasets, foldInfo } = foldMeasures(dataset, findAllMeasures(measures), {
|
12
12
|
measureId: FoldMeasureId,
|
13
13
|
measureName: FoldMeasureName,
|
14
|
-
measureValue: FoldMeasureValue
|
14
|
+
measureValue: FoldMeasureValue,
|
15
|
+
allowEmptyFold: false
|
15
16
|
});
|
16
17
|
const datasetReshapeInfo = [
|
17
18
|
{
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"pipeline/advanced/table/pipes/reshape/reshapePivotTable.js","sources":["webpack://@visactor/vseed/./src/pipeline/advanced/table/pipes/reshape/reshapePivotTable.ts"],"sourcesContent":["import { FoldMeasureId, FoldMeasureName, foldMeasures, FoldMeasureValue } from 'src/dataReshape'\nimport {} from 'src/pipeline/spec/chart/pipes'\nimport { findAllMeasures } from 'src/pipeline/utils'\nimport type { AdvancedPipe, DatasetReshapeInfo, PivotTable } from 'src/types'\n\nexport const reshapePivotTable: AdvancedPipe = (advancedVSeed, context) => {\n const result = { ...advancedVSeed }\n const { vseed } = context\n const { dataset, chartType } = vseed as PivotTable\n const { dimensions, measures } = advancedVSeed\n const { dataset: newDatasets, foldInfo } = foldMeasures(dataset, findAllMeasures(measures), {\n measureId: FoldMeasureId,\n measureName: FoldMeasureName,\n measureValue: FoldMeasureValue,\n })\n\n const datasetReshapeInfo = [\n {\n id: String(chartType),\n index: 0,\n foldInfo,\n },\n ] as unknown as DatasetReshapeInfo\n\n return {\n ...result,\n dataset: newDatasets,\n datasetReshapeInfo: datasetReshapeInfo,\n dimensions,\n measures,\n }\n}\n"],"names":["reshapePivotTable","advancedVSeed","context","result","vseed","dataset","chartType","dimensions","measures","newDatasets","foldInfo","foldMeasures","findAllMeasures","FoldMeasureId","FoldMeasureName","FoldMeasureValue","datasetReshapeInfo","String"],"mappings":";;;AAKO,MAAMA,oBAAkC,CAACC,eAAeC;IAC7D,MAAMC,SAAS;QAAE,GAAGF,aAAa;IAAC;IAClC,MAAM,EAAEG,KAAK,EAAE,GAAGF;IAClB,MAAM,EAAEG,OAAO,EAAEC,SAAS,EAAE,GAAGF;IAC/B,MAAM,EAAEG,UAAU,EAAEC,QAAQ,EAAE,GAAGP;IACjC,MAAM,EAAE,SAASQ,WAAW,EAAEC,QAAQ,EAAE,GAAGC,aAAaN,SAASO,gBAAgBJ,WAAW;QAC1F,WAAWK;QACX,aAAaC;QACb,cAAcC;
|
1
|
+
{"version":3,"file":"pipeline/advanced/table/pipes/reshape/reshapePivotTable.js","sources":["webpack://@visactor/vseed/./src/pipeline/advanced/table/pipes/reshape/reshapePivotTable.ts"],"sourcesContent":["import { FoldMeasureId, FoldMeasureName, foldMeasures, FoldMeasureValue } from 'src/dataReshape'\nimport {} from 'src/pipeline/spec/chart/pipes'\nimport { findAllMeasures } from 'src/pipeline/utils'\nimport type { AdvancedPipe, DatasetReshapeInfo, PivotTable } from 'src/types'\n\nexport const reshapePivotTable: AdvancedPipe = (advancedVSeed, context) => {\n const result = { ...advancedVSeed }\n const { vseed } = context\n const { dataset, chartType } = vseed as PivotTable\n const { dimensions, measures } = advancedVSeed\n const { dataset: newDatasets, foldInfo } = foldMeasures(dataset, findAllMeasures(measures), {\n measureId: FoldMeasureId,\n measureName: FoldMeasureName,\n measureValue: FoldMeasureValue,\n allowEmptyFold: false,\n })\n\n const datasetReshapeInfo = [\n {\n id: String(chartType),\n index: 0,\n foldInfo,\n },\n ] as unknown as DatasetReshapeInfo\n\n return {\n ...result,\n dataset: newDatasets,\n datasetReshapeInfo: datasetReshapeInfo,\n dimensions,\n measures,\n }\n}\n"],"names":["reshapePivotTable","advancedVSeed","context","result","vseed","dataset","chartType","dimensions","measures","newDatasets","foldInfo","foldMeasures","findAllMeasures","FoldMeasureId","FoldMeasureName","FoldMeasureValue","datasetReshapeInfo","String"],"mappings":";;;AAKO,MAAMA,oBAAkC,CAACC,eAAeC;IAC7D,MAAMC,SAAS;QAAE,GAAGF,aAAa;IAAC;IAClC,MAAM,EAAEG,KAAK,EAAE,GAAGF;IAClB,MAAM,EAAEG,OAAO,EAAEC,SAAS,EAAE,GAAGF;IAC/B,MAAM,EAAEG,UAAU,EAAEC,QAAQ,EAAE,GAAGP;IACjC,MAAM,EAAE,SAASQ,WAAW,EAAEC,QAAQ,EAAE,GAAGC,aAAaN,SAASO,gBAAgBJ,WAAW;QAC1F,WAAWK;QACX,aAAaC;QACb,cAAcC;QACd,gBAAgB;IAClB;IAEA,MAAMC,qBAAqB;QACzB;YACE,IAAIC,OAAOX;YACX,OAAO;YACPI;QACF;KACD;IAED,OAAO;QACL,GAAGP,MAAM;QACT,SAASM;QACT,oBAAoBO;QACpBT;QACAC;IACF;AACF"}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { annotationArea, annotationHorizontalLine, annotationPoint, annotationVerticalLine, backgroundColor, cellStyle, color, colorAdapter, colorCellStyleFill, colorLegend, datasetPivot, datasetXY, discreteLegend, initPivot, label,
|
1
|
+
import { annotationArea, annotationHorizontalLine, annotationPoint, annotationVerticalLine, backgroundColor, cellStyle, color, colorAdapter, colorCellStyleFill, colorLegend, datasetPivot, datasetXY, discreteLegend, initPivot, label, linearColor, pivotAdapter, pivotColorLegend, pivotColumnDimensions, pivotDiscreteLegend, pivotGridStyle, pivotIndicators, pivotIndicatorsAsRow, pivotRowDimensions, tooltipHeatmap } from "../pipes/index.js";
|
2
2
|
import { initHeatmap } from "../pipes/init/heatmap.js";
|
3
3
|
const heatmap = [
|
4
4
|
initHeatmap,
|
@@ -6,7 +6,6 @@ const heatmap = [
|
|
6
6
|
datasetXY,
|
7
7
|
colorAdapter(color, linearColor),
|
8
8
|
label,
|
9
|
-
labelColorInversion,
|
10
9
|
colorAdapter(discreteLegend, colorLegend),
|
11
10
|
colorCellStyleFill(cellStyle),
|
12
11
|
tooltipHeatmap,
|
@@ -26,7 +25,6 @@ const pivotHeatmap = [
|
|
26
25
|
datasetXY,
|
27
26
|
colorAdapter(color, linearColor),
|
28
27
|
label,
|
29
|
-
labelColorInversion,
|
30
28
|
discreteLegend,
|
31
29
|
tooltipHeatmap,
|
32
30
|
colorCellStyleFill(cellStyle),
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"pipeline/spec/chart/pipeline/heatmap.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/chart/pipeline/heatmap.ts"],"sourcesContent":["import type { SpecPipeline } from 'src/types'\nimport {\n datasetXY,\n backgroundColor,\n label,\n tooltipHeatmap,\n initPivot,\n datasetPivot,\n pivotIndicators,\n pivotAdapter,\n pivotIndicatorsAsRow,\n pivotGridStyle,\n pivotColumnDimensions,\n pivotRowDimensions,\n annotationPoint,\n annotationVerticalLine,\n annotationHorizontalLine,\n annotationArea,\n
|
1
|
+
{"version":3,"file":"pipeline/spec/chart/pipeline/heatmap.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/chart/pipeline/heatmap.ts"],"sourcesContent":["import type { SpecPipeline } from 'src/types'\nimport {\n datasetXY,\n backgroundColor,\n label,\n tooltipHeatmap,\n initPivot,\n datasetPivot,\n pivotIndicators,\n pivotAdapter,\n pivotIndicatorsAsRow,\n pivotGridStyle,\n pivotColumnDimensions,\n pivotRowDimensions,\n annotationPoint,\n annotationVerticalLine,\n annotationHorizontalLine,\n annotationArea,\n discreteLegend,\n color,\n colorAdapter,\n linearColor,\n colorLegend,\n cellStyle,\n colorCellStyleFill,\n pivotDiscreteLegend,\n pivotColorLegend,\n} from '../pipes'\nimport { initHeatmap } from '../pipes/init/heatmap'\n\nconst heatmap: SpecPipeline = [\n initHeatmap,\n backgroundColor,\n datasetXY,\n colorAdapter(color, linearColor),\n label,\n colorAdapter(discreteLegend, colorLegend),\n colorCellStyleFill(cellStyle),\n tooltipHeatmap,\n annotationPoint,\n annotationVerticalLine,\n annotationHorizontalLine,\n annotationArea,\n]\n\nconst pivotHeatmap: SpecPipeline = [\n initPivot,\n pivotGridStyle,\n pivotIndicatorsAsRow,\n datasetPivot,\n pivotIndicators([\n initHeatmap,\n backgroundColor,\n datasetXY,\n colorAdapter(color, linearColor),\n label,\n discreteLegend,\n tooltipHeatmap,\n colorCellStyleFill(cellStyle),\n annotationPoint,\n annotationVerticalLine,\n annotationHorizontalLine,\n annotationArea,\n ]),\n pivotRowDimensions,\n pivotColumnDimensions,\n colorAdapter(pivotDiscreteLegend, pivotColorLegend),\n]\n\nexport const heatmapSpecPipeline: SpecPipeline = [pivotAdapter(heatmap, pivotHeatmap)]\n"],"names":["heatmap","initHeatmap","backgroundColor","datasetXY","colorAdapter","color","linearColor","label","discreteLegend","colorLegend","colorCellStyleFill","cellStyle","tooltipHeatmap","annotationPoint","annotationVerticalLine","annotationHorizontalLine","annotationArea","pivotHeatmap","initPivot","pivotGridStyle","pivotIndicatorsAsRow","datasetPivot","pivotIndicators","pivotRowDimensions","pivotColumnDimensions","pivotDiscreteLegend","pivotColorLegend","heatmapSpecPipeline","pivotAdapter"],"mappings":";;AA8BA,MAAMA,UAAwB;IAC5BC;IACAC;IACAC;IACAC,aAAaC,OAAOC;IACpBC;IACAH,aAAaI,gBAAgBC;IAC7BC,mBAAmBC;IACnBC;IACAC;IACAC;IACAC;IACAC;CACD;AAED,MAAMC,eAA6B;IACjCC;IACAC;IACAC;IACAC;IACAC,gBAAgB;QACdrB;QACAC;QACAC;QACAC,aAAaC,OAAOC;QACpBC;QACAC;QACAI;QACAF,mBAAmBC;QACnBE;QACAC;QACAC;QACAC;KACD;IACDO;IACAC;IACApB,aAAaqB,qBAAqBC;CACnC;AAEM,MAAMC,sBAAoC;IAACC,aAAa5B,SAASiB;CAAc"}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { annotationArea, annotationHorizontalLine, annotationPoint, annotationVerticalLine, backgroundColor, color, colorAdapter, colorLegend, colorPointStyleFill, datasetPivot, datasetScatter, discreteLegend, horizontalCrosshairLine, initPivot, initScatter,
|
1
|
+
import { annotationArea, annotationHorizontalLine, annotationPoint, annotationVerticalLine, backgroundColor, color, colorAdapter, colorLegend, colorPointStyleFill, datasetPivot, datasetScatter, discreteLegend, horizontalCrosshairLine, initPivot, initScatter, labelScatter, linearColor, pivotAdapter, pivotColorLegend, pivotColumnDimensions, pivotDiscreteLegend, pivotGridStyle, pivotIndicators, pivotIndicatorsAsRow, pivotRowDimensions, pointStateHover, pointStyle, progressive, tooltipScatter, verticalCrosshairLine, xLinear, yLinear } from "../pipes/index.js";
|
2
2
|
const scatter = [
|
3
3
|
initScatter,
|
4
4
|
colorAdapter(color, linearColor),
|
@@ -7,7 +7,7 @@ const scatter = [
|
|
7
7
|
progressive,
|
8
8
|
xLinear,
|
9
9
|
yLinear,
|
10
|
-
|
10
|
+
labelScatter,
|
11
11
|
tooltipScatter,
|
12
12
|
colorAdapter(discreteLegend, colorLegend),
|
13
13
|
verticalCrosshairLine,
|
@@ -32,7 +32,7 @@ const pivotScatter = [
|
|
32
32
|
progressive,
|
33
33
|
xLinear,
|
34
34
|
yLinear,
|
35
|
-
|
35
|
+
labelScatter,
|
36
36
|
tooltipScatter,
|
37
37
|
verticalCrosshairLine,
|
38
38
|
horizontalCrosshairLine,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"pipeline/spec/chart/pipeline/scatter.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/chart/pipeline/scatter.ts"],"sourcesContent":["import type { SpecPipeline } from 'src/types'\nimport {\n yLinear,\n backgroundColor,\n
|
1
|
+
{"version":3,"file":"pipeline/spec/chart/pipeline/scatter.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/chart/pipeline/scatter.ts"],"sourcesContent":["import type { SpecPipeline } from 'src/types'\nimport {\n yLinear,\n backgroundColor,\n tooltipScatter,\n discreteLegend,\n color,\n initPivot,\n datasetPivot,\n pivotDiscreteLegend,\n pivotIndicators,\n pivotAdapter,\n pivotIndicatorsAsRow,\n pivotGridStyle,\n pivotColumnDimensions,\n pivotRowDimensions,\n annotationPoint,\n annotationVerticalLine,\n annotationHorizontalLine,\n annotationArea,\n pointStyle,\n verticalCrosshairLine,\n xLinear,\n horizontalCrosshairLine,\n pointStateHover,\n initScatter,\n progressive,\n datasetScatter,\n linearColor,\n colorAdapter,\n colorPointStyleFill,\n colorLegend,\n pivotColorLegend,\n labelScatter,\n} from '../pipes'\n\nconst scatter: SpecPipeline = [\n initScatter,\n colorAdapter(color, linearColor),\n backgroundColor,\n datasetScatter,\n progressive,\n xLinear,\n yLinear,\n labelScatter,\n tooltipScatter,\n colorAdapter(discreteLegend, colorLegend),\n verticalCrosshairLine,\n horizontalCrosshairLine,\n colorPointStyleFill(pointStyle),\n pointStateHover,\n annotationPoint,\n annotationVerticalLine,\n annotationHorizontalLine,\n annotationArea,\n]\n\nconst pivotScatter: SpecPipeline = [\n initPivot,\n pivotGridStyle,\n pivotIndicatorsAsRow,\n datasetPivot,\n pivotIndicators([\n initScatter,\n colorAdapter(color, linearColor),\n backgroundColor,\n datasetScatter,\n progressive,\n xLinear,\n yLinear,\n labelScatter,\n tooltipScatter,\n verticalCrosshairLine,\n horizontalCrosshairLine,\n colorPointStyleFill(pointStyle),\n pointStateHover,\n annotationPoint,\n annotationVerticalLine,\n annotationHorizontalLine,\n annotationArea,\n ]),\n pivotRowDimensions,\n pivotColumnDimensions,\n colorAdapter(pivotDiscreteLegend, pivotColorLegend),\n]\n\nexport const scatterSpecPipeline: SpecPipeline = [pivotAdapter(scatter, pivotScatter)]\n"],"names":["scatter","initScatter","colorAdapter","color","linearColor","backgroundColor","datasetScatter","progressive","xLinear","yLinear","labelScatter","tooltipScatter","discreteLegend","colorLegend","verticalCrosshairLine","horizontalCrosshairLine","colorPointStyleFill","pointStyle","pointStateHover","annotationPoint","annotationVerticalLine","annotationHorizontalLine","annotationArea","pivotScatter","initPivot","pivotGridStyle","pivotIndicatorsAsRow","datasetPivot","pivotIndicators","pivotRowDimensions","pivotColumnDimensions","pivotDiscreteLegend","pivotColorLegend","scatterSpecPipeline","pivotAdapter"],"mappings":";AAoCA,MAAMA,UAAwB;IAC5BC;IACAC,aAAaC,OAAOC;IACpBC;IACAC;IACAC;IACAC;IACAC;IACAC;IACAC;IACAT,aAAaU,gBAAgBC;IAC7BC;IACAC;IACAC,oBAAoBC;IACpBC;IACAC;IACAC;IACAC;IACAC;CACD;AAED,MAAMC,eAA6B;IACjCC;IACAC;IACAC;IACAC;IACAC,gBAAgB;QACd3B;QACAC,aAAaC,OAAOC;QACpBC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAG;QACAC;QACAC,oBAAoBC;QACpBC;QACAC;QACAC;QACAC;QACAC;KACD;IACDO;IACAC;IACA5B,aAAa6B,qBAAqBC;CACnC;AAEM,MAAMC,sBAAoC;IAACC,aAAalC,SAASuB;CAAc"}
|
@@ -0,0 +1,11 @@
|
|
1
|
+
import { isEmpty, isNullish } from "remeda";
|
2
|
+
import { autoFormatter } from "../../../../../utils/index.js";
|
3
|
+
const createLinearFormat = (value, autoFormat, numFormat, formatter)=>{
|
4
|
+
if (isNullish(autoFormat) && isEmpty(numFormat)) return autoFormatter(value);
|
5
|
+
if (true === autoFormat) return autoFormatter(value);
|
6
|
+
if (!isEmpty(numFormat)) return formatter(value);
|
7
|
+
return String(value);
|
8
|
+
};
|
9
|
+
export { createLinearFormat };
|
10
|
+
|
11
|
+
//# sourceMappingURL=linearFormat.js.map
|
@@ -0,0 +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"}
|
@@ -0,0 +1,14 @@
|
|
1
|
+
import { findAllMeasures } from "../../../../../utils/index.js";
|
2
|
+
const defaultTitleText = (measures, dimensions, idList = [])=>{
|
3
|
+
const allMeasures = findAllMeasures(measures);
|
4
|
+
return idList.map((id)=>{
|
5
|
+
const alias = [
|
6
|
+
...allMeasures,
|
7
|
+
...dimensions
|
8
|
+
].find((f)=>f.id === id)?.alias || '';
|
9
|
+
return alias;
|
10
|
+
}).join(' & ');
|
11
|
+
};
|
12
|
+
export { defaultTitleText };
|
13
|
+
|
14
|
+
//# sourceMappingURL=defaultTitleText.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"pipeline/spec/chart/pipes/axes/title/defaultTitleText.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/chart/pipes/axes/title/defaultTitleText.ts"],"sourcesContent":["import { findAllMeasures } from 'src/pipeline/utils'\nimport type { Dimensions, MeasureTree } from 'src/types'\n\nexport const defaultTitleText = (measures: MeasureTree, dimensions: Dimensions, idList: string[] = []) => {\n const allMeasures = findAllMeasures(measures)\n return idList.map((id) => {\n const alias = [...allMeasures, ...dimensions].find((f) => f.id === id)?.alias || ''\n return alias\n }).join(' & ')\n}\n"],"names":["defaultTitleText","measures","dimensions","idList","allMeasures","findAllMeasures","id","alias","f"],"mappings":";AAGO,MAAMA,mBAAmB,CAACC,UAAuBC,YAAwBC,SAAmB,EAAE;IACnG,MAAMC,cAAcC,gBAAgBJ;IACpC,OAAOE,OAAO,GAAG,CAAC,CAACG;QACjB,MAAMC,QAAQ;eAAIH;eAAgBF;SAAW,CAAC,IAAI,CAAC,CAACM,IAAMA,EAAE,EAAE,KAAKF,KAAK,SAAS;QACjF,OAAOC;IACT,GAAG,IAAI,CAAC;AACV"}
|
@@ -1,9 +1,11 @@
|
|
1
|
+
import { defaultTitleText } from "./title/defaultTitleText.js";
|
1
2
|
const xBand = (spec, context)=>{
|
2
3
|
const result = {
|
3
4
|
...spec
|
4
5
|
};
|
5
6
|
const { advancedVSeed, vseed } = context;
|
6
7
|
const { chartType } = vseed;
|
8
|
+
const { measures, dimensions, encoding } = advancedVSeed;
|
7
9
|
const config = advancedVSeed.config?.[chartType]?.xAxis;
|
8
10
|
if (!result.axes) result.axes = [];
|
9
11
|
if (!config) {
|
@@ -48,7 +50,7 @@ const xBand = (spec, context)=>{
|
|
48
50
|
},
|
49
51
|
title: {
|
50
52
|
visible: title?.visible,
|
51
|
-
text: title?.titleText,
|
53
|
+
text: title?.titleText || defaultTitleText(measures, dimensions, encoding.x),
|
52
54
|
style: {
|
53
55
|
fill: title?.titleColor,
|
54
56
|
fontSize: title?.titleFontSize,
|
@@ -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'\n\nexport const xBand: SpecPipe = (spec, context) => {\n const result = { ...spec } as ISpec\n const { advancedVSeed, vseed } = context\n const { chartType } = vseed\n const config = advancedVSeed.config?.[chartType as 'column']?.xAxis as XBandAxis\n\n if (!result.axes) {\n result.axes = []\n }\n\n if (!config) {\n result.axes = [\n ...result.axes,\n {\n visible: true,\n type: 'band',\n orient: 'bottom',\n },\n ] as ISpec['axes']\n return result\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,\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","config","visible","label","tick","title","grid","line","labelAutoHide","labelAutoHideGap","labelAutoLimit","labelAutoLimitLength","labelAutoRotate","labelAutoRotateAngleRange","sampling","bandAxis"],"mappings":"
|
1
|
+
{"version":3,"file":"pipeline/spec/chart/pipes/axes/xBand.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/chart/pipes/axes/xBand.ts"],"sourcesContent":["import type { ICartesianBandAxisSpec, ISpec } from '@visactor/vchart'\nimport type { 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 if (!config) {\n result.axes = [\n ...result.axes,\n {\n visible: true,\n type: 'band',\n orient: 'bottom',\n },\n ] as ISpec['axes']\n return result\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,IAAI,CAACO,QAAQ;QACXP,OAAO,IAAI,GAAG;eACTA,OAAO,IAAI;YACd;gBACE,SAAS;gBACT,MAAM;gBACN,QAAQ;YACV;SACD;QACD,OAAOA;IACT;IAEA,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,12 +1,14 @@
|
|
1
1
|
import { LINEAR_AXIS_INNER_OFFSET_TOP } from "../../../../utils/constant.js";
|
2
|
-
import {
|
2
|
+
import { createNumFormatter } from "../../../../utils/index.js";
|
3
|
+
import { createLinearFormat } from "./format/linearFormat.js";
|
4
|
+
import { defaultTitleText } from "./title/defaultTitleText.js";
|
3
5
|
const xLinear = (spec, context)=>{
|
4
6
|
const result = {
|
5
7
|
...spec
|
6
8
|
};
|
7
9
|
const { advancedVSeed, vseed } = context;
|
10
|
+
const { encoding, dimensions, measures } = advancedVSeed;
|
8
11
|
const { chartType } = vseed;
|
9
|
-
const { locale } = advancedVSeed;
|
10
12
|
const config = advancedVSeed.config?.[chartType]?.xAxis;
|
11
13
|
if (!result.axes) result.axes = [];
|
12
14
|
if (!config) {
|
@@ -20,7 +22,8 @@ const xLinear = (spec, context)=>{
|
|
20
22
|
];
|
21
23
|
return result;
|
22
24
|
}
|
23
|
-
const { visible = true, label, tick, title, grid, line, zero, nice, inverse, max, min, log, logBase = 10 } = config;
|
25
|
+
const { visible = true, label, tick, title, grid, line, zero, nice, inverse, max, min, log, logBase = 10, autoFormat, numFormat = {} } = config;
|
26
|
+
const formatter = createNumFormatter(numFormat);
|
24
27
|
const linearAxis = {
|
25
28
|
visible,
|
26
29
|
type: log ? 'log' : 'linear',
|
@@ -33,7 +36,7 @@ const xLinear = (spec, context)=>{
|
|
33
36
|
min,
|
34
37
|
label: {
|
35
38
|
visible: label?.visible,
|
36
|
-
formatMethod: (value)=>
|
39
|
+
formatMethod: (value)=>createLinearFormat(value, autoFormat, numFormat, formatter),
|
37
40
|
style: {
|
38
41
|
fill: label?.labelColor,
|
39
42
|
angle: label?.labelAngle,
|
@@ -43,7 +46,7 @@ const xLinear = (spec, context)=>{
|
|
43
46
|
},
|
44
47
|
title: {
|
45
48
|
visible: title?.visible,
|
46
|
-
text: title?.titleText,
|
49
|
+
text: title?.titleText || defaultTitleText(measures, dimensions, encoding.x),
|
47
50
|
style: {
|
48
51
|
fill: title?.titleColor,
|
49
52
|
fontSize: title?.titleFontSize,
|
@@ -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 { LINEAR_AXIS_INNER_OFFSET_TOP } from '../../../../utils/constant'\nimport type { SpecPipe, XLinearAxis } from 'src/types'\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 { LINEAR_AXIS_INNER_OFFSET_TOP } from '../../../../utils/constant'\nimport type { SpecPipe, XLinearAxis } from 'src/types'\nimport { createNumFormatter } from '../../../../utils'\nimport { createLinearFormat } 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 if (!config) {\n result.axes = [\n ...result.axes,\n {\n visible: true,\n type: 'linear',\n orient: 'bottom',\n },\n ] as ISpec['axes']\n return result\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\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 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","linearAxis","value","createLinearFormat","defaultTitleText","LINEAR_AXIS_INNER_OFFSET_TOP"],"mappings":";;;;AAOO,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,IAAI,CAACO,QAAQ;QACXP,OAAO,IAAI,GAAG;eACTA,OAAO,IAAI;YACd;gBACE,SAAS;gBACT,MAAM;gBACN,QAAQ;YACV;SACD;QACD,OAAOA;IACT;IAEA,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;IAErC,MAAMG,aAAa;QACjBjB;QACA,MAAMW,MAAM,QAAQ;QACpB,MAAMC;QACN,QAAQ;QACRL;QACA,MAAMI,MAAM,QAAQL;QACpBE;QACAC;QACAC;QACA,OAAO;YACL,SAAST,OAAO;YAChB,cAAc,CAACiB,QACNC,mBAAmBD,OAAOL,YAAYC,WAAWC;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,iBAAiBvB,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,OAAOgB;QAET;IACF;IAEA7B,OAAO,IAAI,GAAG;WAAIA,OAAO,IAAI;QAAEyB;KAAW;IAE1C,OAAOzB;AACT"}
|
@@ -1,9 +1,11 @@
|
|
1
|
+
import { defaultTitleText } from "./title/defaultTitleText.js";
|
1
2
|
const yBand = (spec, context)=>{
|
2
3
|
const result = {
|
3
4
|
...spec
|
4
5
|
};
|
5
6
|
const { advancedVSeed, vseed } = context;
|
6
7
|
const { chartType } = vseed;
|
8
|
+
const { measures, dimensions, encoding } = advancedVSeed;
|
7
9
|
const config = advancedVSeed.config?.[chartType]?.yAxis;
|
8
10
|
if (!result.axes) result.axes = [];
|
9
11
|
if (!config) {
|
@@ -49,7 +51,7 @@ const yBand = (spec, context)=>{
|
|
49
51
|
},
|
50
52
|
title: {
|
51
53
|
visible: title?.visible,
|
52
|
-
text: title?.titleText,
|
54
|
+
text: title?.titleText || defaultTitleText(measures, dimensions, encoding.y),
|
53
55
|
style: {
|
54
56
|
fill: title?.titleColor,
|
55
57
|
fontSize: title?.titleFontSize,
|
@@ -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'\n\nexport const yBand: SpecPipe = (spec, context) => {\n const result = { ...spec } as ISpec\n const { advancedVSeed, vseed } = context\n const { chartType } = vseed\n const config = advancedVSeed.config?.[chartType as 'bar']?.yAxis as XBandAxis\n\n if (!result.axes) {\n result.axes = []\n }\n\n if (!config) {\n result.axes = [\n ...result.axes,\n {\n visible: true,\n type: 'band',\n orient: 'left',\n },\n ] as ISpec['axes']\n return result\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,\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","config","visible","label","tick","title","grid","line","labelAutoHide","labelAutoHideGap","labelAutoLimit","labelAutoLimitLength","labelAutoRotate","labelAutoRotateAngleRange","sampling","bandAxis"],"mappings":"
|
1
|
+
{"version":3,"file":"pipeline/spec/chart/pipes/axes/yBand.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/chart/pipes/axes/yBand.ts"],"sourcesContent":["import type { ICartesianBandAxisSpec, ISpec } from '@visactor/vchart'\nimport type { 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 if (!config) {\n result.axes = [\n ...result.axes,\n {\n visible: true,\n type: 'band',\n orient: 'left',\n },\n ] as ISpec['axes']\n return result\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"],"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,UAAmB,EAAE;IAE3D,IAAI,CAACH,OAAO,IAAI,EACdA,OAAO,IAAI,GAAG,EAAE;IAGlB,IAAI,CAACO,QAAQ;QACXP,OAAO,IAAI,GAAG;eACTA,OAAO,IAAI;YACd;gBACE,SAAS;gBACT,MAAM;gBACN,QAAQ;YACV;SACD;QACD,OAAOA;IACT;IAEA,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,UAAUS,uBAAuB;QACjCG;QACA,OAAO;QACP,OAAO;YACL,SAASX,OAAO;YAChB,OAAO;YACP,gBAAgB;YAChB,OAAO;YACP,OAAO;gBACL,cAAcQ;gBACd,MAAMR,OAAO;gBACb,OAAOA,OAAO;gBACd,UAAUA,OAAO;gBACjB,YAAYA,OAAO;YACrB;YAEA,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,12 +1,14 @@
|
|
1
1
|
import { LINEAR_AXIS_INNER_OFFSET_TOP } from "../../../../utils/constant.js";
|
2
|
-
import {
|
2
|
+
import { createNumFormatter } from "../../../../utils/index.js";
|
3
|
+
import { createLinearFormat } from "./format/linearFormat.js";
|
4
|
+
import { defaultTitleText } from "./title/defaultTitleText.js";
|
3
5
|
const yLinear = (spec, context)=>{
|
4
6
|
const result = {
|
5
7
|
...spec
|
6
8
|
};
|
7
9
|
const { advancedVSeed, vseed } = context;
|
8
10
|
const { chartType } = vseed;
|
9
|
-
const {
|
11
|
+
const { measures, dimensions, encoding } = advancedVSeed;
|
10
12
|
const config = advancedVSeed.config?.[chartType]?.yAxis;
|
11
13
|
if (!result.axes) result.axes = [];
|
12
14
|
if (!config) {
|
@@ -20,7 +22,8 @@ const yLinear = (spec, context)=>{
|
|
20
22
|
];
|
21
23
|
return result;
|
22
24
|
}
|
23
|
-
const { visible = true, label, tick, title, grid, line, zero, nice, inverse, max, min, log, logBase = 10 } = config;
|
25
|
+
const { visible = true, label, tick, title, grid, line, zero, nice, inverse, max, min, log, logBase = 10, autoFormat, numFormat = {} } = config;
|
26
|
+
const formatter = createNumFormatter(numFormat);
|
24
27
|
const linearAxis = {
|
25
28
|
visible,
|
26
29
|
type: log ? 'log' : 'linear',
|
@@ -33,7 +36,7 @@ const yLinear = (spec, context)=>{
|
|
33
36
|
min,
|
34
37
|
label: {
|
35
38
|
visible: label?.visible,
|
36
|
-
formatMethod: (value)=>
|
39
|
+
formatMethod: (value)=>createLinearFormat(value, autoFormat, numFormat, formatter),
|
37
40
|
style: {
|
38
41
|
fill: label?.labelColor,
|
39
42
|
angle: label?.labelAngle,
|
@@ -43,7 +46,7 @@ const yLinear = (spec, context)=>{
|
|
43
46
|
},
|
44
47
|
title: {
|
45
48
|
visible: title?.visible,
|
46
|
-
text: title?.titleText,
|
49
|
+
text: title?.titleText || defaultTitleText(measures, dimensions, encoding.y),
|
47
50
|
style: {
|
48
51
|
fill: title?.titleColor,
|
49
52
|
fontSize: title?.titleFontSize,
|
@@ -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 { LINEAR_AXIS_INNER_OFFSET_TOP } from '../../../../utils/constant'\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 { LINEAR_AXIS_INNER_OFFSET_TOP } from '../../../../utils/constant'\nimport { createNumFormatter } from '../../../../utils'\nimport type { SpecPipe, YLinearAxis } from 'src/types'\nimport { createLinearFormat } 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 if (!config) {\n result.axes = [\n ...result.axes,\n {\n visible: true,\n type: 'linear',\n orient: 'left',\n },\n ] as ISpec['axes']\n return result\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\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 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","linearAxis","value","createLinearFormat","defaultTitleText","LINEAR_AXIS_INNER_OFFSET_TOP"],"mappings":";;;;AAOO,MAAMA,UAAoB,CAACC,MAAMC;IACtC,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,IAAI,CAACO,QAAQ;QACXP,OAAO,IAAI,GAAG;eACTA,OAAO,IAAI;YACd;gBACE,SAAS;gBACT,MAAM;gBACN,QAAQ;YACV;SACD;QACD,OAAOA;IACT;IAEA,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;IAErC,MAAMG,aAAa;QACjBjB;QACA,MAAMW,MAAM,QAAQ;QACpB,MAAMC;QACN,QAAQ;QACRL;QACA,MAAMI,MAAM,QAAQL;QACpBE;QACAC;QACAC;QACA,OAAO;YACL,SAAST,OAAO;YAChB,cAAc,CAACiB,QACNC,mBAAmBD,OAAOL,YAAYC,WAAWC;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,iBAAiBxB,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,aAAa;YACX,KAAKgB;QAEP;IACF;IAEA7B,OAAO,IAAI,GAAG;WAAIA,OAAO,IAAI;QAAEyB;KAAW;IAE1C,OAAOzB;AACT"}
|
@@ -1,13 +1,15 @@
|
|
1
1
|
import { LINEAR_AXIS_INNER_OFFSET_TOP } from "../../../../utils/constant.js";
|
2
|
-
import {
|
2
|
+
import { createNumFormatter } from "../../../../utils/index.js";
|
3
3
|
import { isEmpty, isNullish } from "remeda";
|
4
|
+
import { createLinearFormat } from "./format/linearFormat.js";
|
5
|
+
import { defaultTitleText } from "./title/defaultTitleText.js";
|
4
6
|
const yLinearPrimary = (spec, context)=>{
|
5
7
|
const result = {
|
6
8
|
...spec
|
7
9
|
};
|
8
10
|
const { advancedVSeed, vseed } = context;
|
9
11
|
const { chartType } = vseed;
|
10
|
-
const {
|
12
|
+
const { datasetReshapeInfo, encoding, measures, dimensions } = advancedVSeed;
|
11
13
|
const { index, id: reshapeInfoId, foldInfoList } = datasetReshapeInfo[0];
|
12
14
|
const primaryYAxis = advancedVSeed.config?.[chartType]?.primaryYAxis;
|
13
15
|
const yAxisConfig = Array.isArray(primaryYAxis) ? primaryYAxis[index] || primaryYAxis[0] : primaryYAxis;
|
@@ -35,7 +37,8 @@ const yLinearPrimary = (spec, context)=>{
|
|
35
37
|
];
|
36
38
|
return result;
|
37
39
|
}
|
38
|
-
const { visible = true, label, tick, title, grid, line, zero, nice, inverse, max, min, log, logBase = 10 } = yAxisConfig;
|
40
|
+
const { visible = true, label, tick, title, grid, line, zero, nice, inverse, max, min, log, logBase = 10, autoFormat, numFormat = {} } = yAxisConfig;
|
41
|
+
const formatter = createNumFormatter(numFormat);
|
39
42
|
const linearAxis = {
|
40
43
|
visible: isEmptySecondary ? false : visible,
|
41
44
|
id,
|
@@ -50,7 +53,7 @@ const yLinearPrimary = (spec, context)=>{
|
|
50
53
|
min,
|
51
54
|
label: {
|
52
55
|
visible: label?.visible,
|
53
|
-
formatMethod: (value)=>
|
56
|
+
formatMethod: (value)=>createLinearFormat(value, autoFormat, numFormat, formatter),
|
54
57
|
style: {
|
55
58
|
fill: label?.labelColor,
|
56
59
|
angle: label?.labelAngle,
|
@@ -60,7 +63,7 @@ const yLinearPrimary = (spec, context)=>{
|
|
60
63
|
},
|
61
64
|
title: {
|
62
65
|
visible: title?.visible,
|
63
|
-
text: title?.titleText,
|
66
|
+
text: title?.titleText || defaultTitleText(measures, dimensions, encoding.y),
|
64
67
|
style: {
|
65
68
|
fill: title?.titleColor,
|
66
69
|
fontSize: title?.titleFontSize,
|
@@ -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 {
|
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 if (!yAxisConfig) {\n result.axes = [\n ...result.axes,\n {\n visible: true,\n id,\n seriesId,\n type: 'linear',\n orient: 'left',\n },\n ] as ISpec['axes']\n return result\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":"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"}
|
@@ -1,13 +1,15 @@
|
|
1
1
|
import { LINEAR_AXIS_INNER_OFFSET_TOP } from "../../../../utils/constant.js";
|
2
|
-
import {
|
2
|
+
import { createNumFormatter } from "../../../../utils/index.js";
|
3
3
|
import { isEmpty, isNullish } from "remeda";
|
4
|
+
import { createLinearFormat } from "./format/linearFormat.js";
|
5
|
+
import { defaultTitleText } from "./title/defaultTitleText.js";
|
4
6
|
const yLinearSecondary = (spec, context)=>{
|
5
7
|
const result = {
|
6
8
|
...spec
|
7
9
|
};
|
8
10
|
const { advancedVSeed, vseed } = context;
|
9
11
|
const { chartType } = vseed;
|
10
|
-
const {
|
12
|
+
const { datasetReshapeInfo, measures, dimensions, encoding } = advancedVSeed;
|
11
13
|
const { index, id: reshapeInfoId, foldInfoList } = datasetReshapeInfo[0];
|
12
14
|
const secondaryYAxis = advancedVSeed.config?.[chartType]?.secondaryYAxis;
|
13
15
|
const yAxisConfig = Array.isArray(secondaryYAxis) ? secondaryYAxis[index] || secondaryYAxis[0] : secondaryYAxis;
|
@@ -41,7 +43,8 @@ const yLinearSecondary = (spec, context)=>{
|
|
41
43
|
];
|
42
44
|
return result;
|
43
45
|
}
|
44
|
-
const { visible = true, label, tick, title, grid, line, zero, nice, inverse, max, min, log, logBase = 10 } = yAxisConfig;
|
46
|
+
const { visible = true, label, tick, title, grid, line, zero, nice, inverse, max, min, log, logBase = 10, numFormat = {}, autoFormat } = yAxisConfig;
|
47
|
+
const formatter = createNumFormatter(numFormat);
|
45
48
|
const linearAxis = {
|
46
49
|
visible: isEmptySecondary ? false : visible,
|
47
50
|
id,
|
@@ -57,7 +60,7 @@ const yLinearSecondary = (spec, context)=>{
|
|
57
60
|
min,
|
58
61
|
label: {
|
59
62
|
visible: label?.visible,
|
60
|
-
formatMethod: (value)=>
|
63
|
+
formatMethod: (value)=>createLinearFormat(value, autoFormat, numFormat, formatter),
|
61
64
|
style: {
|
62
65
|
fill: label?.labelColor,
|
63
66
|
angle: label?.labelAngle,
|
@@ -67,7 +70,7 @@ const yLinearSecondary = (spec, context)=>{
|
|
67
70
|
},
|
68
71
|
title: {
|
69
72
|
visible: title?.visible,
|
70
|
-
text: title?.titleText,
|
73
|
+
text: title?.titleText || defaultTitleText(measures, dimensions, encoding.y),
|
71
74
|
style: {
|
72
75
|
fill: title?.titleColor,
|
73
76
|
fontSize: title?.titleFontSize,
|
@@ -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 {
|
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 if (!yAxisConfig) {\n result.axes = [\n ...result.axes,\n {\n visible: true,\n id,\n seriesId,\n type: 'linear',\n orient: 'right',\n sync,\n },\n ] as ISpec['axes']\n return result\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":"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"}
|
@@ -1,4 +1,4 @@
|
|
1
1
|
import { label } from "./label.js";
|
2
|
-
import { labelColorInversion } from "./labelColorInversion.js";
|
3
2
|
import { labelPrimary, labelSecondary } from "./labelDualAxis.js";
|
4
|
-
|
3
|
+
import { labelScatter } from "./labelScatter.js";
|
4
|
+
export { label, labelPrimary, labelScatter, labelSecondary };
|
@@ -1,2 +1,6 @@
|
|
1
|
-
import type {
|
1
|
+
import type { ILineLikeLabelSpec } from '@visactor/vchart/esm/series/mixin/interface';
|
2
|
+
import type { Dimensions, Encoding, FoldInfo, Formatter, Label, Measure, Measures, NumFormat, SpecPipe } from '../../../../../types';
|
2
3
|
export declare const label: SpecPipe;
|
4
|
+
export declare const generateMeasureValue: (value: number | string, measure?: Measure, labelAutoFormat?: boolean, numFormat?: NumFormat) => string | number;
|
5
|
+
export declare const generateMeasurePercent: (value: number | string, sum: number, formatter: Formatter) => string;
|
6
|
+
export declare const buildLabel: (label: Label, vseedMeasures: Measures | undefined, vseedDimensions: Dimensions | undefined, advancedVSeedMeasures: Measures, encoding: Encoding, foldInfoList: FoldInfo[]) => ILineLikeLabelSpec;
|