Skip to content

Commit 328e6a0

Browse files
author
alansangeeths
authored
Merge pull request #1 from vinoth-Kumar-S/master
Adding Vue Gantt Exporting sample
2 parents 45e3959 + 44265ef commit 328e6a0

File tree

12 files changed

+460
-1
lines changed

12 files changed

+460
-1
lines changed

README.md

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,23 @@
1-
# exporting-vue-gantt-chart-with-complete-customization
1+
# Exporting Vue Gantt Chart with Complete Customization
2+
23
A quick start Vue project that helps you export a Gantt Chart to PDF and Excel formats. This project also contains a code snippet to customize the documents before exporting it.
4+
5+
Refer to the link to know about exporting Gantt chart as PDF:
6+
https://ej2.syncfusion.com/vue/documentation/gantt/pdf-export/pdf-export
7+
8+
Refer to the link to know about exporting Gantt chart to Excel:
9+
https://ej2.syncfusion.com/vue/documentation/gantt/excel-export/excel-export
10+
11+
Check out online examples of exporting in the Vue Gantt Chart component:
12+
https://ej2.syncfusion.com/vue/demos/#/bootstrap5/gantt/exporting.html
13+
14+
Refer to the Syncfusion Vue Gantt Chart Getting Started video:
15+
https://www.youtube.com/watch?v=S1GbWmVcre0
16+
17+
## Project prerequisites
18+
19+
Make sure that you have the latest versions of Vue, Node, Vue Class Component, and Visual Studio Code in your machine before starting to work on this project.
20+
21+
### How to run this application?
22+
23+
To run this application, you need to clone the `exporting-vue-gantt-chart-with-complete-customization` repository and then open it in Visual Studio Code. Now, simply install all the necessary react packages into your current project using the `npm install` command and run your project using the `npm run serve` command.

babel.config.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module.exports = {
2+
presets: [
3+
'@vue/cli-plugin-babel/preset'
4+
]
5+
}

jsconfig.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"compilerOptions": {
3+
"target": "es5",
4+
"module": "esnext",
5+
"baseUrl": "./",
6+
"moduleResolution": "node",
7+
"paths": {
8+
"@/*": [
9+
"src/*"
10+
]
11+
},
12+
"lib": [
13+
"esnext",
14+
"dom",
15+
"dom.iterable",
16+
"scripthost"
17+
]
18+
}
19+
}

package.json

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
{
2+
"name": "myvueproject",
3+
"version": "0.1.0",
4+
"private": true,
5+
"scripts": {
6+
"serve": "vue-cli-service serve",
7+
"build": "vue-cli-service build",
8+
"lint": "vue-cli-service lint"
9+
},
10+
"dependencies": {
11+
"@syncfusion/ej2-vue-buttons": "^21.2.3",
12+
"@syncfusion/ej2-vue-gantt": "^21.1.38",
13+
"core-js": "^3.8.3",
14+
"vue": "^3.2.13"
15+
},
16+
"devDependencies": {
17+
"@babel/core": "^7.12.16",
18+
"@babel/eslint-parser": "^7.12.16",
19+
"@vue/cli-plugin-babel": "~5.0.0",
20+
"@vue/cli-plugin-eslint": "~5.0.0",
21+
"@vue/cli-service": "~5.0.0",
22+
"eslint": "^7.32.0",
23+
"eslint-plugin-vue": "^8.0.3"
24+
},
25+
"eslintConfig": {
26+
"root": true,
27+
"env": {
28+
"node": true
29+
},
30+
"extends": [
31+
"plugin:vue/vue3-essential",
32+
"eslint:recommended"
33+
],
34+
"parserOptions": {
35+
"parser": "@babel/eslint-parser"
36+
},
37+
"rules": {}
38+
},
39+
"browserslist": [
40+
"> 1%",
41+
"last 2 versions",
42+
"not dead",
43+
"not ie 11"
44+
]
45+
}

public/favicon.ico

4.19 KB
Binary file not shown.

public/index.html

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<!DOCTYPE html>
2+
<html lang="">
3+
<head>
4+
<meta charset="utf-8">
5+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
6+
<meta name="viewport" content="width=device-width,initial-scale=1.0">
7+
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
8+
<title><%= htmlWebpackPlugin.options.title %></title>
9+
</head>
10+
<body>
11+
<noscript>
12+
<strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
13+
</noscript>
14+
<div id="app"></div>
15+
<!-- built files will be auto injected -->
16+
</body>
17+
</html>

src/App.vue

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
<template>
2+
<div>
3+
<ejs-gantt ref="gantt" :dataSource="data"
4+
:taskFields="taskFields"
5+
:treeColumnIndex="1"
6+
:toolbar="toolbarOptions"
7+
:allowPdfExport="true"
8+
:allowExcelExport="true"
9+
:toolbarClick="toolbarBtnClk"
10+
:height="450">
11+
<e-columns>
12+
<e-column field="TaskID" headerText="Task ID" width="120" textAlign="Right"></e-column>
13+
<e-column field="TaskName" headerText="Task Name" textAlign="Left" width="200"></e-column>
14+
<e-column field="StartDate" headerText="Start Date" textAlign="Right" format="dd/MM/yyyy" width="120"></e-column>
15+
<e-column field="Duration" headerText="Duration" textAlign="Right" width="120"></e-column>
16+
</e-columns>
17+
</ejs-gantt>
18+
</div>
19+
</template>
20+
21+
<script>
22+
import {GanttComponent, ColumnsDirective, ColumnDirective, Toolbar, PdfExport, ExcelExport} from '@syncfusion/ej2-vue-gantt'
23+
import {projectNewData} from './data.js'
24+
export default{
25+
name: 'App',
26+
components: {
27+
'ejs-gantt': GanttComponent,
28+
'e-columns': ColumnsDirective,
29+
'e-column': ColumnDirective
30+
},
31+
provide:{
32+
gantt: [Toolbar, PdfExport, ExcelExport]
33+
},
34+
methods:{
35+
toolbarBtnClk(args){
36+
let ganttObj = this.$refs.gantt.ej2Instances;
37+
if(args.item.text == 'Pdf export'){
38+
ganttObj.pdfExport(
39+
{
40+
fileName: 'projectData.pdf',
41+
enableFooter: false,
42+
showPredecessorLines: false,
43+
theme: 'Fabric'
44+
}
45+
)
46+
} else if(args.item.text == 'Excel export'){
47+
ganttObj.excelExport({
48+
fileName: 'projectData.xlsx',
49+
theme:{
50+
header:{ fontColor:"#00008B"},
51+
record:{ fontColor:"#C67878"}
52+
},
53+
header:{
54+
headerRows: 1,
55+
rows:[{
56+
cells:[{
57+
colSpan: 4,
58+
value: 'Project Time Tracking Report',
59+
style: {fontSize:20, hAlign:'Center'}
60+
}]
61+
}]
62+
},
63+
footer:{
64+
footerRows: 1,
65+
rows:[{
66+
cells:[{
67+
colSpan: 4,
68+
value: 'Visit Again!!!',
69+
style: {fontSize:18, hAlign:'Center'}
70+
}]
71+
}]
72+
}
73+
})
74+
} else if(args.item.text == 'CSV export'){
75+
ganttObj.csvExport()
76+
}
77+
}
78+
},
79+
data(){
80+
return{
81+
data: projectNewData,
82+
toolbarOptions: ['PdfExport', 'ExcelExport', 'CsvExport'],
83+
taskFields:{
84+
id: 'TaskID',
85+
name: 'TaskName',
86+
startDate: 'StartDate',
87+
endDate: 'EndDate',
88+
duration: 'Duration',
89+
progress: 'Progress',
90+
dependency: 'Predecessor',
91+
child: 'subtasks'
92+
},
93+
}
94+
}
95+
}
96+
97+
</script>
98+
99+
<style>
100+
@import url("https://cdn.syncfusion.com/ej2/material.css");
101+
</style>
102+

src/assets/logo.png

6.69 KB
Loading

src/components/HelloWorld.vue

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
<template>
2+
<div class="hello">
3+
<h1>{{ msg }}</h1>
4+
<p>
5+
For a guide and recipes on how to configure / customize this project,<br>
6+
check out the
7+
<a href="https://cli.vuejs.org" target="_blank" rel="noopener">vue-cli documentation</a>.
8+
</p>
9+
<h3>Installed CLI Plugins</h3>
10+
<ul>
11+
<li><a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-babel" target="_blank" rel="noopener">babel</a></li>
12+
<li><a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-eslint" target="_blank" rel="noopener">eslint</a></li>
13+
</ul>
14+
<h3>Essential Links</h3>
15+
<ul>
16+
<li><a href="https://vuejs.org" target="_blank" rel="noopener">Core Docs</a></li>
17+
<li><a href="https://forum.vuejs.org" target="_blank" rel="noopener">Forum</a></li>
18+
<li><a href="https://chat.vuejs.org" target="_blank" rel="noopener">Community Chat</a></li>
19+
<li><a href="https://twitter.com/vuejs" target="_blank" rel="noopener">Twitter</a></li>
20+
<li><a href="https://news.vuejs.org" target="_blank" rel="noopener">News</a></li>
21+
</ul>
22+
<h3>Ecosystem</h3>
23+
<ul>
24+
<li><a href="https://router.vuejs.org" target="_blank" rel="noopener">vue-router</a></li>
25+
<li><a href="https://vuex.vuejs.org" target="_blank" rel="noopener">vuex</a></li>
26+
<li><a href="https://github.com/vuejs/vue-devtools#vue-devtools" target="_blank" rel="noopener">vue-devtools</a></li>
27+
<li><a href="https://vue-loader.vuejs.org" target="_blank" rel="noopener">vue-loader</a></li>
28+
<li><a href="https://github.com/vuejs/awesome-vue" target="_blank" rel="noopener">awesome-vue</a></li>
29+
</ul>
30+
</div>
31+
</template>
32+
33+
<script>
34+
export default {
35+
name: 'HelloWorld',
36+
props: {
37+
msg: String
38+
}
39+
}
40+
</script>
41+
42+
<!-- Add "scoped" attribute to limit CSS to this component only -->
43+
<style scoped>
44+
h3 {
45+
margin: 40px 0 0;
46+
}
47+
ul {
48+
list-style-type: none;
49+
padding: 0;
50+
}
51+
li {
52+
display: inline-block;
53+
margin: 0 10px;
54+
}
55+
a {
56+
color: #42b983;
57+
}
58+
</style>

0 commit comments

Comments
 (0)