0.11.0 • Published 2 years ago

@tenrok/vue-ganttastic v0.11.0

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

vue-ganttastic

screenshot

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

Homepage

Homepage of the project

DEMO

Installation

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

npm install @tenrok/vue-ganttastic

Moment.js is a peer-dependency of Vue-Ganttastic. In order for Vue-Ganttastic to work correctly, you need to install it in your project:

npm install moment

Basic Usage

Import the components GGanttChart and GGanttRow. Use g-gantt-chart in your template, pass the desired chart start and chart end time as props (chart-start and chart-end) and add g-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

For more detailed information, such as how to style the bars or additional configuration options, please refer to the docs on the project's homepage (coming soon).

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

<template>
  ...

  <g-gantt-chart
    :chart-start="myChartStart"
    :chart-end="myChartEnd"
    day-format="dddd, DD. MMMM"
    precision="day"
    :is-magnetic="true"
    locale="en"
  >
    <g-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"
    />
  </g-gantt-chart>

  ...
</template>

<script>
  import { GGanttChart, GGanttRow } from '@tenrok/vue-ganttastic'

  export default {

    ...

    components: {
      GGanttChart,
      GGanttRow
    },

    data() {
      return {
        myChartStart: "2020-03-01 00:00",
        myChartEnd: "2020-03-03 00:00",
        rows: [
          {
            label: "My row #1",
            labelStyle: {
              justifyContent: "end"
            },
            bars: [
              {
                myStart: "2020-03-01 12:10",
                myEnd: "2020-03-01 16:35"
              }
            ]
          },
          {
            label: "My row #2",
            bars: [
              {
                myStart: "2020-03-02 01:00",
                myEnd: "2020-03-02 12:00"
              },
              {
                myStart: "2020-03-02 13:00",
                myEnd: "2020-03-02 22:00"
              }
            ]
          }
        ]
      }
    }

    ...

  }
</script>

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

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

Props

PropTypeDefaultDescription
allow-addBooleantrueallow to add new bar on double click
bar-config-keyStringganttBarConfig
bar-start-keyStringstartproperty name of the bar objects that represents the start datetime
bar-end-keyStringendproperty name of the bar objects that represents the end datetime
chart-start (required)String-format YYYY-MM-DD HH:mm
chart-end (required)String-format YYYY-MM-DD HH:mm
day-formatStringddd DD MMMM
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
highlighted-daysArray<String>[]format of day YYYY-MM-DD
highlighted-hoursArray<Number>[]
is-magneticBoolean-magnetic effect
localeStringenlocalization
min-gap-between-barsNumber0
month-formatStringMMMM YYYY
precisionStringmonthday, month
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-Ganttastic features can be played around with and tested out. Get it running using:
    npm run serve

Dependencies

Moment.js

License

MIT

0.10.18

3 years ago

0.10.19

3 years ago

0.11.0

2 years ago

0.10.20

2 years ago

0.10.21

2 years ago

0.10.22

2 years ago

0.10.14

3 years ago

0.10.15

3 years ago

0.10.16

3 years ago

0.10.17

3 years ago

0.10.13

3 years ago

0.10.12

3 years ago

0.10.11

3 years ago

0.10.10

3 years ago

0.10.9

3 years ago

0.10.8

3 years ago

0.10.7

3 years ago

0.10.6

3 years ago

0.10.5

3 years ago

0.10.4

3 years ago

0.10.3

3 years ago

0.10.2

3 years ago

0.10.1

3 years ago