GithubHelp home page GithubHelp logo

defect / vizceral Goto Github PK

View Code? Open in Web Editor NEW

This project forked from netflix/vizceral

0.0 3.0 0.0 1.2 MB

WebGL component for displaying animated traffic graphs

License: Apache License 2.0

JavaScript 100.00%

vizceral's Introduction

vizceral

vizceral is a component for displaying traffic data on a webgl canvas. If a graph of nodes and edges with data about traffic volume is provided, it will render a traffic graph animating the connection volume between nodes.

This component can take multiple traffic graphs and will generate a 'global' graph showing all incoming traffic into each of the 'regions', with support for cross-region traffic.

There are three levels of information, global, regional, and service-level, with clicking or double-clicking on a node bringing you one level deeper.

Using

If you are using either React or web components, there are some helper modules that make it easier to get started:

There is an example app using the react wrapper with some sample data to show how the component works. It would also be an easy jumping off point for building your own UI.

Otherwise, to integrate it from scratch:

  1. Add vizceral to package.json

    npm install vizceral --save
  2. Start using the component

    import Vizceral from 'vizceral';
    const viz = new Vizceral();
    
    // Add event handlers for the vizceral events
    viz.on('viewChanged', view => {});
    viz.on('nodeHighlighted', node => {});
    viz.on('rendered', data => {});
    viz.on('nodeContextSizeChanged', dimensions => {});
    
    // Sample data
    viz.updateData({
      name: 'us-west-2',
      renderer: 'global',
      nodes: [
        {name: 'INTERNET'},
        {name: 'service'}
      ],
      connections: [
        {
          source: 'INTERNET',
          target: 'service',
          metrics: { normal: 100, warning: 95, danger: 5 },
          metadata: { streaming: true }
        }
      ]
    });
    viz.setView();
    viz.animate();

Note: The component will not show anything unless you call updateData on the component with relevant traffic data.

Data Structures

See DATAFORMATS.md for example data in the format expected by the component.

Styling

The component uses a map of variables to set all the styles. You may override any number of the default styles. The following example shows all the styles that are used in the component.

import Vizceral from 'vizceral';
const vizceral = new Vizceral();
vizceral.updateStyles({
  colorText: 'rgb(214, 214, 214)',
  colorTextDisabled: 'rgb(129, 129, 129)',
  colorTraffic: {
    normal: 'rgb(186, 213, 237)',
    normalDonut: 'rgb(91, 91, 91)',
    warning: 'rgb(268, 185, 73)',
    danger: 'rgb(184, 36, 36)',
  },
  colorNormalDimmed: 'rgb(101, 117, 128)',
  colorBackgroundDark: 'rgb(35, 35, 35)',
  colorLabelBorder: 'rgb(16, 17, 18)',
  colorLabelText: 'rgb(0, 0, 0)',
  colorDonutInternalColor: 'rgb(35, 35, 35)',
  colorDonutInternalColorHighlighted: 'rgb(255, 255, 255)',
  colorConnectionLine: 'rgb(91, 91, 91)',
  colorPageBackground: 'rgb(45, 45, 45)',
  colorPageBackgroundTransparent: 'rgba(45, 45, 45, 0)',
  colorBorderLines: 'rgb(137, 137, 137)',
  colorArcBackground: 'rgb(60, 60, 60)'
});

Since the main underlying rendering is done via three.js, the component needed an easy way to use the same values for CSS and JS variables.

Notices

Vizceral supports showing notices on connections and nodes. If you want to use this feature, a DOM element with a class of vizceral-notice will have to be provided as a sibling to the vizceral canvas.

API

View USAGE.md

Developing Locally

To see your changes to vizceral locally, you'll need to link the package with bower:

$ git clone [email protected]:Netflix/vizceral.git
$ cd vizceral
$ npm link
$ npm run dev
$ cd /path/to/project-using-vizceral
$ npm link vizceral

Contributing

  1. Clone this repo
  2. Create a branch: git checkout -b your-feature
  3. Make some changes
  4. Test your changes by running your local version
  5. Push your branch and open a Pull Request

Supported Browsers

Currently only developing with Chrome in mind. Seems to work in Safari and Firefox, but more testing is needed.

TODO

  • Unit Tests
  • Modular layout algorithms
    • Smarter current layout algorithm
  • Cross-browser support / testing
  • Create predefined locations and design styles to modularly represent custom metadata
  • Implement redesigned third-level view

License

Code released under the Apache 2.0 license.

vizceral's People

Contributors

deejay1 avatar jrsquared avatar

Watchers

 avatar  avatar  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.