Page 1 of 1

How to make weekends as working days in a resource histogram.

Posted: Fri Jan 14, 2022 7:38 pm
by anthony.dasre

Hello everyone,
I am using Histogram(v4.3.6 ) for displaying the timeline report of the workload.
In the array of calendar, I have declared that we work everyday including weekends.

{
  "id": "1",
  "name": "PLANNING",
  "unspecifiedTimeIsWorking": false,
  "intervals": [
    {
      "recurrentStartDate": "at 7:00",
      "recurrentEndDate": "at 18:00",
      "isWorking": true
    }
  ]
}

However, "Resource histogram" component shows that Saturday and Sunday are not marked as working days. Could someone tell me how to enable the working time in the weekend. Thank you in advance.

Image


Re: How to make weekends as working days in a resource histogram.

Posted: Sat Jan 15, 2022 11:13 am
by mats

Could you please share your code with the component configurations?


Re: How to make weekends as working days in a resource histogram.

Posted: Mon Jan 17, 2022 6:45 pm
by anthony.dasre
histogram =  new bryntum.schedulerpro.ResourceHistogram({
		    project:{
		    	transport : {
		        load : {
		            url : sUrl_l+'?bHisto_p=1',
		            paramName: 'schedulerpro',
		        },
			    },
			    autoLoad : true,
				    
listeners : { beforeLoad({pack}){ pack.params = { dateD:bryntum.schedulerpro.DateHelper.format(scheduler.startDate, 'DD/MM/YY HH:mm'), dateF:bryntum.schedulerpro.DateHelper.format(scheduler.endDate, 'DD/MM/YY HH:mm'), pUfId : pUfId, }; }, }, validateResponse : true }, hideHeaders : true, partner : scheduler, appendTo : 'main', rowHeight : 60, showBarTip : false, minHeight : '10em', flex : '1 1 10%', showBarTip : false, columns : [ { type : 'resourceInfo', text : 'opérateur', field : 'MOYP_LIBELLE', flex : 1, showEventCount : false } ] });

Re: How to make weekends as working days in a resource histogram.

Posted: Tue Jan 18, 2022 1:03 pm
by arcady

We need the dataset too. Please provide the response coming from the URL you configured:

		        load : {
		            url : sUrl_l+'?bHisto_p=1',
		            paramName: 'schedulerpro',
		        },

Re: How to make weekends as working days in a resource histogram.

Posted: Tue Jan 18, 2022 1:09 pm
by anthony.dasre

{
  "success": true,
  "events": {
    "rows": [
      {
        "id": 1,
        "startDate": "2022-01-19 00:00:00",
        "endDate": "2022-01-19 00:00:00"
      },
      {
        "id": 2,
        "startDate": "2022-01-17 09:00:00",
        "endDate": "2022-01-19 05:00:00"
      },
      {
        "id": 3,
        "startDate": "2022-01-20 00:00:00",
        "endDate": "2022-01-22 00:00:00"
      },
      {
        "id": 4,
        "startDate": "2022-01-19 00:00:00",
        "endDate": "2022-01-19 00:00:00"
      },
      {
        "id": 5,
        "startDate": "2022-01-17 07:00:00",
        "endDate": "2022-01-19 05:00:00"
      }
    ]
  },
  "resources": {
    "rows": [
      {
        "id": "53",
        "MOYP_ID": "53",
        "P_MP_ID": "1",
        "MOYP_LIBELLE": "Opérateur Inj",
        "P_UFS_LIBELLE": "Outillage-Injection",
        "P_UFS_ID": "10032",
        "P_PLAN_ID": "1",
        "MOYP_MULTIOF": 0,
        "calendar": "1",
        "rowExpanded": false,
        "showCapacityLine": true,
        "name": "Opérateur Inj"
      }
    ]
  },
  "calendars": {
    "rows": [
      {
        "id": "1",
        "name": "PLANNING",
        "unspecifiedTimeIsWorking": false,
        "tbEveryDaySeconde": {
          "DEFAUT": {
            "duree": 39600,
            "timeD": 25200,
            "timeF": 64800
          }
        },
        "intervals": [
          {
            "recurrentStartDate": "at 7:00",
            "recurrentEndDate": "at 18:00",
            "isWorking": true
          }
        ]
      }
    ]
  },
  "assignments": {
    "rows": [
      {
        "id": 1,
        "eventId": 1,
        "resourceId": "53",
        "units": 100
      },
      {
        "id": 2,
        "eventId": 2,
        "resourceId": "53",
        "units": 100
      },
      {
        "id": 3,
        "eventId": 3,
        "resourceId": "53",
        "units": 40
      },
      {
        "id": 4,
        "eventId": 4,
        "resourceId": "53",
        "units": 100
      },
      {
        "id": 5,
        "eventId": 5,
        "resourceId": "53",
        "units": 100
      }
    ]
  },
  "dependencies": {
    "rows": []
  }
}

Re: How to make weekends as working days in a resource histogram.

Posted: Tue Jan 18, 2022 1:53 pm
by alex.l

Hi anthony.dasre,

You need to share project of your SchedulerPro with the histogram instead of configure its own, as it's done in our examples:

const project = window.project = new ProjectModel({
    transport : {
        load : {
            url : 'data/data.json'
        }
    },
    autoLoad : true,

// This config enables response validation and dumping of found errors to the browser console.
// It's meant to be used as a development stage helper only so please set it to false for production systems.
validateResponse : true
});

const scheduler = new SchedulerPro({
    appendTo  : 'container',
    // ...
    project
});

const histogram = window.histogram = new ResourceHistogram({
    project,
    hideHeaders       : true,
    partner           : scheduler,
   // ...
});

Re: How to make weekends as working days in a resource histogram.

Posted: Tue Jan 18, 2022 2:10 pm
by anthony.dasre

Thanks for your reply. I have shared the project, it calculates the value in histogram. However, there is always a gray zone on weekend in the interface.


Re: How to make weekends as working days in a resource histogram.

Posted: Tue Jan 18, 2022 2:18 pm
by alex.l

Did you set your calendar as active in your code?

JSON:

{
  "success": true,
  "project": {
    "calendar" : "1" // <--- this line
  },
  // ...
    "calendars": {
    "rows": [
      {
        "id": "1",
        "name": "PLANNING",
   // ...

If so, please share a runnable application with us, we will check it. Because it works great on my side. I tested with our resource-histogram demo, I applied your data and it works great.


Re: How to make weekends as working days in a resource histogram.

Posted: Tue Jan 18, 2022 2:52 pm
by alex.l

Btw, histogram should catch calendar settings even if own project instance used, that's a bug. Here is a ticket to track the status: https://github.com/bryntum/support/issues/4038


Re: How to make weekends as working days in a resource histogram.

Posted: Tue Jan 18, 2022 3:37 pm
by anthony.dasre

Thanks for your help.