前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >Echarts网格颜色渐变 + 折线图折线发光高亮效果

Echarts网格颜色渐变 + 折线图折线发光高亮效果

作者头像
全栈程序员站长
发布2022-11-01 09:29:08
1.3K0
发布2022-11-01 09:29:08
举报
文章被收录于专栏:全栈程序员必看

大家好,又见面了,我是你们的朋友全栈君。

在这里插入图片描述
在这里插入图片描述

series:里面定义

折线发光高亮的效果

代码语言:javascript
复制
   lineStyle: {
              shadowColor: "#5cfbff", //透明的颜色
              shadowOffsetX: 0,
              shadowOffsetY: 0,
              opacity: 1, //透明度
              shadowBlur: 8, //阴影大小
              type: "solid", //实线
              width: 2,
            },

Jetbrains全家桶1年46,售后保障稳定

网格颜色的渐变

代码语言:javascript
复制
   areaStyle: {
              normal: {
                //前四个参数代表位置 左下右上,暗青色到亮青色,
                color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
                  { offset: 0, color: "rgba(12,180,250, 1)" }, //从上往下的渐变
                  { offset: 1, color: "rgba(63, 208, 249, 0)" },
                ]),
              },
            },

附上封住代码

代码语言:javascript
复制
<template>
<div id="linechart" />
</template>
<script>
import echarts from "echarts";
export default {
props: ["id"],
data() {
return {
charts: "",
};
},
mounted() {
this.$nextTick(() => {
this.initChart("linechart");
});
},
methods: {
initChart(id) {
this.charts = echarts.init(document.getElementById(id), "blue");
this.charts.setOption({
color: ["#00D8FF"],
tooltip: {
trigger: "axis",
},
legend: {
y: "bottom",
itemGap: 30,
itemWidth: 30,
itemHeight: 10,
textStyle: {
fontSize: 13, //字体大小
color: "rgb(142, 199, 220)", //字体颜色
},
},
calculable: true,
xAxis: [
{
type: "category",
boundaryGap: false,
data: [
"06:00",
"09:00",
"12:00",
"15:00",
"18:00",
"21:00",
"24:00",
],
axisLabel: {
show: true,
textStyle: {
color: ["rgb(142, 199, 220)"],
},
},
axisLine: {
lineStyle: {
color: "#023c7a",
width: 1,
},
},
},
],
yAxis: [
{
type: "value",
axisLabel: {
formatter: "{value} °C",
},
splitLine: {
lineStyle: {
color: "#023c7a",
width: 1,
},
},
axisLine: {
lineStyle: {
color: "#023c7a",
width: 1,
},
},
axisLabel: {
show: true,
textStyle: {
color: ["rgb(142, 199, 220)"],
},
},
},
],
series: [
{
symbolSize: 0, //折线点的大小
type: "line",
data: [6000, 4000, 8000, 10000, 4000, 2000, 4000, 2000, 6000],
areaStyle: {
normal: {
//前四个参数代表位置 左下右上,暗青色到亮青色,
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
{ offset: 0, color: "rgba(12,180,250, 1)" }, //从上往下的渐变
{ offset: 1, color: "rgba(63, 208, 249, 0)" },
]),
},
},
lineStyle: {
shadowColor: "#5cfbff", //透明的颜色
shadowOffsetX: 0,
shadowOffsetY: 0,
opacity: 1, //透明度
shadowBlur: 8, //阴影大小
type: "solid", //实线
width: 2,
},
},
],
});
},
},
};
</script>

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。

发布者:全栈程序员栈长,转载请注明出处:https://javaforall.cn/203619.html原文链接:https://javaforall.cn

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2022年10月23日,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档