0.0.12 • Published 3 years ago

vue-uganttastic v0.0.12

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

Vue-UGanttastic

screenshot

A simple and easy-to-use Gantt chart component for Vue.js based on Vue-Ganttastic

Demo

Installation

You can install and use Vue-UGanttastic in your project using npm:

npm install vue-uganttastic

Basic Usage

Import the components UGanttChart and UGanttRow. Use u-gantt-chart in your template, pass the desired chart axis as prop (axis) and add u-gantt-rows to the default template slot. Pass an array containing your bar objects to every row using the bars prop, while specifying the name of the properties in your bar objects that stand for the bar start and bar end time using the props bar-start and bar-end

The following code showcases a simple usage example in a .vue SFC (Single File Component)

<template>
  ...

  <u-gantt-chart :axis="axis" :highlighted="highlighted" :is-magnetic="true">
    <u-gantt-row
      v-for="row in rows"
      :key="row.label"
      :label="row.label"
      :label-style="row.labelStyle"
      :bars="row.bars"
      bar-start="myStart"
      bar-end="myEnd"
    />
  </u-gantt-chart>

  ...
</template>

<script>
  import { UGanttChart, UGanttRow } from 'vue-uganttastic'

  export default {

    ...

    components: {
      UGanttChart,
      UGanttRow
    },

    data() {
      return {
        axis: [
          {
            key: 'day1',
            label: 'Day #1',
            units: 8,
          },
          {
            key: 'day2',
            label: 'Day #2',
            units: 8,
          },
          {
            key: 'day3',
            label: 'Day #3',
            units: 8,
          },
          {
            key: 'day4',
            label: 'Day #4',
            units: 8,
          },
          {
            key: 'day5',
            label: 'Day #5',
            units: 5,
          },
        ],
        highlighted: [7],
        rows: [
          {
            label: "My row #1",
            labelStyle: {
              justifyContent: "end"
            },
            bars: [
              {
                myStart: "day1, 1",
                myEnd: "day1, 3"
              }
            ]
          },
          {
            label: "My row #2",
            bars: [
              {
                myStart: "day2, 4",
                myEnd: "day2, 8"
              },
              {
                myStart: "day3, 9",
                myEnd: "day3, 12"
              }
            ]
          }
        ]
      }
    }

    ...

  }
</script>

<style lang="scss">
  @import '~vue-uganttastic/dist/vue-uganttastic.css';

  /* Custom */
  .u-grid-line-highlighted {
    background: #ffb0b0 !important;
  }
</style>

Props

PropTypeDefaultDescription
allow-addBooleantrueallow to add new bar on double click
axisArray<Object>[]axis
bar-config-keyStringconfig
bar-start-keyStringstartproperty name of the bar objects that represents the start units
bar-end-keyStringendproperty name of the bar objects that represents the end units
global-bundlesStringfixed
gridBooleanfalsehide/show grid
grid-sizeNumber30horizontal cell width in pixels
default-bar-lengthNumber1
heightString-the total height of the entire Vue-Ganttastic component
hide-timeaxisBooleanfalsehide timeaxis
highlightedArray<Number>[]
is-magneticBoolean-magnetic effect
min-gap-between-barsNumber0
no-tooltipBooleanfalsehide/show bar tooltip
push-on-overlapBoolean-
row-heightNumber40
row-label-widthNumber200label width in pixels
snap-back-on-overlapBoolean-
themeStringdefault
tooltip-formatString{start} - {end} duration: {duration}
widthString100%the total width of the entire Vue-Ganttastic component

Contributing

Pull requests are warmly welcomed, while every major change or proposal ought to be discussed in an issue first. As the project is still new, I will gladly accept suggestions, proposals, contributions etc.

Contributing - How to run the project

  1. Clone the project
  2. Install the Vue CLI service, if you don't already have it installed:
    npm install -g @vue/cli
  3. App.vue is a dedicated Vue SFC where all Vue-UGanttastic features can be played around with and tested out. Get it running using:
    npm run serve

License

MIT

0.0.10

3 years ago

0.0.11

3 years ago

0.0.12

3 years ago

0.0.3

3 years ago

0.0.9

3 years ago

0.0.8

3 years ago

0.0.5

3 years ago

0.0.4

3 years ago

0.0.7

3 years ago

0.0.6

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago