Giter Site home page Giter Site logo

weiqingtangx / f6 Goto Github PK

View Code? Open in Web Editor NEW

This project forked from antvis/f6

0.0 0.0 0.0 22.98 MB

F6 is a graph visualization engine which provides quick and smooth operations on mobile devices.

Home Page: https://f6.antv.vision

License: MIT License

Shell 0.01% JavaScript 89.80% Python 0.01% TypeScript 10.11% CSS 0.01% HTML 0.01% Vue 0.04% Less 0.01% SCSS 0.01%

f6's Introduction

F6: A Mobile Graph Visualization Framework in TypeScript.

typescript MIT npm package NPM downloads Percentage of issues still open

English | 简体中文

What is F6

F6 is a mobile graph visualization engine, which provides a set of basic mechanisms, including rendering, layout, analysis, interaction, animation, and other auxiliary tools. F6 aims to simplify the relationships, and help people to obtain the insight of relational data.

Developers are able to build graph visualization analysis applications or graph visualization modeling applications easily.

Powerful Animation and Interactions

Features

  • Abundant Built-in Items: Nodes and edges with free configurations;
  • Steerable Interactions: More than 10 basic interaction behaviors ;
  • Powerful Layout: More than 10 layout algorithms;
  • Convenient Components: Outstanding ability and performance;
  • Friendly User Experience: Complete documents for different levels of user requirements. TypeScript supported.

F6 concentrates on the principle of 'good by default'. In addition, the custom mechanism of the item, interation behavior, and layout satisfies the customazation requirements.

Abundant Built-in Items

Installation

$ npm install @antv/f6

Usage

import F6 from "@antv/f6";
import graphData from "./data";
import dagreLayout from "@antv/f6/dist/extends/layout/dagreLayout";
import TreeGraph from "@antv/f6/dist/extends/graph/treeGraph";

F6.registerLayout("dagreLayout", dagreLayout);
F6.registerGraph("TreeGraph", TreeGraph);

Page({
  data: {
    width: 300,
    height: 400,
    pixelRatio: 1,
  },
  onLoad() {
    const { windowWidth, windowHeight, pixelRatio } = my.getSystemInfoSync();
    this.setData({
      width: windowWidth,
      height: windowHeight,
      pixelRatio: pixelRatio,
    });
  },
  onCanvasInit(ctx, rect, canvas, renderer) {
    this.graph = new F6.TreeGraph({
      context: ctx,
      renderer,
      width: this.data.width,
      height: this.data.height,
      linkCenter: true,
      modes: {
        default: ["drag-canvas", "zoom-canvas"],
      },
      defaultNode: {
        size: 40,
      },
      layout: {
        type: "compactBox",
        direction: "RL",
        getId: function getId(d) {
          return d.id;
        },
        getHeight: () => {
          return 26;
        },
        getWidth: () => {
          return 26;
        },
        getVGap: () => {
          return 20;
        },
        getHGap: () => {
          return 30;
        },
        radial: false,
      },
    });

    this.graph.node(function (node) {
      return {
        label: node.id,
      };
    });

    this.graph.data(graphData);
    this.graph.render();
    this.graph.fitView();
  },
  onTouch(e) {
    this.graph.emitEvent(e);
  },
  onUnload() {
    this.graph?.destroy();
  },
});

For more information of the usage, please refer to Getting Started.

Development

$ npm install -g @microsoft/rush

# update dependencies
$ rush update

# build the packages
$ rush build

# demo
$ cd packages/f6 && rushx storybook

Documents

How to Contribute

Please let us know what you are you going to help. Do check out issues for bug reports or suggestions first.

To become a contributor, please follow our contributing guide.

License

MIT license.

f6's People

Contributors

openwayne avatar icmi avatar fantasista11 avatar hungwii avatar chenpeng-yiyu avatar tangying1027 avatar chiaweilee avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.