[ { "type": "ia.chart.xy", "version": 0, "props": { "title": { "appearance": { "color": "#000000", "font": { "size": 35 }, "padding": { "bottom": 20 } } }, "legend": { "labels": { "font": { "weight": 500 } } }, "xAxes": [ { "name": "time", "label": { "enabled": true, "text": "", "color": "" }, "visible": true, "tooltip": { "enabled": true, "text": "", "cornerRadius": 3, "pointerLength": 4, "background": { "color": "", "opacity": 1 } }, "inversed": false, "render": "category", "category": { "break": { "enabled": false, "startCategory": "", "endCategory": "", "size": 0.05 } }, "date": { "baseInterval": { "enabled": false, "timeUnit": "hour", "count": 1, "skipEmptyPeriods": false }, "range": { "max": "", "min": "", "useStrict": false }, "break": { "enabled": false, "startDate": "", "endDate": "", "size": 0.05 }, "inputFormat": "yyyy-MM-dd kk:mm:ss", "format": "M/d" }, "value": { "range": { "max": "", "min": "", "useStrict": false }, "logarithmic": false, "break": { "enabled": false, "startValue": 0, "endValue": 100, "size": 0.05 }, "format": "#,###.##" }, "appearance": { "opposite": false, "inside": false, "labels": { "color": "#000000", "opacity": 1, "rotation": 0, "verticalCenter": "middle", "horizontalCenter": "middle" }, "grid": { "color": "#C0C0C0", "opacity": 0, "dashArray": "", "minDistance": 60, "position": 0.5 }, "font": { "size": "", "weight": 500 } } } ], "yAxes": [ { "name": "units", "label": { "enabled": true, "text": "Units/day", "color": "#000000" }, "visible": true, "tooltip": { "enabled": true, "text": "", "cornerRadius": 3, "pointerLength": 4, "background": { "color": "", "opacity": 1 } }, "inversed": false, "render": "value", "category": { "break": { "enabled": false, "startCategory": "", "endCategory": "", "size": 0.05 } }, "date": { "baseInterval": { "enabled": false, "timeUnit": "hour", "count": 1, "skipEmptyPeriods": false }, "range": { "max": "", "min": "", "useStrict": false }, "break": { "enabled": false, "startDate": "", "endDate": "", "size": 0.05 }, "inputFormat": "yyyy-MM-dd kk:mm:ss", "format": "M/d/yyyy HH:mm:ss" }, "value": { "range": { "max": "", "min": "", "useStrict": false }, "logarithmic": false, "break": { "enabled": false, "startValue": 0, "endValue": 100, "size": 0.05 }, "format": "#,###.##" }, "appearance": { "opposite": false, "inside": false, "labels": { "color": "#000000", "opacity": 1, "rotation": 0, "verticalCenter": "middle", "horizontalCenter": "middle" }, "grid": { "color": "#C0C0C0", "opacity": 0.7, "dashArray": "", "minDistance": 90, "position": 0.5 }, "font": { "size": 20, "weight": 500 } } } ], "series": [ { "name": "trackers_1", "label": { "text": "Units/day" }, "visible": true, "hiddenInLegend": true, "defaultState": { "visible": true }, "data": { "source": "trackers", "x": "t_stamp", "y": "units_num" }, "xAxis": "time", "yAxis": "units", "zIndex": 0, "tooltip": { "enabled": false, "text": "{name}: [bold]{valueY}[/]", "cornerRadius": 3, "pointerLength": 4, "background": { "color": "", "opacity": 1 } }, "render": "column", "candlestick": { "open": { "x": "", "y": "" }, "high": { "x": "", "y": "" }, "low": { "x": "", "y": "" }, "appearance": { "fill": { "color": "", "opacity": 1 }, "stroke": { "color": "", "opacity": 1, "width": 1 }, "stacked": false, "deriveFieldsFromData": { "fill": { "color": "", "opacity": "" }, "stroke": { "color": "", "opacity": "", "width": "" } }, "heatRules": { "enabled": false, "max": "", "min": "", "dataField": "" } } }, "column": { "open": { "x": "", "y": "" }, "appearance": { "fill": { "color": "#F68D20", "opacity": 1 }, "stroke": { "color": "#F68D20", "opacity": 1, "width": 1 }, "stacked": false, "width": 50, "height": null, "deriveFieldsFromData": { "fill": { "color": "", "opacity": "" }, "stroke": { "color": "", "opacity": "", "width": "" } }, "heatRules": { "enabled": false, "max": "", "min": "", "dataField": "" } } }, "line": { "open": { "x": "", "y": "" }, "appearance": { "connect": true, "tensionX": 1, "tensionY": 1, "minDistance": 0.5, "stroke": { "width": 3, "opacity": 1, "color": "", "dashArray": "" }, "fill": { "opacity": 0, "color": "" }, "bullets": [ { "enabled": false, "render": "circle", "width": 10, "height": 10, "label": { "text": "{value}", "position": { "dx": 0, "dy": 0 } }, "fill": { "color": "", "opacity": 1 }, "stroke": { "color": "", "opacity": 1, "width": 1 }, "rotation": 0, "tooltip": { "enabled": true, "text": "{name}: [bold]{valueY}[/]", "cornerRadius": 3, "pointerLength": 4, "background": { "color": "", "opacity": 1 } }, "deriveFieldsFromData": { "fill": { "color": "", "opacity": "" }, "stroke": { "color": "", "opacity": "", "width": "" }, "rotation": "" }, "heatRules": { "enabled": false, "max": 100, "min": 2, "dataField": "" } } ] } }, "stepLine": { "open": { "x": "", "y": "" }, "appearance": { "connect": true, "tensionX": 1, "tensionY": 1, "minDistance": 0.5, "stroke": { "width": 3, "opacity": 1, "color": "", "dashArray": "" }, "fill": { "opacity": 0, "color": "" }, "bullets": [ { "enabled": true, "render": "circle", "width": 10, "height": 10, "label": { "text": "{value}", "position": { "dx": 0, "dy": 0 } }, "fill": { "color": "", "opacity": 1 }, "stroke": { "color": "", "opacity": 1, "width": 1 }, "rotation": 0, "tooltip": { "enabled": true, "text": "{name}: [bold]{valueY}[/]", "cornerRadius": 3, "pointerLength": 4, "background": { "color": "", "opacity": 1 } }, "deriveFieldsFromData": { "fill": { "color": "", "opacity": "" }, "stroke": { "color": "", "opacity": "", "width": "" }, "rotation": "" }, "heatRules": { "enabled": false, "max": 100, "min": 2, "dataField": "" } } ] } } }, { "candlestick": { "appearance": { "deriveFieldsFromData": { "fill": { "color": "", "opacity": "" }, "stroke": { "color": "", "opacity": "", "width": "" } }, "fill": { "color": "", "opacity": 1 }, "heatRules": { "dataField": "", "enabled": false, "max": "", "min": "" }, "stacked": false, "stroke": { "color": "", "opacity": 1, "width": 1 } }, "high": { "x": "", "y": "" }, "low": { "x": "", "y": "" }, "open": { "x": "", "y": "" } }, "column": { "appearance": { "deriveFieldsFromData": { "fill": { "color": "", "opacity": "" }, "stroke": { "color": "", "opacity": "", "width": "" } }, "fill": { "color": "#F68D20", "opacity": 1 }, "heatRules": { "dataField": "", "enabled": false, "max": "", "min": "" }, "height": null, "stacked": false, "stroke": { "color": "#F68D20", "opacity": 1, "width": 1 }, "width": null }, "open": { "x": "", "y": "" } }, "data": { "source": "trackers", "x": "t_stamp", "y": "target_plan" }, "defaultState": { "visible": true }, "hiddenInLegend": true, "label": { "text": "" }, "line": { "appearance": { "bullets": [ { "deriveFieldsFromData": { "fill": { "color": "", "opacity": "" }, "rotation": "", "stroke": { "color": "", "opacity": "", "width": "" } }, "enabled": true, "fill": { "color": "", "opacity": 1 }, "heatRules": { "dataField": "", "enabled": false, "max": 100, "min": 2 }, "height": 10, "label": { "position": { "dx": 0, "dy": 0 }, "text": "{value}" }, "render": "circle", "rotation": 0, "stroke": { "color": "", "opacity": 1, "width": 1 }, "tooltip": { "background": { "color": "", "opacity": 1 }, "cornerRadius": 3, "enabled": false, "pointerLength": 4, "text": "{name}: [bold]{valueY}[/]" }, "width": 10 } ], "connect": true, "fill": { "color": "#B46D6D", "opacity": 0 }, "minDistance": 0.5, "stroke": { "color": "#B46D6D", "dashArray": "", "opacity": 1, "width": 3 }, "tensionX": 1, "tensionY": 1 }, "open": { "x": "", "y": "" } }, "name": "target", "render": "line", "stepLine": { "appearance": { "bullets": [ { "deriveFieldsFromData": { "fill": { "color": "", "opacity": "" }, "rotation": "", "stroke": { "color": "", "opacity": "", "width": "" } }, "enabled": true, "fill": { "color": "", "opacity": 1 }, "heatRules": { "dataField": "", "enabled": false, "max": 100, "min": 2 }, "height": 10, "label": { "position": { "dx": 0, "dy": 0 }, "text": "{value}" }, "render": "circle", "rotation": 0, "stroke": { "color": "", "opacity": 1, "width": 1 }, "tooltip": { "background": { "color": "", "opacity": 1 }, "cornerRadius": 3, "enabled": true, "pointerLength": 4, "text": "{name}: [bold]{valueY}[/]" }, "width": 10 } ], "connect": true, "fill": { "color": "#B46D6D", "opacity": 0 }, "minDistance": 0.5, "stroke": { "color": "#B46D6D", "dashArray": "", "opacity": 1, "width": 3 }, "tensionX": 1, "tensionY": 1 }, "open": { "x": "", "y": "" } }, "tooltip": { "background": { "color": "", "opacity": 1 }, "cornerRadius": 3, "enabled": false, "pointerLength": 4, "text": "{name}: [bold]{valueY}[/]" }, "visible": true, "xAxis": "time", "yAxis": "units", "zIndex": 0 }, { "candlestick": { "appearance": { "deriveFieldsFromData": { "fill": { "color": "", "opacity": "" }, "stroke": { "color": "", "opacity": "", "width": "" } }, "fill": { "color": "", "opacity": 1 }, "heatRules": { "dataField": "", "enabled": false, "max": "", "min": "" }, "stacked": false, "stroke": { "color": "", "opacity": 1, "width": 1 } }, "high": { "x": "", "y": "" }, "low": { "x": "", "y": "" }, "open": { "x": "", "y": "" } }, "column": { "appearance": { "deriveFieldsFromData": { "fill": { "color": "", "opacity": "" }, "stroke": { "color": "", "opacity": "", "width": "" } }, "fill": { "color": "", "opacity": 1 }, "heatRules": { "dataField": "", "enabled": false, "max": "", "min": "" }, "height": null, "stacked": false, "stroke": { "color": "", "opacity": 1, "width": 1 }, "width": null }, "open": { "x": "", "y": "" } }, "data": { "source": "trackers", "x": "t_stamp", "y": "units_num" }, "defaultState": { "visible": true }, "hiddenInLegend": true, "label": { "text": "" }, "line": { "appearance": { "bullets": [ { "deriveFieldsFromData": { "fill": { "color": "", "opacity": "" }, "rotation": "", "stroke": { "color": "", "opacity": "", "width": "" } }, "enabled": true, "fill": { "color": "", "opacity": 1 }, "heatRules": { "dataField": "", "enabled": false, "max": 100, "min": 2 }, "height": 15, "label": { "position": { "dx": 0, "dy": -15 }, "text": "[bold]{units_num.formatNumber(\"#.##\")}" }, "render": "label", "rotation": 0, "stroke": { "color": "", "opacity": 1, "width": 1 }, "tooltip": { "background": { "color": "", "opacity": 1 }, "cornerRadius": 3, "enabled": false, "pointerLength": 4, "text": "{name}: [bold]{valueY}[/]" }, "width": 15 } ], "connect": true, "fill": { "color": "", "opacity": 0 }, "minDistance": 0.5, "stroke": { "color": "", "dashArray": "", "opacity": 1, "width": 0 }, "tensionX": 1, "tensionY": 1 }, "open": { "x": "", "y": "" } }, "name": "trackers_2", "render": "line", "stepLine": { "appearance": { "bullets": [ { "deriveFieldsFromData": { "fill": { "color": "", "opacity": "" }, "rotation": "", "stroke": { "color": "", "opacity": "", "width": "" } }, "enabled": true, "fill": { "color": "", "opacity": 1 }, "heatRules": { "dataField": "", "enabled": false, "max": 100, "min": 2 }, "height": 10, "label": { "position": { "dx": 0, "dy": 0 }, "text": "{value}" }, "render": "circle", "rotation": 0, "stroke": { "color": "", "opacity": 1, "width": 1 }, "tooltip": { "background": { "color": "", "opacity": 1 }, "cornerRadius": 3, "enabled": true, "pointerLength": 4, "text": "{name}: [bold]{valueY}[/]" }, "width": 10 } ], "connect": true, "fill": { "color": "", "opacity": 0 }, "minDistance": 0.5, "stroke": { "color": "", "dashArray": "", "opacity": 1, "width": 3 }, "tensionX": 1, "tensionY": 1 }, "open": { "x": "", "y": "" } }, "tooltip": { "background": { "color": "", "opacity": 1 }, "cornerRadius": 3, "enabled": false, "pointerLength": 4, "text": "{name}: [bold]{valueY}[/]" }, "visible": true, "xAxis": "time", "yAxis": "units", "zIndex": 0 } ], "dataSources": { "trackers": [ { "t_stamp": "Avg/day \n(last week)", "target_plan": null }, { "t_stamp": "Avg/day\n(this week)", "target_plan": null }, { "t_stamp": "Monday" }, { "t_stamp": "Tuesday" }, { "t_stamp": "Wednesday" }, { "t_stamp": "Thursday" }, { "t_stamp": "Friday" } ] } }, "meta": { "name": "XYChart" }, "position": { "basis": "1520px" }, "custom": {}, "propConfig": { "props.dataSources.trackers[0].units_num": { "binding": { "config": { "parameters": { "zone_code": "{view.custom.zone}" }, "queryPath": "Production/GetLastWeekProd" }, "transforms": [ { "code": "\t\n\tnumOfLabourDays = 0\n\n\tif value != None and value.getRowCount() > 0:\n\t\t\n\t\tdata = value.getColumnAsList(1)\n\t\tdates = []\n\t\t\n\t\tfor i in data:\n\t\t\tdates.append(system.date.format(i,\"yyyy-MM-dd\"))\n\t\t\n\t\tnumOfLabourDays = len(list(set(dates)))\n\t\t\n\t\tif numOfLabourDays == 0:\n\t\t\treturn 0\n\t\telse:\n\t\t\treturn float(value.getRowCount())/numOfLabourDays\n\telse: \n\t\treturn 0", "type": "script" } ], "type": "query" } }, "props.dataSources.trackers[1].units_num": { "binding": { "config": { "parameters": { "zone_code": "{view.custom.zone}" }, "queryPath": "Production/GetCurrentWeekProd" }, "transforms": [ { "code": "\t\n\tif value != None and value.getRowCount() > 0:\n\t\tavg = 0.0\n\t\t\n\t\ttotalUnits = value.getRowCount()\n\t\t\n\t\tminuteDiff = value.getValueAt(0,\"MinuteDiff\")\n\t\tif minuteDiff > 7200:\n\t\t\tminuteDiff = 7200 #no more than Friday minutes\n\t\t\t\n\t\tnumOfDays = minuteDiff/(24.0*60.0)\n\t\t\n\t\trestOfToday = numOfDays - int(numOfDays)\n\t\t\n\t\tleftMinutes = int(restOfToday * (24*60))\n\t\t\n\t\t\n\t\tleftMinutes = leftMinutes - (7*60) #substract the first seven hours of the day\n\t\t\n\t\tif leftMinutes < 0:\n\t\t\tleftMinutes = 0\n\t\tif leftMinutes > 450: #no more than 7,5 hours (450 minutes) are worked per day\n\t\t\tleftMinutes = 450\n\t\t\n\t\t#remove the non working days\n\t\tdata = value.getColumnAsList(1)\n\t\tdates = []\n\t\tfor i in data:\n\t\t\tdates.append(system.date.format(i,\"yyyy-MM-dd\"))\n\t\t\n\t\tnew_dates = list(set(dates))\n\t\ttoday = system.date.format(system.date.now(), \"yyyy-MM-dd\")\n\t\t\n\t\tif today in new_dates:\n\t\t\tnew_dates.remove(today) #remove from the array in order to count the left minutes\n\t\t\ttotalWorkMinutes = len(new_dates)*(7.5*60) + leftMinutes\n\t\t\t\n\t\telse:\n\t\t\ttotalWorkMinutes = len(new_dates)*(7.5*60)\n\t\t\t\n\t\tavg = totalUnits/(totalWorkMinutes/(7.5*60))\n\t\t\n\t\treturn avg\n\t\n\telse:\n\t\treturn 0", "type": "script" } ], "type": "query" } }, "props.dataSources.trackers[2].target_plan": { "binding": { "config": { "parameters": { "day": "0", "zone_code": "{view.custom.zone}" }, "queryPath": "Production/GetPlan" }, "transforms": [ { "code": "\tif value:\n\t\treturn value.getRowCount()\n\telse:\n\t\treturn 0", "type": "script" } ], "type": "query" } }, "props.dataSources.trackers[2].units_num": { "binding": { "config": { "parameters": { "day1": "0", "day2": "1", "zone_code": "{view.custom.zone}" }, "queryPath": "Production/GetProd" }, "transforms": [ { "code": "\tif value:\n\t\treturn value.getRowCount()\n\telse:\n\t\treturn 0", "type": "script" } ], "type": "query" } }, "props.dataSources.trackers[3].target_plan": { "binding": { "config": { "parameters": { "day": "1", "zone_code": "{view.custom.zone}" }, "queryPath": "Production/GetPlan" }, "transforms": [ { "code": "\tif value:\n\t\treturn value.getRowCount()\n\telse:\n\t\treturn 0", "type": "script" } ], "type": "query" } }, "props.dataSources.trackers[3].units_num": { "binding": { "config": { "parameters": { "day1": "1", "day2": "2", "zone_code": "{view.custom.zone}" }, "queryPath": "Production/GetProd" }, "transforms": [ { "code": "\tif value:\n\t\treturn value.getRowCount()\n\telse:\n\t\treturn 0", "type": "script" } ], "type": "query" } }, "props.dataSources.trackers[4].target_plan": { "binding": { "config": { "parameters": { "day": "2", "zone_code": "{view.custom.zone}" }, "queryPath": "Production/GetPlan" }, "transforms": [ { "code": "\tif value:\n\t\treturn value.getRowCount()\n\telse:\n\t\treturn 0", "type": "script" } ], "type": "query" } }, "props.dataSources.trackers[4].units_num": { "binding": { "config": { "parameters": { "day1": "2", "day2": "3", "zone_code": "{view.custom.zone}" }, "queryPath": "Production/GetProd" }, "transforms": [ { "code": "\tif value:\n\t\treturn value.getRowCount()\n\telse:\n\t\treturn 0", "type": "script" } ], "type": "query" } }, "props.dataSources.trackers[5].target_plan": { "binding": { "config": { "parameters": { "day": "3", "zone_code": "{view.custom.zone}" }, "queryPath": "Production/GetPlan" }, "transforms": [ { "code": "\tif value:\n\t\treturn value.getRowCount()\n\telse:\n\t\treturn 0", "type": "script" } ], "type": "query" } }, "props.dataSources.trackers[5].units_num": { "binding": { "config": { "parameters": { "day1": "3", "day2": "4", "zone_code": "{view.custom.zone}" }, "queryPath": "Production/GetProd" }, "transforms": [ { "code": "\tif value:\n\t\treturn value.getRowCount()\n\telse:\n\t\treturn 0", "type": "script" } ], "type": "query" } }, "props.dataSources.trackers[6].target_plan": { "binding": { "config": { "parameters": { "day": "4", "zone_code": "{view.custom.zone}" }, "queryPath": "Production/GetPlan" }, "transforms": [ { "code": "\tif value:\n\t\treturn value.getRowCount()\n\telse:\n\t\treturn 0", "type": "script" } ], "type": "query" } }, "props.dataSources.trackers[6].units_num": { "binding": { "config": { "parameters": { "day1": "4", "day2": "5", "zone_code": "{view.custom.zone}" }, "queryPath": "Production/GetProd" }, "transforms": [ { "code": "\tif value:\n\t\treturn value.getRowCount()\n\telse:\n\t\treturn 0", "type": "script" } ], "type": "query" } }, "props.title.text": { "binding": { "config": { "path": "view.custom.WeekNumber" }, "transforms": [ { "code": "\timport time\n\t\n\ttime.sleep(1)\n\t\n\ttotal_units = self.props.dataSources.trackers[2].units_num + self.props.dataSources.trackers[3].units_num + self.props.dataSources.trackers[4].units_num + self.props.dataSources.trackers[5].units_num + self.props.dataSources.trackers[6].units_num\n\t\n\treturn \"Week \" + str(value) + \" - Total units: \" + str(total_units)\n\t", "type": "script" } ], "type": "property" } } } } ]