zzz-pc-view 0.0.121 → 0.0.123
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/package.json +1 -1
- package/src/index.es.js +89 -59
- package/src/index.umd.js +2 -2
package/package.json
CHANGED
package/src/index.es.js
CHANGED
|
@@ -1661,7 +1661,7 @@ const findAllLeafNodes = (list2, childrenKey, leafNodeFilter) => {
|
|
|
1661
1661
|
};
|
|
1662
1662
|
const getFilter = (childrenKey, leafNodeFilter) => (
|
|
1663
1663
|
// 如果 leafNodeFilter 是字符串类型,则返回一个函数,该函数检查节点的 leafNodeFilter 属性是否为 true
|
|
1664
|
-
leafNodeFilter === "string" ? (node) => node[leafNodeFilter] : (
|
|
1664
|
+
typeof leafNodeFilter === "string" ? (node) => node[leafNodeFilter] : (
|
|
1665
1665
|
// 如果 leafNodeFilter 是函数类型,则直接返回该函数
|
|
1666
1666
|
typeof leafNodeFilter === "function" ? leafNodeFilter : (
|
|
1667
1667
|
// 如果 leafNodeFilter 未提供或不是字符串或函数类型,则返回一个函数,该函数检查节点的 childrenKey 属性是否为数组
|
|
@@ -3258,66 +3258,70 @@ const setYAxis$1 = (chartOption, param) => {
|
|
|
3258
3258
|
const axisNameIndexMap = {};
|
|
3259
3259
|
const { yAxisNameLocation, chartStyleConfig, dataset } = param;
|
|
3260
3260
|
const { axisNameFontSize, axisFontSize } = chartStyleConfig;
|
|
3261
|
+
const markLineMap = {};
|
|
3261
3262
|
param.dimensions.forEach((dimension) => {
|
|
3262
|
-
var _a2, _b2;
|
|
3263
|
+
var _a2, _b2, _c2;
|
|
3263
3264
|
const axisName = dimension.axisName ?? "";
|
|
3265
|
+
const minMax = {};
|
|
3266
|
+
const { min, max } = dimension;
|
|
3267
|
+
if (Number.isFinite(min)) {
|
|
3268
|
+
minMax.min = min;
|
|
3269
|
+
}
|
|
3270
|
+
if (Number.isFinite(max)) {
|
|
3271
|
+
minMax.max = max;
|
|
3272
|
+
}
|
|
3264
3273
|
if (!Object.prototype.hasOwnProperty.call(axisNameIndexMap, axisName)) {
|
|
3265
3274
|
axisNameIndexMap[axisName] = yAxis.length;
|
|
3266
|
-
const minMax = {};
|
|
3267
|
-
const { min, max } = dimension;
|
|
3268
|
-
if (Number.isFinite(min)) {
|
|
3269
|
-
minMax.min = min;
|
|
3270
|
-
}
|
|
3271
|
-
if (Number.isFinite(max)) {
|
|
3272
|
-
minMax.max = max;
|
|
3273
|
-
}
|
|
3274
3275
|
yAxis.push(
|
|
3275
|
-
Object.assign(
|
|
3276
|
-
|
|
3277
|
-
|
|
3278
|
-
|
|
3279
|
-
|
|
3280
|
-
|
|
3281
|
-
|
|
3282
|
-
|
|
3283
|
-
|
|
3284
|
-
|
|
3285
|
-
|
|
3286
|
-
|
|
3287
|
-
|
|
3288
|
-
|
|
3289
|
-
|
|
3290
|
-
show: true,
|
|
3291
|
-
// 是否启用缩放,继承自维度配置
|
|
3292
|
-
scale: dimension.scale,
|
|
3293
|
-
// Y 轴刻度配置
|
|
3294
|
-
axisTick: {
|
|
3295
|
-
// 显示刻度
|
|
3276
|
+
Object.assign(
|
|
3277
|
+
{
|
|
3278
|
+
name: axisName,
|
|
3279
|
+
// Y 轴名称
|
|
3280
|
+
nameLocation: yAxisNameLocation,
|
|
3281
|
+
// Y 轴名称的位置
|
|
3282
|
+
nameTextStyle: {
|
|
3283
|
+
// Y 轴名称的文本样式
|
|
3284
|
+
fontSize: axisNameFontSize,
|
|
3285
|
+
// 字体大小
|
|
3286
|
+
fontFamily: EN_TEXT_FONT_FAMILY
|
|
3287
|
+
// 字体族
|
|
3288
|
+
},
|
|
3289
|
+
type: "value",
|
|
3290
|
+
// Y 轴类型为数值轴
|
|
3296
3291
|
show: true,
|
|
3297
|
-
//
|
|
3298
|
-
|
|
3299
|
-
|
|
3300
|
-
|
|
3301
|
-
|
|
3302
|
-
|
|
3303
|
-
|
|
3304
|
-
|
|
3305
|
-
|
|
3306
|
-
|
|
3307
|
-
|
|
3308
|
-
|
|
3309
|
-
|
|
3310
|
-
|
|
3311
|
-
|
|
3312
|
-
|
|
3292
|
+
// 显示 Y 轴
|
|
3293
|
+
scale: dimension.scale,
|
|
3294
|
+
// 是否开启缩放
|
|
3295
|
+
axisTick: {
|
|
3296
|
+
// 坐标轴刻度配置
|
|
3297
|
+
show: true,
|
|
3298
|
+
// 显示刻度
|
|
3299
|
+
alignWithLabel: true
|
|
3300
|
+
// 刻度线与标签对齐
|
|
3301
|
+
},
|
|
3302
|
+
axisLine: {
|
|
3303
|
+
// 坐标轴线配置
|
|
3304
|
+
show: true
|
|
3305
|
+
// 显示坐标轴线
|
|
3306
|
+
},
|
|
3307
|
+
axisLabel: {
|
|
3308
|
+
// 坐标轴标签配置
|
|
3309
|
+
fontSize: axisFontSize,
|
|
3310
|
+
// 字体大小
|
|
3311
|
+
fontFamily: dimension.labelFontFamily || NUMBER_FONT_FAMILY,
|
|
3312
|
+
// 字体族
|
|
3313
|
+
formatter: dimension.labelFormatter || numberFormatter
|
|
3314
|
+
// 标签格式化函数
|
|
3315
|
+
},
|
|
3316
|
+
splitLine: {
|
|
3317
|
+
// 分隔线配置
|
|
3318
|
+
show: false
|
|
3319
|
+
// 不显示分隔线
|
|
3320
|
+
}
|
|
3313
3321
|
},
|
|
3314
|
-
|
|
3315
|
-
|
|
3316
|
-
|
|
3317
|
-
show: false
|
|
3318
|
-
}
|
|
3319
|
-
}),
|
|
3320
|
-
minMax
|
|
3322
|
+
minMax
|
|
3323
|
+
// 合并最小值和最大值配置
|
|
3324
|
+
)
|
|
3321
3325
|
);
|
|
3322
3326
|
}
|
|
3323
3327
|
const yAxisIndex = axisNameIndexMap[axisName];
|
|
@@ -3325,20 +3329,46 @@ const setYAxis$1 = (chartOption, param) => {
|
|
|
3325
3329
|
const seriesItem = dimension.series;
|
|
3326
3330
|
const datasetIndex = seriesItem.datasetIndex ?? 0;
|
|
3327
3331
|
series.push({
|
|
3328
|
-
// 系列名称为维度的唯一标识符
|
|
3329
3332
|
name: dimensionId,
|
|
3330
|
-
//
|
|
3333
|
+
// 系列名称
|
|
3331
3334
|
encode: {
|
|
3332
3335
|
x: (_b2 = (_a2 = dataset[datasetIndex]) == null ? void 0 : _a2.dimension) == null ? void 0 : _b2.id,
|
|
3336
|
+
// X 轴数据字段映射
|
|
3333
3337
|
y: dimensionId
|
|
3338
|
+
// Y 轴数据字段映射
|
|
3334
3339
|
},
|
|
3335
|
-
// 关联的 Y 轴索引
|
|
3336
3340
|
yAxisIndex,
|
|
3337
|
-
//
|
|
3341
|
+
// 系列对应的 Y 轴索引
|
|
3338
3342
|
...seriesItem,
|
|
3339
|
-
//
|
|
3343
|
+
// 合并用户自定义的系列配置
|
|
3340
3344
|
datasetIndex
|
|
3345
|
+
// 系列对应的数据集索引
|
|
3341
3346
|
});
|
|
3347
|
+
if ((_c2 = seriesItem.markLine) == null ? void 0 : _c2.data) {
|
|
3348
|
+
const subMarkLineDataList = seriesItem.markLine.data.filter((data) => Number.isFinite(data.yAxis));
|
|
3349
|
+
if (subMarkLineDataList.length > 0) {
|
|
3350
|
+
let markLineDataList = markLineMap[yAxisIndex];
|
|
3351
|
+
if (!markLineDataList) {
|
|
3352
|
+
markLineDataList = markLineMap[yAxisIndex] = [];
|
|
3353
|
+
}
|
|
3354
|
+
markLineDataList.push(...subMarkLineDataList.map((data) => data.yAxis));
|
|
3355
|
+
}
|
|
3356
|
+
}
|
|
3357
|
+
});
|
|
3358
|
+
Object.entries(markLineMap).forEach(([yAxisIndex, markLineDataList]) => {
|
|
3359
|
+
const yAxisItem = yAxis[Number(yAxisIndex)];
|
|
3360
|
+
const mins = [Math.min(...markLineDataList)];
|
|
3361
|
+
const maxs = [Math.max(...markLineDataList)];
|
|
3362
|
+
const yAxisMin = yAxisItem.min;
|
|
3363
|
+
if (Number.isFinite(yAxisMin)) {
|
|
3364
|
+
mins.push(yAxisMin);
|
|
3365
|
+
}
|
|
3366
|
+
const yAxisMax = yAxisItem.max;
|
|
3367
|
+
if (Number.isFinite(yAxisMax)) {
|
|
3368
|
+
maxs.push(yAxisMax);
|
|
3369
|
+
}
|
|
3370
|
+
yAxisItem.min = (extent) => Math.min(extent.min, ...mins);
|
|
3371
|
+
yAxisItem.max = (extent) => Math.max(extent.max, ...maxs);
|
|
3342
3372
|
});
|
|
3343
3373
|
chartOption.yAxis = yAxis;
|
|
3344
3374
|
chartOption.series = series;
|