@visactor/vseed 0.2.1 → 0.2.2
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/builder/register/all.js +2 -2
- package/dist/esm/builder/register/all.js.map +1 -1
- package/dist/esm/builder/register/chartType/boxplot.d.ts +1 -1
- package/dist/esm/builder/register/chartType/boxplot.js +2 -2
- package/dist/esm/builder/register/chartType/boxplot.js.map +1 -1
- package/dist/esm/builder/register/chartType/index.d.ts +1 -1
- package/dist/esm/builder/register/chartType/index.js +2 -2
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/index.js +2 -2
- package/dist/esm/pipeline/advanced/chart/pipes/config/histogram.js +17 -0
- package/dist/esm/pipeline/advanced/chart/pipes/config/histogram.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipeline/histogram.js +3 -3
- package/dist/esm/pipeline/spec/chart/pipeline/histogram.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipes/annotation/annotationPoint.js +3 -76
- package/dist/esm/pipeline/spec/chart/pipes/annotation/annotationPoint.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipes/annotation/annotationPointCommon.d.ts +6 -0
- package/dist/esm/pipeline/spec/chart/pipes/annotation/annotationPointCommon.js +95 -0
- package/dist/esm/pipeline/spec/chart/pipes/annotation/annotationPointCommon.js.map +1 -0
- package/dist/esm/pipeline/spec/chart/pipes/annotation/annotationPointOfDualAxis.js +16 -84
- package/dist/esm/pipeline/spec/chart/pipes/annotation/annotationPointOfDualAxis.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipes/annotation/annotationPointOfHistogram.d.ts +2 -0
- package/dist/esm/pipeline/spec/chart/pipes/annotation/annotationPointOfHistogram.js +23 -0
- package/dist/esm/pipeline/spec/chart/pipes/annotation/annotationPointOfHistogram.js.map +1 -0
- package/dist/esm/pipeline/spec/chart/pipes/annotation/index.d.ts +1 -0
- package/dist/esm/pipeline/spec/chart/pipes/annotation/index.js +2 -1
- package/dist/esm/pipeline/spec/chart/pipes/tooltip/tooltipHistogram.js +8 -7
- package/dist/esm/pipeline/spec/chart/pipes/tooltip/tooltipHistogram.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/utils/histogram.d.ts +1 -0
- package/dist/esm/pipeline/spec/chart/utils/histogram.js +6 -2
- package/dist/esm/pipeline/spec/chart/utils/histogram.js.map +1 -1
- package/dist/esm/types/chartType/area/area.d.ts +2 -2
- package/dist/esm/types/chartType/areaPercent/areaPercent.d.ts +3 -5
- package/dist/esm/types/chartType/bar/bar.d.ts +3 -3
- package/dist/esm/types/chartType/barParallel/barParallel.d.ts +3 -3
- package/dist/esm/types/chartType/barPercent/barPercent.d.ts +3 -3
- package/dist/esm/types/chartType/{boxplot/boxplot.d.ts → boxPlot/boxPlot.d.ts} +6 -6
- package/dist/esm/types/chartType/boxPlot/index.d.ts +2 -0
- package/dist/esm/types/chartType/boxPlot/index.js +1 -0
- package/dist/esm/types/chartType/{boxplot/zBoxplot.d.ts → boxPlot/zBoxPlot.d.ts} +1 -1
- package/dist/esm/types/chartType/{boxplot/zBoxplot.js → boxPlot/zBoxPlot.js} +3 -3
- package/dist/esm/types/chartType/{boxplot/zBoxplot.js.map → boxPlot/zBoxPlot.js.map} +1 -1
- package/dist/esm/types/chartType/column/column.d.ts +4 -4
- package/dist/esm/types/chartType/column/zColumn.d.ts +2 -2
- package/dist/esm/types/chartType/column/zColumn.js +1 -1
- package/dist/esm/types/chartType/column/zColumn.js.map +1 -1
- package/dist/esm/types/chartType/columnParallel/columnParallel.d.ts +3 -5
- package/dist/esm/types/chartType/columnPercent/columnPercent.d.ts +3 -3
- package/dist/esm/types/chartType/dualAxis/dualAxis.d.ts +3 -3
- package/dist/esm/types/chartType/histogram/histogram.d.ts +6 -6
- package/dist/esm/types/chartType/index.d.ts +1 -1
- package/dist/esm/types/chartType/index.js +1 -1
- package/dist/esm/types/chartType/line/line.d.ts +3 -5
- package/dist/esm/types/chartType/pivotTable/pivotTable.d.ts +1 -1
- package/dist/esm/types/chartType/scatter/scatter.d.ts +7 -7
- package/dist/esm/types/chartType/scatter/zScatter.d.ts +8 -8
- package/dist/esm/types/chartType/scatter/zScatter.js +4 -4
- package/dist/esm/types/chartType/scatter/zScatter.js.map +1 -1
- package/dist/esm/types/chartType/table/table.d.ts +1 -1
- package/dist/esm/types/properties/regressionLine/linearRegressionLine.d.ts +4 -0
- package/dist/esm/types/properties/regressionLine/logisticRegressionLine.d.ts +4 -0
- package/dist/esm/types/properties/regressionLine/lowessRegressionLine.d.ts +4 -0
- package/dist/esm/types/properties/regressionLine/polynomialRegressionLine.d.ts +4 -0
- package/dist/esm/types/vseed.d.ts +2 -2
- package/dist/esm/types/zVseed.d.ts +10 -10
- package/dist/esm/types/zVseed.js +2 -2
- package/dist/esm/types/zVseed.js.map +1 -1
- package/dist/umd/index.js +170 -135
- package/dist/umd/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/esm/types/chartType/boxplot/index.d.ts +0 -2
- package/dist/esm/types/chartType/boxplot/index.js +0 -1
- /package/dist/esm/types/chartType/{boxplot/boxplot.js → boxPlot/boxPlot.js} +0 -0
package/dist/umd/index.js
CHANGED
|
@@ -119,7 +119,6 @@
|
|
|
119
119
|
ORIGINAL_DATA: ()=>ORIGINAL_DATA,
|
|
120
120
|
columnAdvancedPipeline: ()=>columnAdvancedPipeline,
|
|
121
121
|
FoldMeasureId: ()=>FoldMeasureId,
|
|
122
|
-
zBoxplot: ()=>zBoxplot,
|
|
123
122
|
MeasureName: ()=>MeasureName,
|
|
124
123
|
lightTheme: ()=>lightTheme,
|
|
125
124
|
zSort: ()=>zSort,
|
|
@@ -209,7 +208,6 @@
|
|
|
209
208
|
dualAxisSpecPipeline: ()=>dualAxisSpecPipeline,
|
|
210
209
|
unfoldDimensions: ()=>unfoldDimensions,
|
|
211
210
|
zArea: ()=>zArea,
|
|
212
|
-
registerBoxplot: ()=>registerBoxplot,
|
|
213
211
|
histogramAdvancedPipeline: ()=>histogramAdvancedPipeline,
|
|
214
212
|
registerDarkTheme: ()=>registerDarkTheme,
|
|
215
213
|
ChartTypeEnum: ()=>ChartTypeEnum,
|
|
@@ -232,6 +230,7 @@
|
|
|
232
230
|
registerPivotTable: ()=>registerPivotTable,
|
|
233
231
|
execPipeline: ()=>execPipeline,
|
|
234
232
|
XEncoding: ()=>XEncoding,
|
|
233
|
+
zBoxPlot: ()=>zBoxPlot,
|
|
235
234
|
zLineStyle: ()=>zLineStyle,
|
|
236
235
|
zRegressionLine: ()=>zRegressionLine,
|
|
237
236
|
findMeasureById: ()=>findMeasureById,
|
|
@@ -247,12 +246,13 @@
|
|
|
247
246
|
registerDonut: ()=>registerDonut,
|
|
248
247
|
findTreeNodesBy: ()=>findTreeNodesBy,
|
|
249
248
|
zRadar: ()=>zRadar,
|
|
250
|
-
|
|
249
|
+
registerBoxPlot: ()=>registerBoxPlot,
|
|
251
250
|
zAnnotation: ()=>zAnnotation,
|
|
252
|
-
|
|
251
|
+
zTable: ()=>zTable,
|
|
253
252
|
pieAdvancedPipeline: ()=>pieAdvancedPipeline,
|
|
254
253
|
ANNOTATION_Z_INDEX: ()=>1000,
|
|
255
254
|
zColumnPercent: ()=>zColumnPercent,
|
|
255
|
+
zXBandAxis: ()=>zXBandAxis,
|
|
256
256
|
createFormatter: ()=>createFormatter,
|
|
257
257
|
columnPercentSpecPipeline: ()=>columnPercentSpecPipeline,
|
|
258
258
|
zSelector: ()=>zSelector,
|
|
@@ -3874,33 +3874,39 @@
|
|
|
3874
3874
|
textBaseline: 'middle'
|
|
3875
3875
|
}
|
|
3876
3876
|
};
|
|
3877
|
-
const
|
|
3878
|
-
const
|
|
3879
|
-
const
|
|
3880
|
-
|
|
3881
|
-
|
|
3882
|
-
|
|
3883
|
-
|
|
3884
|
-
|
|
3885
|
-
|
|
3886
|
-
|
|
3887
|
-
|
|
3888
|
-
|
|
3889
|
-
|
|
3890
|
-
|
|
3891
|
-
|
|
3892
|
-
|
|
3893
|
-
|
|
3894
|
-
|
|
3895
|
-
|
|
3896
|
-
|
|
3897
|
-
|
|
3898
|
-
|
|
3899
|
-
|
|
3900
|
-
|
|
3877
|
+
const generateAnnotationPointPipe = (options)=>{
|
|
3878
|
+
const findSelectedDatas = options.findSelectedDatas ?? ((dataset, s)=>dataset.filter((datum)=>selector_selector(datum, s)));
|
|
3879
|
+
const generateMarkPoint = options.generateMarkPoint ?? ((datum)=>[
|
|
3880
|
+
{
|
|
3881
|
+
coordinate: (data)=>data.find((item)=>isSubset(datum, item))
|
|
3882
|
+
}
|
|
3883
|
+
]);
|
|
3884
|
+
return (spec, context)=>{
|
|
3885
|
+
const { advancedVSeed, vseed } = context;
|
|
3886
|
+
const { annotation, config } = advancedVSeed;
|
|
3887
|
+
if (!annotation || !annotation.annotationPoint) return spec;
|
|
3888
|
+
const theme = config?.[vseed.chartType]?.annotation?.annotationPoint;
|
|
3889
|
+
const { annotationPoint } = annotation;
|
|
3890
|
+
const annotationPointList = Array.isArray(annotationPoint) ? annotationPoint : [
|
|
3891
|
+
annotationPoint
|
|
3892
|
+
];
|
|
3893
|
+
const isHorizontalBar = isBarLikeChart(advancedVSeed);
|
|
3894
|
+
const defaultStyle = isHorizontalBar ? {
|
|
3895
|
+
textAlign: 'right',
|
|
3896
|
+
textBaseline: 'middle'
|
|
3897
|
+
} : {
|
|
3898
|
+
textAlign: 'center',
|
|
3899
|
+
textBaseline: 'top'
|
|
3900
|
+
};
|
|
3901
|
+
const markPoint = annotationPointList.flatMap((annotationPoint)=>{
|
|
3902
|
+
const { selector: selectorPoint, text = '', textColor = theme?.textColor ?? '#ffffff', textFontSize = theme?.textFontSize ?? 12, textFontWeight = theme?.textFontWeight ?? 400, textAlign = defaultStyle.textAlign, textBaseline = defaultStyle.textBaseline, textBackgroundBorderColor = theme?.textBackgroundBorderColor, textBackgroundBorderRadius = theme?.textBackgroundBorderRadius ?? 4, textBackgroundBorderWidth = theme?.textBackgroundBorderWidth ?? 1, textBackgroundColor = theme?.textBackgroundColor ?? '#212121', textBackgroundPadding = theme?.textBackgroundPadding ?? 2, textBackgroundVisible = theme?.textBackgroundVisible ?? true, offsetX = theme?.offsetX ?? 0, offsetY = theme?.offsetY ?? 0 } = annotationPoint;
|
|
3903
|
+
const dataset = advancedVSeed.dataset.flat();
|
|
3904
|
+
const selectedData = selectorPoint ? findSelectedDatas(dataset, selectorPoint, spec, context) : [];
|
|
3905
|
+
const dx = -10 - (isHorizontalBar ? textFontSize : 0);
|
|
3906
|
+
const dy = isHorizontalBar ? 0 : textFontSize;
|
|
3907
|
+
const markPointStyle = {
|
|
3901
3908
|
zIndex: 1000,
|
|
3902
3909
|
regionRelative: true,
|
|
3903
|
-
coordinate: (data)=>data.find((item)=>isSubset(datum, item)),
|
|
3904
3910
|
itemLine: {
|
|
3905
3911
|
visible: false
|
|
3906
3912
|
},
|
|
@@ -3938,13 +3944,25 @@
|
|
|
3938
3944
|
}
|
|
3939
3945
|
}
|
|
3940
3946
|
}
|
|
3941
|
-
}
|
|
3942
|
-
|
|
3943
|
-
|
|
3944
|
-
|
|
3945
|
-
|
|
3947
|
+
};
|
|
3948
|
+
return selectedData.reduce((res, datum)=>{
|
|
3949
|
+
const marks = generateMarkPoint(datum, spec, context);
|
|
3950
|
+
if (marks && marks.length) marks.forEach((mark)=>{
|
|
3951
|
+
res.push({
|
|
3952
|
+
...markPointStyle,
|
|
3953
|
+
...mark
|
|
3954
|
+
});
|
|
3955
|
+
});
|
|
3956
|
+
return res;
|
|
3957
|
+
}, []);
|
|
3958
|
+
});
|
|
3959
|
+
return {
|
|
3960
|
+
...spec,
|
|
3961
|
+
markPoint
|
|
3962
|
+
};
|
|
3946
3963
|
};
|
|
3947
3964
|
};
|
|
3965
|
+
const annotationPoint_annotationPoint = generateAnnotationPointPipe({});
|
|
3948
3966
|
function chunk_BO3LQZNF_o(r) {
|
|
3949
3967
|
return Array.isArray(r);
|
|
3950
3968
|
}
|
|
@@ -9878,90 +9896,23 @@
|
|
|
9878
9896
|
}), match || (result[k] = v);
|
|
9879
9897
|
}), result;
|
|
9880
9898
|
}
|
|
9881
|
-
const annotationPointOfDualAxis = (
|
|
9882
|
-
|
|
9883
|
-
|
|
9884
|
-
|
|
9885
|
-
const theme = config?.[vseed.chartType]?.annotation?.annotationPoint;
|
|
9886
|
-
const { annotationPoint } = annotation;
|
|
9887
|
-
const annotationPointList = Array.isArray(annotationPoint) ? annotationPoint : [
|
|
9888
|
-
annotationPoint
|
|
9889
|
-
];
|
|
9890
|
-
const isHorizontalBar = isBarLikeChart(advancedVSeed);
|
|
9891
|
-
const defaultStyle = isHorizontalBar ? {
|
|
9892
|
-
textAlign: 'right',
|
|
9893
|
-
textBaseline: 'middle'
|
|
9894
|
-
} : {
|
|
9895
|
-
textAlign: 'center',
|
|
9896
|
-
textBaseline: 'top'
|
|
9897
|
-
};
|
|
9898
|
-
const allMeasureIds = findAllMeasures(advancedVSeed.reshapeMeasures ?? advancedVSeed.measures).map((m)=>m.id);
|
|
9899
|
-
const markPoint = annotationPointList.flatMap((annotationPoint)=>{
|
|
9900
|
-
const { selector: selectorPoint, text = '', textColor = theme?.textColor ?? '#ffffff', textFontSize = theme?.textFontSize ?? 12, textFontWeight = theme?.textFontWeight ?? 400, textAlign = defaultStyle.textAlign, textBaseline = defaultStyle.textBaseline, textBackgroundBorderColor = theme?.textBackgroundBorderColor, textBackgroundBorderRadius = theme?.textBackgroundBorderRadius ?? 4, textBackgroundBorderWidth = theme?.textBackgroundBorderWidth ?? 1, textBackgroundColor = theme?.textBackgroundColor ?? '#212121', textBackgroundPadding = theme?.textBackgroundPadding ?? 2, textBackgroundVisible = theme?.textBackgroundVisible ?? true, offsetX = theme?.offsetX ?? 0, offsetY = theme?.offsetY ?? 0 } = annotationPoint;
|
|
9901
|
-
const dataset = advancedVSeed.dataset.flat();
|
|
9902
|
-
const selectedData = selectorPoint ? dataset.reduce((res, d)=>{
|
|
9899
|
+
const annotationPointOfDualAxis = generateAnnotationPointPipe({
|
|
9900
|
+
findSelectedDatas: (dataset, s, spec, context)=>dataset.reduce((res, d)=>{
|
|
9901
|
+
const { advancedVSeed } = context;
|
|
9902
|
+
const allMeasureIds = findAllMeasures(advancedVSeed.reshapeMeasures ?? advancedVSeed.measures).map((m)=>m.id);
|
|
9903
9903
|
const pickedDatum = pickWithout(d, allMeasureIds.filter((id)=>id !== d[MeasureId]));
|
|
9904
|
-
if (selector_selector(pickedDatum,
|
|
9904
|
+
if (selector_selector(pickedDatum, s)) res.push(pickedDatum);
|
|
9905
9905
|
return res;
|
|
9906
|
-
}, [])
|
|
9907
|
-
|
|
9908
|
-
const
|
|
9909
|
-
const
|
|
9910
|
-
|
|
9911
|
-
|
|
9912
|
-
|
|
9913
|
-
}
|
|
9914
|
-
|
|
9915
|
-
|
|
9916
|
-
offsetX,
|
|
9917
|
-
confine: true,
|
|
9918
|
-
text: {
|
|
9919
|
-
text: text,
|
|
9920
|
-
style: {
|
|
9921
|
-
opacity: 0.95,
|
|
9922
|
-
visible: true,
|
|
9923
|
-
textAlign: textAlign,
|
|
9924
|
-
textBaseline: textBaseline,
|
|
9925
|
-
fill: textColor,
|
|
9926
|
-
stroke: textBackgroundColor,
|
|
9927
|
-
lineWidth: 1,
|
|
9928
|
-
fontSize: textFontSize,
|
|
9929
|
-
fontWeight: textFontWeight,
|
|
9930
|
-
dx,
|
|
9931
|
-
dy
|
|
9932
|
-
},
|
|
9933
|
-
labelBackground: {
|
|
9934
|
-
visible: textBackgroundVisible,
|
|
9935
|
-
padding: textBackgroundPadding,
|
|
9936
|
-
style: {
|
|
9937
|
-
opacity: 0.95,
|
|
9938
|
-
cornerRadius: textBackgroundBorderRadius ?? 4,
|
|
9939
|
-
fill: textBackgroundColor,
|
|
9940
|
-
stroke: textBackgroundBorderColor,
|
|
9941
|
-
lineWidth: textBackgroundBorderWidth,
|
|
9942
|
-
dx,
|
|
9943
|
-
dy
|
|
9944
|
-
}
|
|
9945
|
-
}
|
|
9946
|
-
}
|
|
9947
|
-
}
|
|
9948
|
-
};
|
|
9949
|
-
return spec.series?.reduce((res, s, index)=>{
|
|
9950
|
-
selectedData.forEach((datum)=>{
|
|
9951
|
-
res.push({
|
|
9952
|
-
...baseConfig,
|
|
9953
|
-
relativeSeriesIndex: index,
|
|
9954
|
-
coordinate: (data)=>data.find((item)=>isSubset(datum, item, allMeasureIds.filter((id)=>id !== item[MeasureId])))
|
|
9955
|
-
});
|
|
9956
|
-
});
|
|
9957
|
-
return res;
|
|
9958
|
-
}, []);
|
|
9959
|
-
});
|
|
9960
|
-
return {
|
|
9961
|
-
...spec,
|
|
9962
|
-
markPoint
|
|
9963
|
-
};
|
|
9964
|
-
};
|
|
9906
|
+
}, []),
|
|
9907
|
+
generateMarkPoint: (datum, spec, context)=>{
|
|
9908
|
+
const { advancedVSeed } = context;
|
|
9909
|
+
const allMeasureIds = findAllMeasures(advancedVSeed.reshapeMeasures ?? advancedVSeed.measures).map((m)=>m.id);
|
|
9910
|
+
return spec.series?.map((s, index)=>({
|
|
9911
|
+
relativeSeriesIndex: index,
|
|
9912
|
+
coordinate: (data)=>data.find((item)=>isSubset(datum, item, allMeasureIds.filter((id)=>id !== item[MeasureId])))
|
|
9913
|
+
}));
|
|
9914
|
+
}
|
|
9915
|
+
});
|
|
9965
9916
|
const dualAxis = [
|
|
9966
9917
|
seriesDualAxis([
|
|
9967
9918
|
initDualAxisPrimary,
|
|
@@ -12210,10 +12161,55 @@
|
|
|
12210
12161
|
const boxplotSpecPipeline = [
|
|
12211
12162
|
pivotAdapter_pivotAdapter(boxplot_boxplot, pivotBoxplot)
|
|
12212
12163
|
];
|
|
12213
|
-
const
|
|
12164
|
+
const registerBoxPlot = ()=>{
|
|
12214
12165
|
Builder._advancedPipelineMap.boxPlot = boxplotAdvancedPipeline;
|
|
12215
12166
|
Builder._specPipelineMap.boxPlot = boxplotSpecPipeline;
|
|
12216
12167
|
};
|
|
12168
|
+
const isArrayLike_isArrayLike = function(value) {
|
|
12169
|
+
return null !== value && "function" != typeof value && Number.isFinite(value.length);
|
|
12170
|
+
};
|
|
12171
|
+
const common_isArrayLike = isArrayLike_isArrayLike;
|
|
12172
|
+
function baseMerge(target, source, shallowArray = !1, skipTargetArray = !1) {
|
|
12173
|
+
if (source) {
|
|
12174
|
+
if (target === source) return;
|
|
12175
|
+
if (common_isValid(source) && "object" == typeof source) {
|
|
12176
|
+
const iterable = Object(source), props = [];
|
|
12177
|
+
for(const key in iterable)props.push(key);
|
|
12178
|
+
let { length: length } = props, propIndex = -1;
|
|
12179
|
+
for(; length--;){
|
|
12180
|
+
const key = props[++propIndex];
|
|
12181
|
+
!common_isValid(iterable[key]) || "object" != typeof iterable[key] || skipTargetArray && common_isArray(target[key]) ? assignMergeValue(target, key, iterable[key]) : baseMergeDeep(target, source, key, shallowArray, skipTargetArray);
|
|
12182
|
+
}
|
|
12183
|
+
}
|
|
12184
|
+
}
|
|
12185
|
+
}
|
|
12186
|
+
function baseMergeDeep(target, source, key, shallowArray = !1, skipTargetArray = !1) {
|
|
12187
|
+
const objValue = target[key], srcValue = source[key];
|
|
12188
|
+
let newValue = source[key], isCommon = !0;
|
|
12189
|
+
if (common_isArray(srcValue)) {
|
|
12190
|
+
if (shallowArray) newValue = [];
|
|
12191
|
+
else if (common_isArray(objValue)) newValue = objValue;
|
|
12192
|
+
else if (common_isArrayLike(objValue)) {
|
|
12193
|
+
newValue = new Array(objValue.length);
|
|
12194
|
+
let index = -1;
|
|
12195
|
+
const length = objValue.length;
|
|
12196
|
+
for(; ++index < length;)newValue[index] = objValue[index];
|
|
12197
|
+
}
|
|
12198
|
+
} else common_isPlainObject(srcValue) ? (newValue = null != objValue ? objValue : {}, "function" != typeof objValue && "object" == typeof objValue || (newValue = {})) : isCommon = !1;
|
|
12199
|
+
isCommon && baseMerge(newValue, srcValue, shallowArray, skipTargetArray), assignMergeValue(target, key, newValue);
|
|
12200
|
+
}
|
|
12201
|
+
function assignMergeValue(target, key, value) {
|
|
12202
|
+
(void 0 === value || eq(target[key], value)) && (void 0 !== value || key in target) || (target[key] = value);
|
|
12203
|
+
}
|
|
12204
|
+
function eq(value, other) {
|
|
12205
|
+
return value === other || Number.isNaN(value) && Number.isNaN(other);
|
|
12206
|
+
}
|
|
12207
|
+
function merge(target, ...sources) {
|
|
12208
|
+
let sourceIndex = -1;
|
|
12209
|
+
const length = sources.length;
|
|
12210
|
+
for(; ++sourceIndex < length;)baseMerge(target, sources[sourceIndex], !0);
|
|
12211
|
+
return target;
|
|
12212
|
+
}
|
|
12217
12213
|
const histogramConfig = (advancedVSeed, context)=>{
|
|
12218
12214
|
const { vseed } = context;
|
|
12219
12215
|
const { chartType } = vseed;
|
|
@@ -12236,6 +12232,22 @@
|
|
|
12236
12232
|
'dimensionLinkage'
|
|
12237
12233
|
]);
|
|
12238
12234
|
let config = replaceNullToUndefined(pickedConfig);
|
|
12235
|
+
if (pickedConfig?.binValueType === 'percentage') config = merge({}, {
|
|
12236
|
+
yAxis: {
|
|
12237
|
+
autoFomat: false,
|
|
12238
|
+
numFormat: {
|
|
12239
|
+
type: 'percent',
|
|
12240
|
+
fractionDigits: 1
|
|
12241
|
+
}
|
|
12242
|
+
},
|
|
12243
|
+
label: {
|
|
12244
|
+
autoFormat: false,
|
|
12245
|
+
numFormat: {
|
|
12246
|
+
type: 'percent',
|
|
12247
|
+
fractionDigits: 1
|
|
12248
|
+
}
|
|
12249
|
+
}
|
|
12250
|
+
}, config);
|
|
12239
12251
|
if (!hasColorEncoding && !config?.legend?.enable) config = {
|
|
12240
12252
|
...config,
|
|
12241
12253
|
legend: {
|
|
@@ -12758,6 +12770,10 @@
|
|
|
12758
12770
|
const formatter = createNumFormatter(numFormat);
|
|
12759
12771
|
return (value)=>createLinearFormat(value, autoFormat, numFormat, formatter);
|
|
12760
12772
|
};
|
|
12773
|
+
const getDefaultValueFormatterOfHistogram = (binValueType = 'count')=>'percentage' === binValueType ? createNumFormatter({
|
|
12774
|
+
type: 'percent',
|
|
12775
|
+
fractionDigits: 1
|
|
12776
|
+
}) : (value)=>autoFormatter(value);
|
|
12761
12777
|
const tooltipHistogram_VCHART_OUTLIER_KEY = '__VCHART_BOX_PLOT_OUTLIER_VALUE';
|
|
12762
12778
|
const tooltipHistogram = (spec, context)=>{
|
|
12763
12779
|
const result = {
|
|
@@ -12766,11 +12782,12 @@
|
|
|
12766
12782
|
const { advancedVSeed } = context;
|
|
12767
12783
|
const { chartType, dimensions, encoding } = advancedVSeed;
|
|
12768
12784
|
const baseConfig = advancedVSeed.config[chartType];
|
|
12769
|
-
const { tooltip = {
|
|
12785
|
+
const { binValueType, tooltip = {
|
|
12770
12786
|
enable: true
|
|
12771
12787
|
} } = baseConfig;
|
|
12772
12788
|
const { enable } = tooltip;
|
|
12773
12789
|
const defaultXFormatter = getDefaultXFormatterOfHistogram(advancedVSeed);
|
|
12790
|
+
const defaultValueFormatter = getDefaultValueFormatterOfHistogram(binValueType);
|
|
12774
12791
|
result.tooltip = {
|
|
12775
12792
|
style: getTooltipStyle(tooltip),
|
|
12776
12793
|
visible: enable,
|
|
@@ -12778,18 +12795,18 @@
|
|
|
12778
12795
|
title: {
|
|
12779
12796
|
visible: false
|
|
12780
12797
|
},
|
|
12781
|
-
content: tooltipHistogram_createMarkContent(encoding.tooltip || [], dimensions, encoding, defaultXFormatter)
|
|
12798
|
+
content: tooltipHistogram_createMarkContent(encoding.tooltip || [], dimensions, encoding, defaultXFormatter, defaultValueFormatter)
|
|
12782
12799
|
},
|
|
12783
12800
|
dimension: {
|
|
12784
12801
|
title: {
|
|
12785
12802
|
visible: false
|
|
12786
12803
|
},
|
|
12787
|
-
content: tooltipHistogram_createMarkContent(encoding.tooltip || [], dimensions, encoding, defaultXFormatter)
|
|
12804
|
+
content: tooltipHistogram_createMarkContent(encoding.tooltip || [], dimensions, encoding, defaultXFormatter, defaultValueFormatter)
|
|
12788
12805
|
}
|
|
12789
12806
|
};
|
|
12790
12807
|
return result;
|
|
12791
12808
|
};
|
|
12792
|
-
const tooltipHistogram_createMarkContent = (tooltip, dimensions, encoding, dimFormatter)=>{
|
|
12809
|
+
const tooltipHistogram_createMarkContent = (tooltip, dimensions, encoding, dimFormatter, defaultValueFormatter)=>{
|
|
12793
12810
|
const dims = C(dimensions.filter((item)=>tooltip.includes(item.id)), T((item)=>item.id), T((item)=>item.alias));
|
|
12794
12811
|
const dimContent = dims.map((item)=>({
|
|
12795
12812
|
visible: true,
|
|
@@ -12801,7 +12818,7 @@
|
|
|
12801
12818
|
if (encoding.color?.includes(item.id)) return datum?.[ColorEncoding];
|
|
12802
12819
|
if (encoding.x?.includes(item.id)) return datum?.[XEncoding];
|
|
12803
12820
|
}
|
|
12804
|
-
return datum?.[item.id];
|
|
12821
|
+
return defaultValueFormatter(datum?.[item.id]);
|
|
12805
12822
|
}
|
|
12806
12823
|
}));
|
|
12807
12824
|
const defaultContent = [
|
|
@@ -12815,7 +12832,7 @@
|
|
|
12815
12832
|
},
|
|
12816
12833
|
value: (datum)=>{
|
|
12817
12834
|
if (!datum) return '';
|
|
12818
|
-
return datum[FoldMeasureValue];
|
|
12835
|
+
return defaultValueFormatter(datum[FoldMeasureValue]);
|
|
12819
12836
|
}
|
|
12820
12837
|
}
|
|
12821
12838
|
];
|
|
@@ -12845,6 +12862,24 @@
|
|
|
12845
12862
|
};
|
|
12846
12863
|
return result;
|
|
12847
12864
|
};
|
|
12865
|
+
const annotationPointOfHistogram = generateAnnotationPointPipe({
|
|
12866
|
+
generateMarkPoint: (datum, spec)=>{
|
|
12867
|
+
const histogramSpec = spec;
|
|
12868
|
+
const xField = histogramSpec.xField;
|
|
12869
|
+
const x2Field = histogramSpec.x2Field;
|
|
12870
|
+
return [
|
|
12871
|
+
{
|
|
12872
|
+
coordinate: (data)=>{
|
|
12873
|
+
const d = data.find((item)=>isSubset(datum, item));
|
|
12874
|
+
return d ? {
|
|
12875
|
+
...d,
|
|
12876
|
+
[xField]: (d[xField] + d[x2Field]) / 2
|
|
12877
|
+
} : void 0;
|
|
12878
|
+
}
|
|
12879
|
+
}
|
|
12880
|
+
];
|
|
12881
|
+
}
|
|
12882
|
+
});
|
|
12848
12883
|
const gaussian = (u)=>1 / Math.sqrt(2 * Math.PI) * Math.exp(-0.5 * u * u);
|
|
12849
12884
|
function scott(n, std, dim = 1) {
|
|
12850
12885
|
return n <= 0 || 0 === std ? 0 : std * Math.pow(n, -1 / (dim + 4));
|
|
@@ -13234,7 +13269,7 @@
|
|
|
13234
13269
|
colorAdapter(discreteLegend, colorLegend),
|
|
13235
13270
|
histogramVerticalCrosshairRect,
|
|
13236
13271
|
colorBarStyleFill(barStyle_barStyle),
|
|
13237
|
-
|
|
13272
|
+
annotationPointOfHistogram,
|
|
13238
13273
|
annotationVerticalLine_annotationVerticalLine,
|
|
13239
13274
|
annotationHorizontalLine_annotationHorizontalLine,
|
|
13240
13275
|
annotationAreaBand,
|
|
@@ -13257,7 +13292,7 @@
|
|
|
13257
13292
|
tooltipHistogram,
|
|
13258
13293
|
colorBarStyleFill(barStyle_barStyle),
|
|
13259
13294
|
histogramVerticalCrosshairRect,
|
|
13260
|
-
|
|
13295
|
+
annotationPointOfHistogram,
|
|
13261
13296
|
annotationVerticalLine_annotationVerticalLine,
|
|
13262
13297
|
annotationHorizontalLine_annotationHorizontalLine,
|
|
13263
13298
|
annotationAreaBand,
|
|
@@ -14392,7 +14427,7 @@
|
|
|
14392
14427
|
registerRadar();
|
|
14393
14428
|
registerFunnel();
|
|
14394
14429
|
registerHeatmap();
|
|
14395
|
-
|
|
14430
|
+
registerBoxPlot();
|
|
14396
14431
|
registerHistogram();
|
|
14397
14432
|
registerLightTheme();
|
|
14398
14433
|
registerDarkTheme();
|
|
@@ -14737,7 +14772,7 @@
|
|
|
14737
14772
|
});
|
|
14738
14773
|
return clone(schema, def);
|
|
14739
14774
|
}
|
|
14740
|
-
function
|
|
14775
|
+
function util_merge(a, b) {
|
|
14741
14776
|
const def = mergeDefs(a._zod.def, {
|
|
14742
14777
|
get shape () {
|
|
14743
14778
|
const _shape = {
|
|
@@ -17416,7 +17451,7 @@
|
|
|
17416
17451
|
catchall: void 0
|
|
17417
17452
|
});
|
|
17418
17453
|
inst.extend = (incoming)=>extend(inst, incoming);
|
|
17419
|
-
inst.merge = (other)=>
|
|
17454
|
+
inst.merge = (other)=>util_merge(inst, other);
|
|
17420
17455
|
inst.pick = (mask)=>pick(inst, mask);
|
|
17421
17456
|
inst.omit = (mask)=>omit(inst, mask);
|
|
17422
17457
|
inst.partial = (...args)=>partial(ZodOptional, inst, args[0]);
|
|
@@ -19004,7 +19039,7 @@
|
|
|
19004
19039
|
annotationVerticalLine: schemas_array(zAnnotationVerticalLine).or(zAnnotationVerticalLine).nullish(),
|
|
19005
19040
|
annotationHorizontalLine: schemas_array(zAnnotationHorizontalLine).or(zAnnotationHorizontalLine).nullish(),
|
|
19006
19041
|
annotationArea: schemas_array(zAnnotationArea).or(zAnnotationArea).nullish(),
|
|
19007
|
-
polynomialRegressionLine: schemas_array(zPolynomialRegressionLine).or(zPolynomialRegressionLine).
|
|
19042
|
+
polynomialRegressionLine: schemas_array(zPolynomialRegressionLine).or(zPolynomialRegressionLine).nullish(),
|
|
19008
19043
|
dimensionLinkage: zDimensionLinkage.nullish(),
|
|
19009
19044
|
locale: zLocale.nullish()
|
|
19010
19045
|
});
|
|
@@ -19208,10 +19243,10 @@
|
|
|
19208
19243
|
annotationVerticalLine: schemas_array(zAnnotationVerticalLine).or(zAnnotationVerticalLine).nullish(),
|
|
19209
19244
|
annotationHorizontalLine: schemas_array(zAnnotationHorizontalLine).or(zAnnotationHorizontalLine).nullish(),
|
|
19210
19245
|
annotationArea: schemas_array(zAnnotationArea).or(zAnnotationArea).nullish(),
|
|
19211
|
-
linearRegressionLine: schemas_array(zLinearRegressionLine).or(zLinearRegressionLine).
|
|
19212
|
-
lowessRegressionLine: schemas_array(zLowessRegressionLine).or(zLowessRegressionLine).
|
|
19213
|
-
polynomialRegressionLine: schemas_array(zPolynomialRegressionLine).or(zPolynomialRegressionLine).
|
|
19214
|
-
logisticRegressionLine: schemas_array(zLogisticRegressionLine).or(zLogisticRegressionLine).
|
|
19246
|
+
linearRegressionLine: schemas_array(zLinearRegressionLine).or(zLinearRegressionLine).nullish(),
|
|
19247
|
+
lowessRegressionLine: schemas_array(zLowessRegressionLine).or(zLowessRegressionLine).nullish(),
|
|
19248
|
+
polynomialRegressionLine: schemas_array(zPolynomialRegressionLine).or(zPolynomialRegressionLine).nullish(),
|
|
19249
|
+
logisticRegressionLine: schemas_array(zLogisticRegressionLine).or(zLogisticRegressionLine).nullish(),
|
|
19215
19250
|
dimensionLinkage: zDimensionLinkage.nullish(),
|
|
19216
19251
|
locale: zLocale.nullish()
|
|
19217
19252
|
});
|
|
@@ -19373,7 +19408,7 @@
|
|
|
19373
19408
|
theme: zTheme.nullish(),
|
|
19374
19409
|
locale: zLocale.nullish()
|
|
19375
19410
|
});
|
|
19376
|
-
const
|
|
19411
|
+
const zBoxPlot = schemas_object({
|
|
19377
19412
|
chartType: literal('boxPlot'),
|
|
19378
19413
|
dataset: zDataset.nullish(),
|
|
19379
19414
|
encoding: zEncoding.nullish(),
|
|
@@ -19423,7 +19458,7 @@
|
|
|
19423
19458
|
zRadar,
|
|
19424
19459
|
zFunnel,
|
|
19425
19460
|
zHeatmap,
|
|
19426
|
-
|
|
19461
|
+
zBoxPlot,
|
|
19427
19462
|
zHistogram
|
|
19428
19463
|
]);
|
|
19429
19464
|
const zCellStyle = schemas_object({
|