Table of Contents
What is mind mapping?
How to draw in F6
In Alipay
In WeChat
Welcome to discuss
Home WeChat Applet Mini Program Development What is a mind map? How to use F6 to draw a mind map in a mini program?

What is a mind map? How to use F6 to draw a mind map in a mini program?

Oct 18, 2021 am 11:26 AM
Applets mind Mapping

What is mind mapping? How to draw a mind map in a mini program? The following article will introduce to you how to use F6 to draw a mind map in a small program. I hope it will be helpful to you!

What is a mind map? How to use F6 to draw a mind map in a mini program?

What is mind mapping?

Mind Map (English: mind map), also known as Brain Map, Mind Map, Brainstorming Picture, Mind Map, Inspiration Trigger Map, Concept Map, or Thinking Map is a way to organize information using images. illustration. It uses a central keyword or idea to connect all representative words, ideas, tasks or other related items in a radiating line. It can use different methods to express people's ideas, such as quotation type, visible visualization type, construction system type and classification type. It is commonly used in research, organization, problem solving, and policy formulation. "Wikipedia"

Mind mapping is an auxiliary thinking tool proposed by Tony Buzan in the UK in the 1970s. With the target theme as the central node, the relationships are continuously extended outward, decomposed and explored, and finally a complete tree diagram is formed. From the perspective of the specific operation process, it can also be understood as a visualization of the exploration process, which completely records the results of each association. This form is more in line with people's way of thinking, and the final picture also gives us a more physical and overall understanding of the subject.

What is a mind map? How to use F6 to draw a mind map in a mini program?

Precisely because the focus of mind maps is thinking, and our normal activities are inseparable from thinking, mind maps have a very wide range of usage scenarios. Such as summary, report presentation, brainstorming, etc. To implement it, only pen and paper are enough. Of course, there are also a variety of online and independent applications that can support the production of diagrams. If our product needs to display multiple layers of related information around a topic, we can use a mind map. F6 can easily draw brain maps in small programs, such as the effect in the picture above. Students with related needs are worth a try. [Related learning recommendations: 小program development tutorial]

How to draw in F6

Demonstration examples can refer tof6.antv.vision/zh/docs/exa …The code in this section has been open sourced. If you are interested, you can check it out

In Alipay

First install

npm install @antv/f6 @antv/f6-alipay -S
Copy after login

data.js

export default {
  id: 'Modeling Methods',
  children: [
    {
      id: 'Classification',
      children: [
        {
          id: 'Logistic regression',
        },
        {
          id: 'Linear discriminant analysis',
        },
        {
          id: 'Rules',
        },
        {
          id: 'Decision trees',
        },
        {
          id: 'Naive Bayes',
        },
        {
          id: 'K nearest neighbor',
        },
        {
          id: 'Probabilistic neural network',
        },
        {
          id: 'Support vector machine',
        },
      ],
    },
    {
      id: 'Consensus',
      children: [
        {
          id: 'Models diversity',
          children: [
            {
              id: 'Different initializations',
            },
            {
              id: 'Different parameter choices',
            },
            {
              id: 'Different architectures',
            },
            {
              id: 'Different modeling methods',
            },
            {
              id: 'Different training sets',
            },
            {
              id: 'Different feature sets',
            },
          ],
        },
        {
          id: 'Methods',
          children: [
            {
              id: 'Classifier selection',
            },
            {
              id: 'Classifier fusion',
            },
          ],
        },
        {
          id: 'Common',
          children: [
            {
              id: 'Bagging',
            },
            {
              id: 'Boosting',
            },
            {
              id: 'AdaBoost',
            },
          ],
        },
      ],
    },
    {
      id: 'Regression',
      children: [
        {
          id: 'Multiple linear regression',
        },
        {
          id: 'Partial least squares',
        },
        {
          id: 'Multi-layer feedforward neural network',
        },
        {
          id: 'General regression neural network',
        },
        {
          id: 'Support vector regression',
        },
      ],
    },
  ],
};
Copy after login

index .json

{
  "defaultTitle": "mindMap",
  "usingComponents": {
    "f6-canvas": "@antv/f6-alipay/es/container/container"
  }
}
Copy after login

index.js

import F6 from '@antv/f6';
import TreeGraph from '@antv/f6/dist/extends/graph/treeGraph';
import { wrapContext } from '../../../common/utils/context';

import data from './data';

/**
 * 脑图-自节点自动两侧分布
 */

Page({
  canvas: null,
  ctx: null,
  renderer: '', // mini、mini-native等,F6需要,标记环境
  isCanvasInit: false, // canvas是否准备好了
  graph: null,

  data: {
    width: 375,
    height: 600,
    pixelRatio: 2,
    forceMini: false,
  },

  onLoad() {
    // 注册自定义树,节点等
    F6.registerGraph('TreeGraph', TreeGraph);

    // 同步获取window的宽高
    const { windowWidth, windowHeight, pixelRatio } = my.getSystemInfoSync();

    this.setData({
      width: windowWidth,
      height: windowHeight,
      pixelRatio,
    });
  },

  /**
   * 初始化cnavas回调,缓存获得的context
   * @param {*} ctx 绘图context
   * @param {*} rect 宽高信息
   * @param {*} canvas canvas对象,在render为mini时为null
   * @param {*} renderer 使用canvas 1.0还是canvas 2.0,mini | mini-native
   */
  handleInit(ctx, rect, canvas, renderer) {
    this.isCanvasInit = true;
    this.ctx = wrapContext(ctx);
    this.renderer = renderer;
    this.canvas = canvas;
    this.updateChart();
  },

  /**
   * canvas派发的事件,转派给graph实例
   */
  handleTouch(e) {
    this.graph && this.graph.emitEvent(e);
  },

  updateChart() {
    const { width, height, pixelRatio } = this.data;

    // 创建F6实例
    this.graph = new F6.TreeGraph({
      context: this.ctx,
      renderer: this.renderer,
      width,
      height,
      pixelRatio,
      fitView: true,
      modes: {
        default: [
          {
            type: 'collapse-expand',
            onChange: function onChange(item, collapsed) {
              const model = item.getModel();
              model.collapsed = collapsed;
              return true;
            },
          },
          'drag-canvas',
          'zoom-canvas',
        ],
      },
      defaultNode: {
        size: 26,
        anchorPoints: [
          [0, 0.5],
          [1, 0.5],
        ],
      },
      defaultEdge: {
        type: 'cubic-horizontal',
      },
      layout: {
        type: 'mindmap',
        direction: 'H',
        getHeight: function getHeight() {
          return 16;
        },
        getWidth: function getWidth() {
          return 16;
        },
        getVGap: function getVGap() {
          return 10;
        },
        getHGap: function getHGap() {
          return 50;
        },
      },
    });
    let centerX = 0;
    this.graph.node(function(node) {
      if (node.id === 'Modeling Methods') {
        centerX = node.x;
      }

      // position的取值(由于ESlint禁止嵌套的三元表达,所以单独提取出来写)
      let position_value = null;
      if (node.children && node.children.length > 0) {
        position_value = 'left';
      } else if (node.x > centerX) position_value = 'right';
      else position_value = 'left';

      return {
        label: node.id,
        labelCfg: {
          offset: 5,
          position: position_value,
        },
      };
    });

    this.graph.data(data);
    this.graph.render();
    this.graph.fitView();
  },
});
Copy after login

index.axml

<f6-canvas
  width="{{width}}"
  height="{{height}}"
  forceMini="{{forceMini}}"
  pixelRatio="{{pixelRatio}}"
  onTouchEvent="handleTouch"
  onInit="handleInit"
></f6-canvas>
Copy after login

In WeChat

First install

npm install @antv/f6-wx -S
Copy after login

@ antv/f6-wx Since WeChat is not very friendly to npm packages, we have repackaged @antv/f6-wx to help users simplify operations.

data.js Same as above

index.json

{
  "defaultTitle": "脑图",
  "usingComponents": {
    "f6-canvas": "@antv/f6-wx/canvas/canvas"
  }
}
Copy after login

index.wxml

<f6-canvas
  width="{{width}}"
  height="{{height}}"
  forceMini="{{forceMini}}"
  pixelRatio="{{pixelRatio}}"
  bind:onTouchEvent="handleTouch"
  bind:onInit="handleInit"
></f6-canvas>
Copy after login

index.js

import F6 from &#39;@antv/f6-wx&#39;;
import TreeGraph from &#39;@antv/f6-wx/extends/graph/treeGraph&#39;;


import data from &#39;./data&#39;;

/**
 * 脑图-自节点自动两侧分布
 */

Page({
  canvas: null,
  ctx: null,
  renderer: &#39;&#39;, // mini、mini-native等,F6需要,标记环境
  isCanvasInit: false, // canvas是否准备好了
  graph: null,

  data: {
    width: 375,
    height: 600,
    pixelRatio: 1,
    forceMini: false,
  },

  onLoad() {
    // 注册自定义树,节点等
    F6.registerGraph(&#39;TreeGraph&#39;, TreeGraph);

    // 同步获取window的宽高
    const { windowWidth, windowHeight, pixelRatio } = wx.getSystemInfoSync();

    this.setData({
      width: windowWidth,
      height: windowHeight,
      // pixelRatio,
    });
  },

  /**
   * 初始化cnavas回调,缓存获得的context
   * @param {*} ctx 绘图context
   * @param {*} rect 宽高信息
   * @param {*} canvas canvas对象,在render为mini时为null
   * @param {*} renderer 使用canvas 1.0还是canvas 2.0,mini | mini-native
   */
  handleInit(event) {
    const {ctx, rect, canvas, renderer} = event.detail
    this.isCanvasInit = true;
    this.ctx = ctx;
    this.renderer = renderer;
    this.canvas = canvas;
    this.updateChart();
  },

  /**
   * canvas派发的事件,转派给graph实例
   */
  handleTouch(e) {
    this.graph && this.graph.emitEvent(e.detail);
  },

  updateChart() {
    const { width, height, pixelRatio } = this.data;

    // 创建F6实例
    this.graph = new F6.TreeGraph({
      context: this.ctx,
      renderer: this.renderer,
      width,
      height,
      pixelRatio,
      fitView: true,
      modes: {
        default: [
          {
            type: &#39;collapse-expand&#39;,
            onChange: function onChange(item, collapsed) {
              const model = item.getModel();
              model.collapsed = collapsed;
              return true;
            },
          },
          &#39;drag-canvas&#39;,
          &#39;zoom-canvas&#39;,
        ],
      },
      defaultNode: {
        size: 26,
        anchorPoints: [
          [0, 0.5],
          [1, 0.5],
        ],
      },
      defaultEdge: {
        type: &#39;cubic-horizontal&#39;,
      },
      layout: {
        type: &#39;mindmap&#39;,
        direction: &#39;H&#39;,
        getHeight: function getHeight() {
          return 16;
        },
        getWidth: function getWidth() {
          return 16;
        },
        getVGap: function getVGap() {
          return 10;
        },
        getHGap: function getHGap() {
          return 50;
        },
      },
    });
    let centerX = 0;
    this.graph.node(function(node) {
      if (node.id === &#39;Modeling Methods&#39;) {
        centerX = node.x;
      }

      // position的取值(由于ESlint禁止嵌套的三元表达,所以单独提取出来写)
      let position_value = null;
      if (node.children && node.children.length > 0) {
        position_value = &#39;left&#39;;
      } else if (node.x > centerX) position_value = &#39;right&#39;;
      else position_value = &#39;left&#39;;

      return {
        label: node.id,
        labelCfg: {
          offset: 5,
          position: position_value,
        },
      };
    });

    this.graph.data(data);
    this.graph.render();
    this.graph.fitView();
  },
});
Copy after login

Welcome to discuss

For mind maps, If you are interested in graph visualization, you can add my WeChat number openwayne to join our WeChat group discussion.

For more programming-related knowledge, please visit: Introduction to Programming! !

The above is the detailed content of What is a mind map? How to use F6 to draw a mind map in a mini program?. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to use word to make a mind map - How to use word to make a mind map How to use word to make a mind map - How to use word to make a mind map Mar 05, 2024 pm 08:22 PM

Many friends still don’t know how to use word to make mind maps, so the editor below will explain how to use word to make mind maps. If you are in need, please take a look. I believe it will be helpful to everyone. . Step 1: First open Word, click Insert in the menu bar (as shown in the picture). Step 2: Click the shape icon (as shown in the picture). Step 3: Click on the rounded rectangle (as shown in the picture). Step 4: Draw a suitable rounded rectangle in the document (as shown in the picture). Step 5: In the shape, click to select the curve connector icon (as shown in the picture). Step 6: Use curve connectors to connect the rounded rectangles (as shown in the picture). Step 7: Click to select the rounded rectangle, enter text, and a mind map will be drawn (such as

Develop WeChat applet using Python Develop WeChat applet using Python Jun 17, 2023 pm 06:34 PM

With the popularity of mobile Internet technology and smartphones, WeChat has become an indispensable application in people's lives. WeChat mini programs allow people to directly use mini programs to solve some simple needs without downloading and installing applications. This article will introduce how to use Python to develop WeChat applet. 1. Preparation Before using Python to develop WeChat applet, you need to install the relevant Python library. It is recommended to use the two libraries wxpy and itchat here. wxpy is a WeChat machine

How to draw a mind map How to draw a mind map using WPS software How to draw a mind map How to draw a mind map using WPS software Feb 22, 2024 pm 03:04 PM

Find the insert in the WPS software and click on the mind map to draw it. Analysis 1. Open the WPS mobile software and go to the homepage, click Insert above, and then click Mind Map. 2. The panel will pop up, and then click the New Blank Mind Map option above. 33Finally, draw the mind map on the page and click Insert to display it. Supplement: What is a mind map tool? 1 Mind map, also known as mind map, is an effective graphical innovative thinking tool for expressing divergent thinking. It is simple but very effective and at the same time very efficient. It is an application innovative thinking tools. Summary/Notes When creating a mind map, the connection between core themes and core graphics is crucial. The close connection between them helps promote the fluency and logic of thinking

Can small programs use react? Can small programs use react? Dec 29, 2022 am 11:06 AM

Mini programs can use react. How to use it: 1. Implement a renderer based on "react-reconciler" and generate a DSL; 2. Create a mini program component to parse and render DSL; 3. Install npm and execute the developer Build npm in the tool; 4. Introduce the package into your own page, and then use the API to complete the development.

Implement card flipping effects in WeChat mini programs Implement card flipping effects in WeChat mini programs Nov 21, 2023 am 10:55 AM

Implementing card flipping effects in WeChat mini programs In WeChat mini programs, implementing card flipping effects is a common animation effect that can improve user experience and the attractiveness of interface interactions. The following will introduce in detail how to implement the special effect of card flipping in the WeChat applet and provide relevant code examples. First, you need to define two card elements in the page layout file of the mini program, one for displaying the front content and one for displaying the back content. The specific sample code is as follows: &lt;!--index.wxml--&gt;&l

Alipay launched the 'Chinese Character Picking-Rare Characters' mini program to collect and supplement the rare character library Alipay launched the 'Chinese Character Picking-Rare Characters' mini program to collect and supplement the rare character library Oct 31, 2023 pm 09:25 PM

According to news from this site on October 31, on May 27 this year, Ant Group announced the launch of the "Chinese Character Picking Project", and recently ushered in new progress: Alipay launched the "Chinese Character Picking-Uncommon Characters" mini program to collect collections from the society Rare characters supplement the rare character library and provide different input experiences for rare characters to help improve the rare character input method in Alipay. Currently, users can enter the "Uncommon Characters" applet by searching for keywords such as "Chinese character pick-up" and "rare characters". In the mini program, users can submit pictures of rare characters that have not been recognized and entered by the system. After confirmation, Alipay engineers will make additional entries into the font library. This website noticed that users can also experience the latest word-splitting input method in the mini program. This input method is designed for rare words with unclear pronunciation. User dismantling

How uniapp achieves rapid conversion between mini programs and H5 How uniapp achieves rapid conversion between mini programs and H5 Oct 20, 2023 pm 02:12 PM

How uniapp can achieve rapid conversion between mini programs and H5 requires specific code examples. In recent years, with the development of the mobile Internet and the popularity of smartphones, mini programs and H5 have become indispensable application forms. As a cross-platform development framework, uniapp can quickly realize the conversion between small programs and H5 based on a set of codes, greatly improving development efficiency. This article will introduce how uniapp can achieve rapid conversion between mini programs and H5, and give specific code examples. 1. Introduction to uniapp unia

Mind map of Python syntax: in-depth understanding of code structure Mind map of Python syntax: in-depth understanding of code structure Feb 21, 2024 am 09:00 AM

Python is widely used in a wide range of fields with its simple and easy-to-read syntax. It is crucial to master the basic structure of Python syntax, both to improve programming efficiency and to gain a deep understanding of how the code works. To this end, this article provides a comprehensive mind map detailing various aspects of Python syntax. Variables and Data Types Variables are containers used to store data in Python. The mind map shows common Python data types, including integers, floating point numbers, strings, Boolean values, and lists. Each data type has its own characteristics and operation methods. Operators Operators are used to perform various operations on data types. The mind map covers the different operator types in Python, such as arithmetic operators, ratio

See all articles