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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zzz-pc-view",
3
- "version": "0.0.120",
3
+ "version": "0.0.122",
4
4
  "main": "src/index.umd.js",
5
5
  "module": "src/index.es.js",
6
6
  "types": "src/index.d.ts",
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
- // Y 轴名称
3268
- name: axisName,
3269
- // Y 轴名称的位置
3270
- nameLocation: yAxisNameLocation,
3271
- // Y 轴名称的文本样式
3272
- nameTextStyle: {
3273
- // 轴名称字体大小
3274
- fontSize: axisNameFontSize,
3275
- // 轴名称字体族
3276
- fontFamily: EN_TEXT_FONT_FAMILY
3277
- },
3278
- // Y 轴类型为数值轴
3279
- type: "value",
3280
- // 显示 Y 轴
3281
- show: true,
3282
- // 是否启用缩放,继承自维度配置
3283
- scale: dimension.scale,
3284
- // Y 轴刻度配置
3285
- axisTick: {
3286
- // 显示刻度
3287
- show: true,
3288
- // 刻度与标签对齐
3289
- alignWithLabel: true
3290
- },
3291
- // Y 轴轴线配置
3292
- axisLine: {
3293
- // 显示轴线
3294
- show: true
3295
- },
3296
- // Y 轴标签配置
3297
- axisLabel: {
3298
- // 标签字体大小
3299
- fontSize: axisFontSize,
3300
- // 标签字体族,若未提供则使用默认字体族
3301
- fontFamily: dimension.labelFontFamily || NUMBER_FONT_FAMILY,
3302
- // 标签格式化函数,若未提供则使用默认数字格式化函数
3303
- formatter: dimension.labelFormatter || numberFormatter
3304
- },
3305
- // Y 轴分割线配置
3306
- splitLine: {
3307
- // 不显示分割线
3308
- show: false
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
- // 数据编码配置,指定 X 轴和 Y 轴对应的数据维度
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;