@indfnd/common-mobile-pro 1.0.70 → 1.0.71

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.
@@ -178648,8 +178648,8 @@ var packages_common_table_component = (0,packages_componentNormalizer["default"]
178648
178648
 
178649
178649
  /* harmony default export */ const packages_components_common_table = (packages_common_table);
178650
178650
 
178651
- ;// ./node_modules/vue-loader/lib/loaders/templateLoader.js??ruleSet[1].rules[1]!./node_modules/vue-loader/lib/index.js??vue-loader-options!./packages/components/data-chart/index.vue?vue&type=template&id=675ff4b9
178652
- var packages_data_chartvue_type_template_id_675ff4b9_render = function render() {
178651
+ ;// ./node_modules/vue-loader/lib/loaders/templateLoader.js??ruleSet[1].rules[1]!./node_modules/vue-loader/lib/index.js??vue-loader-options!./packages/components/data-chart/index.vue?vue&type=template&id=56e77c6e
178652
+ var packages_data_chartvue_type_template_id_56e77c6e_render = function render() {
178653
178653
  var _vm = this,
178654
178654
  _c = _vm._self._c
178655
178655
  return _c(
@@ -178673,11 +178673,11 @@ var packages_data_chartvue_type_template_id_675ff4b9_render = function render()
178673
178673
  ]
178674
178674
  )
178675
178675
  }
178676
- var packages_data_chartvue_type_template_id_675ff4b9_staticRenderFns = []
178677
- packages_data_chartvue_type_template_id_675ff4b9_render._withStripped = true
178676
+ var packages_data_chartvue_type_template_id_56e77c6e_staticRenderFns = []
178677
+ packages_data_chartvue_type_template_id_56e77c6e_render._withStripped = true
178678
178678
 
178679
178679
 
178680
- ;// ./packages/components/data-chart/index.vue?vue&type=template&id=675ff4b9
178680
+ ;// ./packages/components/data-chart/index.vue?vue&type=template&id=56e77c6e
178681
178681
 
178682
178682
  ;// ./node_modules/echarts/node_modules/tslib/tslib.es6.js
178683
178683
  /*! *****************************************************************************
@@ -285390,526 +285390,942 @@ packages_use(packages_installUniversalTransition);
285390
285390
  // })
285391
285391
  packages_use(packages_installLabelLayout);
285392
285392
  ;// ./node_modules/vue-loader/lib/index.js??vue-loader-options!./packages/components/data-chart/index.vue?vue&type=script&lang=js
285393
-
285394
-
285395
- /* harmony default export */ const packages_data_chartvue_type_script_lang_js = ({
285396
- props: {
285397
- datas: {
285398
- type: Object,
285399
- default: () => {},
285400
- },
285401
- },
285402
- watch: {
285403
- datas: {
285404
- deep: true,
285405
- immediate: true,
285406
- handler(newVal) {
285407
- this.updateChart()
285408
- this.checkDatas(newVal)
285409
- },
285410
- },
285411
- },
285412
- data() {
285413
- return {
285414
- chart: null,
285415
- resizeObserver: null,
285416
- }
285417
- },
285418
- computed: {
285419
- getGrid() {
285420
- return {
285421
- top: this.datas.grid?.top || '23%', // 距离容器顶部的距离
285422
- left: this.datas.grid?.left || '10%', // 距离容器左侧的距离
285423
- right: this.datas.grid?.right || '10%', // 距离容器右侧的距离
285424
- bottom: this.datas.grid?.bottom || '0%', // 距离容器底部的距离
285425
- containLabel: true, // 自动包含坐标轴的标签区域,以防止标签被裁剪
285426
- }
285427
- },
285428
- getTitle() {
285429
- const { title } = this.datas
285430
- return typeof title === 'string'
285431
- ? {
285432
- left: '2%', // 距离左侧2%
285433
- top: '2%', // 距离顶部2%
285434
- text: title,
285435
- }
285436
- : {
285437
- left: '2%', // 距离左侧2%
285438
- top: '2%', // 距离顶部2%
285439
- ...title,
285440
- }
285441
- },
285442
- getYaxis() {
285443
- if (!this.datas.yAxis) return []
285444
- // Y轴传递的为数组
285445
- if (Array.isArray(this.datas.yAxis)) {
285446
- return this.datas.yAxis.length === 1
285447
- ? this.formatSingleYAxis(this.datas.yAxis[0])
285448
- : this.formatMultipleYAxis(this.datas.yAxis)
285449
- }
285450
- // Y轴传递的为对象
285451
- return typeof this.datas.yAxis === 'object' ? this.formatYAxis(this.datas.yAxis) : {}
285452
- },
285453
- getXaxis() {
285454
- if (!this.datas.xAxis) return []
285455
- // 对象就是单X轴
285456
- if (typeof this.datas.xAxis === 'object' && !Array.isArray(this.datas.xAxis)) {
285457
- return this.formatXAxis(this.datas.xAxis)
285458
- } else if (Array.isArray(this.datas.xAxis)) {
285459
- return this.datas.xAxis.length === 1
285460
- ? this.formatSingleXAxis(this.datas.xAxis[0])
285461
- : this.formatMultipleXAxis(this.datas.xAxis)
285462
- }
285463
- return []
285464
- },
285465
- getTooltip() {
285466
- return this.datas.series.map((data) => {
285467
- if (data.type === 'scatter' || data.type === 'pie') {
285468
- return {
285469
- trigger: 'item',
285470
- }
285471
- } else {
285472
- return {
285473
- trigger: 'axis',
285474
- }
285475
- }
285476
- })
285477
- },
285478
- getSeries() {
285479
- return this.datas.series.map((data) => {
285480
- if (data.type === 'pie') {
285481
- return {
285482
- ...data,
285483
- center: [`${data.center ? data.center : 50}%`, '52%'],
285484
- label: {
285485
- show: true,
285486
- position: data.label,
285487
- },
285488
- data: data.data.map((item) => ({
285489
- ...item,
285490
- })),
285491
- }
285492
- } else if (data.type === 'bar') {
285493
- return {
285494
- ...data,
285495
- itemStyle: {
285496
- borderRadius: data.smooth ? [10, 10, 0, 0] : [0, 0, 0, 0],
285497
- },
285498
- emphasis: {
285499
- focus: 'series',
285500
- },
285501
- }
285502
- } else if (data.type === 'line') {
285503
- return {
285504
- ...data,
285505
- smooth: data.smooth,
285506
- label: {
285507
- show: false,
285508
- position: 'top',
285509
- formatter: '{c} units',
285510
- },
285511
- emphasis: {
285512
- focus: 'series',
285513
- },
285514
- symbol: 'circle', // 点的形状:'circle', 'rect', 'roundRect', 'triangle', 'diamond', 'pin', 'arrow'
285515
- symbolSize: 6, // 点的大小
285516
- lineStyle: {
285517
- width: 1,
285518
- type: 'solid',
285519
- },
285520
- }
285521
- } else if (data.type === 'scatter') {
285522
- return {
285523
- ...data,
285524
- symbol: 'rect', // 点的形状设置为带圆角的矩形
285525
- symbolSize: (data, params) => {
285526
- const name = params?.data?.name || '' // 检查 name 是否存在,若不存在则赋值为空字符串
285527
- const textLength = name.length // 获取字符长度
285528
- const width = Math.max(40, textLength * 15) // 每个字符15px,最小宽度为40px
285529
- const height = 25 // 高度固定为25px
285530
- return [width, height]
285531
- },
285532
- tooltip: {
285533
- show: true,
285534
- formatter: (params) => {
285535
- const xValue = params?.data?.value?.[0] ?? 'N/A' // 如果 X 值不存在,显示 "N/A"
285536
- const yValue = params?.data?.value?.[1] ?? 'N/A' // 如果 Y 值不存在,显示 "N/A"
285537
- return `X: ${xValue}, Y: ${yValue}` // 提示框的格式
285538
- },
285539
- },
285540
- label: {
285541
- show: true, // 显示文字标签
285542
- formatter: (params) => {
285543
- const name = params?.data?.name || 'Unknown' // 当 name 不存在时使用 "Unknown"
285544
- return `${name}`
285545
- },
285546
- position: 'inside', // 文字显示在矩形内部
285547
- fontSize: 12, // 文字大小
285548
- align: 'center', // 文字居中对齐
285549
- verticalAlign: 'middle', // 文字垂直居中对齐
285550
- },
285551
- }
285552
- }
285553
- })
285554
- },
285555
- getLegend() {
285556
- const showLegend = this.datas?.showLegend?.[0] ?? true
285557
- if (!showLegend) {
285558
- return null
285559
- }
285560
- if (!this.datas.legend)
285561
- return {
285562
- orient: this.datas?.showLegend?.[1] || 'horizontal',
285563
- top: '2%',
285564
- right: '2%',
285565
- }
285566
- // Y轴传递的为数组
285567
- if (Array.isArray(this.datas.legend)) {
285568
- return this.datas.yAxis.length === 1
285569
- ? this.formatLegend(this.datas.legend[0])
285570
- : this.formatMultipleLegend(this.datas.legend)
285571
- }
285572
- // Y轴传递的为对象
285573
- return typeof this.datas.legend === 'object' ? this.formatLegend(this.datas.legend) : {}
285574
- },
285575
- getGraphic() {
285576
- if (this.datas.graphic) {
285577
- return [
285578
- // 第一象限背景色和文字
285579
- {
285580
- type: 'text',
285581
- left: '32%',
285582
- top: '32%',
285583
- style: {
285584
- text: this.datas.graphic[0],
285585
- fill: '#ddd', // 标签文字颜色,
285586
- font: 'bold 16px sans-serif',
285587
- },
285588
- },
285589
- // 第二象限背景色和文字
285590
- {
285591
- type: 'text',
285592
- left: '70%',
285593
- top: '32%',
285594
- style: {
285595
- text: this.datas.graphic[1],
285596
- fill: '#ddd', // 标签文字颜色,
285597
- font: 'bold 16px sans-serif',
285598
- },
285599
- },
285600
- // 第三象限背景色和文字
285601
- {
285602
- type: 'text',
285603
- left: '70%',
285604
- top: '58%',
285605
- style: {
285606
- text: this.datas.graphic[3],
285607
- fill: '#ddd', // 标签文字颜色,
285608
- font: 'bold 16px sans-serif',
285609
- },
285610
- },
285611
- // 第四象限背景色和文字
285612
- {
285613
- type: 'text',
285614
- left: '32%',
285615
- top: '58%',
285616
- style: {
285617
- text: this.datas.graphic[2],
285618
- fill: '#ddd', // 标签文字颜色,
285619
- font: 'bold 16px sans-serif',
285620
- },
285621
- },
285622
- ]
285623
- } else {
285624
- return []
285625
- }
285626
- },
285627
- getDataZoom() {
285628
- return this.datas.dataZoom
285629
- },
285630
- },
285631
- mounted() {
285632
- this.initchart()
285633
- this.initResizeObserver()
285634
- this.checkDatas(this.datas)
285635
- },
285636
- beforeDestroy() {
285637
- this.cleanupResizeObserver()
285638
- this.disposeChart()
285639
- },
285640
- methods: {
285641
- formatMultipleLegend(legends) {
285642
- return legends.map((legend) => ({
285643
- ...legend,
285644
- orient: legend.orient || 'horizontal', // 默认方向为水平
285645
- textStyle: {
285646
- ...(legend.textStyle || {}), // 合并用户传入的 textStyle 配置
285647
- },
285648
- }))
285649
- },
285650
- formatLegend(legend) {
285651
- return {
285652
- ...legend,
285653
- orient: legend.orient || 'horizontal', // 默认方向为水平
285654
- textStyle: {
285655
- ...(legend.textStyle || {}), // 合并用户传入的 textStyle 配置
285656
- },
285657
- }
285658
- },
285659
- disposeChart() {
285660
- if (this.chart) {
285661
- this.chart.dispose()
285662
- this.chart = null
285663
- }
285664
- },
285665
- initResizeObserver() {
285666
- this.resizeObserver = new ResizeObserver(() => {
285667
- if (this.chart) this.chart.resize()
285668
- })
285669
- this.resizeObserver.observe(this.$refs.main)
285670
- },
285671
- cleanupResizeObserver() {
285672
- if (this.resizeObserver) {
285673
- this.resizeObserver.disconnect()
285674
- this.resizeObserver = null
285675
- }
285676
- },
285677
- updateChart() {
285678
- if (!this.chart) {
285679
- return
285680
- }
285681
- this.initchart()
285682
- },
285683
- // 对象时的配置
285684
- formatYAxis(yAxis) {
285685
- // 获取数据时增加默认值和防御性检查
285686
- const seriesData = this.datas?.series || [] // 如果 this.datas 或 series 是 undefined,使用空数组作为默认值
285687
- const result = seriesData
285688
- .flatMap((item) => item.data.map((innerItem) => innerItem.value[1]))
285689
- .filter(
285690
- (value) =>
285691
- value !== null &&
285692
- value !== undefined && // 排除 null 和 undefined
285693
- !isNaN(Number(value)) &&
285694
- isFinite(Number(value)), // 检查是否是有效数值(包括字符串形式的纯数字)
285695
- )
285696
- const maxAbsoluteValue = Math.max(...result.map((value) => Math.abs(value)))
285697
-
285698
- // 动态设置 y 轴配置
285699
- return {
285700
- ...yAxis,
285701
- ...{
285702
- min: -maxAbsoluteValue,
285703
- max: maxAbsoluteValue,
285704
- interval: Math.ceil(maxAbsoluteValue / 5),
285705
- }, // 仅在正负都有时设置 min 和 max
285706
- nameGap: 20, // 控制与轴线的距离
285707
- axisLabel: {
285708
- formatter: yAxis.formatter,
285709
- },
285710
- nameTextStyle: {
285711
- padding: yAxis.padding || null,
285712
- },
285713
- splitLine: {
285714
- show: true, // 显示背景线
285715
- },
285716
- }
285717
- },
285718
- // 对象时的配置
285719
- formatXAxis(xAxis) {
285720
- // 获取数据时增加默认值和防御性检查
285721
- const seriesData = this.datas?.series || [] // 如果 this.datas 或 series 是 undefined,使用空数组作为默认值
285722
- const result = seriesData
285723
- .flatMap((item) => item.data.map((innerItem) => innerItem.value[0]))
285724
- .filter(
285725
- (value) =>
285726
- value !== null &&
285727
- value !== undefined && // 排除 null 和 undefined
285728
- !isNaN(Number(value)) &&
285729
- isFinite(Number(value)), // 检查是否是有效数值(包括字符串形式的纯数字)
285730
- )
285731
- const maxAbsoluteValue = Math.max(...result.map((value) => Math.abs(value)))
285732
- // 返回带有动态配置的X轴配置
285733
- return {
285734
- ...xAxis, // 保留原有的xAxis配置
285735
- ...{
285736
- min: -maxAbsoluteValue,
285737
- max: maxAbsoluteValue,
285738
- interval: Math.ceil(maxAbsoluteValue / 5),
285739
- }, // 仅在正负都有时设置 min 和 max
285740
- nameRotate: 0, // 将名称旋转90度
285741
- nameGap: 20, // 控制与轴线的距离
285742
- nameTextStyle: {
285743
- padding: xAxis.padding || null,
285744
- },
285745
- axisLabel: {
285746
- formatter: xAxis.formatter,
285747
- },
285748
- splitLine: {
285749
- show: true, // 显示背景线
285750
- },
285751
- }
285752
- },
285753
- // 数组单Y轴的配置
285754
- formatSingleYAxis(yAxis) {
285755
- // 获取所有 yAxisIndex 为 0 的系列数据(左侧 Y 轴)
285756
- const YAxisData = this.datas.series.flatMap((serie) => serie.data)
285757
- const ret = this.calculateAxisRange(YAxisData)
285758
- return {
285759
- ...yAxis,
285760
- nameLocation: 'end',
285761
- boundaryGap: yAxis.type === 'category' ? true : [0, 0.01],
285762
- nameTextStyle: {
285763
- padding: yAxis.padding || null,
285764
- },
285765
- axisLabel: {
285766
- formatter: yAxis.formatter,
285767
- },
285768
- min: ret.min,
285769
- max: ret.max,
285770
- interval: ret.interval,
285771
- splitLine: {
285772
- show: true, // 显示背景线
285773
- },
285774
- }
285775
- },
285776
- // 数组单X轴的配置
285777
- formatSingleXAxis(xAxis) {
285778
- return {
285779
- ...xAxis,
285780
- boundaryGap: xAxis.type === 'category' ? true : [0, 0.01],
285781
- nameLocation: 'end',
285782
- nameTextStyle: {
285783
- padding: [0, 45, 0, 0],
285784
- },
285785
- axisLabel: {
285786
- formatter: xAxis.formatter,
285787
- rotate: xAxis.rotate, // 设置倾斜角度
285788
- },
285789
- scale: true,
285790
- axisLine: { onZero: true },
285791
- axisTick: {
285792
- // 刻度样式
285793
- show: false,
285794
- alignWithLabel: true, // 刻度与标签对齐
285795
- length: 5, // 刻度线长度
285796
- },
285797
- splitLine: {
285798
- show: false, // 显示背景线
285799
- },
285800
- }
285801
- },
285802
- // 数组多Y轴的配置
285803
- formatMultipleYAxis(yAxis) {
285804
- // 获取所有 yAxisIndex 为 0 的系列数据(左侧 Y 轴)
285805
- const leftYAxisData = this.datas.series
285806
- .filter((serie) => serie.yAxisIndex === 0)
285807
- .flatMap((serie) => serie.data)
285808
- const ret1 = this.calculateAxisRange(leftYAxisData)
285809
- // 获取所有 yAxisIndex 为 1 的系列数据(右侧 Y 轴)
285810
- const rightYAxisData = this.datas.series
285811
- .filter((serie) => serie.yAxisIndex === 1)
285812
- .flatMap((serie) => serie.data)
285813
- const ret2 = this.calculateAxisRange(rightYAxisData)
285814
- return yAxis.map((yAxisItem) => {
285815
- return {
285816
- ...yAxisItem, // 正确地将对象解构放入返回的对象中
285817
- min: yAxisItem.yAxisIndex === 0 ? ret1.min : ret2.min,
285818
- max: yAxisItem.yAxisIndex === 0 ? ret1.max : ret2.max,
285819
- interval: ret1.interval,
285820
- nameLocation: 'end',
285821
- nameTextStyle: {
285822
- padding: yAxisItem.padding || null,
285823
- },
285824
- nameGap: 15, // 控制名称与轴线的距离
285825
- axisLabel: {
285826
- formatter: yAxisItem.formatter,
285827
- },
285828
- splitLine: {
285829
- show: yAxisItem.yAxisIndex === 0 ? true : false, // 显示背景线
285830
- },
285831
- }
285832
- })
285833
- },
285834
- // 数组多X轴的配置
285835
- formatMultipleXAxis(xAxis) {
285836
- // 获取所有 yAxisIndex 为 0 的系列数据(左侧 Y 轴)
285837
- const leftxAxisData = this.datas.series
285838
- .filter((serie) => serie.xAxisIndex === 0)
285839
- .flatMap((serie) => serie.data)
285840
- const ret1 = this.calculateAxisRange(leftxAxisData)
285841
- // 获取所有 yAxisIndex 为 1 的系列数据(右侧 Y 轴)
285842
- const rightxAxisData = this.datas.series
285843
- .filter((serie) => serie.xAxisIndex === 1)
285844
- .flatMap((serie) => serie.data)
285845
- const ret2 = this.calculateAxisRange(rightxAxisData)
285846
- return xAxis.map((xAxisItem) => {
285847
- return {
285848
- ...xAxisItem, // 正确地将对象解构放入返回的对象中
285849
- min: xAxisItem.xAxisIndex === 0 ? ret1.min : ret2.min,
285850
- max: xAxisItem.xAxisIndex === 0 ? ret1.max : ret2.max,
285851
- interval: ret1.interval,
285852
- nameLocation: 'end',
285853
- nameTextStyle: {
285854
- padding: xAxisItem.padding || null,
285855
- },
285856
- nameGap: 15, // 控制名称与轴线的距离
285857
- axisLabel: {
285858
- formatter: xAxisItem.formatter,
285859
- },
285860
- splitLine: {
285861
- show: xAxisItem.xAxisIndex === 0 ? false : true,
285862
- },
285863
- }
285864
- })
285865
- },
285866
- calculateAxisRange(series) {
285867
- // 防御性检查
285868
- if (!Array.isArray(series) || series.length === 0) return [0, 0, 1] // 返回默认值,避免崩溃
285869
- // 过滤无效值
285870
- const validSeries = series.filter(
285871
- (value) =>
285872
- value !== null &&
285873
- value !== undefined &&
285874
- typeof value === 'number' &&
285875
- !Number.isNaN(value) &&
285876
- Number.isFinite(value),
285877
- )
285878
- if (validSeries.length === 0) return [0, 0, 1]
285879
- // 计算最大值和最小值
285880
- const maxDataValue = Math.max(...validSeries)
285881
- const minDataValue = Math.min(...validSeries)
285882
- // 确保范围有效
285883
- const max = Math.ceil(maxDataValue * 1.1) // 上限扩大 10%
285884
- const min = Math.floor(minDataValue * 1) // 下限保持不变
285885
- // 计算 interval,确保不为 0
285886
- const interval = Math.ceil((max - min) / 5) || 1 // 避免 interval 为 0
285887
- return [max, min, interval]
285888
- },
285889
- initchart() {
285890
- this.chart = packages_echarts_init(this.$refs.chart)
285891
- const lineOption = {
285892
- // 标题
285893
- title: this.getTitle,
285894
- grid: this.getGrid,
285895
- // 提示
285896
- tooltip: this.getTooltip,
285897
- // 四象限
285898
- graphic: this.getGraphic,
285899
- // 标签
285900
- legend: this.getLegend,
285901
- // 横轴
285902
- xAxis: this.getXaxis,
285903
- // 竖轴
285904
- yAxis: this.getYaxis,
285905
- // 数据
285906
- series: this.getSeries,
285907
- dataZoom: this.getDataZoom,
285908
- }
285909
- this.chart.setOption(lineOption)
285910
- },
285911
- },
285912
- });
285393
+
285394
+
285395
+ const packages_westeros = {
285396
+ color: [
285397
+ 'rgb(184, 125, 57)',
285398
+ 'rgb(59, 115, 205)',
285399
+ 'rgb(13, 180, 38)',
285400
+ 'rgb(241, 147, 0)',
285401
+ '#aa47bc',
285402
+ '#eb4165',
285403
+ '#80cbc4',
285404
+ ],
285405
+ backgroundColor: '#fcf8ec',
285406
+ textStyle: {},
285407
+ title: {
285408
+ textStyle: {
285409
+ color: '#464646',
285410
+ },
285411
+ subtextStyle: {
285412
+ color: '#6E7079',
285413
+ },
285414
+ },
285415
+ line: {
285416
+ itemStyle: {
285417
+ borderWidth: 1,
285418
+ },
285419
+ lineStyle: {
285420
+ width: 2,
285421
+ },
285422
+ symbolSize: 4,
285423
+ symbol: 'emptyCircle',
285424
+ smooth: false,
285425
+ },
285426
+ radar: {
285427
+ itemStyle: {
285428
+ borderWidth: 1,
285429
+ },
285430
+ lineStyle: {
285431
+ width: 2,
285432
+ },
285433
+ symbolSize: 4,
285434
+ symbol: 'emptyCircle',
285435
+ smooth: false,
285436
+ },
285437
+ bar: {
285438
+ itemStyle: {
285439
+ barBorderWidth: 0,
285440
+ barBorderColor: 'rgba(0,0,0,0)',
285441
+ },
285442
+ barWidth: 15, // 柱子宽度
285443
+ barMaxWidth: 15, // 柱子最大宽度
285444
+ showBackground: false, //是否显示柱子背景(增强视觉层次)
285445
+ },
285446
+ pie: {
285447
+ itemStyle: {
285448
+ borderWidth: 0,
285449
+ borderColor: '#ccc',
285450
+ },
285451
+ },
285452
+ scatter: {
285453
+ itemStyle: {
285454
+ borderWidth: 0,
285455
+ borderColor: '#ccc',
285456
+ },
285457
+ },
285458
+ boxplot: {
285459
+ itemStyle: {
285460
+ borderWidth: 0,
285461
+ borderColor: '#ccc',
285462
+ },
285463
+ },
285464
+ parallel: {
285465
+ itemStyle: {
285466
+ borderWidth: 0,
285467
+ borderColor: '#ccc',
285468
+ },
285469
+ },
285470
+ sankey: {
285471
+ itemStyle: {
285472
+ borderWidth: 0,
285473
+ borderColor: '#ccc',
285474
+ },
285475
+ },
285476
+ funnel: {
285477
+ itemStyle: {
285478
+ borderWidth: 0,
285479
+ borderColor: '#ccc',
285480
+ },
285481
+ },
285482
+ gauge: {
285483
+ itemStyle: {
285484
+ borderWidth: 0,
285485
+ borderColor: '#ccc',
285486
+ },
285487
+ },
285488
+ candlestick: {
285489
+ itemStyle: {
285490
+ color: '#eb5454',
285491
+ color0: '#47b262',
285492
+ borderColor: '#eb5454',
285493
+ borderColor0: '#47b262',
285494
+ borderWidth: 1,
285495
+ },
285496
+ },
285497
+ graph: {
285498
+ itemStyle: {
285499
+ borderWidth: 0,
285500
+ borderColor: '#ccc',
285501
+ },
285502
+ lineStyle: {
285503
+ width: 1,
285504
+ color: '#aaa',
285505
+ },
285506
+ symbolSize: 4,
285507
+ symbol: 'emptyCircle',
285508
+ smooth: false,
285509
+ color: [
285510
+ 'rgb(184, 125, 57)',
285511
+ 'rgb(59, 115, 205)',
285512
+ 'rgb(13, 180, 38)',
285513
+ 'rgb(241, 147, 0)',
285514
+ '#aa47bc',
285515
+ '#eb4165',
285516
+ '#80cbc4',
285517
+ ],
285518
+ label: {
285519
+ color: '#eee',
285520
+ },
285521
+ },
285522
+ map: {
285523
+ itemStyle: {
285524
+ areaColor: '#eee',
285525
+ borderColor: '#444',
285526
+ borderWidth: 0.5,
285527
+ },
285528
+ label: {
285529
+ color: '#000',
285530
+ },
285531
+ emphasis: {
285532
+ itemStyle: {
285533
+ areaColor: 'rgba(255,215,0,0.8)',
285534
+ borderColor: '#444',
285535
+ borderWidth: 1,
285536
+ },
285537
+ label: {
285538
+ color: 'rgb(100,0,0)',
285539
+ },
285540
+ },
285541
+ },
285542
+ geo: {
285543
+ itemStyle: {
285544
+ areaColor: '#eee',
285545
+ borderColor: '#444',
285546
+ borderWidth: 0.5,
285547
+ },
285548
+ label: {
285549
+ color: '#000',
285550
+ },
285551
+ emphasis: {
285552
+ itemStyle: {
285553
+ areaColor: 'rgba(255,215,0,0.8)',
285554
+ borderColor: '#444',
285555
+ borderWidth: 1,
285556
+ },
285557
+ label: {
285558
+ color: 'rgb(100,0,0)',
285559
+ },
285560
+ },
285561
+ },
285562
+ categoryAxis: {
285563
+ // 轴线
285564
+ axisLine: {
285565
+ show: true,
285566
+ lineStyle: {
285567
+ color: 'rgba(175, 108, 31,0.2)',
285568
+ },
285569
+ },
285570
+ axisTick: {
285571
+ show: true,
285572
+ lineStyle: {
285573
+ color: '#6E7079',
285574
+ },
285575
+ },
285576
+ // x轴文字
285577
+ axisLabel: {
285578
+ show: true,
285579
+ color: 'rgba(50, 39, 23, 0.4)',
285580
+ },
285581
+ // 图中线
285582
+ splitLine: {
285583
+ show: false,
285584
+ lineStyle: {
285585
+ color: ['#f1e7d5'],
285586
+ },
285587
+ },
285588
+ splitArea: {
285589
+ show: false,
285590
+ areaStyle: {
285591
+ color: ['rgba(250,250,250,0.2)', 'rgba(210,219,238,0.2)'],
285592
+ },
285593
+ },
285594
+ },
285595
+ valueAxis: {
285596
+ axisLine: {
285597
+ show: false,
285598
+ lineStyle: {
285599
+ color: 'rgba(50, 39, 23, 0.4)',
285600
+ },
285601
+ },
285602
+ axisTick: {
285603
+ show: false,
285604
+ lineStyle: {
285605
+ color: '#6E7079',
285606
+ },
285607
+ },
285608
+ axisLabel: {
285609
+ show: true,
285610
+ color: 'rgba(50, 39, 23, 0.4)',
285611
+ },
285612
+ // 图中线
285613
+ splitLine: {
285614
+ show: true,
285615
+ lineStyle: {
285616
+ color: ['#f1e7d5'],
285617
+ },
285618
+ },
285619
+ splitArea: {
285620
+ show: false,
285621
+ areaStyle: {
285622
+ color: ['rgba(250,250,250,0.2)', 'rgba(210,219,238,0.2)'],
285623
+ },
285624
+ },
285625
+ },
285626
+ logAxis: {
285627
+ axisLine: {
285628
+ show: false,
285629
+ lineStyle: {
285630
+ color: '#6E7079',
285631
+ },
285632
+ },
285633
+ axisTick: {
285634
+ show: false,
285635
+ lineStyle: {
285636
+ color: '#6E7079',
285637
+ },
285638
+ },
285639
+ axisLabel: {
285640
+ show: true,
285641
+ color: '#6E7079',
285642
+ },
285643
+ splitLine: {
285644
+ show: true,
285645
+ lineStyle: {
285646
+ color: ['#f1e7d5'],
285647
+ },
285648
+ },
285649
+ splitArea: {
285650
+ show: false,
285651
+ areaStyle: {
285652
+ color: ['rgba(250,250,250,0.2)', 'rgba(210,219,238,0.2)'],
285653
+ },
285654
+ },
285655
+ },
285656
+ timeAxis: {
285657
+ axisLine: {
285658
+ show: true,
285659
+ lineStyle: {
285660
+ color: '#6E7079',
285661
+ },
285662
+ },
285663
+ axisTick: {
285664
+ show: true,
285665
+ lineStyle: {
285666
+ color: '#6E7079',
285667
+ },
285668
+ },
285669
+ axisLabel: {
285670
+ show: true,
285671
+ color: '#6E7079',
285672
+ },
285673
+ splitLine: {
285674
+ show: false,
285675
+ lineStyle: {
285676
+ color: ['#f1e7d5'],
285677
+ },
285678
+ },
285679
+ splitArea: {
285680
+ show: false,
285681
+ areaStyle: {
285682
+ color: ['rgba(250,250,250,0.2)', 'rgba(210,219,238,0.2)'],
285683
+ },
285684
+ },
285685
+ },
285686
+ toolbox: {
285687
+ iconStyle: {
285688
+ borderColor: '#999',
285689
+ },
285690
+ emphasis: {
285691
+ iconStyle: {
285692
+ borderColor: '#666',
285693
+ },
285694
+ },
285695
+ },
285696
+ legend: {
285697
+ textStyle: {
285698
+ color: '#333',
285699
+ },
285700
+ left: 'center',
285701
+ right: 'auto',
285702
+ top: 0,
285703
+ bottom: 10,
285704
+ },
285705
+ tooltip: {
285706
+ axisPointer: {
285707
+ lineStyle: {
285708
+ color: '#ccc',
285709
+ width: 1,
285710
+ },
285711
+ crossStyle: {
285712
+ color: '#ccc',
285713
+ width: 1,
285714
+ },
285715
+ },
285716
+ },
285717
+ timeline: {
285718
+ lineStyle: {
285719
+ color: '#DAE1F5',
285720
+ width: 2,
285721
+ },
285722
+ itemStyle: {
285723
+ color: '#A4B1D7',
285724
+ borderWidth: 1,
285725
+ },
285726
+ controlStyle: {
285727
+ color: '#A4B1D7',
285728
+ borderColor: '#A4B1D7',
285729
+ borderWidth: 1,
285730
+ },
285731
+ checkpointStyle: {
285732
+ color: '#316bf3',
285733
+ borderColor: '#fff',
285734
+ },
285735
+ label: {
285736
+ color: '#A4B1D7',
285737
+ },
285738
+ emphasis: {
285739
+ itemStyle: {
285740
+ color: '#FFF',
285741
+ },
285742
+ controlStyle: {
285743
+ color: '#A4B1D7',
285744
+ borderColor: '#A4B1D7',
285745
+ borderWidth: 1,
285746
+ },
285747
+ label: {
285748
+ color: '#A4B1D7',
285749
+ },
285750
+ },
285751
+ },
285752
+ visualMap: {
285753
+ color: ['rgb(184, 125, 57)', 'rgb(248, 248, 236)'],
285754
+ },
285755
+ markPoint: {
285756
+ label: {
285757
+ color: '#eee',
285758
+ },
285759
+ emphasis: {
285760
+ label: {
285761
+ color: '#eee',
285762
+ },
285763
+ },
285764
+ },
285765
+ }
285766
+ /* harmony default export */ const packages_data_chartvue_type_script_lang_js = ({
285767
+ props: {
285768
+ datas: {
285769
+ type: Object,
285770
+ default: () => {},
285771
+ },
285772
+ },
285773
+ watch: {
285774
+ datas: {
285775
+ deep: true,
285776
+ immediate: true,
285777
+ handler() {
285778
+ this.updateChart()
285779
+ },
285780
+ },
285781
+ },
285782
+ data() {
285783
+ return {
285784
+ chart: null,
285785
+ resizeObserver: null,
285786
+ }
285787
+ },
285788
+ computed: {
285789
+ getGrid() {
285790
+ return {
285791
+ top: this.datas.grid?.top || '20%', // 距离容器顶部的距离
285792
+ left: this.datas.grid?.left || '8%', // 距离容器左侧的距离
285793
+ right: this.datas.grid?.right || '8%', // 距离容器右侧的距离
285794
+ bottom: this.datas.grid?.bottom || '0%', // 距离容器底部的距离
285795
+ containLabel: true, // 自动包含坐标轴的标签区域,以防止标签被裁剪
285796
+ }
285797
+ },
285798
+ getTitle() {
285799
+ const { title } = this.datas
285800
+ return typeof title === 'string'
285801
+ ? {
285802
+ left: '2%', // 距离左侧2%
285803
+ top: '2%', // 距离顶部2%
285804
+ text: title,
285805
+ }
285806
+ : {
285807
+ left: '2%', // 距离左侧2%
285808
+ top: '2%', // 距离顶部2%
285809
+ ...title,
285810
+ }
285811
+ },
285812
+ getYaxis() {
285813
+ if (!this.datas.yAxis) return []
285814
+ // Y轴传递的为数组
285815
+ if (Array.isArray(this.datas.yAxis)) {
285816
+ return this.datas.yAxis.length === 1
285817
+ ? this.formatSingleYAxis(this.datas.yAxis[0])
285818
+ : this.formatMultipleYAxis(this.datas.yAxis)
285819
+ }
285820
+ // Y轴传递的为对象
285821
+ return typeof this.datas.yAxis === 'object' ? this.formatYAxis(this.datas.yAxis) : {}
285822
+ },
285823
+ getXaxis() {
285824
+ if (!this.datas.xAxis) return []
285825
+ // 对象就是单X轴
285826
+ if (typeof this.datas.xAxis === 'object' && !Array.isArray(this.datas.xAxis)) {
285827
+ return this.formatXAxis(this.datas.xAxis)
285828
+ } else if (Array.isArray(this.datas.xAxis)) {
285829
+ return this.datas.xAxis.length === 1
285830
+ ? this.formatSingleXAxis(this.datas.xAxis[0])
285831
+ : this.formatMultipleXAxis(this.datas.xAxis)
285832
+ }
285833
+ return []
285834
+ },
285835
+ getTooltip() {
285836
+ return this.datas.series.map((data) => {
285837
+ if (data.type === 'scatter' || data.type === 'pie') {
285838
+ return {
285839
+ trigger: 'item',
285840
+ }
285841
+ } else {
285842
+ return {
285843
+ trigger: 'axis',
285844
+ }
285845
+ }
285846
+ })
285847
+ },
285848
+ getSeries() {
285849
+ return this.datas.series.map((data, index) => {
285850
+ if (data.type === 'pie') {
285851
+ return {
285852
+ ...data,
285853
+ center: [`${data.center ? data.center : 50}%`, '52%'],
285854
+ label: {
285855
+ show: true,
285856
+ position: data.label,
285857
+ },
285858
+ data: data.data.map((item) => ({
285859
+ ...item,
285860
+ })),
285861
+ }
285862
+ } else if (data.type === 'bar') {
285863
+ const topRgb = packages_westeros.color[index]
285864
+ const topColor = this.rgbToRgba(topRgb, 1)
285865
+ const midColor = this.rgbToRgba(topRgb, 0.8)
285866
+ const botColor = this.rgbToRgba(topRgb, 0.2)
285867
+ return {
285868
+ ...data,
285869
+ itemStyle: {
285870
+ borderRadius: data.smooth ? [4, 4, 0, 0] : [0, 0, 0, 0],
285871
+ color: new packages_graphic_LinearGradient(0, 0, 0, 1, [
285872
+ { offset: 0, color: topColor }, // 底部更透明
285873
+ { offset: 0.5, color: midColor }, // 中间过渡
285874
+ { offset: 1, color: botColor }, // 顶部不透明
285875
+ ]),
285876
+ },
285877
+ emphasis: {
285878
+ focus: 'series',
285879
+ },
285880
+ }
285881
+ } else if (data.type === 'line') {
285882
+ const topRgb = packages_westeros.color[index]
285883
+ const topColor = this.rgbToRgba(topRgb, 0.6)
285884
+ return {
285885
+ ...data,
285886
+ smooth: data.smooth,
285887
+ label: {
285888
+ show: false,
285889
+ position: 'top',
285890
+ formatter: '{c} units',
285891
+ },
285892
+ itemStyle: {
285893
+ color: topColor,
285894
+ },
285895
+ areaStyle: data.disAreaStyle
285896
+ ? {
285897
+ color: new packages_graphic_LinearGradient(0, 0, 0, 1, [
285898
+ { offset: 0, color: topColor },
285899
+ { offset: 0.6, color: 'rgba(178, 112, 37, 0)' },
285900
+ { offset: 1, color: 'rgba(178, 112, 37, 0)' },
285901
+ ]),
285902
+ }
285903
+ : {
285904
+ color: new packages_graphic_LinearGradient(0, 0, 0, 1, [
285905
+ { offset: 0, color: 'rgba(178, 112, 37, 0)' },
285906
+ { offset: 1, color: 'rgba(178, 112, 37, 0)' },
285907
+ ]),
285908
+ },
285909
+ emphasis: {
285910
+ focus: 'series',
285911
+ },
285912
+ }
285913
+ } else if (data.type === 'scatter') {
285914
+ return {
285915
+ ...data,
285916
+ symbol: 'rect', // 点的形状设置为带圆角的矩形
285917
+ symbolSize: (data, params) => {
285918
+ const name = params?.data?.name || '' // 检查 name 是否存在,若不存在则赋值为空字符串
285919
+ const textLength = name.length // 获取字符长度
285920
+ const width = Math.max(40, textLength * 15) // 每个字符15px,最小宽度为40px
285921
+ const height = 25 // 高度固定为25px
285922
+ return [width, height]
285923
+ },
285924
+ tooltip: {
285925
+ show: true,
285926
+ formatter: (params) => {
285927
+ const xValue = params?.data?.value?.[0] ?? 'N/A' // 如果 X 值不存在,显示 "N/A"
285928
+ const yValue = params?.data?.value?.[1] ?? 'N/A' // 如果 Y 值不存在,显示 "N/A"
285929
+ return `X: ${xValue}, Y: ${yValue}` // 提示框的格式
285930
+ },
285931
+ },
285932
+ label: {
285933
+ show: true, // 显示文字标签
285934
+ formatter: (params) => {
285935
+ const name = params?.data?.name || 'Unknown' // 当 name 不存在时使用 "Unknown"
285936
+ return `${name}`
285937
+ },
285938
+ position: 'inside', // 文字显示在矩形内部
285939
+ fontSize: 12, // 文字大小
285940
+ align: 'center', // 文字居中对齐
285941
+ verticalAlign: 'middle', // 文字垂直居中对齐
285942
+ },
285943
+ }
285944
+ }
285945
+ })
285946
+ },
285947
+ getLegend() {
285948
+ const showLegend = this.datas?.showLegend?.[0] ?? true
285949
+ if (!showLegend) {
285950
+ return null
285951
+ }
285952
+ if (!this.datas.legend)
285953
+ return {
285954
+ orient: this.datas?.showLegend?.[1] || 'horizontal',
285955
+ top: '2%',
285956
+ right: '2%',
285957
+ }
285958
+ // Y轴传递的为数组
285959
+ if (Array.isArray(this.datas.legend)) {
285960
+ return this.datas.yAxis.length === 1
285961
+ ? this.formatLegend(this.datas.legend[0])
285962
+ : this.formatMultipleLegend(this.datas.legend)
285963
+ }
285964
+ // Y轴传递的为对象
285965
+ return typeof this.datas.legend === 'object' ? this.formatLegend(this.datas.legend) : {}
285966
+ },
285967
+ getGraphic() {
285968
+ if (this.datas.graphic) {
285969
+ return [
285970
+ // 第一象限背景色和文字
285971
+ {
285972
+ type: 'text',
285973
+ left: '32%',
285974
+ top: '32%',
285975
+ style: {
285976
+ text: this.datas.graphic[0],
285977
+ fill: '#ddd', // 标签文字颜色,
285978
+ font: 'bold 16px sans-serif',
285979
+ },
285980
+ },
285981
+ // 第二象限背景色和文字
285982
+ {
285983
+ type: 'text',
285984
+ left: '70%',
285985
+ top: '32%',
285986
+ style: {
285987
+ text: this.datas.graphic[1],
285988
+ fill: '#ddd', // 标签文字颜色,
285989
+ font: 'bold 16px sans-serif',
285990
+ },
285991
+ },
285992
+ // 第三象限背景色和文字
285993
+ {
285994
+ type: 'text',
285995
+ left: '70%',
285996
+ top: '58%',
285997
+ style: {
285998
+ text: this.datas.graphic[3],
285999
+ fill: '#ddd', // 标签文字颜色,
286000
+ font: 'bold 16px sans-serif',
286001
+ },
286002
+ },
286003
+ // 第四象限背景色和文字
286004
+ {
286005
+ type: 'text',
286006
+ left: '32%',
286007
+ top: '58%',
286008
+ style: {
286009
+ text: this.datas.graphic[2],
286010
+ fill: '#ddd', // 标签文字颜色,
286011
+ font: 'bold 16px sans-serif',
286012
+ },
286013
+ },
286014
+ ]
286015
+ } else {
286016
+ return []
286017
+ }
286018
+ },
286019
+ getDataZoom() {
286020
+ return this.datas.dataZoom
286021
+ },
286022
+ },
286023
+ mounted() {
286024
+ this.initchart()
286025
+ this.initResizeObserver()
286026
+ },
286027
+ beforeDestroy() {
286028
+ this.cleanupResizeObserver()
286029
+ this.disposeChart()
286030
+ },
286031
+ methods: {
286032
+ rgbToRgba(rgbStr, alpha = 1) {
286033
+ const match = rgbStr.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/)
286034
+ if (match) {
286035
+ const [, r, g, b] = match
286036
+ return `rgba(${r}, ${g}, ${b}, ${alpha})`
286037
+ }
286038
+ return rgbStr // 如果格式不对就返回原值
286039
+ },
286040
+ formatMultipleLegend(legends) {
286041
+ return legends.map((legend) => ({
286042
+ ...legend,
286043
+ orient: legend.orient || 'horizontal', // 默认方向为水平
286044
+ textStyle: {
286045
+ ...(legend.textStyle || {}), // 合并用户传入的 textStyle 配置
286046
+ },
286047
+ }))
286048
+ },
286049
+ formatLegend(legend) {
286050
+ return {
286051
+ ...legend,
286052
+ orient: legend.orient || 'horizontal', // 默认方向为水平
286053
+ textStyle: {
286054
+ ...(legend.textStyle || {}), // 合并用户传入的 textStyle 配置
286055
+ },
286056
+ }
286057
+ },
286058
+ disposeChart() {
286059
+ if (this.chart) {
286060
+ this.chart.dispose()
286061
+ this.chart = null
286062
+ }
286063
+ },
286064
+ initResizeObserver() {
286065
+ this.resizeObserver = new ResizeObserver(() => {
286066
+ if (this.chart) this.chart.resize()
286067
+ })
286068
+ this.resizeObserver.observe(this.$refs.main)
286069
+ },
286070
+ cleanupResizeObserver() {
286071
+ if (this.resizeObserver) {
286072
+ this.resizeObserver.disconnect()
286073
+ this.resizeObserver = null
286074
+ }
286075
+ },
286076
+ updateChart() {
286077
+ if (!this.chart) {
286078
+ return
286079
+ }
286080
+ this.initchart()
286081
+ },
286082
+ // 对象时的配置
286083
+ formatYAxis(yAxis) {
286084
+ // 获取数据时增加默认值和防御性检查
286085
+ const seriesData = this.datas?.series || [] // 如果 this.datas 或 series 是 undefined,使用空数组作为默认值
286086
+ const result = seriesData
286087
+ .flatMap((item) => item.data.map((innerItem) => innerItem.value[1]))
286088
+ .filter(
286089
+ (value) =>
286090
+ value !== null &&
286091
+ value !== undefined && // 排除 null 和 undefined
286092
+ !isNaN(Number(value)) &&
286093
+ isFinite(Number(value)), // 检查是否是有效数值(包括字符串形式的纯数字)
286094
+ )
286095
+ const maxAbsoluteValue = Math.max(...result.map((value) => Math.abs(value)))
286096
+
286097
+ // 动态设置 y 轴配置
286098
+ return {
286099
+ ...yAxis,
286100
+ ...{
286101
+ min: -maxAbsoluteValue,
286102
+ max: maxAbsoluteValue,
286103
+ interval: Math.ceil(maxAbsoluteValue / 5),
286104
+ }, // 仅在正负都有时设置 min 和 max
286105
+ nameGap: 20, // 控制与轴线的距离
286106
+ axisLabel: {
286107
+ formatter: yAxis.formatter,
286108
+ },
286109
+ nameTextStyle: {
286110
+ padding: yAxis.padding || null,
286111
+ },
286112
+ splitLine: {
286113
+ show: true, // 显示背景线
286114
+ },
286115
+ }
286116
+ },
286117
+ // 对象时的配置
286118
+ formatXAxis(xAxis) {
286119
+ // 获取数据时增加默认值和防御性检查
286120
+ const seriesData = this.datas?.series || [] // 如果 this.datas 或 series 是 undefined,使用空数组作为默认值
286121
+ const result = seriesData
286122
+ .flatMap((item) => item.data.map((innerItem) => innerItem.value[0]))
286123
+ .filter(
286124
+ (value) =>
286125
+ value !== null &&
286126
+ value !== undefined && // 排除 null 和 undefined
286127
+ !isNaN(Number(value)) &&
286128
+ isFinite(Number(value)), // 检查是否是有效数值(包括字符串形式的纯数字)
286129
+ )
286130
+ const maxAbsoluteValue = Math.max(...result.map((value) => Math.abs(value)))
286131
+ // 返回带有动态配置的X轴配置
286132
+ return {
286133
+ ...xAxis, // 保留原有的xAxis配置
286134
+ ...{
286135
+ min: -maxAbsoluteValue,
286136
+ max: maxAbsoluteValue,
286137
+ interval: Math.ceil(maxAbsoluteValue / 5),
286138
+ }, // 仅在正负都有时设置 min 和 max
286139
+ nameRotate: 0, // 将名称旋转90度
286140
+ nameGap: 20, // 控制与轴线的距离
286141
+ nameTextStyle: {
286142
+ padding: xAxis.padding || null,
286143
+ },
286144
+ axisLabel: {
286145
+ formatter: xAxis.formatter,
286146
+ },
286147
+ splitLine: {
286148
+ show: true, // 显示背景线
286149
+ },
286150
+ }
286151
+ },
286152
+ // 数组单Y轴的配置
286153
+ formatSingleYAxis(yAxis) {
286154
+ // 获取所有 yAxisIndex 为 0 的系列数据(左侧 Y 轴)
286155
+ const YAxisData = this.datas.series.flatMap((serie) => serie.data)
286156
+ const ret = this.calculateAxisRange(YAxisData)
286157
+ return {
286158
+ ...yAxis,
286159
+ nameLocation: 'end',
286160
+ boundaryGap: yAxis.type === 'category' ? true : [0, 0.01],
286161
+ nameTextStyle: {
286162
+ padding: yAxis.padding || null,
286163
+ },
286164
+ axisLabel: {
286165
+ formatter: yAxis.formatter,
286166
+ },
286167
+ min: ret.min,
286168
+ max: ret.max,
286169
+ interval: ret.interval,
286170
+ splitLine: {
286171
+ show: true, // 显示背景线
286172
+ lineStyle: {
286173
+ width: 1, // 背景线宽度
286174
+ type: 'dashed', // 背景线类型,可选:'solid', 'dashed', 'dotted'
286175
+ },
286176
+ },
286177
+ }
286178
+ },
286179
+ // 数组单X轴的配置
286180
+ formatSingleXAxis(xAxis) {
286181
+ return {
286182
+ ...xAxis,
286183
+ boundaryGap: xAxis.type === 'category' ? true : [0, 0.01],
286184
+ nameLocation: 'end',
286185
+ nameTextStyle: {
286186
+ padding: [0, 45, 0, 0],
286187
+ },
286188
+ axisLabel: {
286189
+ formatter: xAxis.formatter,
286190
+ rotate: xAxis.rotate, // 设置倾斜角度
286191
+ },
286192
+ scale: true,
286193
+ axisLine: { onZero: true },
286194
+ axisTick: {
286195
+ // 刻度样式
286196
+ show: false,
286197
+ alignWithLabel: true, // 刻度与标签对齐
286198
+ length: 5, // 刻度线长度
286199
+ },
286200
+ splitLine: {
286201
+ show: false, // 显示背景线
286202
+ lineStyle: {
286203
+ width: 1, // 背景线宽度
286204
+ type: 'dashed', // 背景线类型,可选:'solid', 'dashed', 'dotted'
286205
+ },
286206
+ },
286207
+ }
286208
+ },
286209
+ // 数组多Y轴的配置
286210
+ formatMultipleYAxis(yAxis) {
286211
+ // 获取所有 yAxisIndex 为 0 的系列数据(左侧 Y 轴)
286212
+ const leftYAxisData = this.datas.series
286213
+ .filter((serie) => serie.yAxisIndex === 0)
286214
+ .flatMap((serie) => serie.data)
286215
+ const ret1 = this.calculateAxisRange(leftYAxisData)
286216
+ // 获取所有 yAxisIndex 为 1 的系列数据(右侧 Y 轴)
286217
+ const rightYAxisData = this.datas.series
286218
+ .filter((serie) => serie.yAxisIndex === 1)
286219
+ .flatMap((serie) => serie.data)
286220
+ const ret2 = this.calculateAxisRange(rightYAxisData)
286221
+ return yAxis.map((yAxisItem) => {
286222
+ return {
286223
+ ...yAxisItem, // 正确地将对象解构放入返回的对象中
286224
+ min: yAxisItem.yAxisIndex === 0 ? ret1.min : ret2.min,
286225
+ max: yAxisItem.yAxisIndex === 0 ? ret1.max : ret2.max,
286226
+ interval: ret1.interval,
286227
+ nameLocation: 'end',
286228
+ nameTextStyle: {
286229
+ padding: yAxisItem.padding || null,
286230
+ },
286231
+ nameGap: 15, // 控制名称与轴线的距离
286232
+ axisLabel: {
286233
+ formatter: yAxisItem.formatter,
286234
+ },
286235
+ splitLine: {
286236
+ show: yAxisItem.yAxisIndex === 0 ? true : false, // 显示背景线
286237
+ lineStyle: {
286238
+ width: 1, // 背景线宽度
286239
+ type: 'dashed', // 背景线类型,可选:'solid', 'dashed', 'dotted'
286240
+ },
286241
+ },
286242
+ }
286243
+ })
286244
+ },
286245
+ // 数组多X轴的配置
286246
+ formatMultipleXAxis(xAxis) {
286247
+ // 获取所有 yAxisIndex 为 0 的系列数据(左侧 Y 轴)
286248
+ const leftxAxisData = this.datas.series
286249
+ .filter((serie) => serie.xAxisIndex === 0)
286250
+ .flatMap((serie) => serie.data)
286251
+ const ret1 = this.calculateAxisRange(leftxAxisData)
286252
+ // 获取所有 yAxisIndex 为 1 的系列数据(右侧 Y 轴)
286253
+ const rightxAxisData = this.datas.series
286254
+ .filter((serie) => serie.xAxisIndex === 1)
286255
+ .flatMap((serie) => serie.data)
286256
+ const ret2 = this.calculateAxisRange(rightxAxisData)
286257
+ return xAxis.map((xAxisItem) => {
286258
+ return {
286259
+ ...xAxisItem, // 正确地将对象解构放入返回的对象中
286260
+ min: xAxisItem.xAxisIndex === 0 ? ret1.min : ret2.min,
286261
+ max: xAxisItem.xAxisIndex === 0 ? ret1.max : ret2.max,
286262
+ interval: ret1.interval,
286263
+ nameLocation: 'end',
286264
+ nameTextStyle: {
286265
+ padding: xAxisItem.padding || null,
286266
+ },
286267
+ nameGap: 15, // 控制名称与轴线的距离
286268
+ axisLabel: {
286269
+ formatter: xAxisItem.formatter,
286270
+ },
286271
+ splitLine: {
286272
+ show: xAxisItem.xAxisIndex === 0 ? false : true,
286273
+ lineStyle: {
286274
+ width: 1, // 背景线宽度
286275
+ type: 'dashed', // 背景线类型,可选:'solid', 'dashed', 'dotted'
286276
+ },
286277
+ },
286278
+ }
286279
+ })
286280
+ },
286281
+ calculateAxisRange(series) {
286282
+ // 防御性检查
286283
+ if (!Array.isArray(series) || series.length === 0) return [0, 0, 1] // 返回默认值,避免崩溃
286284
+ // 过滤无效值
286285
+ const validSeries = series.filter(
286286
+ (value) =>
286287
+ value !== null &&
286288
+ value !== undefined &&
286289
+ typeof value === 'number' &&
286290
+ !Number.isNaN(value) &&
286291
+ Number.isFinite(value),
286292
+ )
286293
+ if (validSeries.length === 0) return [0, 0, 1]
286294
+ // 计算最大值和最小值
286295
+ const maxDataValue = Math.max(...validSeries)
286296
+ const minDataValue = Math.min(...validSeries)
286297
+ // 确保范围有效
286298
+ const max = Math.ceil(maxDataValue * 1.1) // 上限扩大 10%
286299
+ const min = Math.floor(minDataValue * 1) // 下限保持不变
286300
+ // 计算 interval,确保不为 0
286301
+ const interval = Math.ceil((max - min) / 5) || 1 // 避免 interval 为 0
286302
+ return [max, min, interval]
286303
+ },
286304
+ initchart() {
286305
+ packages_registerTheme('westeros', packages_westeros)
286306
+ this.chart = packages_echarts_init(this.$refs.chart, 'westeros')
286307
+ const lineOption = {
286308
+ // 标题
286309
+ title: this.getTitle,
286310
+ grid: this.getGrid,
286311
+ // 提示
286312
+ tooltip: this.getTooltip,
286313
+ // 四象限
286314
+ graphic: this.getGraphic,
286315
+ // 标签
286316
+ legend: this.getLegend,
286317
+ // 横轴
286318
+ xAxis: this.getXaxis,
286319
+ // 竖轴
286320
+ yAxis: this.getYaxis,
286321
+ // 数据
286322
+ series: this.getSeries,
286323
+ dataZoom: this.getDataZoom,
286324
+ }
286325
+ this.chart.setOption(lineOption)
286326
+ },
286327
+ },
286328
+ });
285913
286329
 
285914
286330
  ;// ./packages/components/data-chart/index.vue?vue&type=script&lang=js
285915
286331
  /* harmony default export */ const packages_components_data_chartvue_type_script_lang_js = (packages_data_chartvue_type_script_lang_js);
@@ -285923,8 +286339,8 @@ packages_use(packages_installLabelLayout);
285923
286339
  ;
285924
286340
  var packages_data_chart_component = (0,packages_componentNormalizer["default"])(
285925
286341
  packages_components_data_chartvue_type_script_lang_js,
285926
- packages_data_chartvue_type_template_id_675ff4b9_render,
285927
- packages_data_chartvue_type_template_id_675ff4b9_staticRenderFns,
286342
+ packages_data_chartvue_type_template_id_56e77c6e_render,
286343
+ packages_data_chartvue_type_template_id_56e77c6e_staticRenderFns,
285928
286344
  false,
285929
286345
  null,
285930
286346
  null,