add stats, and add history import details
This commit is contained in:
@@ -607,6 +607,37 @@ include('parsedatachart.php');
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row chart-box" id="chart7" data-id="7">
|
||||
<div class="col-md-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<h5 class="card-title" id="dynamicChartTitle">Rating Distribution by Group</h5>
|
||||
|
||||
<!-- Inserisci il dropdown direttamente all'interno della card -->
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<label for="groupingField">Group by:</label>
|
||||
<select id="groupingField" class="form-control">
|
||||
<option value="products_season">Product Season</option>
|
||||
<option value="agerange">Age Range</option>
|
||||
<option value="namesupplier">Name Supplier</option>
|
||||
<!-- Aggiungi altri campi se necessario -->
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Area per il grafico -->
|
||||
<br>
|
||||
<h6 class="mt-4">Report Rating Distribution</h6> <!-- Titolo per il primo grafico -->
|
||||
<div id="horizontalBarChart"></div>
|
||||
|
||||
<h6 class="mt-4">Analysis Rating Distribution</h6> <!-- Titolo per il secondo grafico -->
|
||||
<div id="horizontalBarAnalysisChart"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
@@ -707,6 +738,13 @@ include('parsedatachart.php');
|
||||
var reportsLabName = $('#reportsLabName').val();
|
||||
var reportsTestType = $('#reportsTestType').val();
|
||||
var reportsNumberLab = $('#reportsNumberLab').val();
|
||||
var groupingField = $('#groupingField').val();
|
||||
|
||||
// Aggiorna il titolo dinamicamente in base alla selezione del dropdown
|
||||
var groupingText = $('#groupingField option:selected').text(); // Ottieni il testo dell'opzione selezionata
|
||||
$('#dynamicChartTitle').text(`Rating Distribution by Group: ${groupingText}`); // Aggiorna il titolo
|
||||
|
||||
|
||||
|
||||
$.ajax({
|
||||
url: 'parsedatachart.php',
|
||||
@@ -720,7 +758,8 @@ include('parsedatachart.php');
|
||||
ageRange: ageRange,
|
||||
reportsLabName: reportsLabName,
|
||||
reportsTestType: reportsTestType,
|
||||
reportsNumberLab: reportsNumberLab
|
||||
reportsNumberLab: reportsNumberLab,
|
||||
groupingField: groupingField
|
||||
},
|
||||
success: function(response) {
|
||||
if (!response) {
|
||||
@@ -867,6 +906,102 @@ include('parsedatachart.php');
|
||||
var chart = new ApexCharts(document.querySelector("#worsttenanalysis"), options);
|
||||
chart.render();
|
||||
|
||||
// Genera il nuovo grafico a barre orizzontali
|
||||
$('#horizontalBarChart').html('');
|
||||
var horizontalBarData = data.horizontalBarData;
|
||||
var categories = horizontalBarData.map(item => item.groupingValue);
|
||||
var passData = horizontalBarData.map(item => item.passCount);
|
||||
var failData = horizontalBarData.map(item => item.failCount);
|
||||
var otherData = horizontalBarData.map(item => item.otherCount);
|
||||
|
||||
var options = {
|
||||
series: [{
|
||||
name: 'Pass',
|
||||
data: passData
|
||||
},
|
||||
{
|
||||
name: 'Fail',
|
||||
data: failData
|
||||
},
|
||||
{
|
||||
name: 'Others',
|
||||
data: otherData
|
||||
}
|
||||
],
|
||||
chart: {
|
||||
type: 'bar',
|
||||
height: 400,
|
||||
stacked: true,
|
||||
horizontal: true
|
||||
},
|
||||
xaxis: {
|
||||
categories: categories
|
||||
},
|
||||
colors: ['#28A745', '#FF4D4D', '#FFA500'],
|
||||
plotOptions: {
|
||||
bar: {
|
||||
horizontal: true,
|
||||
dataLabels: {
|
||||
enabled: false
|
||||
}
|
||||
}
|
||||
},
|
||||
legend: {
|
||||
position: 'top'
|
||||
},
|
||||
};
|
||||
|
||||
var chart = new ApexCharts(document.querySelector("#horizontalBarChart"), options);
|
||||
chart.render();
|
||||
|
||||
// Dati per il grafico delle analisi
|
||||
var horizontalBarAnalysisData = data.horizontalBarAnalysisData;
|
||||
var categoriesAnalysis = horizontalBarAnalysisData.map(item => item.groupingValue);
|
||||
var passDataAnalysis = horizontalBarAnalysisData.map(item => item.passCount);
|
||||
var failDataAnalysis = horizontalBarAnalysisData.map(item => item.failCount);
|
||||
var otherDataAnalysis = horizontalBarAnalysisData.map(item => item.otherCount);
|
||||
|
||||
// Crea o aggiorna il grafico delle analisi
|
||||
$('#horizontalBarAnalysisChart').html('');
|
||||
var optionsAnalysis = {
|
||||
series: [{
|
||||
name: 'Pass',
|
||||
data: passDataAnalysis
|
||||
},
|
||||
{
|
||||
name: 'Fail',
|
||||
data: failDataAnalysis
|
||||
},
|
||||
{
|
||||
name: 'Others',
|
||||
data: otherDataAnalysis
|
||||
}
|
||||
],
|
||||
chart: {
|
||||
type: 'bar',
|
||||
height: 400,
|
||||
stacked: true,
|
||||
horizontal: true
|
||||
},
|
||||
xaxis: {
|
||||
categories: categoriesAnalysis
|
||||
},
|
||||
colors: ['#28A745', '#FF4D4D', '#FFA500'],
|
||||
plotOptions: {
|
||||
bar: {
|
||||
horizontal: true,
|
||||
dataLabels: {
|
||||
enabled: false
|
||||
}
|
||||
}
|
||||
},
|
||||
legend: {
|
||||
position: 'top'
|
||||
},
|
||||
};
|
||||
var chartAnalysis = new ApexCharts(document.querySelector("#horizontalBarAnalysisChart"), optionsAnalysis);
|
||||
chartAnalysis.render();
|
||||
|
||||
// remove bar chart and create a new one
|
||||
$('#worstSuppliersChart').html('');
|
||||
|
||||
@@ -1144,8 +1279,8 @@ include('parsedatachart.php');
|
||||
|
||||
|
||||
|
||||
// Eventi per applicare i filtri
|
||||
$('#startDate, #endDate, #supplierFilter, #productsRefnumber, #productsSeason, #ageRange, #reportsLabName, #reportsTestType, #reportsNumberLab').on('change', function() {
|
||||
// Eventi per applicare i filtri e il cambio di raggruppamento
|
||||
$('#startDate, #endDate, #supplierFilter, #productsRefnumber, #productsSeason, #ageRange, #reportsLabName, #reportsTestType, #reportsNumberLab, #groupingField').on('change', function() {
|
||||
updateData();
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user