1.1.0 • Published 5 years ago

vue-visjs-timeline v1.1.0

Weekly downloads
50
License
MIT
Repository
github
Last release
5 years ago

Vue-visjs-timeline

Vue component for the vis.js timeline module.

Installation

npm i -- save vue-visjs-timeline

Basic usage

Import and declare the component

import timeline from 'vue-visjs-timeline'
Vue.component('timeline', timeline)

Add the component in the template.

<template>
    <timeline v-bind:items="items" v-bind:groups="groups"></timeline>
</template>

Create items and groups data in the component.

export default {
	name: 'home-page',
	data() {
		return {
			groups: [
			    {id: 'a1', content:'Group one'},
			    {id: 'a2', content:'Group two'},
			    {id: 'a3', content:'Group three'}
			],
			items: [
			    {id: 'a1', content: 'Item one', group: 'Group one'},
			    {id: 'a2', content: 'Item two', group: 'Group two'},
			    {id: 'a3', content: 'Item three', group: 'Group three'}
			]
		}
	}
}

Styling

Custom CSS added to enhance the UI. Import custom CSS

require('../node_modules/vue-visjs-timeline/dist/vue-visjs-timeline.css')

Configure tools

Tools is group of options (Go today, Zoom in, Zoom out). Enabled by default. Add the configuration to disable.

<timeline v-bind:items="items" v-bind:groups="groups" :hide-tools=true></timeline>

Events

This event is triggered when item is moved or changed

<timeline v-bind:items="items" v-bind:groups="groups" v-on:item-move="updateItem"></timeline>

export default {
	name: 'home-page',
	methods: {
	    updateItem: function (item) {
	        // handle the event
	    }
	}
}

Supported events

Note: Only limited events are supported for now

EventsDescription
v-on:item-moveOn item position change
v-on:range-changedOn window zoom in/out or move

Supported props

Note: Only limited props are enabled

NameDescription
v-bind:itemsList of items
v-bind:groupsList of groups
v-bind:optionTimeline option (If not present default option is added)
v-bind:startWindow start (Timestamp/moment date)
v-bind:endWindow end (Timestamp/moment date)
:hideToolsForce tools to hide
1.1.0

5 years ago

1.0.9

5 years ago

1.0.8

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago