index.vue 4.76 KB
<template>
  <div class="go-content-box">
    <svg :width="w" :height="h" fill="none">
      <defs>
        <linearGradient id="linear_0" x1="0%" y1="50%" x2="100%" y2="50%" gradientUnits="objectBoundingBox">
          <stop offset="0" :stop-color="attribute.linearColors[0]" stop-opacity="1" />
          <stop offset="1" :stop-color="attribute.linearColors[1]" stop-opacity="1" />
        </linearGradient>
        <linearGradient id="linear_1" x1="0%" y1="50%" x2="100%" y2="50%" gradientUnits="objectBoundingBox">
          <stop offset="0" :stop-color="attribute.linearColors[2]" stop-opacity="1" />
          <stop offset="1" :stop-color="attribute.linearColors[3]" stop-opacity="0" />
        </linearGradient>
        <linearGradient id="linear_2" x1="0%" y1="50%" x2="100%" y2="50%" gradientUnits="objectBoundingBox">
          <stop offset="0" :stop-color="attribute.linearColors[4]" stop-opacity="1" />
          <stop offset="1" :stop-color="attribute.linearColors[5]" stop-opacity="0" />
        </linearGradient>
      </defs>
      <g opacity="1" transform="translate(-6.249999273677531e-8 0.5)  rotate(0 160.00000003125 15.000000000000005)">
        <path
          id="矩形 16"
          fill-rule="evenodd"
          fill="url(#linear_0)"
          transform="translate(6.249999895402425e-8 2)  rotate(0 160 13)"
          opacity="1"
          :d="`M0,${h - 5} L${w},${h - 5} L${w},0 L0,0 L0,${h - 5} Z`"
        />
        <g opacity="1" :transform="`translate(34.0000000625  ${h / 2 - 26 / 2})  rotate(0 46 13)`">
          <text>
            <tspan
              :x="attribute.fontPos.x"
              :y="attribute.fontPos.y"
              :font-size="attribute.fontSize"
              line-height="0"
              :fill="attribute.fontColor"
              opacity="1"
              font-family="YouSheBiaoTiHei"
              letter-spacing="0"
            >
              {{ dataset }}
            </tspan>
          </text>
        </g>
        <path
          id="路径 5"
          style="stroke: url(#linear_1); stroke-width: 1; stroke-opacity: 100; stroke-dasharray: 0 0"
          transform="translate(6.249999895402425e-8 30)  rotate(0 160 0)"
          d="M0,0L320,0 "
        />
        <path
          id="路径 5"
          style="stroke: url(#linear_2); stroke-width: 1; stroke-opacity: 100; stroke-dasharray: 0 0"
          transform="translate(6.249999895402425e-8 0)  rotate(0 160 0)"
          d="M0,0L320,0 "
        />
        <path
          id="路径 5"
          :style="{ stroke: attribute.linearColors[10], strokeWidth: 1, strokeOpacity: 1, strokeDasharray: 0 }"
          transform="translate(0 0.0005)  rotate(0 2.000000062499999 0)"
          d="M0,0L4,0 "
        />
        <path
          id="路径 5"
          :style="{ stroke: attribute.linearColors[11], strokeWidth: 1, strokeOpacity: 1, strokeDasharray: 0 }"
          :transform="`translate(0 ${h - 1})  rotate(0 2.000000062499999 0)`"
          d="M0,0 L4,0 "
        />
        <g opacity="1" :transform="`translate(10.0000000625 ${h / 2 - 18 / 2})  rotate(0 8.598076211353316 9)`">
          <path
            id="三角形 1"
            fill-rule="evenodd"
            :style="{ fill: attribute.linearColors[6] }"
            transform="translate(4 0)  rotate(0 6.598076211353316 4.5)"
            opacity="1"
            d="M2.8,9L13.2,9L0,0L2.8,9Z "
          />
          <path
            id="三角形 1"
            fill-rule="evenodd"
            :style="{ fill: attribute.linearColors[7] }"
            transform="translate(4 9)  rotate(0 6.598076211353316 4.5)"
            opacity="1"
            d="M13.2,0L2.8,0L0,9L13.2,0Z "
          />
          <path
            id="圆形 7"
            fill-rule="evenodd"
            :style="{ fill: attribute.linearColors[8] }"
            transform="translate(0 7)  rotate(0 2 2)"
            opacity="1"
            d="M2,0C0.9,0 0,0.9 0,2C0,3.1 0.9,4 2,4C3.1,4 4,3.1 4,2C4,0.9 3.1,0 2,0Z "
          />
        </g>
        <path
          id="矩形 17"
          fill-rule="evenodd"
          :style="{ fill: attribute.linearColors[9] }"
          transform="translate(6.249999895402425e-8 2)  rotate(0 0.5 13)"
          opacity="1"
          :d="`M0,${h - 5}L1,${h - 5}L1,0L0,0L0,${h - 5}Z`"
        />
      </g>
    </svg>
  </div>
</template>
<script setup lang="ts">
import { PropType, toRefs } from 'vue'
import { CreateComponentType } from '@/packages/index.d'

const props = defineProps({
  chartConfig: {
    type: Object as PropType<CreateComponentType>,
    required: true
  }
})

const { dataset, attribute } = toRefs(props.chartConfig.option)

const { w, h } = toRefs(props.chartConfig.attr)
</script>

<style lang="scss" scoped>
.go-content-box {
  width: v-bind('w+"px"');
  height: v-bind('h+"px"');
  display: flex;
  align-items: center;
  justify-content: center;
}
</style>