蓝色天空.知识 · 实践 · 创造
我的收藏
在线代码实验室

节点和边分别查询:独立实例

JAVASCRIPTECharts6.1.0 / Edge156.0.4314.58 / 自有同源数据与本地HTTP服务;实际程序化指针和动作echarts-events.js
echarts-events.js277 行
import * as echarts from 'echarts';
import {mount} from './lab.js';

// 本章独立配置和实际运行共用;数值均为自有虚构数据。
const specification = {
  "key": "echarts-events",
  "title": "ECharts 事件与动作:点击、查询、联动及清理",
  "cases": [
    {
      "id": "event-bar",
      "title": "真实鼠标、dialog及本地详情",
      "option": {
        "animation": false,
        "title": {
          "text": "蓝色天空网 · 虚构学习数据"
        },
        "tooltip": {
          "trigger": "item"
        },
        "legend": {
          "top": 35,
          "data": [
            "练习次数"
          ]
        },
        "grid": {
          "top": 90,
          "bottom": 65,
          "containLabel": true
        },
        "xAxis": {
          "type": "category",
          "data": [
            "阅读",
            "实作",
            "复习",
            "调试",
            "整理",
            "回顾"
          ]
        },
        "yAxis": {
          "type": "value",
          "name": "次数"
        },
        "series": [
          {
            "id": "study",
            "name": "练习次数",
            "type": "bar",
            "data": [
              12,
              24,
              18,
              31,
              22,
              27
            ]
          }
        ]
      },
      "behavior": "eventbar"
    },
    {
      "id": "event-query",
      "title": "类型与名称query",
      "option": {
        "animation": false,
        "title": {
          "text": "蓝色天空网 · 虚构学习数据"
        },
        "tooltip": {
          "trigger": "item"
        },
        "legend": {
          "top": 35
        },
        "grid": {
          "top": 90,
          "bottom": 65,
          "containLabel": true
        },
        "xAxis": {
          "type": "category",
          "data": [
            "阅读",
            "实作",
            "复习",
            "调试",
            "整理",
            "回顾"
          ]
        },
        "yAxis": {
          "type": "value",
          "name": "次数"
        },
        "series": [
          {
            "id": "line-a",
            "name": "其他线",
            "type": "line",
            "data": [
              12,
              24,
              18,
              31,
              22,
              27
            ]
          },
          {
            "id": "line-b",
            "name": "目标线",
            "type": "line",
            "data": [
              {
                "name": "目标点",
                "value": 20
              },
              {
                "name": "点1",
                "value": 32
              },
              {
                "name": "点2",
                "value": 26
              },
              {
                "name": "点3",
                "value": 39
              },
              {
                "name": "点4",
                "value": 30
              },
              {
                "name": "点5",
                "value": 35
              }
            ]
          }
        ]
      },
      "behavior": "eventquery"
    },
    {
      "id": "event-graph",
      "title": "节点和边分别查询",
      "option": {
        "animation": false,
        "tooltip": {},
        "series": [
          {
            "id": "relations",
            "type": "graph",
            "layout": "none",
            "roam": false,
            "symbolSize": 45,
            "label": {
              "show": true
            },
            "lineStyle": {
              "width": 8,
              "color": "#64748b"
            },
            "data": [
              {
                "id": "node-a",
                "name": "概念",
                "x": 120,
                "y": 160,
                "value": 10
              },
              {
                "id": "node-b",
                "name": "实作",
                "x": 420,
                "y": 160,
                "value": 20
              }
            ],
            "links": [
              {
                "source": "node-a",
                "target": "node-b"
              }
            ]
          }
        ]
      },
      "behavior": "eventgraph"
    },
    {
      "id": "event-custom",
      "title": "custom子图元my_el",
      "option": {
        "animation": false,
        "xAxis": {
          "type": "value",
          "min": 0,
          "max": 20
        },
        "yAxis": {
          "type": "value",
          "min": 0,
          "max": 20
        },
        "series": [
          {
            "type": "custom",
            "data": [
              [
                12,
                13
              ]
            ]
          }
        ]
      },
      "behavior": "eventcustom"
    },
    {
      "id": "event-cycle",
      "title": "有界提示轮播",
      "option": {
        "animation": false,
        "title": {
          "text": "蓝色天空网 · 学习构成"
        },
        "tooltip": {
          "trigger": "item"
        },
        "legend": {
          "bottom": 0
        },
        "series": [
          {
            "id": "composition",
            "name": "学习构成",
            "type": "pie",
            "radius": "55%",
            "center": [
              "50%",
              "50%"
            ],
            "data": [
              {
                "name": "阅读",
                "value": 12
              },
              {
                "name": "实作",
                "value": 24
              },
              {
                "name": "复习",
                "value": 18
              },
              {
                "name": "调试",
                "value": 31
              },
              {
                "name": "整理",
                "value": 22
              }
            ]
          }
        ]
      },
      "behavior": "cycle"
    }
  ]
};
export default async function run(){await mount(echarts,specification);}
本例需在 ECharts6.1.0 / Edge156.0.4314.58 / 自有同源数据与本地HTTP服务;实际程序化指针和动作 中运行,请复制源码、保存文件或下载工程包后在本地执行验证。
运行说明与环境独立工程

运行环境:ECharts6.1.0 / Edge156.0.4314.58 / 自有同源数据与本地HTTP服务;实际程序化指针和动作

入口文件:projects/echarts-lab/src/echarts-events.js

预期结果与验证条件观察提示
  • 对应变体真实运行;其数据、图元、事件或状态独立记录

请结合实际环境逐项观察。

附件与关联工程包下载

下载课程关联工程包:ECharts

课程关联工程包(登记关联12章) · 含当前章节或实例 · mbskycom202611a498.zip
SITE SEARCH

搜索教程、工具与资讯

热门搜索

JavaScriptJSON格式化正则表达式AI 编程AI 翻译AI导航专题标签
Esc 关闭

欢迎登录蓝色天空网

使用会员账号,继续你的学习