Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ha-chart

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ha-chart

beautiful auto layout flowchart

  • 0.0.1
  • latest
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Hachart

HaHa, this is a flowchart generator.

online edit website

example

install

npm install ha-chart --save

quick start

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>flow-draw</title>
  </head>
  <body>
    <div id="container"></div>
  </body>
</html>
const {compiler, layout, Container} = require('Hachart')

const code = `
type CondStyle struct{
  "extend": "deafultShape",
  "fill": "#fcb738"
}

def start("action")
  () -> cond
end

def cond:CondStyle("is 10?")
  ("yes") -> step1
  ("no") -> step2
end

def step1("step 1")
end

def step2("step 2")
end
`

const output = layout(compiler(code))
const container = new Container({containerID: "container"})
container.draw(output)

example

API

compiler(code, options)

code

//create new style, you can extends default style to create new style
type style struct{
  "extend": "deafultShape",
  "fill": "#fcb738"
}

// create a chart
def name:style("string")
  () -> nextShape
end

options

you can change the default style at compiler code using options.

{
  type: {
    deafultShape: {
      fill: '#3ab882',
      cornerRadius: 10,
      maxWidth: 180,
      fontType: {
        fontSize: 16,
        fontFamily: 'Calibri',
        padding: 20,
        fill: '#fff',
        fontStyle: 'bold',
        align: 'center'
      }
    },
    defaultAnnotation: {
      fill: '#fff',
      fontType: {
        fontSize: 16,
        fontFamily: 'Calibri',
        padding: 5,
        fill: '#8699a3',
        fontStyle: 'bold',
        align: 'center'
      }
    },
    defaultFontType: {
      'fontSize': 16,
      'fontFamily': 'Calibri',
      'fill': '#fff',
      'fontStyle': 'bold',
      'align': 'center',
      'padding': 20
    },
    defaultArrow: {
      stroke: '#8699a3',
      strokeWidth: 3,
      lineCap: 'round',
      lineJoin: 'round'
    }
  }
}

layout(input, options)

input

const input = compiler(code)

options

namedefaultValuedescription
rankdirTBDirection for rank nodes. Can be TB, BT, LR, or RL, where T = top, B = bottom, L = left, and R = right.
alignTBAlignment for rank nodes. Can be UL, UR, DL, or DR, where U = up, D = down, L = left, and R = right.
nodesep50Number of pixels that separate nodes horizontally in the layout.
edgesep10Number of pixels that separate edges horizontally in the layout.
ranksep50Number of pixels between each rank in the layout.
marginx0Number of pixels to use as a margin around the left and right of the graph.
marginy0Number of pixels to use as a margin around the top and bottom of the graph.
acyclicerundefinedIf set to greedy, uses a greedy heuristic for finding a feedback arc set for a graph. A feedback arc set is a set of edges that can be removed to make a graph acyclic.
rankernetwork-simplexType of algorithm to assigns a rank to each node in the input graph. Possible values: network-simplex, tight-tree or longest-path

Container

constructor({containerID: "string"})

containerID: the id of document node.

draw(input)

draw the compiler code

Keywords

FAQs

Package last updated on 05 Jul 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc