Files
crm.twinpol.com/modules/EcmReportsBackUp20151106/javascript/ReportValue.js

88 lines
2.1 KiB
JavaScript
Raw Normal View History

2025-05-12 15:45:17 +00:00
$(document).ready(function(){
$(".rowShowHide").hide();
$(".tablesShowHide").hide();
//assign the sortStart event
$("#myTable thead").click(function() {
//alert($(this).attr("id"));
$(".productsTable").remove();
var minus = $(".hideProducts");
$.each(minus,function(){
$(this).html("[+]");
$(this).attr("class","showProducts");
});
});
// call the tablesorter plugin
$("table").tablesorter({
theme: 'blue',
// initialize zebra striping of the table
widgets: ['zebra','staticRow'],
// change the default striping class names
// updated in v2.1 to use widgetOptions.zebra = ["even", "odd"]
// widgetZebra: { css: [ "normal-row", "alt-row" ] } still works
widgetOptions : {
zebra : [ "normal-row", "alt-row" ]
}
});
});
google.load("visualization", "1", {packages:["corechart"]});
google.setOnLoadCallback(drawChart);
function drawChart() {
var a = new Array();
var html = "";
var table = document.getElementById("myTable");
for (var i = 0, row; row = table.rows[i]; i++) {
a[i] = new Array();
for (var j = 0, col; col = row.cells[j]; j++) {
a[i][j]=row.cells[j].textContent;
if(j>0 && i > 0){
a[i][j] = a[i][j].replace(".", "");
a[i][j] = parseFloat(a[i][j].replace(",", "."));
}
}
}
// Calculate the width and height of the Array
var w = a.length ? a.length : 0,
h = a[0] instanceof Array ? a[0].length : 0;
// In case it is a zero matrix, no transpose routine needed.
if(h === 0 || w === 0) { t=[]; }
/**
* @var {Number} i Counter
* @var {Number} j Counter
* @var {Array} t Transposed data is stored in this array.
*/
var i, j, t = [];
// Loop through every item in the outer array (height)
for(i=0; i<h-1; i++) {
// Insert a new row (array)
t[i] = [];
// Loop through every item per item in outer array (width)
for(j=0; j<w-1; j++) {
// Save transposed data.
t[i][j] = a[j][i];
}
}
var data = google.visualization.arrayToDataTable(t);
var options = {
title: 'Wykres porównawczy',
};
var chart = new google.visualization.ColumnChart(document.getElementById('chart_div'));
chart.draw(data, options);
}