当前位置: 首页 > wzjs >正文

wordpress时尚英文站小程序定制

wordpress时尚英文站,小程序定制,建筑工程网站开发,武汉网站制作找谁主要功能 数据可视化:以堆叠柱形图形式展示两组数据(销售和技术)的月度分布情况。响应式设计:图表会根据窗口大小自动调整。数据交互:鼠标悬停时显示详细数据(包括每项的具体数值和总计)。数据更…

主要功能

  1. 数据可视化:以堆叠柱形图形式展示两组数据(销售和技术)的月度分布情况。
  2. 响应式设计:图表会根据窗口大小自动调整。
  3. 数据交互:鼠标悬停时显示详细数据(包括每项的具体数值和总计)。
  4. 数据更新:当传入的 props 数据变化时,图表会自动更新。

 组件代码

<template><div class="chart-container" ref="chartRef"></div>
</template><script setup>
import { ref, onMounted, watch } from "vue";
import * as echarts from "echarts";const props = defineProps({// 接收秘密和机密数据secretData: {type: Array,default: () => [],},confidentialData: {type: Array,default: () => [],},// 可选:自定义标题title: {type: String,default: "堆叠柱形图",},// 可选:自定义x轴标签xAxisLabels: {type: Array,default: () => ["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月",],},
});const chartRef = ref(null);
let chartInstance = null;// 初始化图表
const initChart = () => {if (!chartRef.value) return;chartInstance = echarts.init(chartRef.value);const option = {backgroundColor: "#fff",title: {text: props.title,left: "center",textStyle: {color: "#333",fontSize: 16,},},tooltip: {trigger: "axis",axisPointer: {type: "cross",crossStyle: {color: "#999",},},formatter: (params) => {let result = `<div class="font-bold">${params[0].name}</div>`;let total = 0;params.forEach((param) => {total += param.value;result += `<div class="flex items-center"><span class="inline-block w-3 h-3 rounded-full mr-2" style="background-color: ${param.color}"></span>${param.seriesName}: ${param.value}</div>`;});result += `<div class="font-bold mt-1">总计: ${total}</div>`;return result;},},legend: {data: ["销售", "技术"],top: "5%",right: "0",itemWidth: 10,itemHeight: 10,},grid: {left: "3%",right: "4%",bottom: "3%",containLabel: true,},xAxis: {type: "category",data: props.xAxisLabels,axisTick: false,axisLabel: {color: "#999999",},axisLine: {show: true, // 显示轴线lineStyle: {color: "#DDDDDD", // 轴线颜色width: 1, // 轴线宽度type: "solid", // 轴线样式:solid, dashed, dotted},},},yAxis: {type: "value",min: 0,axisLabel: {formatter: "{value}",color: "#999999",},splitLine: {show: false, // 隐藏y轴横线(网格线)},},series: [{name: "销售",type: "bar",stack: "总量",data: props.secretData,color: "#FC1705",barWidth: "30%",},{name: "技术",type: "bar",stack: "总量",data: props.confidentialData,color: "#970E02",barWidth: "30%",},],};chartInstance.setOption(option);// 监听窗口大小变化,调整图表window.addEventListener("resize", () => {if (chartInstance) chartInstance.resize();});
};// 初始化和更新图表
onMounted(() => {initChart();
});// 监听props变化,更新图表
watch([() => props.secretData, () => props.confidentialData], () => {if (chartInstance) {chartInstance.setOption({series: [{data: props.secretData,},{data: props.confidentialData,},],});}
});// 组件卸载时销毁图表
onUnmounted(() => {if (chartInstance) {chartInstance.dispose();chartInstance = null;}
});
</script><style scoped>
.chart-container {width: 100%;height: 360px;margin: 0 auto;
}
</style>

组件引用

<StackedBarChart:secretData="[0, 0, 0, 0, 0, 23, 0, 0, 0, 0, 0, 0]":confidentialData="[0, 0, 0, 0, 0, 251, 0, 0, 0, 0, 0, 0]"
/>

http://www.dtcms.com/wzjs/369973.html

相关文章:

  • 做一网站困难吗百度云搜索引擎入口官网
  • 弱电工程公司网站怎么做环球资源外贸平台免费
  • 做个网站商城要多少钱seo官网优化详细方法
  • 国外申请域名的网站广告联盟app
  • 帮我做网站推广seo百度点击软件
  • 局域网建站软件北京最新疫情情况
  • 盘锦网站建设公司排名优化课程
  • 做app和网站怎样seo搜索引擎优化课程
  • 万网网站建设购买过程东莞关键词优化软件
  • 自适应自助建站网站做seo的公司
  • 个人网站制作基本步骤输入关键词进行搜索
  • 中小企业网站建设 网络营销网站建设情况
  • 西安市免费做网站提高工作效率8个方法
  • 做网站的后台开发需要会些什么淘宝怎么做引流和推广
  • 临沂教育平台网站建设搜索引擎营销简称为
  • 个人怎么做影视网站最近三天的新闻大事摘抄
  • 广告接单平台app铜陵seo
  • 京东网的公司全称是南宁网站seo
  • 网站 备案地优化seo公司哪家好
  • java网站开发的底层语言是福建seo优化
  • 做外贸生意上哪个网站google推广seo
  • 搭建网站的主要风险网站推广公司大家好
  • 免费公司介绍网站怎么做河南郑州最新事件
  • 珠海网站制作报价seo兼职接单平台
  • 网站建设的方案计划seo关键词排名优化销售
  • 凡科做的网站打不开百度一下生活更好
  • 网站基础建设网络营销网站推广
  • 四川省城乡住房建设部网站首页免费发布活动的平台
  • 做企业营销网站google海外推广
  • 外贸网站制作广州推广网站最有效办法