Quintiq file version 2.0
#parent: GanttChartCapacityPlanning
Response OnDrawNode (
  StockingPointInPeriod element
) id:Response_GanttChartCapacityPlanning_OnDrawNode_653
{
  #keys: '[139394.1.1196618415]'
  CanBindMultiple: false
  DefinitionID: 'Responsedef_WebGanttChart_OnDrawNode'
  QuillAction
  {
    Body:
    [*
      // Determine colors for gantt chart spip nodes
      textcolour := ColorScheme.CapacityGanttChart_TextGood();
      
      if( element.HasConstraintViolations() )
      {
        // Override the constraint red, to show a less fierce/strong color (blend in with other colors in GC)
        drawinfo.AddCompartment( ColorScheme.CapacityGanttChart_Error(), element.Duration() );
        textcolour := ColorScheme.CapacityGanttChart_WarningText();
      }
      else
      {
        duration := minvalue( element.Duration() * element.UtilizationPercentage() / 100, element.Duration() );
        color := ColorScheme.CapacityGanttChart_Good();
        
        if( element.UtilizationPercentage() > element.MaxCapacity() )
        {
          color := ColorScheme.CapacityGanttChart_WarningHigh();
          textcolour := ColorScheme.CapacityGanttChart_WarningText();
          
        }
        else if( element.UtilizationPercentage() > element.MacroPlan().GlobalParameters_MP().StockingPointBottleneckThreshold() and
                 element.Period_MP().IsWithinBottleneckWindow() )
        {
          color := ColorScheme.CapacityGanttChart_WarningMid();
          textcolour := ColorScheme.CapacityGanttChart_WarningText();
        }
        
        drawinfo.AddCompartment( color, duration );
        drawinfo.AddCompartment( ColorScheme.CapacityGanttChart_Free(), element.Duration() );
      }
      
      drawinfo.TextColor( textcolour );
    *]
    GroupServerCalls: false
  }
}
