mirror of
				https://github.com/inventree/InvenTree.git
				synced 2025-10-31 21:25:42 +00:00 
			
		
		
		
	Add a 'zero stock' threshold line to the part scheduling tab (#3587)
This commit is contained in:
		| @@ -2539,15 +2539,34 @@ function loadPartSchedulingChart(canvas_id, part_id) { | ||||
|         ], | ||||
|     }; | ||||
|  | ||||
|     var t_min = quantity_scheduled[0].x; | ||||
|     var t_max = quantity_scheduled[quantity_scheduled.length - 1].x; | ||||
|  | ||||
|     // Construct a 'zero stock' threshold line | ||||
|     data.datasets.push({ | ||||
|         data: [ | ||||
|             { | ||||
|                 x: t_min, | ||||
|                 y: 0, | ||||
|             }, | ||||
|             { | ||||
|                 x: t_max, | ||||
|                 y: 0, | ||||
|             } | ||||
|         ], | ||||
|         borderColor: 'rgba(250, 50, 50, 0.75)', | ||||
|         label: 'zero-stock-level', | ||||
|     }); | ||||
|  | ||||
|     // Construct a 'minimum stock' threshold line | ||||
|     if (part_info.minimum_stock) { | ||||
|         // Construct a 'minimum stock' threshold line | ||||
|         var minimum_stock_curve = [ | ||||
|             { | ||||
|                 x: quantity_scheduled[0].x, | ||||
|                 x: t_min, | ||||
|                 y: part_info.minimum_stock, | ||||
|             }, | ||||
|             { | ||||
|                 x: quantity_scheduled[quantity_scheduled.length - 1].x, | ||||
|                 x: t_max, | ||||
|                 y: part_info.minimum_stock, | ||||
|             } | ||||
|         ]; | ||||
| @@ -2626,7 +2645,14 @@ function loadPartSchedulingChart(canvas_id, part_id) { | ||||
|                             return `{% trans "Quantity" %}: ${item.raw.y}${delta}`; | ||||
|                         } | ||||
|                     } | ||||
|                 } | ||||
|                 }, | ||||
|                 legend: { | ||||
|                     labels: { | ||||
|                         filter: function(item, chart) { | ||||
|                             return !item.text.includes('zero-stock-level'); | ||||
|                         } | ||||
|                     } | ||||
|                 }, | ||||
|             }, | ||||
|         } | ||||
|     }); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user