Commit 4fc0e6d2 authored by Clément Damiens's avatar Clément Damiens
Browse files

Merge branch 'qa'

parents a0c3271f 9c763ebc
......@@ -7,6 +7,16 @@
<script type="text/javascript">
window.chartColors = {
red: 'rgb(255, 99, 132)',
orange: 'rgb(255, 159, 64)',
yellow: 'rgb(255, 205, 86)',
green: 'rgb(75, 192, 192)',
blue: 'rgb(54, 162, 235)',
purple: 'rgb(153, 102, 255)',
grey: 'rgb(201, 203, 207)'
};
var COLORS = [
"#0A2F62",
"#0B2D66",
......
<?php
$cssAnsScriptFilesTheme = array(
"/plugins/Chart-2.8.0/Chart.min.js",
); HtmlHelper::registerCssAndScriptsFiles($cssAnsScriptFilesTheme, Yii::app()->request->baseUrl);
?>
<script type="text/javascript">
window.chartColors = {
red: 'rgb(255, 99, 132)',
orange: 'rgb(255, 159, 64)',
yellow: 'rgb(255, 205, 86)',
green: 'rgb(75, 192, 192)',
blue: 'rgb(54, 162, 235)',
purple: 'rgb(153, 102, 255)',
grey: 'rgb(201, 203, 207)'
};
var materialcolor = [
window.chartColors.red , window.chartColors.orange , window.chartColors.yellow, window.chartColors.green, window.chartColors.blue, window.chartColors.purple, window.chartColors.grey
]
var COLORS = [
"#0A2F62",
"#0B2D66",
"#064191",
"#2C97D0",
"#16A9B1",
"#0AA178",
"#74B976",
"#0AA178",
"#16A9B1",
"#2A99D1",
"#064191",
"#0B2E68"
];
</script>
<div id="container" style="margin:0px auto;width:100%">
<canvas id="canvas-bar<?php echo $id?>"></canvas>
</div>
<script>
var randomScalingFactor = function() {
return Math.round(Math.random() * 100);
};
jQuery(document).ready(function() {
if(typeof <?php echo $id?>Data == "undefined"){
mylog.log("render","/modules/graph/views/co/bar.php");
var barChartData = {
labels: ["Developpement",
"Chef de projet",
"Formation",
"Commercial",
"Graphiste",
"Designer",
"Créatif"],
datasets: [{
label : "Tibor",
backgroundColor: window.chartColors.red,
borderColor: window.chartColors.red,
borderWidth: 1,
data: [78,43,40,29,40,59,103]
},
{
label : "Rapha",
backgroundColor: window.chartColors.blue,
borderColor: window.chartColors.blue,
borderWidth: 1,
data: [28,23,20,9,20,29,203]
},
{
label : "Bouboule",
backgroundColor: window.chartColors.orange,
borderColor: window.chartColors.orange,
borderWidth: 1,
data: [8,5,2,98,200,299,3]
}]
};
} else {
var barChartData<?php echo $id?> = {
labels : <?php echo $id?>Data.label,
datasets: [
{
backgroundColor: materialcolor,
borderColor: materialcolor,
borderWidth: 1,
data: <?php echo $id?>Data.dataset
}
]
}
}
var ctx = document.getElementById('canvas-bar<?php echo $id?>').getContext('2d');
window.myBar = new Chart(ctx, {
type: 'bar',
data: barChartData<?php echo $id?>,
options: {
title: {
display: true,
text: 'Chart.js Bar Chart - Stacked'
},
tooltips: {
mode: 'index',
intersect: false
},
responsive: true,
scales: {
xAxes: [{
stacked: true,
}],
yAxes: [{
stacked: true
}]
}
}
});
});
</script>
<?php
$cssAnsScriptFilesTheme = array(
"/plugins/Chart-2.8.0/Chart.min.js",
); HtmlHelper::registerCssAndScriptsFiles($cssAnsScriptFilesTheme, Yii::app()->request->baseUrl);
?>
<script type="text/javascript">
window.chartColors = {
red: 'rgb(255, 99, 132)',
orange: 'rgb(255, 159, 64)',
yellow: 'rgb(255, 205, 86)',
green: 'rgb(75, 192, 192)',
blue: 'rgb(54, 162, 235)',
purple: 'rgb(153, 102, 255)',
grey: 'rgb(201, 203, 207)'
};
var materialcolor = [
window.chartColors.red , window.chartColors.orange , window.chartColors.yellow, window.chartColors.green, window.chartColors.blue, window.chartColors.purple, window.chartColors.grey
]
var COLORS = [
"#0A2F62",
"#0B2D66",
"#064191",
"#2C97D0",
"#16A9B1",
"#0AA178",
"#74B976",
"#0AA178",
"#16A9B1",
"#2A99D1",
"#064191",
"#0B2E68"
];
</script>
<div id="container" style="margin:0px auto;width:100%">
<canvas id="canvas-bar<?php echo $id?>"></canvas>
</div>
<script>
var randomScalingFactor = function() {
return Math.round(Math.random() * 100);
};
jQuery(document).ready(function() {
if(typeof <?php echo $id?>Datachart == "undefined" || <?php echo $id?>Datachart.label.length == 0){
mylog.log("render","/modules/graph/views/co/bar.php");
var barChartData = {
labels: ["Developpement",
"Chef de projet",
"Formation",
"Commercial",
"Graphiste",
"Designer",
"Créatif"],
datasets: [{
label : "Tibor",
backgroundColor: window.chartColors.red,
borderColor: window.chartColors.red,
borderWidth: 1,
data: [78,43,40,29,40,59,103]
},
{
label : "Rapha",
backgroundColor: window.chartColors.blue,
borderColor: window.chartColors.blue,
borderWidth: 1,
data: [28,23,20,9,20,29,203]
},
{
label : "Bouboule",
backgroundColor: window.chartColors.orange,
borderColor: window.chartColors.orange,
borderWidth: 1,
data: [8,5,2,98,200,299,3]
}]
};
} else {
var dtasets = [];
for (var i = <?php echo $id?>Datachart.labels.length - 1; i >= 0; i--) {
dtasets.push({
label : <?php echo $id?>Datachart.labels[i] ,
backgroundColor: materialcolor[i],
borderColor: materialcolor[i],
borderWidth: 1,
data : <?php echo $id?>Datachart.datasets[i]
})
}
var barChartData<?php echo $id?> = {
labels : <?php echo $id?>Datachart.label,
datasets: dtasets
}
}
var ctx = document.getElementById('canvas-bar<?php echo $id?>').getContext('2d');
window.myBar = new Chart(ctx, {
type: 'bar',
data: barChartData<?php echo $id?>,
options: {
title: {
display: true,
text: 'Chart.js Bar Chart - Stacked'
},
tooltips: {
mode: 'label',
callbacks: {
afterTitle: function() {
window.total = 0;
},
label: function(tooltipItem, data) {
var corporation = data.datasets[tooltipItem.datasetIndex].label;
var valor = data.datasets[tooltipItem.datasetIndex].data[tooltipItem.index];
window.total += valor;
return corporation + ": " + valor.toString().replace(/\B(?=(\d{3})+(?!\d))/g, " ");
},
footer: function() {
return "TOTAL: " + window.total.toString().replace(/\B(?=(\d{3})+(?!\d))/g, " ");
}
}
},
responsive: true,
scales: {
xAxes: [{
stacked: true,
}],
yAxes: [{
stacked: true
}]
}
}
});
});
</script>
<?php
$cssAnsScriptFilesTheme = array(
"/plugins/Chart-2.8.0/Chart.min.js",
); HtmlHelper::registerCssAndScriptsFiles($cssAnsScriptFilesTheme, Yii::app()->request->baseUrl);
?>
<!-- <script src="https://cdn.jsdelivr.net/npm/chartjs-plugin-datalabels@0.4.0/dist/chartjs-plugin-datalabels.min.js"></script> -->
<script type="text/javascript">
window.chartColors = {
red: 'rgb(255, 99, 132)',
orange: 'rgb(255, 159, 64)',
yellow: 'rgb(255, 205, 86)',
green: 'rgb(75, 192, 192)',
blue: 'rgb(54, 162, 235)',
purple: 'rgb(153, 102, 255)',
grey: 'rgb(201, 203, 207)'
};
var materialcolor = [
window.chartColors.red , window.chartColors.orange , window.chartColors.yellow, window.chartColors.green, window.chartColors.blue, window.chartColors.purple, window.chartColors.grey
]
var MONTHS = [
'January',
'February',
'March',
'April',
'May',
'June',
'July',
'August',
'September',
'October',
'November',
'December'
];
var COLORS = [
"#0A2F62",
"#0B2D66",
"#064191",
"#2C97D0",
"#16A9B1",
"#0AA178",
"#74B976",
"#0AA178",
"#16A9B1",
"#2A99D1",
"#064191",
"#0B2E68"
];
</script>
<div id="canvas-holder" style="margin:25px auto;width:100%">
<canvas id="chart-area<?php echo $id?>"></canvas>
</div>
<script>
var randomScalingFactor = function() {
return Math.round(Math.random() * 100);
};
jQuery(document).ready(function() {
mylog.log("render","/modules/graph/views/co/pie.php");
if(typeof <?php echo $id?>Data == "undefined"){
var config = {
type: 'pie',
data: {
datasets: [{
data: [
randomScalingFactor(),
randomScalingFactor(),
randomScalingFactor(),
randomScalingFactor(),
randomScalingFactor(),
randomScalingFactor(),
randomScalingFactor(),
randomScalingFactor(),
randomScalingFactor(),
randomScalingFactor(),
randomScalingFactor()
],
backgroundColor: COLORS,
label: 'Dataset 1'
}],
labels: [
'One fdgsdfg fds gsdfgsdf',
'Two sfdgs fdg fdsgsdf',
'Three sfg fdsgfdsgsdf',
'Four sfdg fdsgsfdg',
'Five sfgs fdgsfdgsd',
'One sfdg dsfgsfd',
'Two sfdg dsf gsfd',
'Three sgf dsfgsd',
'Four fgs fdgsdf',
'Five sdfg fdsgdsf',
"Eleven sfgs fdgsfd"
]
},
options: {
responsive: true,
legend : {
<?php if($size=="S") { ?>display: false<?php } ?>
},
title: {
display: true,
text: 'Camembert écologique'
}
}
};
}
else {
var config = {
type: 'pie',
data: {
datasets: [{
data: <?php echo $id?>Data.dataset,
backgroundColor: materialcolor
}],
labels: <?php echo $id?>Data.label
},
options: {
responsive: true,
title: {
display: true,
text : <?php echo $id?>Data.title
},
tooltips: {
callbacks: {
label: function (tooltipItem, data) {
try {
let label = ' ' + data.labels[tooltipItem.index] || '';
if (label) {
label += ': ';
}
const sum = data.datasets[0].data.reduce((accumulator, curValue) => {
return accumulator + curValue;
});
const value = data.datasets[tooltipItem.datasetIndex].data[tooltipItem.index];
label += Number((value / sum) * 100).toFixed(2) + '%';
return label;
} catch (error) {
console.log(error);
}
}
}
}
}
};
}
var ctx = document.getElementById('chart-area<?php echo $id?>').getContext('2d');
window.myPie = new Chart(ctx, config);
});
</script>
\ No newline at end of file
......@@ -291,7 +291,7 @@ function createFluidGraph(type, contextId, dataToD3) {
NGO : {sameAs:"organization", color:"green", icon:"users"},
Association : {sameAs:"organization", color:"green", icon: "group"},
GovernmentOrganization : {col:"organization", color: "red",icon: "university"},
Cooperative : {col:"organization", color: "green",icon: "university"},
Cooperative : {col:"organization", color: "nightblue",icon: "university"},
Group : { col:"organizations",color: "turq",icon: "circle-o"},
event : {col:"events",ctrl:"event",icon : "calendar",titleClass : "bg-orange", color:"orange",bgClass : "bgEvent"},
events : {sameAs:"event"},
......
......@@ -154,7 +154,7 @@ jQuery(document).ready(function() {
NGO : {sameAs:"organization", color:"green", icon:"users"},
Association : {sameAs:"organization", color:"green", icon: "group"},
GovernmentOrganization : {col:"organization", color: "red",icon: "university"},
Cooperative : {col:"organization", color: "green",icon: "industry"},
Cooperative : {col:"organization", color: "nightblue",icon: "industry"},
Group : { col:"organizations",color: "turq",icon: "circle-o"},
event : {col:"events",ctrl:"event",icon : "calendar",titleClass : "bg-orange", color:"orange",bgClass : "bgEvent"},
events : {sameAs:"event"},
......
<?php
$cssAnsScriptFilesTheme = array(
"/plugins/Chart-2.8.0/Chart.min.js",
); HtmlHelper::registerCssAndScriptsFiles($cssAnsScriptFilesTheme, Yii::app()->request->baseUrl);
?>
<script type="text/javascript">
window.chartColors = {
red: 'rgb(255, 99, 132)',
orange: 'rgb(255, 159, 64)',
yellow: 'rgb(255, 205, 86)',
green: 'rgb(75, 192, 192)',
blue: 'rgb(54, 162, 235)',
purple: 'rgb(153, 102, 255)',
grey: 'rgb(201, 203, 207)'
};
var materialcolor = [
window.chartColors.red , window.chartColors.orange , window.chartColors.yellow, window.chartColors.green, window.chartColors.blue, window.chartColors.purple, window.chartColors.grey
]
var COLORS = [
"#0A2F62",
"#0B2D66",
"#064191",
"#2C97D0",
"#16A9B1",
"#0AA178",
"#74B976",
"#0AA178",
"#16A9B1",
"#2A99D1",
"#064191",
"#0B2E68"
];
</script>
<div id="container" style="margin:0px auto;width:100%">
<canvas id="canvas-bar<?php echo $id?>"></canvas>
</div>
<script>
var randomScalingFactor = function() {
return Math.round(Math.random() * 100);
};
jQuery(document).ready(function() {
if(typeof <?php echo $id?>Data == "undefined" || <?php echo $id?>Data.label.length == 0){
mylog.log("render","/modules/graph/views/co/bar.php");
var barChartData = {
labels: ["Developpement",
"Chef de projet",
"Formation",
"Commercial",
"Graphiste",
"Designer",
"Créatif"],
datasets: [{
label : "Tibor",
backgroundColor: window.chartColors.red,
borderColor: window.chartColors.red,
borderWidth: 1,
data: [78,43,40,29,40,59,103]
},
{
label : "Rapha",
backgroundColor: window.chartColors.blue,
borderColor: window.chartColors.blue,
borderWidth: 1,
data: [28,23,20,9,20,29,203]
},
{
label : "Bouboule",
backgroundColor: window.chartColors.orange,
borderColor: window.chartColors.orange,
borderWidth: 1,
data: [8,5,2,98,200,299,3]
}]
};
} else {
var barChartData<?php echo $id?> = {
labels : <?php echo $id?>Data.label,
datasets: [
{
backgroundColor: materialcolor,
borderColor: materialcolor,
borderWidth: 1,
data: <?php echo $id?>Data.dataset
}
]
}
}
var ctx = document.getElementById('canvas-bar<?php echo $id?>').getContext('2d');
window.myBar = new Chart(ctx, {
type: 'bar',
data: barChartData<?php echo $id?>,
options: {
title: {
display: true,