Giter Club home page Giter Club logo

vue-orgchart's Introduction

OrgChart

Foreword

  • First of all, thanks a lot for wesnolte's great work:blush: -- jOrgChart. The thought that using nested tables to build out the tree-like orgonization chart is amazing. This idea is more simple and direct than its counterparts based on svg
  • Unfortunately, it's long time not to see the update of jOrgChart. on the other hand, I got some interesting ideas to add, so I choose to create a new repo.

Features

  • For now, just static organization chart

Installation

npm install vue-organization-chart -S

Usage

<template>
  <div>
    <organization-chart :datasource="ds"></organization-chart>
  </div>
</template>

<script>
  import Vue from 'vue'
  import OrganizationChart from 'vue-organization-chart'
  import 'vue-organization-chart/dist/orgchart.css'

  export default {
    components: {
      OrganizationChart
    },
    data () {
      return {
        ds: {
          'id': '1',
          'name': 'Lao Lao',
          'title': 'general manager',
          'children': [
            { 'id': '2', 'name': 'Bo Miao', 'title': 'department manager' },
            { 'id': '3', 'name': 'Su Miao', 'title': 'department manager',
              'children': [
                { 'id': '4', 'name': 'Tie Hua', 'title': 'senior engineer' },
                { 'id': '5', 'name': 'Hei Hei', 'title': 'senior engineer',
                  'children': [
                    { 'id': '6', 'name': 'Pang Pang', 'title': 'engineer' },
                    { 'id': '7', 'name': 'Xiang Xiang', 'title': 'UE engineer' }
                  ]
                 }
               ]
             },
            { 'id': '8', 'name': 'Hong Miao', 'title': 'department manager' },
            { 'id': '9', 'name': 'Chun Miao', 'title': 'department manager' }
          ]
        }
      }
    }
  }
</script>

Attributes

NameTypeRequiredDefaultDescription
datasourcejsonyesdatasource usded to build out structure of orgchart. It could be a json object.
panbooleannofalseUsers could pan the orgchart by mouse drag&drop if they enable this attribute.
zoombooleannofalseUsers could zoomin/zoomout the orgchart by mouse wheel if they enable this attribute.
zoomin-limitnumberno7Users are allowed to set a zoom-in limit.
zoomout-limitnumberno0.5Users are allowed to set a zoom-out limit.

Events

NameParametersDescription
node-clicknode datatriggers when user clicks the node.

Scoped Slots

<template slot-scope="{ nodeData }">
  <!-- feel free to customize the internal structure of node -->
</template>

vue-orgchart's People

Contributors

dabeng avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vue-orgchart's Issues

OrgChart Container Height

how i can set the height of orgchart container ?

.orgchart-container {
  position: relative;
  display: inline-block;
  height: 420px;
  width: calc(100% - 24px);
  border: 2px dashed #aaa;
  border-radius: 5px;
  overflow: auto;
  text-align: center;
}

Support for customizing only the children's node

Hello @dabeng, thank you very much for the awesome project.

I want to customize the contents only for the children's nodes, not the parent node.
I got great help from here. But the problem with that solution is if I add some custom fields, they appear in all nodes, including the parent node.
However, I just want to add some fields, for example, a submit button to only children's nodes.
Is there any way how can I achieve this?

From the image below, you can see that I have an additional attribute "Submit" (shown in the red box).
I achieved this by adding an extra attribute to the children. But, the problem with that is if I apply CSS style (padding), it also appears in the parent node.
any help to fix this?
Thanking in advance.

image

schedule

Good luck with your new project!
Can you provide a schedule for the project? I was waiting a long time to use org chart with Vue.
Thank you!

Support multiple parent

image

Could you support multiple parent as jquery orgchart does, so that we can make things like image above.

Export to JSON and to Image

Hi @dabeng, I'm a bit newbie to Vue, but I find a great potential of your project to my side project.
How can I create an export to JSON and export to image buttons? Is it possible to have a exposed function?
If it is not implemented yet, are you going to implement it for your next release?

Thank you so much

Zoom and pan on touch devices

Hi, first of all thank you .
I'm on Nuxt and the chart works fine in desktop but it will not be zoomed or panned in touch devices. The pinch gesture zoom-in/zoom-out the whole page!

Draggable

The underlying OrgChart object (looking at your ES6 examples) seems to support some basic ability to drag nodes to reorder the org chart, but I don't see how to do that in the Vue version. is this supported?

Providing examples

Congrats on your release.
Can you please provide some basic examples? For example how can I zoom and pan, insert data and so on.

Unable to export chart

Hi, I am not able to use the export chart functionality. I noticed it is available in the jQuery version but dont seem to find it in the Vue version.

List of available options

Hi @dabeng, Which of the following options are available on your Vue orgchart project? (I took it from your other orgchart project).

Thanks!

image

BUG: Zoom on center instead on current mouse position

Hi,

while using your plugin for org chart (which is BTW amazing thanks a lot), I noticed that when you apply the zoom function on the chart you only watch and change the matrix scale property and the translationX and Y stays 0. This leads to constantly zooming to center of the div and not on the current mouse position. Also when zooming is enabled you should set overflow from auto to hidden to prevent collision between scroll and zoom on mouse wheel. Solution is that you track where is the current mouse position on x and y and than subtract the offset of the div x an y, so your mouse position does not move while zooming in. This value is then inserted in last 2 parameters of matrix and the problem should be solved.

Thanks again for amazing plugin and keep up the good work :) .

Define position of node (right/left)

I am curently using your vueorgchart in my mlm (binary system) project. However I cannot find solution on how can I customize the positioning of node. E. G left or right. I read the slot-scope on template but not able to implement positioning.

Adding basic props

Hello @dabeng, I though of using this project in another project I need to create for my University (it must be in Vue so I can't use your other projects).
Problem is, that I need to implement it until the end of January and I saw that the only available prop is "datasource". I will be really glad to use the basic props that the JQuery project has (like createNode, direction and pan).
Are you planning to release those features on the next 1-2 weeks? it would really help me out because there is no good Vue projects which handles with tree charts.

Best regards,
Tom

Adding basic chart features

Hi @dabeng, I came across with your project by accident. My team and I were looking for a Vue project that could create a tree chart out of the JSON data. I though that your project could help us, but I saw that it leaks some basic features that your jQuery project has (like pan, export and so on). Are you planning to add those features soon? If so, when? If not, do you have any other suggestions for Vue?

Thank you for all the hard work,
Richard

TMS4422 - jQuery HTML Injection Weakness

Hi we found this injection weakness.

TMS4422 - jQuery HTML Injection Weakness

  • js/chunk-.....js file

Could you update vue-orgchar's jquery to latest version in order to solve this weakness?

Thanks.

Feature: Option to draw chart horizontally

Since the node templates are wider than they are tall, it would present a more compact chart it one were able to have it be drawn horizontally , like the following. (I'm using the Vue component)

  = b
a
  = c

vue 3 Cannot read property '_c' of undefined

orgchart.umd.min.js?e0d6:1 Uncaught (in promise) TypeError: Cannot read property '_c' of undefined
at Proxy.i (orgchart.umd.min.js?e0d6:1)
at renderComponentRoot (runtime-core.esm-bundler.js?5c40:1168)
at componentEffect (runtime-core.esm-bundler.js?5c40:5214)
at reactiveEffect (reactivity.esm-bundler.js?a1e9:42)
at effect (reactivity.esm-bundler.js?a1e9:17)
at setupRenderEffect (runtime-core.esm-bundler.js?5c40:5167)
at mountComponent (runtime-core.esm-bundler.js?5c40:5126)
at processComponent (runtime-core.esm-bundler.js?5c40:5084)
at patch (runtime-core.esm-bundler.js?5c40:4690)
at mountChildren (runtime-core.esm-bundler.js?5c40:4874)

Virtual DOM mismatching

When I tested default configuration of this component (without changes) I have received Vue warning:

screen shot 2019-03-05 at 13 08 06

Looks like some problems with tables you used for chart nodes creation.

Thank you for your help!

ISSUE IN FILTERING THE NODE

When I am trying to filter the nodes into parent and three children such that the lines will be shown. The lines are not appearing .Don't know why.
image
@dabeng

Node customization example

Could you provide a complete example, how can I customize nodes. Add image to the node for example. Thanks!

Zoom with mouse

Hey there. First a quick thank you for this great library.
I just find the mouse zoom a big annoying. It only zoom in and out from the center of the box.
Can it be zoom from where the mousse is positioned? This will avoid getting the box out of sight
Thanks
Alex.

Feature - Dynamic datasource objects

What if my databases data is not structured like the original { title, name, children } object? is there anyway to make those keys dynamic, eg :keys=[text, description, nodes, icon]

Pan to location of a node

Is there any way to programmatically pan to the location of a node?

For example, if the orgchart becomes really wide we may want to pan to the top-most node so that it appears on screen. Or, we might want to have a side menu that lists items from the current 'node levels deep' which, when selected, jumps to the location of that node in the orgchart.

I have attempted this myself, but I am unable to figure it out - I've dived into grabbing what I can with document.getElementsByClassName("orgchart") but this hasn't worked for me - it's probably not ideal to be trying to go through the DOM anyway.

[Mobile] Zoom and Pan Support

@dabeng Thanks you very much for your effort to create this library. Do you have a plan to support mobile multi-touch to zoom and also touch slide left/right to pan the chart.

PS. I would like to help enhance in my free time, if you ok with that.

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.