const locale = { "decimal": ",", "thousands": "\u00a0", "grouping": [3], "currency": ["$", ""] }; d3.formatDefaultLocale(locale); function numberWithSpaces(x) { var parts = x.toString().split("."); parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, " "); return parts.join("."); } $(document).ready(function() { var time_arr = ["1623549632","1623553240","1623556828","1623560444","1623564045","1623567641","1623571242","1623574834","1623578436","1623582034","1623585639","1623589234","1623592836","1623596436","1623600042","1623603646","1623607242","1623610839","1623614436","1623618035","1623621635","1623625246","1623628841","1623632452"]; var time_new = []; time_arr.forEach(function(item, i, time_arr) { var unixtimestamp = item; var date = new Date(unixtimestamp * 1000); var hours = "0" + date.getHours(); var days = "0" + date.getDate(); var convdataTime = hours.substr(-2); var convdataDay = days.substr(-2); time_new.push(convdataDay + ' ' + convdataTime + ':00'); }); $('.analytics_page_stats .load_hide.active').removeClass('active'); $('.all_projects_desc').html(numberWithSpaces(15389)); $('.all_price_desc').html('$'+numberWithSpaces(5036448)); var chart_projects = c3.generate({ bindto: '#container1', data: { x: 'x', xFormat: '%d %H:%M', // how the date is parsed columns: [ ['x', time_new[0], time_new[1], time_new[2], time_new[3], time_new[4], time_new[5], time_new[6], time_new[7], time_new[8], time_new[9], time_new[10], time_new[11], time_new[12], time_new[13], time_new[14], time_new[15], time_new[16], time_new[17], time_new[18], time_new[19], time_new[20], time_new[21], time_new[22], time_new[23]], ['Fl.ru',6, 1, 4, 28, 15, 33, 28, 18, 28, 36, 34, 34, 32, 29, 24, 18, 15, 12, 11, 5, 5, 3, 2, 4],['Freelancehunt.com',5, 2, 2, 3, 9, 10, 6, 14, 13, 18, 13, 10, 12, 14, 10, 15, 21, 13, 17, 6, 5, 1, 0, 0],['Habr.freelance',0, 3, 0, 1, 2, 1, 1, 3, 2, 7, 5, 6, 3, 0, 2, 2, 3, 3, 1, 2, 0, 0, 3, 0],['Weblancer.net',1, 0, 5, 0, 2, 1, 2, 7, 6, 3, 7, 12, 7, 5, 2, 6, 6, 4, 2, 4, 0, 1, 3, 1],['Freelance.ru',1, 1, 0, 2, 0, 1, 9, 5, 12, 15, 17, 15, 16, 7, 13, 10, 6, 8, 6, 6, 6, 1, 5, 0],['Freelance.youdo.com',0, 0, 2, 0, 2, 1, 8, 8, 8, 4, 11, 9, 6, 1, 17, 6, 5, 7, 3, 1, 1, 0, 0, 0],['Upwork.com',120, 123, 155, 145, 173, 179, 204, 202, 196, 242, 258, 222, 238, 274, 270, 256, 264, 226, 245, 170, 195, 186, 177, 204],['Freelancer.com',85, 87, 114, 99, 147, 170, 158, 126, 165, 165, 148, 141, 148, 142, 147, 188, 162, 116, 113, 105, 95, 110, 110, 83],['Peopleperhour.com',2, 0, 5, 0, 4, 6, 4, 13, 8, 1, 3, 25, 10, 4, 12, 8, 7, 11, 14, 0, 0, 0, 0, 0],['Guru.com',3, 2, 0, 3, 5, 4, 2, 2, 2, 0, 0, 0, 1, 0, 2, 1, 0, 0, 3, 8, 0, 0, 3, 3],['Etxt.ru',2, 6, 39, 36, 33, 46, 153, 212, 155, 157, 150, 157, 201, 164, 150, 157, 141, 130, 125, 135, 95, 46, 46, 47],['YouDo.com',15, 16, 38, 57, 93, 142, 218, 201, 173, 215, 193, 208, 158, 180, 139, 140, 110, 100, 99, 65, 19, 10, 13, 13],['Freelance.ua',0, 0, 0, 1, 1, 2, 0, 5, 5, 7, 6, 4, 3, 1, 4, 4, 2, 4, 0, 1, 1, 0, 0, 0],['Text.ru',12, 5, 4, 28, 15, 5, 9, 61, 20, 26, 18, 10, 12, 11, 22, 22, 18, 37, 19, 2, 4, 3, 6, 0],['Advego.com',1, 2, 3, 2, 17, 11, 8, 4, 15, 7, 8, 12, 1, 0, 0, 0, 0, 0, 0, 0, 0, 4, 5, 15],['Kabannchik.ua',0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],['Kwork.ru',1, 1, 7, 7, 22, 17, 26, 21, 37, 24, 33, 30, 25, 20, 18, 21, 24, 15, 18, 8, 5, 2, 1, 1], ], type: 'spline', }, axis: { x: { type: 'timeseries', tick: { format: '%H:%M' } }, y: { label: { text: 'Projects per hour', position: 'outer-middle' } } }, grid: { y: { show: true } }, tooltip: { format: { value: function(value, ratio, id) { return d3.format(",")(value); } } }, }); var chart_budget = c3.generate({ bindto: '#container', data: { x: 'x', xFormat: '%d %H:%M', // how the date is parsed columns: [ ['x', time_new[0], time_new[1], time_new[2], time_new[3], time_new[4], time_new[5], time_new[6], time_new[7], time_new[8], time_new[9], time_new[10], time_new[11], time_new[12], time_new[13], time_new[14], time_new[15], time_new[16], time_new[17], time_new[18], time_new[19], time_new[20], time_new[21], time_new[22], time_new[23]], ['Fl.ru',391, 500, 331, 6619, 6670, 15314, 7432, 6262, 5044, 6339, 7569, 15312, 10327, 6539, 3316, 1322, 10207, 8375, 338, 152, 345, 55, 800, 112],['Freelancehunt.com',2364, 0, 71, 67, 1871, 365, 178, 271, 1901, 113, 2377, 196, 335, 355, 8, 717, 461, 500, 646, 2142, 1992, 35, 0, 0],['Habr.freelance',0, 1185, 0, 714, 171, 0, 50, 114, 142, 808, 896, 2201, 14, 0, 8571, 205, 2142, 50, 28, 0, 0, 0, 114, 0],['Weblancer.net',0, 0, 0, 0, 38, 2, 15, 1075, 1065, 65, 20, 508, 12, 0, 1800, 69, 52, 510, 0, 30, 0, 0, 5, 0],['Freelance.ru',0, 0, 0, 128, 0, 0, 157, 21, 300, 102, 568, 77, 2057, 35, 354, 497, 0, 511, 285, 624, 142, 0, 0, 0],['Freelance.youdo.com',0, 0, 100, 0, 57, 28, 400, 1228, 571, 457, 1700, 1678, 628, 71, 1871, 485, 314, 328, 128, 28, 71, 0, 0, 0],['Upwork.com',15429, 117241, 26314, 33596, 34126, 28238, 25324, 52216, 106314, 134530, 40506, 26519, 25356, 34142, 102594, 540800, 67555, 49629, 34269, 24717, 32908, 26629, 17291, 27056],['Freelancer.com',79610, 521655, 59393, 49716, 58765, 100747, 133432, 59858, 78460, 572929, 63821, 44337, 62153, 49032, 153370, 59274, 90370, 48507, 33723, 80260, 36595, 60265, 59407, 46102],['Peopleperhour.com',108, 0, 622, 0, 613, 613, 162, 1455, 12750, 133, 258, 3129, 1801, 1603, 2233, 922, 874, 14446, 1200, 0, 0, 0, 0, 0],['Guru.com',10255, 50, 0, 500, 1287, 605, 265, 500, 500, 0, 0, 0, 0, 0, 5250, 2, 0, 0, 6000, 1545, 0, 0, 1250, 750],['Etxt.ru',1, 6, 59, 75, 86, 81, 243, 319, 337, 193, 315, 232, 224, 203, 199, 226, 226, 209, 138, 144, 95, 48, 38, 46],['YouDo.com',3015, 4464, 14974, 16087, 12654, 15509, 32039, 55155, 20533, 37843, 24653, 23296, 21683, 59975, 14071, 18255, 12786, 8942, 34347, 7795, 1202, 2257, 460, 1132],['Freelance.ua',0, 0, 0, 196, 17, 0, 0, 103, 262, 93, 3871, 157, 63, 35, 1464, 96, 28, 3625, 0, 2200, 3, 0, 0, 0],['Text.ru',22, 2, 3, 40, 15, 15, 32, 40, 18, 69, 36, 19, 121, 55, 117, 63, 97, 145, 71, 32, 35, 18, 2, 0],['Advego.com',4, 1, 2, 0, 11, 14, 9, 3, 4, 4, 15, 29, 1, 0, 0, 0, 0, 0, 0, 0, 0, 4, 17, 24],['Kabannchik.ua',0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],['Kwork.ru',128, 85, 1400, 864, 8550, 1778, 2260, 791, 12171, 10799, 5594, 13412, 9075, 1564, 3359, 2262, 15604, 7842, 722, 4750, 857, 135, 21, 64], ], type: 'spline', }, axis: { x: { type: 'timeseries', tick: { format: '%H:%M' } }, y: { label: { text: '$ in hour', position: 'outer-middle' }, tick: { format: d3.format(".1s") } } }, grid: { y: { show: true } }, tooltip: { format: { value: function(value, ratio, id) { return d3.format("$,")(value); } } }, }); var chart_all_projects = c3.generate({ bindto: '#container5', data: { x: 'x', xFormat: '%d %H:%M', columns: [ ['x', time_new[0], time_new[1], time_new[2], time_new[3], time_new[4], time_new[5], time_new[6], time_new[7], time_new[8], time_new[9], time_new[10], time_new[11], time_new[12], time_new[13], time_new[14], time_new[15], time_new[16], time_new[17], time_new[18], time_new[19], time_new[20], time_new[21], time_new[22], time_new[23]], ['Projects', 254, 249, 378, 412, 540, 629, 836, 902, 845, 927, 904, 895, 873, 852, 832, 854, 784, 686, 676, 518, 431, 367, 374, 371] ], type: 'area-spline', }, axis: { x: { type: 'timeseries', tick: { format: '%H:%M' }, show: false, }, y: { show: false, } }, legend: { hide: true }, point: { show: false }, color: { pattern: ['#0aac41'] }, tooltip: { format: { value: function(value, ratio, id) { return d3.format(",")(value); } } }, }); var chart_all_budget = c3.generate({ bindto: '#container4', data: { x: 'x', xFormat: '%d %H:%M', columns: [ ['x', time_new[0], time_new[1], time_new[2], time_new[3], time_new[4], time_new[5], time_new[6], time_new[7], time_new[8], time_new[9], time_new[10], time_new[11], time_new[12], time_new[13], time_new[14], time_new[15], time_new[16], time_new[17], time_new[18], time_new[19], time_new[20], time_new[21], time_new[22], time_new[23]], ['Budget', 111327, 645189, 103269, 108602, 124931, 163309, 201998, 179411, 240372, 764477, 152199, 131102, 133850, 153609, 298577, 625195, 200716, 143619, 111895, 124419, 74245, 89446, 79405, 75286] ], type: 'area-spline', }, axis: { x: { type: 'timeseries', tick: { format: '%H:%M' }, show: false, }, y: { show: false, } }, legend: { hide: true }, point: { show: false }, color: { pattern: ['#ff8204'] }, tooltip: { format: { value: function(value, ratio, id) { return d3.format("$,")(value); } } }, }); var chart_pie_budget = c3.generate({ bindto: '#container2', data: { // iris data from R columns: [ ['Fl.ru',391, 500, 331, 6619, 6670, 15314, 7432, 6262, 5044, 6339, 7569, 15312, 10327, 6539, 3316, 1322, 10207, 8375, 338, 152, 345, 55, 800, 112],['Freelancehunt.com',2364, 0, 71, 67, 1871, 365, 178, 271, 1901, 113, 2377, 196, 335, 355, 8, 717, 461, 500, 646, 2142, 1992, 35, 0, 0],['Habr.freelance',0, 1185, 0, 714, 171, 0, 50, 114, 142, 808, 896, 2201, 14, 0, 8571, 205, 2142, 50, 28, 0, 0, 0, 114, 0],['Weblancer.net',0, 0, 0, 0, 38, 2, 15, 1075, 1065, 65, 20, 508, 12, 0, 1800, 69, 52, 510, 0, 30, 0, 0, 5, 0],['Freelance.ru',0, 0, 0, 128, 0, 0, 157, 21, 300, 102, 568, 77, 2057, 35, 354, 497, 0, 511, 285, 624, 142, 0, 0, 0],['Freelance.youdo.com',0, 0, 100, 0, 57, 28, 400, 1228, 571, 457, 1700, 1678, 628, 71, 1871, 485, 314, 328, 128, 28, 71, 0, 0, 0],['Upwork.com',15429, 117241, 26314, 33596, 34126, 28238, 25324, 52216, 106314, 134530, 40506, 26519, 25356, 34142, 102594, 540800, 67555, 49629, 34269, 24717, 32908, 26629, 17291, 27056],['Freelancer.com',79610, 521655, 59393, 49716, 58765, 100747, 133432, 59858, 78460, 572929, 63821, 44337, 62153, 49032, 153370, 59274, 90370, 48507, 33723, 80260, 36595, 60265, 59407, 46102],['Peopleperhour.com',108, 0, 622, 0, 613, 613, 162, 1455, 12750, 133, 258, 3129, 1801, 1603, 2233, 922, 874, 14446, 1200, 0, 0, 0, 0, 0],['Guru.com',10255, 50, 0, 500, 1287, 605, 265, 500, 500, 0, 0, 0, 0, 0, 5250, 2, 0, 0, 6000, 1545, 0, 0, 1250, 750],['Etxt.ru',1, 6, 59, 75, 86, 81, 243, 319, 337, 193, 315, 232, 224, 203, 199, 226, 226, 209, 138, 144, 95, 48, 38, 46],['YouDo.com',3015, 4464, 14974, 16087, 12654, 15509, 32039, 55155, 20533, 37843, 24653, 23296, 21683, 59975, 14071, 18255, 12786, 8942, 34347, 7795, 1202, 2257, 460, 1132],['Freelance.ua',0, 0, 0, 196, 17, 0, 0, 103, 262, 93, 3871, 157, 63, 35, 1464, 96, 28, 3625, 0, 2200, 3, 0, 0, 0],['Text.ru',22, 2, 3, 40, 15, 15, 32, 40, 18, 69, 36, 19, 121, 55, 117, 63, 97, 145, 71, 32, 35, 18, 2, 0],['Advego.com',4, 1, 2, 0, 11, 14, 9, 3, 4, 4, 15, 29, 1, 0, 0, 0, 0, 0, 0, 0, 0, 4, 17, 24],['Kabannchik.ua',0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],['Kwork.ru',128, 85, 1400, 864, 8550, 1778, 2260, 791, 12171, 10799, 5594, 13412, 9075, 1564, 3359, 2262, 15604, 7842, 722, 4750, 857, 135, 21, 64], ], type: 'pie', }, tooltip: { format: { value: function(value, ratio, id) { return d3.format("$,")(value); } } }, }); var chart_pie_projects = c3.generate({ bindto: '#container3', data: { columns: [ ['Fl.ru',6, 1, 4, 28, 15, 33, 28, 18, 28, 36, 34, 34, 32, 29, 24, 18, 15, 12, 11, 5, 5, 3, 2, 4],['Freelancehunt.com',5, 2, 2, 3, 9, 10, 6, 14, 13, 18, 13, 10, 12, 14, 10, 15, 21, 13, 17, 6, 5, 1, 0, 0],['Habr.freelance',0, 3, 0, 1, 2, 1, 1, 3, 2, 7, 5, 6, 3, 0, 2, 2, 3, 3, 1, 2, 0, 0, 3, 0],['Weblancer.net',1, 0, 5, 0, 2, 1, 2, 7, 6, 3, 7, 12, 7, 5, 2, 6, 6, 4, 2, 4, 0, 1, 3, 1],['Freelance.ru',1, 1, 0, 2, 0, 1, 9, 5, 12, 15, 17, 15, 16, 7, 13, 10, 6, 8, 6, 6, 6, 1, 5, 0],['Freelance.youdo.com',0, 0, 2, 0, 2, 1, 8, 8, 8, 4, 11, 9, 6, 1, 17, 6, 5, 7, 3, 1, 1, 0, 0, 0],['Upwork.com',120, 123, 155, 145, 173, 179, 204, 202, 196, 242, 258, 222, 238, 274, 270, 256, 264, 226, 245, 170, 195, 186, 177, 204],['Freelancer.com',85, 87, 114, 99, 147, 170, 158, 126, 165, 165, 148, 141, 148, 142, 147, 188, 162, 116, 113, 105, 95, 110, 110, 83],['Peopleperhour.com',2, 0, 5, 0, 4, 6, 4, 13, 8, 1, 3, 25, 10, 4, 12, 8, 7, 11, 14, 0, 0, 0, 0, 0],['Guru.com',3, 2, 0, 3, 5, 4, 2, 2, 2, 0, 0, 0, 1, 0, 2, 1, 0, 0, 3, 8, 0, 0, 3, 3],['Etxt.ru',2, 6, 39, 36, 33, 46, 153, 212, 155, 157, 150, 157, 201, 164, 150, 157, 141, 130, 125, 135, 95, 46, 46, 47],['YouDo.com',15, 16, 38, 57, 93, 142, 218, 201, 173, 215, 193, 208, 158, 180, 139, 140, 110, 100, 99, 65, 19, 10, 13, 13],['Freelance.ua',0, 0, 0, 1, 1, 2, 0, 5, 5, 7, 6, 4, 3, 1, 4, 4, 2, 4, 0, 1, 1, 0, 0, 0],['Text.ru',12, 5, 4, 28, 15, 5, 9, 61, 20, 26, 18, 10, 12, 11, 22, 22, 18, 37, 19, 2, 4, 3, 6, 0],['Advego.com',1, 2, 3, 2, 17, 11, 8, 4, 15, 7, 8, 12, 1, 0, 0, 0, 0, 0, 0, 0, 0, 4, 5, 15],['Kabannchik.ua',0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],['Kwork.ru',1, 1, 7, 7, 22, 17, 26, 21, 37, 24, 33, 30, 25, 20, 18, 21, 24, 15, 18, 8, 5, 2, 1, 1], ], type: 'pie', }, tooltip: { format: { value: function(value, ratio, id) { return d3.format(",")(value); } } }, }); });