月球大数据地理空间分析展示平台-【前端】-月球2期前端
surprise
2023-11-29 36fbd1e5a40e319e6ac5f43d11c99ba4b66e93a3
src/components/BarGraphAxisLine.vue
@@ -1,12 +1,6 @@
<template>
  <div
    class="Echarts_box"
    :style="{ width: width, height: height }"
  >
    <div
      id="myEchartsBIG"
      style="width: 100%; height: 100%"
    ></div>
  <div class="Echarts_box" :style="{ width: width, height: height }">
    <div id="myEchartsBIG" style="width: 100%; height: 100%"></div>
  </div>
</template>
<script lang="ts" setup>
@@ -38,6 +32,7 @@
  props.layerData.points.forEach((e, i) => {
    xAxisData.value.push(returnFloat1(e.len));
  });
  data = trans(props.layerData.points);
  seriesData.value = [];
  data.forEach((e) => {
@@ -87,10 +82,17 @@
  return result;
}
function initChart() {
  let chart = myEcharts.init(
    document.getElementById("myEchartsBIG"),
    "purple-passion"
  );
  var unit = props.layerData.unit ? props.layerData.unit : '';
  var val = [];
  xAxisData.value.filter(res => {
    val.push((res / 1000).toFixed(3));
  })
  chart.setOption({
    title: {
      text: "",
@@ -159,8 +161,8 @@
    },
    xAxis: {
      type: "category",
      data: xAxisData.value,
      name: "米(m)",
      data: val,
      name: "千米",
      axisLabel: {
        //x轴文字的配置
        showMinLabel: true, // 强制显示最小值标签
@@ -198,7 +200,9 @@
    },
    yAxis: {
      name:unit,
      type: "value",
    },
    series: seriesData.value,
  });