mirror of
https://github.com/Gnucash/gnucash.git
synced 2026-09-03 20:53:02 -05:00
Bug 778042 These are the script changes for jqplot reports.
I have added the resize function to all jqplot reports and an on load function to bar and line charts. This last change is required when a table is added to the report and the vertical scroll bar appears and covers part of the plot. This was observed in the Gnucash and also when opening the generated file in the gnome browser.
This commit is contained in:
committed by
Geert Janssens
parent
22191afb1e
commit
0078de0be3
@@ -514,14 +514,41 @@ var plot = $.jqplot('")(push chart-id)(push"', data, options);
|
||||
plot.axes.xaxis.ticks = getVisualTicks();
|
||||
plot.replot();
|
||||
var timer;
|
||||
var load_timer;
|
||||
|
||||
// var win_width = $(window).width();
|
||||
// var win_height = $(window).height();
|
||||
// console.log( 'Window Width ' + win_width + ' Height ' + win_height);
|
||||
|
||||
// var doc_width = document.body.clientWidth;
|
||||
// var doc_height = document.body.clientHeight;
|
||||
// console.log( 'Doc Width ' + doc_width + ' Height ' + doc_height);
|
||||
|
||||
$(window).resize(function () {
|
||||
clearTimeout(timer);
|
||||
timer = setTimeout(function () {
|
||||
plot.replot({resetAxes: true });
|
||||
$.each(plot.series, function(index, series) {
|
||||
series.barWidth = undefined;
|
||||
});
|
||||
plot.axes.xaxis.ticks = getVisualTicks();
|
||||
// console.log( 'Resize Timer!' );
|
||||
plot.replot();
|
||||
}, 100);
|
||||
});
|
||||
|
||||
$(window).on('load', function () {
|
||||
var hasVScroll = document.body.scrollHeight > document.body.clientHeight;
|
||||
clearTimeout(load_timer);
|
||||
load_timer = setTimeout(function () {
|
||||
// console.log( 'Load Timer!' );
|
||||
if(hasVScroll)
|
||||
{
|
||||
// console.log( 'Load Timer Replot!' );
|
||||
plot.replot();
|
||||
}
|
||||
},100);
|
||||
});
|
||||
});
|
||||
|
||||
function formatTooltip(str, seriesIndex, pointIndex) {
|
||||
@@ -549,6 +576,7 @@ function getVisualTicks() {
|
||||
else
|
||||
visual_ticks.push (' ');
|
||||
}
|
||||
// console.log( 'getVis chart_width ' + chart_width );
|
||||
return visual_ticks;
|
||||
}\n")
|
||||
|
||||
|
||||
@@ -552,15 +552,49 @@
|
||||
(push (qof-date-format-get-string (qof-date-format-get)))
|
||||
(push "';\n")
|
||||
|
||||
(push "$.jqplot.config.enablePlugins = true;")
|
||||
(push "var plot = $.jqplot('")(push chart-id)(push"', data, options);
|
||||
(push "$.jqplot.config.enablePlugins = true;\n")
|
||||
(push "$(document).ready(function() {
|
||||
var plot = $.jqplot('")(push chart-id)(push"', data, options);
|
||||
plot.replot();
|
||||
var timer;
|
||||
var load_timer;
|
||||
|
||||
function formatTooltip(str, seriesIndex, pointIndex) {
|
||||
x = $.jqplot.DateTickFormatter (options.axes.xaxis.tickOptions.formatString,
|
||||
data[seriesIndex][pointIndex][0]);
|
||||
y = data[seriesIndex][pointIndex][1].toFixed(2);
|
||||
return options.series[seriesIndex].label + ' ' + x + '<br><b>' + y + '</b>';
|
||||
}\n")
|
||||
// var win_width = $(window).width();
|
||||
// var win_height = $(window).height();
|
||||
// console.log( 'Window Width ' + win_width + ' Height ' + win_height);
|
||||
|
||||
// var doc_width = document.body.clientWidth;
|
||||
// var doc_height = document.body.clientHeight;
|
||||
// console.log( 'Doc Width ' + doc_width + ' Height ' + doc_height);
|
||||
|
||||
$(window).resize(function () {
|
||||
clearTimeout(timer);
|
||||
timer = setTimeout(function () {
|
||||
// console.log( 'Resize Timer!' );
|
||||
plot.replot();
|
||||
}, 100);
|
||||
});
|
||||
|
||||
$(window).on('load', function () {
|
||||
var hasVScroll = document.body.scrollHeight > document.body.clientHeight;
|
||||
clearTimeout(load_timer);
|
||||
load_timer = setTimeout(function () {
|
||||
// console.log( 'Load Timer!' );
|
||||
if(hasVScroll)
|
||||
{
|
||||
// console.log( 'Load Timer Replot!' );
|
||||
plot.replot();
|
||||
}
|
||||
},100);
|
||||
});
|
||||
});
|
||||
|
||||
function formatTooltip(str, seriesIndex, pointIndex) {
|
||||
x = $.jqplot.DateTickFormatter (options.axes.xaxis.tickOptions.formatString,
|
||||
data[seriesIndex][pointIndex][0]);
|
||||
y = data[seriesIndex][pointIndex][1].toFixed(2);
|
||||
return options.series[seriesIndex].label + ' ' + x + '<br><b>' + y + '</b>';
|
||||
}\n")
|
||||
|
||||
(push "});\n</script>")
|
||||
|
||||
|
||||
@@ -257,7 +257,28 @@
|
||||
(push ")\";\n")))
|
||||
|
||||
(push "$.jqplot.config.enablePlugins = true;\n")
|
||||
(push "var plot = $.jqplot('")(push chart-id)(push "', [data], options);\n")
|
||||
(push "$(document).ready(function() {
|
||||
var plot = $.jqplot('")(push chart-id)(push "', [data], options);
|
||||
plot.replot();
|
||||
var timer;
|
||||
|
||||
// var win_width = $(window).width();
|
||||
// var win_height = $(window).height();
|
||||
// console.log( 'Window Width ' + win_width + ' Height ' + win_height);
|
||||
|
||||
// var doc_width = document.body.clientWidth;
|
||||
// var doc_height = document.body.clientHeight;
|
||||
// console.log( 'Doc Width ' + doc_width + ' Height ' + doc_height);
|
||||
|
||||
$(window).resize(function () {
|
||||
clearTimeout(timer);
|
||||
timer = setTimeout(function () {
|
||||
// console.log( 'Resize Timer!' );
|
||||
plot.replot();
|
||||
}, 100);
|
||||
});
|
||||
});\n")
|
||||
|
||||
(push "});\n</script>"))
|
||||
(begin (gnc:warn "null-data, not rendering piechart")
|
||||
" "))
|
||||
|
||||
@@ -229,7 +229,27 @@
|
||||
|
||||
|
||||
(push "$.jqplot.config.enablePlugins = true;\n")
|
||||
(push "var plot = $.jqplot('")(push chart-id)(push "', [data], options);\n")
|
||||
(push "$(document).ready(function() {
|
||||
var plot = $.jqplot('")(push chart-id)(push "', [data], options);
|
||||
plot.replot();
|
||||
var timer;
|
||||
|
||||
// var win_width = $(window).width();
|
||||
// var win_height = $(window).height();
|
||||
// console.log( 'Window Width ' + win_width + ' Height ' + win_height);
|
||||
|
||||
// var doc_width = document.body.clientWidth;
|
||||
// var doc_height = document.body.clientHeight;
|
||||
// console.log( 'Doc Width ' + doc_width + ' Height ' + doc_height);
|
||||
|
||||
$(window).resize(function () {
|
||||
clearTimeout(timer);
|
||||
timer = setTimeout(function () {
|
||||
// console.log( 'Resize Timer!' );
|
||||
plot.replot();
|
||||
}, 100);
|
||||
});
|
||||
});\n")
|
||||
|
||||
(push "});\n</script>"))
|
||||
(begin
|
||||
|
||||
Reference in New Issue
Block a user