Index: arms/js/analysisCost.js =================================================================== diff -u -r83edfd67668048e964394a067f6326e29b3d937b -rf10f772589f1ca9356c3bdd8c04d2810985309b9 --- arms/js/analysisCost.js (.../analysisCost.js) (revision 83edfd67668048e964394a067f6326e29b3d937b) +++ arms/js/analysisCost.js (.../analysisCost.js) (revision f10f772589f1ca9356c3bdd8c04d2810985309b9) @@ -739,9 +739,21 @@ return data; }).get(); */ + $('input[name="person-salary"]').map(function() { + let owner = $(this).data('owner'); + 인력맵[owner].연봉 = $(this).val(); + }); + + /*let inputSalaryValues = $('input[name="person-salary"]').toArray().reduce(function(acc, cur) { + let owner = $(cur).data('owner'); + acc[owner] = $(cur).val(); + return acc; + }, {});*/ + // 인력별 성과 측정 차트 - $("#manpower-analysis-chart").height("500px"); - 인력별_연봉대비_성과차트_기본세팅(인력맵); + $("#manpower-analysis-chart2").height("500px"); + 성과차트2(); + // 인력별_연봉대비_성과차트_기본세팅(인력맵); }); } @@ -1444,4 +1456,151 @@ } }, 500); // 100ms마다 globalDeadline 값 확인 }); -} \ No newline at end of file +} + + +function 성과차트2() { + + const tooltipFormatter = function (params) { + + let data = dataAll.filter(item => item[0] === params.value[0] && item[1] === params.value[1]); + let tooltipContent = ''; + + if (data.length > 1) { + for (let i = 0; i < data.length; i++) { + tooltipContent += data[i][2] + ", 연봉 : " + data[i][0] + ", 성과 : " + data[i][1] + '
'; + } + } + else if (data.length === 1) { + tooltipContent = data[0][2] + "
연봉 : " + data[0][0] + "
성과 : " + data[0][1]; + } + + return tooltipContent; + }; + + let dataAll = Object.entries(인력맵).map(([key, value]) => { + return [Number(value.연봉)*10000, Number(value.성과)*10000, value.이름+"["+key+"]"]; + }); + + var dom = document.getElementById('manpower-analysis-chart2'); + var myChart = echarts.init(dom, null, { + renderer: 'canvas', + useDirtyRect: false + }); + var app = {}; + + var option; + + let maxX = Math.max(...dataAll.map(item => item[0])); + let maxX2 = Math.max(...dataAll.map(item => item[1])); + + let max = Math.max(maxX, maxX2); + + const markLineOpt = { + animation: false, + label: { + formatter: '성과기준선', + align: 'right', + color: 'white' + }, + lineStyle: { + type: 'dashed', + color: '#EE6666', + width: 2 + }, + tooltip: { + formatter: '성과기준선' + }, + data: [ + [ + { + coord: [0, 0], + symbol: 'none' + }, + { + coord: [max, max], + symbol: 'none' + } + ] + ] + }; + option = { + grid: [ + { left: '15%', top: '5%'} + ], + tooltip: { + confine: true, + /* formatter: function (params) { + return params.value[2] + "
연봉 : " + params.value[0] + "
성과 : " + params.value[1]; + },*/ + formatter: tooltipFormatter + }, + xAxis: [ + { + gridIndex: 0, + min: 0, + max: max, + axisLabel: { + color: 'white', + interval: 1, + rotate: 45, + formatter: function (value) { + return value === 0 ? '' : value; + }, + }, + splitLine: { + lineStyle: { + color: 'gray', + type: 'dashed' + } + } + } + ], + yAxis: [ + { + gridIndex: 0, + min: 0, + max: max, + axisLabel: { + color: 'white', + interval: 1, + }, + splitLine: { + lineStyle: { + color: 'gray', + type: 'dashed' + } + } + } + ], + series: [ + { + name: 'I', + type: 'scatter', + xAxisIndex: 0, + yAxisIndex: 0, + data: dataAll, + markLine: markLineOpt + } + ], + toolbox: { + show: true, + orient: "vertical", + left: "right", + bottom: "50px", + feature: { + mark: { show: true }, + dataView: {show: true, readOnly: true}, + }, + iconStyle: { + borderColor: "white" + } + }, + }; + + if (option && typeof option === 'object') { + myChart.setOption(option); + } + + window.addEventListener('resize', myChart.resize); +}