码农知识堂 - 1000bd
  •   Python
  •   PHP
  •   JS/TS
  •   JAVA
  •   C/C++
  •   C#
  •   GO
  •   Kotlin
  •   Swift
  • echarts折线图(其他图也是一样)设置tooltip自动滚动


    按顺序自动滚动效果

    1. class="leftComp-charts" id="chartsBox">
    2. chartsData: {
    3. roadNorm: [],
    4. time: []
    5. },
    6. eChartsTimer: null
    7. initChartsBox() {
    8. this.option = {
    9. tooltip: {
    10. trigger: "axis",
    11. axisPointer: {
    12. // 方法一
    13. type: "shadow", // 默认为直线,可选为:'line' | 'shadow'
    14. shadowStyle: {
    15. color: "rgba(41, 95, 204, 0.2)",
    16. },
    17. },
    18. borderColor: "rgba(0, 170, 255)", // 边框颜色
    19. }, // 坐标轴指示器配置
    20. textStyle: {
    21. color: "#333", // xy轴的提示文字颜色,不包含背景刻度线
    22. },
    23. color: ["#1492FF"],
    24. grid: {
    25. top: "25px",
    26. left: "50px",
    27. right: "20px",
    28. bottom: "35px",
    29. },
    30. xAxis: [
    31. {
    32. type: "category",
    33. data: this.chartsData.time,
    34. axisLine: {
    35. show: true,
    36. lineStyle: {
    37. color: "#004080",
    38. // width: 0,
    39. type: "solid",
    40. }, // x轴线的颜色以及宽度
    41. },
    42. // axisLabel: {
    43. // show: true,
    44. // textStyle: {
    45. // color: "rgba(255, 255, 255, 0.3)",
    46. // }
    47. // }, // x轴文字的配置
    48. splitLine: {
    49. show: false,
    50. lineStyle: {}, // 分割线配置
    51. },
    52. axisTick: {
    53. show: false,
    54. }, // x轴的刻度线
    55. },
    56. ],
    57. yAxis: [
    58. {
    59. type: "value",
    60. splitLine: {
    61. show: true,
    62. lineStyle: {
    63. color: "#333",
    64. opacity: 0.1,
    65. }, // 设置横向的线的颜色
    66. },
    67. axisLabel: {
    68. show: true,
    69. margin: 20,
    70. // textStyle: {
    71. // color: "rgba(255, 255, 255, 0.3)",
    72. // }, // y轴的字体配置
    73. },
    74. },
    75. ],
    76. series: [
    77. {
    78. data: this.chartsData.roadNorm,
    79. type: "line",
    80. smooth: true,
    81. },
    82. ],
    83. };
    84. this.myChart = this.$echarts.init(document.getElementById("chartsBox")); // 图标初始化
    85. this.myChart.setOption(this.option); // 渲染页面
    86. var that = this;
    87. let index = 0;
    88. this.eChartsTimer = setInterval(function () {
    89. let len = that.chartsData.time.length;
    90. if (index >= len) {
    91. index = 0;
    92. }
    93. that.myChart.dispatchAction({
    94. type: "showTip", // 提示框
    95. seriesIndex: 0,
    96. dataIndex: index, // 第 lightIndex 柱子高亮
    97. });
    98. index += 1
    99. }, 1000);
    100. /* ECharts动态效果 */
    101. window.addEventListener("resize", () => {
    102. this.myChart.resize();
    103. });
    104. },
    105. mounted() {
    106. this.initChartsBox()
    107. },
    108. destroyed() {
    109. clearInterval(this.eChartsTimer)
    110. }
    111. .leftComp-charts {
    112. width: 600px;
    113. height: 220px;
    114. border: 1px solid red;
    115. }

    随机滚动请看这里

    1. var that = this;
    2. this.eChartTimer = setInterval(function () {
    3. var index = Math.round(Math.random() * that.yAxisData.length);
    4. if (index === 0) {
    5. index = 1;
    6. }
    7. that.myChart.dispatchAction({
    8. type: "showTip", // 提示框
    9. seriesIndex: 0,
    10. dataIndex: index, // 第 lightIndex 柱子高亮
    11. });
    12. }, 1000);

  • 相关阅读:
    次时代武器全流程大揭秘
    Dos慢速攻击
    Mac的Safari浏览器如何打开检查元素【网页控制台】
    多因素共同作用,行业格局或将发生变化
    【深度学习】 Python 和 NumPy 系列教程(四):Python容器:2、元组tuple详解(初始化、索引和切片、元组特性、常用操作、拆包、遍历)
    MODB:软体动物线粒体基因组数据库
    qlib高阶应用之财务数据库与自定义表达式
    【影刀演示_发送邮件的格式化HTML留存】
    今天的码农女孩学习了关于jQuery遍历节点、查询节点以及插件的知识
    性能测试的概念到底是什么?---《跟着高楼学习性能测试--进阶高级性能工程师》系列
  • 原文地址:https://blog.csdn.net/m0_74149462/article/details/133767881
  • 最新文章
  • 攻防演习之三天拿下官网站群
    数据安全治理学习——前期安全规划和安全管理体系建设
    企业安全 | 企业内一次钓鱼演练准备过程
    内网渗透测试 | Kerberos协议及其部分攻击手法
    0day的产生 | 不懂代码的"代码审计"
    安装scrcpy-client模块av模块异常,环境问题解决方案
    leetcode hot100【LeetCode 279. 完全平方数】java实现
    OpenWrt下安装Mosquitto
    AnatoMask论文汇总
    【AI日记】24.11.01 LangChain、openai api和github copilot
  • 热门文章
  • 十款代码表白小特效 一个比一个浪漫 赶紧收藏起来吧!!!
    奉劝各位学弟学妹们,该打造你的技术影响力了!
    五年了,我在 CSDN 的两个一百万。
    Java俄罗斯方块,老程序员花了一个周末,连接中学年代!
    面试官都震惊,你这网络基础可以啊!
    你真的会用百度吗?我不信 — 那些不为人知的搜索引擎语法
    心情不好的时候,用 Python 画棵樱花树送给自己吧
    通宵一晚做出来的一款类似CS的第一人称射击游戏Demo!原来做游戏也不是很难,连憨憨学妹都学会了!
    13 万字 C 语言从入门到精通保姆级教程2021 年版
    10行代码集2000张美女图,Python爬虫120例,再上征途
Copyright © 2022 侵权请联系2656653265@qq.com    京ICP备2022015340号-1
正则表达式工具 cron表达式工具 密码生成工具

京公网安备 11010502049817号