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

网站怎么添加模块南山品牌网站建设企业

网站怎么添加模块,南山品牌网站建设企业,如何下载海外app,网页制作属于哪个专业文章目录概要技术细节效果概要 需求需要实现图例移入显示描述说明 故实现自定义图例 技术细节 templatediv classcustom-legenddivv-foritem in legends:keyitem.nameclasslegend-item:class{ i… 文章目录概要技术细节效果概要 需求需要实现图例移入显示描述说明 故实现自定义图例 技术细节 templatediv classcustom-legenddivv-foritem in legends:keyitem.nameclasslegend-item:class{ is-disabled: !isItemActive(item.name) }clicktoggleLegend(item)spanclasslegend-marker:style{ backgroundColor: item.color }/spana-tooltiptemplate #titlespan{{ item.tooltip || item.name }}/span/templatespan{{ item.name }}/span/a-tooltip/div/div /templatescript setup import { ref, computed, watch, onMounted, onBeforeUnmount } from vueconst props defineProps({chartInstance: {type: Object,default: () null},customTooltips: {type: Object,default: () ({})} })const legends ref([]) const activeMap ref({})const isItemActive computed(() (name) {return activeMap.value[name] })const toggleLegend (item) {if (!props.chartInstance) returnconst name item.nameconst newState !activeMap.value[name]activeMap.value { ...activeMap.value, [name]: newState }props.chartInstance.setOption({legend: {selected: activeMap.value}}) }const renderLegends () {if (!props.chartInstance) {legends.value []return}const chart props.chartInstanceconst options chart.getOption()const { series, color: globalColors, legend } optionsconst chartSelectedMap legend?.[0]?.selected || {}activeMap.value { ...chartSelectedMap }const legendItems []series.forEach((seriesItem, seriesIndex) {if (seriesItem.type pie) {seriesItem.data.forEach((dataItem, dataIndex) {const name dataItem.nameconst color dataItem.itemStyle?.color ||globalColors[dataIndex % globalColors.length] ||#000if (activeMap.value[name] undefined) {activeMap.value[name] true}legendItems.push({name,color,tooltip: props.customTooltips[name] || name})})} else {const name seriesItem.nameconst color seriesItem.itemStyle?.color ||globalColors[seriesIndex % globalColors.length] ||#000if (activeMap.value[name] undefined) {activeMap.value[name] true}legendItems.push({name,color,tooltip: props.customTooltips[name] || name})}})legends.value legendItems }const handleChartLegendChange (params) {activeMap.value { ...params.selected } }watch(() props.chartInstance,(newVal) {if (newVal) {renderLegends()} else {legends.value []}},{ immediate: true } ) /scriptstyle scoped langscss .custom-legend {display: flex;flex-wrap: wrap;justify-content: center;gap: 12px;padding: 8px;.legend-item {display: flex;align-items: center;gap: 6px;cursor: pointer;transition: all 0.2s ease;.legend-marker {width: 14px;height: 14px;border-radius: 50%;transition: all 0.2s ease;}.is-disabled {opacity: 0.6;.legend-marker {filter: grayscale(100%);transform: scale(0.9);}}:hover:not(.is-disabled) {transform: translateY(-1px);opacity: 0.9;}} } /style templatediv classcontainerdiv classchart reflineChart/divdiv classchart refpieChart/divdiv classlegend1Legend :chartInstancechartInstance1 //divdiv classlegend2Legend :chartInstancechartInstance2 //div/div /template script setup import * as echarts from echarts import Legend from ./components/Legend.vueconst lineChart ref(null) const pieChart ref(null)const chartInstance1 shallowRef(null) const chartInstance2 shallowRef(null)const _data {line: {title: 折线图示例,categories: [周一, 周二, 周三, 周四, 周五, 周六, 周日],legend: [邮件营销, 联盟广告, 视频广告, 直接访问, 搜索引擎],series: [{name: 邮件营销,type: line,data: [120, 132, 101, 134, 90, 230, 210]},{name: 联盟广告,type: line,data: [220, 182, 191, 234, 290, 330, 310]},{name: 视频广告,type: line,data: [150, 232, 201, 154, 190, 330, 410]},{name: 直接访问,type: line,data: [320, 332, 301, 334, 390, 330, 320]},{name: 搜索引擎,type: line,data: [820, 932, 901, 934, 1290, 1330, 1320]}]},pie: {title: 饼图示例,legend: [直接访问, 邮件营销, 联盟广告, 视频广告, 搜索引擎],series: [{ value: 335, type: pie, name: 直接访问 },{ value: 310, type: pie, name: 邮件营销 },{ value: 234, type: pie, name: 联盟广告 },{ value: 135, type: pie, name: 视频广告 },{ value: 1548, type: pie, name: 搜索引擎 }]} }const onItemClick (params) {chartInstance1.value.dispatchAction({type: legendToggleSelect,name: params.name}) }const initChart () {const lineOption {title: {text: _data.line.title},tooltip: {trigger: axis},legend: {show: false},grid: {left: 3%,right: 4%,bottom: 3%,containLabel: true},xAxis: {type: category,boundaryGap: false,data: _data.line.categories},yAxis: {type: value},series: _data.line.series}const pieOption {title: {text: _data.pie.title},tooltip: {trigger: item,formatter: {a} br/{b} : {c} ({d}%)},legend: {show: false},series: [{name: 访问来源,type: pie,radius: 55%,center: [50%, 60%],data: _data.pie.series,itemStyle: {emphasis: {shadowBlur: 10,shadowOffsetX: 0,shadowColor: rgba(0, 0, 0, 0.5)}}}]}const lineChartDom lineChart.valueconst pieChartDom pieChart.valueconst lineChartInstance echarts.init(lineChartDom)const pieChartInstance echarts.init(pieChartDom)lineChartInstance.setOption(lineOption)pieChartInstance.setOption(pieOption)chartInstance1.value lineChartInstancechartInstance2.value pieChartInstance }onMounted(() {initChart() }) /scriptstyle langscss scoped .container {display: flex;width: 1200px;justify-content: space-between;margin-top: 20px;position: relative;.chart {width: 49%;height: 400px;}.legend1 {position: absolute;bottom: -50px;left: 50px;}.legend2 {position: absolute;bottom: -50px;right: 50px;} } /style 效果
http://www.zqtcl.cn/news/709100/

相关文章:

  • 如何找网站做推广wordpress登录及注册
  • 韩国美容网站 模板wordpress中英文
  • 为什么邮箱突然进不去了总提示正在进入不安全网站wordpress需注册访问
  • 建网站哪家最好山东泰安房价
  • wordpress4.9+多站点网络推广公司联系昔年下拉
  • 西安seo网站关键词优化罗田县建设局网站
  • 北京网站建设 shwllnmp新手 wordpress
  • 优化网站结构一般包括如何进行网络营销风险控制
  • 怎样查看网站是用什么做的郫都区规划建设局网站
  • 新乡营销型网站建设制作网站设计的总结
  • 做网站的免费空间微信crm管理系统
  • 网站开发方向 英语翻译护肤品网页设计图片
  • 南昌做兼职的网站佛山网站建设公司排名
  • 购物网站建设推进表国外设计素材网站
  • 广州网站建设推广公司有哪些有一个网站专门做民宿
  • 安徽省建设干部网站淘客网站超级搜怎么做
  • 网站地图提交地址网站地图可以自己做么
  • 电子商务网站建设与推广wordpress手机大标题
  • 网站页面上的下载功能怎么做ps扩展插件网站
  • 打开网站出现directory今天时政新闻热点是什么
  • 高校校园网站建设与运行网站规划教学设计
  • 包头手机网站制作seo推广手段
  • 汕头网站推广seo品牌网站建设 app建设
  • 网站后台word编辑器如何申请一个网站 做视频
  • 源代码做网站网站编辑可以做运营吗
  • 小游戏网站模板无锡网站建设818gx
  • 娄底做网站陕西网站维护
  • 电子商务网站建设首要问题是佛山网站设计步骤
  • iphone网站哈尔滨做平台网站平台公司吗
  • 公司网站制作高端有什么网站可以做外贸出口信息