demarchisd / stacked-gantt

JQuery Gantt-like chart with stacked activities/tasks, providing conciser information.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Default style to appear even without any data

vaibhav12aggarwal opened this issue · comments

Hi demarchisd

I want that the default style to appear even without any data, i.e. the date and time header and the description should appear even if the is no data:
My code:

var newData = [
{
description: '<img src="../pics/gt_travel_cab.jpg" style="width: 78px;height: 33px;"alt="Smiley face">',
activities: traveldata
},

	{
		description: '<img src="../pics/gt_hotel.jpg" style="width: 78px;height: 33px;"alt="Smiley face">',
		activities: staydata
	},
		
	{
		description: '<img src="../pics/gt_adventure.jpg" style="width: 78px;height: 33px;"alt="Smiley face">',
		activities: activitydata
	},
];

	var options={
      data: newData,
      style: {
      months: ['Jan','Feb','Mar','April','May','Jun','Jul','Aug','Sept','Oct','Nov','Dec'],
      activityStyle: {
        'Activity': { color: "rgb(238, 129, 0)", height: "26px" },
         'Travel': { color: "rgb(32, 65, 149)", height: "26px" },
        'Stay': { color: "rgb(165, 39, 20)" , height: "26px" }
      },
      showDateOnHeader: true,
      dateHeaderFormat: function(date)
      {
        var days = ['Sun','Mon','Tues','Wed','Thur','Fri','Sat'];
        var months = ['Jan','Feb','Mar','April','May','Jun','Jul','Aug','Sept','Oct','Nov','Dec'];

        return days[date.getDay()] + ", " + date.getDate()  + months[date.getMonth()] +  date.getFullYear();
      },
	  hourWidth: 35
      //thresholdHeight: "15px",
      //thresholdColor: "#000000"
    }
	
  };
  $('#chart').stackedGantt(options);

The Gantt chart should appear with date and description even if traveldata, staydata, activitydata have no data in them.

Thanks and Regards,
Vaibhav
+91 7290979102 (India)

Hello Vaibhav!

I'm glad you're using the StackedGantt :)

I fixed the bug and pushed the changes to the master branch. Please try using the new version. Also, take a look at the new properties defaultBeginDate and defaultEndDate in style option (they're not mandatory, but you could customize it if you'd like to).

Best regards

Thanks Demarchisd,
This is working wonderfull for me and all the issues for now are resolved.
Thanks for all your support all this while.

regards,
Vaibhav.

Thanks!