zzz-pc-view 0.0.120 → 0.0.122
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 +92 -51
- package/src/index.umd.js +1 -1
- package/src/webUtils/ECharts/trendChartUtils.d.ts +8 -0
package/package.json
CHANGED
package/src/index.es.js
CHANGED
|
@@ -3258,76 +3258,117 @@ 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
|
-
yAxis.push(
|
|
3267
|
-
|
|
3268
|
-
|
|
3269
|
-
|
|
3270
|
-
|
|
3271
|
-
|
|
3272
|
-
|
|
3273
|
-
|
|
3274
|
-
|
|
3275
|
-
|
|
3276
|
-
|
|
3277
|
-
|
|
3278
|
-
|
|
3279
|
-
|
|
3280
|
-
|
|
3281
|
-
|
|
3282
|
-
|
|
3283
|
-
|
|
3284
|
-
|
|
3285
|
-
|
|
3286
|
-
|
|
3287
|
-
|
|
3288
|
-
|
|
3289
|
-
|
|
3290
|
-
|
|
3291
|
-
|
|
3292
|
-
|
|
3293
|
-
|
|
3294
|
-
|
|
3295
|
-
|
|
3296
|
-
|
|
3297
|
-
|
|
3298
|
-
|
|
3299
|
-
|
|
3300
|
-
|
|
3301
|
-
|
|
3302
|
-
|
|
3303
|
-
|
|
3304
|
-
|
|
3305
|
-
|
|
3306
|
-
|
|
3307
|
-
|
|
3308
|
-
|
|
3309
|
-
|
|
3310
|
-
|
|
3275
|
+
yAxis.push(
|
|
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 轴类型为数值轴
|
|
3291
|
+
show: true,
|
|
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
|
+
}
|
|
3321
|
+
},
|
|
3322
|
+
minMax
|
|
3323
|
+
// 合并最小值和最大值配置
|
|
3324
|
+
)
|
|
3325
|
+
);
|
|
3311
3326
|
}
|
|
3312
3327
|
const yAxisIndex = axisNameIndexMap[axisName];
|
|
3313
3328
|
const dimensionId = dimension.id;
|
|
3314
3329
|
const seriesItem = dimension.series;
|
|
3315
3330
|
const datasetIndex = seriesItem.datasetIndex ?? 0;
|
|
3316
3331
|
series.push({
|
|
3317
|
-
// 系列名称为维度的唯一标识符
|
|
3318
3332
|
name: dimensionId,
|
|
3319
|
-
//
|
|
3333
|
+
// 系列名称
|
|
3320
3334
|
encode: {
|
|
3321
3335
|
x: (_b2 = (_a2 = dataset[datasetIndex]) == null ? void 0 : _a2.dimension) == null ? void 0 : _b2.id,
|
|
3336
|
+
// X 轴数据字段映射
|
|
3322
3337
|
y: dimensionId
|
|
3338
|
+
// Y 轴数据字段映射
|
|
3323
3339
|
},
|
|
3324
|
-
// 关联的 Y 轴索引
|
|
3325
3340
|
yAxisIndex,
|
|
3326
|
-
//
|
|
3341
|
+
// 系列对应的 Y 轴索引
|
|
3327
3342
|
...seriesItem,
|
|
3328
|
-
//
|
|
3343
|
+
// 合并用户自定义的系列配置
|
|
3329
3344
|
datasetIndex
|
|
3345
|
+
// 系列对应的数据集索引
|
|
3330
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);
|
|
3331
3372
|
});
|
|
3332
3373
|
chartOption.yAxis = yAxis;
|
|
3333
3374
|
chartOption.series = series;
|