All Components

Diagram Overview

The Diagram represents information in a schematic way and according to particular visualization techniques.

The Diagram wrapper for Vue is a client-side wrapper for the Kendo UI Diagram widget.

Basic Usage

<div id="vueapp" class="vue-app">
    <kendo-hierarchicaldatasource ref="remoteDataSourceComponent"
                                  :data="diagramData"
                                  :schema-model-children="'items'">
    </kendo-hierarchicaldatasource>

    <kendo-diagram :data-source-ref="'remoteDataSourceComponent'"
                   :layout-type="'layered'"
                   :shape-defaults-visual="visualTemplate"
                   :connection-defaults-stroke-color="'#979797'"
                   :connection-defaults-stroke-width="2"
                   @kendowidgetready="kendowidgetready">
    </kendo-diagram>
</div>
Vue.use(DiagramInstaller);
Vue.use(DataSourceInstaller);

new Vue({
    el: '#vueapp',
    data: function() {
        return {
            diagramModel: {
                children: 'items'
            },
            diagramData: [{
                firstName: 'Antonio',
                lastName: 'Moreno',
                image: 'antonio.jpg',
                title: 'Team Lead',
                colorScheme: '#1696d3',
                items: [{
                    firstName: 'Elizabeth',
                    image: 'elizabeth.jpg',
                    lastName: 'Brown',
                    title: 'Design Lead',
                    colorScheme: '#ef6944',
                    items: [{
                        firstName: 'Ann',
                        lastName: 'Devon',
                        image: 'ann.jpg',
                        title: 'UI Designer',
                        colorScheme: '#ef6944'
                    }]
                }, {
                    firstName: 'Diego',
                    lastName: 'Roel',
                    image: 'diego.jpg',
                    title: 'QA Engineer',
                    colorScheme: '#ee587b',
                    items: [{
                        firstName: 'Fran',
                        lastName: 'Wilson',
                        image: 'fran.jpg',
                        title: 'QA Intern',
                        colorScheme: '#ee587b'
                    }]
                }, {
                    firstName: 'Felipe',
                    lastName: 'Izquiedro',
                    image: 'felipe.jpg',
                    title: 'Senior Developer',
                    colorScheme: '#75be16',
                    items: [{
                        firstName: 'Daniel',
                        lastName: 'Tonini',
                        image: 'daniel.jpg',
                        title: 'Developer',
                        colorScheme: '#75be16'
                    }]
                }]
            }]
        }
    },
    methods: {
        kendowidgetready: function (widget) {
            widget.bringIntoView(widget.shapes)
        },
        visualTemplate: function (options) {
            var dataviz = kendo.dataviz
            var g = new dataviz.diagram.Group()
            var dataItem = options.dataItem

            g.append(new dataviz.diagram.Rectangle({
                width: 210,
                height: 75,
                stroke: {
                    width: 0
                },
                fill: {
                    gradient: {
                    type: 'linear',
                    stops: [{
                        color: dataItem.colorScheme,
                        offset: 0,
                        opacity: 0.5
                    }, {
                        color: dataItem.colorScheme,
                        offset: 1,
                        opacity: 1
                    }]
                    }
                }
            }))

            g.append(new dataviz.diagram.TextBlock({
                text: dataItem.firstName + ' ' + dataItem.lastName,
                x: 85,
                y: 20,
                fill: '#fff'
            }))

            g.append(new dataviz.diagram.TextBlock({
                text: dataItem.title,
                x: 85,
                y: 40,
                fill: '#fff'
            }))

            g.append(new dataviz.diagram.Image({
                source: 'https://demos.telerik.com/kendo-ui/content/dataviz/diagram/people/' + dataItem.image,
                x: 3,
                y: 3,
                width: 68,
                height: 68
            }))

            return g
        }
    }
})

Installation

To initialize the Diagram, either:

Initializing with Webpack

  1. Install Kendo UI and add a theme.

    npm install --save @progress/kendo-ui
    npm install --save @progress/kendo-theme-default
  2. Install the Kendo UI Diagram package for Vue.

    npm install --save @progress/kendo-diagram-vue-wrapper
  3. Import the Kendo UI packages to the App component. If you use the Kendo UI components more than once in your application, add all Kendo UI-related files to the main.js file. If you use the Kendo UI components once in your application, add the Kendo UI-related files the component where they will be referred.

    import '@progress/kendo-ui'
    import '@progress/kendo-theme-default/dist/all.css'
    
    import { Diagram, DiagramInstaller } from '@progress/kendo-diagram-vue-wrapper'
    
    Vue.use(DiagramInstaller)
    
    new Vue({
       el: '#app',
       components: {
           Diagram
       }
    })

Functionality and Features

In this article