793 lines
28 KiB
JavaScript
793 lines
28 KiB
JavaScript
var grab_all_data_api = "https://rms.rmto.ir/reports_summary";
|
||
var data;
|
||
var delayed;
|
||
// data colections
|
||
var gasht_rozane;
|
||
var user_activity;
|
||
var contract_subitem_projects;
|
||
var total_percent_complaints_handled;
|
||
var number_of_complaints_per_type;
|
||
var mehvar_statistics;
|
||
var top_provinces_according_to_number_of_complaints_handled;
|
||
var top_provinces_according_to_percent_of_complaints_handled;
|
||
var links;
|
||
var naqshe_faaliat_haye_rozaneh;
|
||
// map variables
|
||
var iranGeoJSON = JSON.parse(PROVICES_GEOJSON);
|
||
|
||
var iranMapGeo;
|
||
var keepMapFeatureColor = null;
|
||
var iranArrayCount = 0;
|
||
MAP_ENDPOINT = "https://rmsmap.rmto.ir";
|
||
var bounds = [
|
||
[42.9130026312, 75.6166317076],
|
||
[20.5782370061, 35.5092252948],
|
||
];
|
||
var showbounds = [32.4279, 53.688];
|
||
var mapZoning;
|
||
var diagramData = [];
|
||
// end map variables
|
||
const hideChartLegend = getWidth() < 508 ? false : true;
|
||
const mapZoom = getWidth() < 508 ? 4 : 5;
|
||
const today = new Date();
|
||
const year = today.getFullYear();
|
||
// end data colections
|
||
|
||
// square func
|
||
function squareFunc() {
|
||
let cw = $('.square-maker').width();
|
||
$('.square-maker').css({'height':cw+'px'});
|
||
}
|
||
// end square func
|
||
|
||
// resize func
|
||
window.addEventListener('resize', function(event) {
|
||
squareFunc();
|
||
}, true);
|
||
|
||
function getWidth() {
|
||
return Math.max(
|
||
document.body.scrollWidth,
|
||
document.documentElement.scrollWidth,
|
||
document.body.offsetWidth,
|
||
document.documentElement.offsetWidth,
|
||
document.documentElement.clientWidth
|
||
);
|
||
}
|
||
// end resize func
|
||
|
||
// map part
|
||
function initStyleMapFeatures() {
|
||
let randomchoose = null;
|
||
randomchoose = getForArrayFeatureColor(fillColorMap(iranArrayCount, diagramData));
|
||
let StyleMap = {
|
||
fillColor: randomchoose.color,
|
||
weight: 2,
|
||
opacity: 1,
|
||
color: "white",
|
||
fillOpacity: 0.5,
|
||
};
|
||
if (randomchoose.num != -2) {
|
||
if (iranArrayCount == 35) {
|
||
iranArrayCount = 0;
|
||
}
|
||
iranArrayCount++;
|
||
}
|
||
return StyleMap;
|
||
}
|
||
|
||
function fillColorMap(featureRow, diagramData) {
|
||
for (let i = 0; i < diagramData.length; i++) {
|
||
if (i == featureRow) {
|
||
return diagramData[i];
|
||
}
|
||
}
|
||
}
|
||
|
||
function getForArrayFeatureColor(arrayNum) {
|
||
if (keepMapFeatureColor) {
|
||
return {
|
||
num: -1,
|
||
color: keepMapFeatureColor,
|
||
};
|
||
} else {
|
||
var colors = {};
|
||
var minOfData = Math.min(...diagramData);
|
||
var maxOfData = Math.max(...diagramData);
|
||
var quarter = Math.round((maxOfData - minOfData) / 3);
|
||
if (arrayNum == null) {
|
||
colors = {
|
||
num: arrayNum,
|
||
color: "#B2B1B9",
|
||
};
|
||
} else if (arrayNum <= minOfData + quarter)
|
||
colors = {
|
||
num: arrayNum,
|
||
color: "#FF0000",
|
||
};
|
||
else if (arrayNum < maxOfData - quarter)
|
||
colors = {
|
||
num: arrayNum,
|
||
color: "#FFCC00",
|
||
};
|
||
else
|
||
colors = {
|
||
num: arrayNum,
|
||
color: "#13BB51",
|
||
};
|
||
|
||
return colors;
|
||
}
|
||
}
|
||
// end map part
|
||
|
||
$(function() {
|
||
mapZoning = L.map("map_zoning", {
|
||
maxBounds: bounds,
|
||
zoomControl: false,
|
||
dragging: false,
|
||
minZoom: mapZoom,
|
||
maxZoom: mapZoom,
|
||
attributionControl: false
|
||
}).setView(showbounds, 5);
|
||
$(".forth-year-header").text(moment(today).format("jYYYY") - 3);
|
||
$(".third-year-header").text(moment(today).format("jYYYY") - 2);
|
||
$(".second-year-header").text(moment(today).format("jYYYY") - 1);
|
||
$(".first-year-header").text(moment(today).format("jYYYY"));
|
||
Chart.defaults.font.family = "IRANSansFaNum";
|
||
squareFunc();
|
||
// grab data
|
||
$.ajax({
|
||
url: grab_all_data_api,
|
||
type: "GET",
|
||
cache: false,
|
||
async: false,
|
||
contentType: false,
|
||
processData: false,
|
||
success: function(result) {
|
||
data = result.data;
|
||
console.log(data);
|
||
gasht_rozane = data.find( ({ report_name }) => report_name === 'gasht_rozane' );
|
||
user_activity = data.find( ({ report_name }) => report_name === 'user_activity' );
|
||
contract_subitem_projects = data.find( ({ report_name }) => report_name === 'contract_subitem_projects' );
|
||
total_percent_complaints_handled = data.find( ({ report_name }) => report_name === 'total_percent_complaints_handled' );
|
||
number_of_complaints_per_type = data.find( ({ report_name }) => report_name === 'number_of_complaints_per_type' );
|
||
mehvar_statistics = data.find( ({ report_name }) => report_name === 'mehvar_statistics' );
|
||
top_provinces_according_to_number_of_complaints_handled = data.find( ({ report_name }) => report_name === 'top_provinces_according_to_number_of_complaints_handled' );
|
||
top_provinces_according_to_percent_of_complaints_handled = data.find( ({ report_name }) => report_name === 'top_provinces_according_to_percent_of_complaints_handled' );
|
||
links = data.find( ({ report_name }) => report_name === 'links' );
|
||
naqshe_faaliat_haye_rozaneh = data.find( ({ report_name }) => report_name === 'naqshe_faaliat_haye_rozaneh' );
|
||
diagramData = naqshe_faaliat_haye_rozaneh.data.geojson;
|
||
showcountall();
|
||
},
|
||
error: function() {
|
||
Swal.fire({
|
||
icon: "error",
|
||
title: "خطا",
|
||
text: "مشکل در دریافت اطلاعات",
|
||
confirmButtonText: "بروزرسانی صفحه",
|
||
showLoaderOnConfirm: true,
|
||
preConfirm: () => {
|
||
location.reload(true);
|
||
},
|
||
});
|
||
},
|
||
});
|
||
// end grab data
|
||
|
||
// map geojson
|
||
keepMapFeatureColor = null;
|
||
iranArrayCount = 0;
|
||
iranMapGeo = L.geoJSON(iranGeoJSON, {
|
||
style: initStyleMapFeatures,
|
||
});
|
||
iranMapGeo.addTo(mapZoning);
|
||
// end map geojson
|
||
|
||
// counter func
|
||
function showcountall() {
|
||
$(".project-num-counter").append( `<span class="count-this filteritem counter-for-rahdari counter-for" >${contract_subitem_projects.data.count}</span>` );
|
||
$(".hour-counter-first").append( `<span class="count-this filteritem counter-for-rahdari counter-for" >1401</span>` );
|
||
$(".number-counter-first").append( `<span class="count-this filteritem counter-for-rahdari counter-for" >1401</span>` );
|
||
$(".hour-counter-second").append( `<span class="count-this filteritem counter-for-rahdari counter-for" >1400</span>` );
|
||
$(".number-counter-second").append( `<span class="count-this filteritem counter-for-rahdari counter-for" >1400</span>` );
|
||
$(".hour-counter-third").append( `<span class="count-this filteritem counter-for-rahdari counter-for" >1399</span>` );
|
||
$(".number-counter-third").append( `<span class="count-this filteritem counter-for-rahdari counter-for" >1399</span>` );
|
||
$(".hour-counter-forth").append( `<span class="count-this filteritem counter-for-rahdari counter-for" >1398</span>` );
|
||
$(".number-counter-forth").append( `<span class="count-this filteritem counter-for-rahdari counter-for" >1398</span>` );
|
||
counternum()
|
||
}
|
||
function counternum() {
|
||
$('.count-this').each(function () {
|
||
$(this).prop('Counter', 0).animate({ Counter: $(this).text() }, {
|
||
duration: 2000,
|
||
easing: 'swing',
|
||
step: function (now) { $(this).text(Math.ceil(now)); }
|
||
});
|
||
});
|
||
}
|
||
// end counter func
|
||
|
||
// swiper slider
|
||
const swiper = new Swiper('.swiper', {
|
||
autoplay: {
|
||
delay: 3000,
|
||
disableOnInteraction: false,
|
||
},
|
||
loop: true,
|
||
});
|
||
// end swiper slider
|
||
|
||
// gasht rozane
|
||
$(document).find(".circle-1-pipe-line").text(gasht_rozane.data[0].province_fa);
|
||
$(document).find(".circle-2-pipe-line").text(gasht_rozane.data[1].province_fa);
|
||
$(document).find(".circle-3-pipe-line").text(gasht_rozane.data[2].province_fa);
|
||
$(document).find(".circle-4-pipe-line").text(gasht_rozane.data[3].province_fa);
|
||
$(document).find(".circle-5-pipe-line").text(gasht_rozane.data[4].province_fa);
|
||
$(document).find(".circle-1-count").text(parseFloat(gasht_rozane.data[0].avarage_distance).toFixed(2));
|
||
$(document).find(".circle-2-count").text(parseFloat(gasht_rozane.data[1].avarage_distance).toFixed(2));
|
||
$(document).find(".circle-3-count").text(parseFloat(gasht_rozane.data[2].avarage_distance).toFixed(2));
|
||
$(document).find(".circle-4-count").text(parseFloat(gasht_rozane.data[3].avarage_distance).toFixed(2));
|
||
$(document).find(".circle-5-count").text(parseFloat(gasht_rozane.data[4].avarage_distance).toFixed(2));
|
||
// gasht rozane
|
||
|
||
// top_provinces_according_to_number_of_complaints_handled
|
||
const top_provinces_according_to_number_of_complaints_handled_Label = [];
|
||
const top_provinces_according_to_number_of_complaints_handled_Count = [];
|
||
for (let i = 0; i < top_provinces_according_to_number_of_complaints_handled.data.length; i++) {
|
||
top_provinces_according_to_number_of_complaints_handled_Count.push(top_provinces_according_to_number_of_complaints_handled.data[i].count_number);
|
||
top_provinces_according_to_number_of_complaints_handled_Label.push(top_provinces_according_to_number_of_complaints_handled.data[i].ProvinceName);
|
||
}
|
||
const top_provinces_according_to_number_of_complaints_handled_ChartData = {
|
||
labels: top_provinces_according_to_number_of_complaints_handled_Label,
|
||
datasets: [{
|
||
data: top_provinces_according_to_number_of_complaints_handled_Count,
|
||
backgroundColor: [
|
||
'#f3722c'
|
||
],
|
||
borderColor: '#f3722c',
|
||
borderWidth: 3,
|
||
}]
|
||
};
|
||
const top_provinces_according_to_number_of_complaints_handled_option = {
|
||
responsive: true,
|
||
maintainAspectRatio: false,
|
||
layout: {
|
||
padding: 15
|
||
},
|
||
plugins: {
|
||
title: {
|
||
display: true,
|
||
position: 'top',
|
||
text: "استان های برتر بر اساس تعداد رسیدگی به شکایات",
|
||
font: {
|
||
family: "IRANSansFaNum",
|
||
size: 14,
|
||
weight: 'bold'
|
||
}
|
||
},
|
||
legend: {
|
||
display: false
|
||
}
|
||
},
|
||
}
|
||
|
||
const top_provinces_according_to_number_of_complaints_handled_chart = new Chart(
|
||
document.getElementById("top_provinces_according_to_number_of_complaints_handled").getContext("2d"),
|
||
{
|
||
type: 'line',
|
||
data: top_provinces_according_to_number_of_complaints_handled_ChartData,
|
||
options: top_provinces_according_to_number_of_complaints_handled_option,
|
||
}
|
||
);
|
||
// end top_provinces_according_to_number_of_complaints_handled
|
||
|
||
// status_sperate
|
||
const status_sperate_Label = [];
|
||
const status_sperate_Count = [];
|
||
for (let i = 0; i < contract_subitem_projects.data.status_sperate.data.length; i++) {
|
||
status_sperate_Count.push(contract_subitem_projects.data.status_sperate.data[i]);
|
||
status_sperate_Label.push(contract_subitem_projects.data.status_sperate.label[i]);
|
||
}
|
||
const status_sperate_ChartData = {
|
||
labels: status_sperate_Label,
|
||
datasets: [{
|
||
data: status_sperate_Count,
|
||
backgroundColor: [
|
||
'#f3722c',
|
||
'#f8961e',
|
||
'#577590',
|
||
'#43aa8b'
|
||
],
|
||
}]
|
||
};
|
||
const status_sperate_option = {
|
||
responsive: true,
|
||
maintainAspectRatio: false,
|
||
layout: {
|
||
padding: 15
|
||
},
|
||
animation: {
|
||
onComplete: () => {
|
||
delayed = true;
|
||
},
|
||
delay: (context) => {
|
||
let delay = 0;
|
||
if (context.type === 'data' && context.mode === 'default' && !delayed) {
|
||
delay = context.dataIndex * 300 + context.datasetIndex * 100;
|
||
}
|
||
return delay;
|
||
},
|
||
},
|
||
plugins: {
|
||
title: {
|
||
display: true,
|
||
position: 'top',
|
||
text: "پروژه ها به تفکیک وضعیت",
|
||
font: {
|
||
family: "IRANSansFaNum",
|
||
size: 14,
|
||
weight: 'bold'
|
||
}
|
||
},
|
||
legend: {
|
||
display: hideChartLegend,
|
||
position: "left",
|
||
rtl: true,
|
||
labels: {
|
||
boxWidth: 13,
|
||
fontSize: 16,
|
||
fontStyle: "bold",
|
||
fontColor: "#000",
|
||
},
|
||
},
|
||
},
|
||
}
|
||
|
||
const status_sperate_chart = new Chart(
|
||
document.getElementById("project_status_sperate").getContext("2d"),
|
||
{
|
||
type: 'doughnut',
|
||
data: status_sperate_ChartData,
|
||
options: status_sperate_option,
|
||
}
|
||
);
|
||
// end status_sperate
|
||
|
||
// type_sperate
|
||
const type_sperate_Label = [];
|
||
const type_sperate_Count = [];
|
||
for (let i = 0; i < contract_subitem_projects.data.type_sperate.data.length; i++) {
|
||
type_sperate_Count.push(contract_subitem_projects.data.type_sperate.data[i]);
|
||
type_sperate_Label.push(contract_subitem_projects.data.type_sperate.label[i]);
|
||
}
|
||
const type_sperate_ChartData = {
|
||
labels: type_sperate_Label,
|
||
datasets: [{
|
||
data: type_sperate_Count,
|
||
backgroundColor: [
|
||
'#277da1',
|
||
'#43aa8b',
|
||
'#577590',
|
||
'#f8961e',
|
||
'#f3722c',
|
||
"#dd2c2c"
|
||
],
|
||
}]
|
||
};
|
||
const type_sperate_option = {
|
||
responsive: true,
|
||
maintainAspectRatio: false,
|
||
layout: {
|
||
padding: 15
|
||
},
|
||
animation: {
|
||
onComplete: () => {
|
||
delayed = true;
|
||
},
|
||
delay: (context) => {
|
||
let delay = 0;
|
||
if (context.type === 'data' && context.mode === 'default' && !delayed) {
|
||
delay = context.dataIndex * 300 + context.datasetIndex * 100;
|
||
}
|
||
return delay;
|
||
},
|
||
},
|
||
plugins: {
|
||
title: {
|
||
display: true,
|
||
position: 'top',
|
||
text: "پروژه ها به تفکیک نوع",
|
||
font: {
|
||
family: "IRANSansFaNum",
|
||
size: 14,
|
||
weight: 'bold'
|
||
}
|
||
},
|
||
legend: {
|
||
display: hideChartLegend,
|
||
position: "left",
|
||
rtl: true,
|
||
labels: {
|
||
boxWidth: 13,
|
||
fontSize: 16,
|
||
fontStyle: "bold",
|
||
fontColor: "#000",
|
||
},
|
||
},
|
||
},
|
||
}
|
||
|
||
const type_sperate_chart = new Chart(
|
||
document.getElementById("project_type_sperate").getContext("2d"),
|
||
{
|
||
type: 'pie',
|
||
data: type_sperate_ChartData,
|
||
options: type_sperate_option,
|
||
}
|
||
);
|
||
// end type_sperate
|
||
|
||
// number_of_complaints_per_type
|
||
const number_of_complaints_per_type_Label = [];
|
||
const number_of_complaints_per_type_Count_processed = [];
|
||
const number_of_complaints_per_type_Count_reached = [];
|
||
for (let i = 0; i < number_of_complaints_per_type.data.labels.length; i++) {
|
||
number_of_complaints_per_type_Count_processed.push(number_of_complaints_per_type.data.datasets[0].data[i]);
|
||
number_of_complaints_per_type_Count_reached.push(number_of_complaints_per_type.data.datasets[1].data[i]);
|
||
if (screen.width < 1000 && screen.width >= 490) {
|
||
number_of_complaints_per_type_Label.push(number_of_complaints_per_type.data.labels[i].substring(0,14) + "...");
|
||
}else if(screen.width < 490) {
|
||
number_of_complaints_per_type_Label.push("");
|
||
}
|
||
else {
|
||
number_of_complaints_per_type_Label.push(number_of_complaints_per_type.data.labels[i]);
|
||
}
|
||
}
|
||
const number_of_complaints_per_type_ChartData = {
|
||
labels: number_of_complaints_per_type_Label,
|
||
datasets: [
|
||
{
|
||
label: number_of_complaints_per_type.data.datasets[0].label,
|
||
backgroundColor: "#277da1",
|
||
data: number_of_complaints_per_type_Count_processed
|
||
},
|
||
{
|
||
label: number_of_complaints_per_type.data.datasets[1].label,
|
||
backgroundColor: "#f3722c",
|
||
data: number_of_complaints_per_type_Count_reached
|
||
}
|
||
]
|
||
};
|
||
const number_of_complaints_per_type_option = {
|
||
responsive: true,
|
||
maintainAspectRatio: true,
|
||
layout: {
|
||
padding: 15
|
||
},
|
||
animation: {
|
||
onComplete: () => {
|
||
delayed = true;
|
||
},
|
||
delay: (context) => {
|
||
let delay = 0;
|
||
if (context.type === 'data' && context.mode === 'default' && !delayed) {
|
||
delay = context.dataIndex * 300 + context.datasetIndex * 100;
|
||
}
|
||
return delay;
|
||
},
|
||
},
|
||
plugins: {
|
||
title: {
|
||
display: true,
|
||
position: 'top',
|
||
text: "شکایات به تفکیک نوع",
|
||
font: {
|
||
family: "IRANSansFaNum",
|
||
size: 14,
|
||
weight: 'bold'
|
||
}
|
||
},
|
||
legend: {
|
||
display: false
|
||
}
|
||
},
|
||
}
|
||
|
||
const number_of_complaints_per_type_chart = new Chart(
|
||
document.getElementById("number_of_complaints_per_type").getContext("2d"),
|
||
{
|
||
type: 'bar',
|
||
data: number_of_complaints_per_type_ChartData,
|
||
options: number_of_complaints_per_type_option,
|
||
}
|
||
);
|
||
// end number_of_complaints_per_type
|
||
|
||
// mehvar_statistics_pie length & cnt
|
||
const mehvar_statistics_pie_Label_length = [];
|
||
const mehvar_statistics_pie_Count_length = [];
|
||
const mehvar_statistics_pie_Count_cnt = [];
|
||
for (let i = 0; i < mehvar_statistics.data.charts.pies.length; i++) {
|
||
mehvar_statistics_pie_Count_length.push(mehvar_statistics.data.charts.pies[i].lenght);
|
||
mehvar_statistics_pie_Count_cnt.push(mehvar_statistics.data.charts.pies[i].cnt);
|
||
mehvar_statistics_pie_Label_length.push(mehvar_statistics.data.charts.pies[i].blockage_cause_fa);
|
||
}
|
||
const mehvar_statistics_pie_ChartData_length = {
|
||
labels: mehvar_statistics_pie_Label_length,
|
||
datasets: [{
|
||
data: mehvar_statistics_pie_Count_length,
|
||
backgroundColor: [
|
||
'#277da1',
|
||
'#43aa8b',
|
||
'#577590',
|
||
'#f8961e',
|
||
'#f3722c'
|
||
],
|
||
}]
|
||
};
|
||
const mehvar_statistics_pie_ChartData_cnt = {
|
||
labels: mehvar_statistics_pie_Label_length,
|
||
datasets: [{
|
||
data: mehvar_statistics_pie_Count_cnt,
|
||
backgroundColor: [
|
||
'#277da1',
|
||
'#43aa8b',
|
||
'#577590',
|
||
'#f8961e',
|
||
'#f3722c'
|
||
],
|
||
}]
|
||
};
|
||
const mehvar_statistics_pie_option_length = {
|
||
responsive: true,
|
||
maintainAspectRatio: false,
|
||
layout: {
|
||
padding: 15
|
||
},
|
||
animation: {
|
||
onComplete: () => {
|
||
delayed = true;
|
||
},
|
||
delay: (context) => {
|
||
let delay = 0;
|
||
if (context.type === 'data' && context.mode === 'default' && !delayed) {
|
||
delay = context.dataIndex * 300 + context.datasetIndex * 100;
|
||
}
|
||
return delay;
|
||
},
|
||
},
|
||
plugins: {
|
||
title: {
|
||
display: true,
|
||
position: 'top',
|
||
text: "طول محور های آسیب دیده",
|
||
font: {
|
||
family: "IRANSansFaNum",
|
||
size: 14,
|
||
weight: 'bold'
|
||
}
|
||
},
|
||
legend: {
|
||
display: false
|
||
}
|
||
},
|
||
}
|
||
const mehvar_statistics_pie_option_cnt = {
|
||
responsive: true,
|
||
maintainAspectRatio: false,
|
||
layout: {
|
||
padding: 15
|
||
},
|
||
animation: {
|
||
onComplete: () => {
|
||
delayed = true;
|
||
},
|
||
delay: (context) => {
|
||
let delay = 0;
|
||
if (context.type === 'data' && context.mode === 'default' && !delayed) {
|
||
delay = context.dataIndex * 300 + context.datasetIndex * 100;
|
||
}
|
||
return delay;
|
||
},
|
||
},
|
||
plugins: {
|
||
title: {
|
||
display: true,
|
||
position: 'top',
|
||
text: "تعداد محور های آسیب دیده",
|
||
font: {
|
||
family: "IRANSansFaNum",
|
||
size: 14,
|
||
weight: 'bold'
|
||
}
|
||
},
|
||
legend: {
|
||
display: false
|
||
}
|
||
},
|
||
}
|
||
const mehvar_statistics_pie_chart_length = new Chart(
|
||
document.getElementById("mehvar_statistics_pie_length").getContext("2d"),
|
||
{
|
||
type: 'doughnut',
|
||
data: mehvar_statistics_pie_ChartData_length,
|
||
options: mehvar_statistics_pie_option_length,
|
||
}
|
||
);
|
||
const mehvar_statistics_pie_chart_cnt = new Chart(
|
||
document.getElementById("mehvar_statistics_pie_cnt").getContext("2d"),
|
||
{
|
||
type: 'pie',
|
||
data: mehvar_statistics_pie_ChartData_cnt,
|
||
options: mehvar_statistics_pie_option_cnt,
|
||
}
|
||
);
|
||
// end mehvar_statistics_pie length & cnt
|
||
|
||
// road geometry acc contribution
|
||
const mehvar_statistics_stack_data = mehvar_statistics.data.charts.stack;
|
||
const mylabels =[]
|
||
const mydatasets = []
|
||
|
||
const colors = [
|
||
'#277da1',
|
||
'#43aa8b',
|
||
'#577590',
|
||
'#f8961e',
|
||
'#f3722c'
|
||
]
|
||
let cntarr = {}
|
||
let lengtharr = {}
|
||
|
||
for(const [index, mevar_stack] of mehvar_statistics_stack_data.entries()){
|
||
|
||
for (const item of mevar_stack.data) {
|
||
if(cntarr[item.blockage_cause_fa] == undefined) cntarr[item.blockage_cause_fa] = []
|
||
cntarr[item.blockage_cause_fa][index] = item.cnt
|
||
|
||
if(lengtharr[item.blockage_cause_fa] == undefined) lengtharr[item.blockage_cause_fa] = []
|
||
lengtharr[item.blockage_cause_fa][index] = item.length
|
||
}
|
||
|
||
mylabels.push(mevar_stack.axis_type_fa)
|
||
}
|
||
|
||
let indexColor = 0
|
||
for (const [key,item] of Object.entries(cntarr)) {
|
||
mydatasets.push(
|
||
{
|
||
label: key,
|
||
data: item,
|
||
stack: 0,
|
||
backgroundColor: colors[indexColor]
|
||
}
|
||
)
|
||
indexColor++
|
||
}
|
||
|
||
indexColor = 0
|
||
for (const [key,item] of Object.entries(lengtharr)) {
|
||
mydatasets.push(
|
||
{
|
||
label: key,
|
||
data: item,
|
||
stack: 1,
|
||
backgroundColor: colors[indexColor]
|
||
}
|
||
)
|
||
indexColor++
|
||
}
|
||
|
||
const mehvar_statistics_stack_ChartData = {
|
||
labels: mylabels,
|
||
datasets: mydatasets,
|
||
};
|
||
const mehvar_statistics_stack_option = {
|
||
responsive: true,
|
||
maintainAspectRatio: true,
|
||
layout: {
|
||
padding: 15
|
||
},
|
||
animation: {
|
||
onComplete: () => {
|
||
delayed = true;
|
||
},
|
||
delay: (context) => {
|
||
let delay = 0;
|
||
if (context.type === 'data' && context.mode === 'default' && !delayed) {
|
||
delay = context.dataIndex * 300 + context.datasetIndex * 100;
|
||
}
|
||
return delay;
|
||
},
|
||
},
|
||
plugins: {
|
||
title: {
|
||
display: true,
|
||
position: 'top',
|
||
text: "اطلاعات محور های آسیب دیده (طول/تعداد)",
|
||
font: {
|
||
family: "IRANSansFaNum",
|
||
size: 14,
|
||
weight: 'bold'
|
||
}
|
||
},
|
||
legend: {
|
||
display: false
|
||
}
|
||
},
|
||
// interaction: {
|
||
// mode: 'point'
|
||
// },
|
||
scales: {
|
||
x: {
|
||
stacked: true,
|
||
},
|
||
y: {
|
||
stacked: true
|
||
}
|
||
},
|
||
}
|
||
const mehvar_statistics_stack_Chart = new Chart(
|
||
document.getElementById("mehvar_statistics_stack").getContext("2d"),
|
||
{
|
||
type: 'bar',
|
||
data: mehvar_statistics_stack_ChartData,
|
||
options: mehvar_statistics_stack_option,
|
||
}
|
||
);
|
||
// end road geometry acc contribution
|
||
|
||
// timeline
|
||
for (let i = user_activity.data.length-1; i > user_activity.data.length-5; i--) {
|
||
let timelineEvent = "";
|
||
if (user_activity.data[i].user_activity != 0 && user_activity.data[i].user_activity_count != 0) {
|
||
timelineEvent += `<li class="timeline-event">
|
||
<label class="timeline-event-icon"></label>
|
||
<div class="timeline-event-copy">
|
||
<p class="timeline-event-thumbnail first-year-header">${user_activity.data[i].year}</p>
|
||
<div class="row my-3">
|
||
<div class="col-6 d-flex justify-content-center">
|
||
<div class="d-flex flex-column action-counter-box align-items-center">
|
||
<i class="action-icon fa fa-clock"></i>
|
||
<div class="timeline-counter hour-counter-first">${user_activity.data[i].user_activity}</div>
|
||
<small class="action-counter-title">ساعت فعالیت</small>
|
||
</div>
|
||
</div>
|
||
<div class="col-6 d-flex justify-content-center">
|
||
<div class="d-flex flex-column action-counter-box align-items-center">
|
||
<i class="action-icon fa fa-calculator"></i>
|
||
<div class="timeline-counter number-counter-first">${user_activity.data[i].user_activity_count}</div>
|
||
<small class="action-counter-title">تعداد فعالیت</small>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</li>`;
|
||
$(".timeline").append(timelineEvent);
|
||
}
|
||
}
|
||
// end timeline
|
||
|
||
// link parts
|
||
let link_buttons = "";
|
||
for (let i = 0; i < links.data.length; i++) {
|
||
link_buttons += `<div class="links mt-2 d-flex align-items-center"><a href="${links.data[i].address}"><button class="btn-links link-${i} px-3 py-3"><span class="btn-links-span pl-2 ml-2"><i class="fa fa-tags"></i></span>${links.data[i].title}</button></a></div>`;
|
||
}
|
||
$(".link-parts").append(link_buttons);
|
||
// end link parts
|
||
});
|
||
$('#downloadApp').on('click', function(){
|
||
window.open(`https://rms.rmto.ir/storage/rmto_1400_3_5.apk`, '_blank')
|
||
})
|
||
$(document).on("click", "#namayeshgah" , function() {
|
||
const modal = $("#exhibition_modal");
|
||
modal.modal("show");
|
||
});
|
||
$('#exhibition_new').on('click', function(){
|
||
window.open(`https://www.panoman.ir/vexpo/rahdari1400/`, '_blank')
|
||
})
|
||
|
||
$('#exhibition_first').on('click', function(){
|
||
window.open(`https://www.panoman.ir/vexpo/innoroad2020/`, '_blank')
|
||
}) |