[Rt-commit] rt branch, 4.4/stacked-bar-chart, repushed
? sunnavy
sunnavy at bestpractical.com
Fri Jan 22 11:09:05 EST 2021
The branch 4.4/stacked-bar-chart was deleted and repushed:
was c6e41c53bce35acb1b91779cd6b277c40e8c142a
now 6d44d7e7ab939ed88c49b5bcdc3e5f5131967dcb
1: 7b87228f2a ! 1: 458dc3ce48 Add basic stacked bar chart support
@@ -1,8 +1,8 @@
Author: sunnavy <sunnavy at bestpractical.com>
- basic stacked bar chart support
+ Add basic stacked bar chart support
- for now, only count chart function is supported.
+ For now, only count chart function is supported.
diff --git a/share/html/Search/Chart b/share/html/Search/Chart
--- a/share/html/Search/Chart
@@ -143,9 +143,11 @@
var val = jQuery(".chart-picture [name=ChartType]").val();
+ if ( val == 'bar' ) {
+ jQuery("span.stacked-group").removeClass('hidden');
++ jQuery("input.stacked-group-checkbox").prop('disabled', false);
+ }
+ else {
+ jQuery("span.stacked-group").addClass('hidden');
++ jQuery("input.stacked-group-checkbox").prop('disabled', true);
+ }
+
if ( val != 'table' && jQuery(".chart-picture [name=ChartStyleIncludeTable]").is(':checked') ) {
@@ -155,7 +157,6 @@
jQuery(".chart-picture [name=ChartStyleIncludeTable]").change( updateChartStyle );
jQuery(".chart-picture [name=ChartStyleIncludeSQL]").change( updateChartStyle );
-+
+jQuery("input.stacked-group-checkbox").change( function() {
+ if ( jQuery(this).is(':checked') ) {
+ jQuery("input.stacked-group-checkbox").not(this).prop('checked', false);
@@ -175,22 +176,29 @@
+ }
+});
+
-+jQuery("select[name=ChartFunction]:first").change( function() {
-+ if ( jQuery(this).val() && jQuery(this).val().match(/count/i) ) {
-+ jQuery("input.stacked-group-checkbox").prop('disabled', false);
-+ }
-+ else {
-+ jQuery("input.stacked-group-checkbox").prop('disabled', true).prop('checked', false);
-+ }
-+});
-+
-+jQuery("select[name=ChartFunction]:not(:first)").change( function() {
-+ if ( jQuery(this).val() ) {
-+ jQuery("input.stacked-group-checkbox").prop('disabled', true).prop('checked', false);
-+ }
-+ else {
-+ jQuery("select[name=ChartFunction]:first").change();
-+ }
++jQuery( function() {
++ jQuery("select[name=ChartFunction-Groups]").change( function() {
++ var allow_stacked = jQuery(".chart-picture [name=ChartType]").val() == 'bar';
++
++ var value_count;
++ jQuery("select[name=ChartFunction-Groups]").each( function() {
++ if ( jQuery(this).val() ) {
++ value_count++;
++ if ( value_count > 1 || !jQuery(this).val().match(/count/i) ) {
++ allow_stacked = 0;
++ }
++ }
++ } );
++
++ if ( allow_stacked ) {
++ jQuery("span.stacked-group").removeClass('hidden');
++ jQuery("input.stacked-group-checkbox").prop('disabled', false);
++ }
++ else {
++ jQuery("span.stacked-group").addClass('hidden');
++ jQuery("input.stacked-group-checkbox").prop('disabled', true);
++ }
++ }).change();
+});
+
</script>
2: 642cae8855 ! 2: 938968cc9f Increase chart width/height for better stacked bars rendering
@@ -1,6 +1,6 @@
Author: sunnavy <sunnavy at bestpractical.com>
- increase chart width/height for better stacked bars rendering
+ Increase chart width/height for better stacked bars rendering
diff --git a/share/html/Search/Chart b/share/html/Search/Chart
--- a/share/html/Search/Chart
3: c6e41c53bc ! 3: 6d44d7e7ab Silence "numeric" warnings in GD::Graph for stacked bar charts
@@ -1,11 +1,14 @@
Author: sunnavy <sunnavy at bestpractical.com>
- silence "isn't numeric" warnings in GD::Graph for stacked bar charts
+ Silence "numeric" warnings in GD::Graph for stacked bar charts
- we want to show extra info such as status or queue names in bar values,
- but values are supposed to be numeric. though strings like "2 open"
- could be automatically interpreted to numbers, "isn't numeric" warnings
- will be emitted too. it's ok to silence them since it's expected.
+ We want to show extra info such as status or queue names in bar values,
+ but values are supposed to be numeric. Though strings like "2 open"
+ could be automatically interpreted to numbers, perl warns "isn't
+ numeric" in this case.
+
+ The other related warning is "Use of uninitialized value $_ in numeric",
+ which happens if there are absent stacks(i.e. 0 tickets in some groups).
diff --git a/share/html/Search/Chart b/share/html/Search/Chart
--- a/share/html/Search/Chart
@@ -16,14 +19,11 @@
};
+
+ if ( $chart_options{cumulate} ) {
-+ # we want to show extra info such as status or queue names in bar values,
-+ # but values are supposed to be numeric. though strings like "2 open"
-+ # could be automatically interpreted to numbers, "isn't numeric" warnings
-+ # will be emitted too. it's ok to silence them since it's expected.
-+
++ # Avoid "numeric" warnings caused by labels like "2 open" or absent
++ # stacks.
+ no strict 'refs';
+ my @warning_subs = ();
-+ for my $pkg ( 'GD::Graph::Data::', 'GD::Graph::axestype::' ) {
++ for my $pkg ( 'GD::Graph::Data::', 'GD::Graph::axestype::', 'GD::Graph::bars' ) {
+ push @warning_subs, map { $pkg . $_ } grep { /^[a-z_]+$/ } keys %$pkg;
+ }
+
@@ -32,7 +32,7 @@
+ my ( $package, $sub ) = $warning_sub =~ /(.+)::(\w+)/;
+ if ( my $orig = $package->can($sub) ) {
+ *$warning_sub = sub {
-+ local $SIG{__WARN__} = sub { warn $_[0] unless $_[0] =~ /isn't numeric/ };
++ local $SIG{__WARN__} = sub { warn $_[0] unless $_[0] =~ /numeric/ };
+ $orig->( @_ );
+ };
+ }
More information about the rt-commit
mailing list