View Issue Details

IDProjectCategoryView StatusLast Update
0011671mantisbtreportspublic2016-07-19 04:19
Reporterfairyamanada Assigned Tovboctor  
PriorityhighSeverityminorReproducibilityalways
Status closedResolutionfixed 
Product Version1.2.0 
Target Version2.0.0-beta.1Fixed in Version2.0.0-beta.1 
Summary0011671: 3 graphs couldnot display in the page of 'summary_jpgraph_page.php'
Description

I found 3 graphs couldnot display in the page of 'summary_jpgraph_page.php' whose categories are 'summary_graph_bydeveloper', 'summary_graph_byreporter' and 'summary_graph_bycategory'. I checked the Apache error log file and find the error logs as follow.


[Thu Mar 18 11:40:32 2010] [error] [client 10.2.21.140] PHP Fatal error: Uncaught exception 'ezcGraphUnregularStepsException' with
message 'Bar charts do not support axis with unregular steps sizes.' in /data/www/tracker/library/ezc/Graph/src/charts/line.php:251\
nStack trace:\n#0 /data/www/tracker/library/ezc/Graph/src/charts/line.php(668): ezcGraphLineChart->renderData(Object(ezcGraphRendere
r2d), Object(ezcGraphBoundings), Object(ezcGraphBoundings))\n#1 /data/www/tracker/library/ezc/Graph/src/charts/line.php(711): ezcGra
phLineChart->renderElements(375, 337.5)\n#2 /data/www/tracker/plugins/MantisGraph/core/graph_api.php(141): ezcGraphLineChart->render
ToOutput(375, 337.5)\n#3 /data/www/tracker/plugins/MantisGraph/pages/summary_graph_bycategory.php(42): graph_bar(Array, '???????????
????', 375, 337.5)\n#4 /data/www/tracker/plugin.php(52): include('/data/www/track...')\n#5 {main}\n thrown in /data/www/tracker/lib
rary/ezc/Graph/src/charts/line.php on line 251, referer: https://tracker.opi-corp.com/plugin.php?page=MantisGraph/summary_jpgraph_pa
ge
[Thu Mar 18 11:40:33 2010] [error] [client 10.2.21.140] PHP Fatal error: Uncaught exception 'ezcGraphUnregularStepsException' with
message 'Bar charts do not support axis with unregular steps sizes.' in /data/www/tracker/library/ezc/Graph/src/charts/line.php:251\
nStack trace:\n#0 /data/www/tracker/library/ezc/Graph/src/charts/line.php(668): ezcGraphLineChart->renderData(Object(ezcGraphRendere
r2d), Object(ezcGraphBoundings), Object(ezcGraphBoundings))\n#1 /data/www/tracker/library/ezc/Graph/src/charts/line.php(711): ezcGra
phLineChart->renderElements(375, 337.5)\n#2 /data/www/tracker/plugins/MantisGraph/core/graph_api.php(228): ezcGraphLineChart->render
ToOutput(375, 337.5)\n#3 /data/www/tracker/plugins/MantisGraph/pages/summary_graph_bydeveloper.php(36): graph_group(Array, '????????
???????', 375, 337.5)\n#4 /data/www/tracker/plugin.php(52): include('/data/www/track...')\n#5 {main}\n thrown in /data/www/tracker/
library/ezc/Graph/src/charts/line.php on line 251, referer: https://tracker.opi-corp.com/plugin.php?page=MantisGraph/summary_jpgraph
_page
[Thu Mar 18 11:40:33 2010] [error] [client 10.2.21.140] PHP Fatal error: Uncaught exception 'ezcGraphUnregularStepsException' with
message 'Bar charts do not support axis with unregular steps sizes.' in /data/www/tracker/library/ezc/Graph/src/charts/line.php:251\
nStack trace:\n#0 /data/www/tracker/library/ezc/Graph/src/charts/line.php(668): ezcGraphLineChart->renderData(Object(ezcGraphRendere
r2d), Object(ezcGraphBoundings), Object(ezcGraphBoundings))\n#1 /data/www/tracker/library/ezc/Graph/src/charts/line.php(711): ezcGra
phLineChart->renderElements(375, 337.5)\n#2 /data/www/tracker/plugins/MantisGraph/core/graph_api.php(141): ezcGraphLineChart->render
ToOutput(375, 337.5)\n#3 /data/www/tracker/plugins/MantisGraph/pages/summary_graph_byreporter.php(36): graph_bar(Array, '???????????
?', 375, 337.5)\n#4 /data/www/tracker/plugin.php(52): include('/data/www/track...')\n#5 {main}\n thrown in /data/www/tracker/librar
y/ezc/Graph/src/charts/line.php on line 251, referer: https://tracker.opi-corp.com/plugin.php?page=MantisGraph/summary_jpgraph_page

If I comment the excrption codes of line.php around line 250
/elseif ( $step->width !== $stepWidth)
{
throw new ezcGraphUnregularStepsException();
}
/
the bars of graph will overlapping display like the uploading files.
I printed the step width values of one graph in the log file and received the results as follow:
stepWidth= step->width=0.11538461538462
stepWidth=0.11538461538462 step->width=0.11538461538462
stepWidth=0.11538461538462 step->width=0.11538461538462
stepWidth=0.11538461538462 step->width=0.11538461538462
stepWidth=0.11538461538462 step->width=0.11538461538462
stepWidth=0.11538461538462 step->width=0.11538461538462
stepWidth=0.11538461538462 step->width=0.11538461538462
stepWidth=0.11538461538462 step->width=0.11538461538462
stepWidth=0.11538461538462 step->width=0.076923076923077
stepWidth=0.11538461538462 step->width=0.11538461538462

I think there is something wrong with the "calculateAxisBoundings" function of "ezcGraphChartElementLabeledAxis" class.But I donnot know how to fix it.

I will be appreciate if you could fix this bug as soon as possible.

Additional Information

There is another bug about the graph ,but I fixed it already.
The title font size of 'summary_graph_cumulative_bydate' in 'summary_jpgraph_page.php' is too large for the option of '$graph->options->font->maxFontSize' didnot be set.

TagsNo tags attached.
Attached Files
by_reporter.jpg (16,823 bytes)   
by_reporter.jpg (16,823 bytes)   
by_project.jpg (13,226 bytes)   
by_project.jpg (13,226 bytes)   

Activities

C4Vette

C4Vette

2010-03-29 08:22

reporter   ~0024922

Same here, but it does work when "Project=All Projects"

Ed

C4Vette

C4Vette

2010-03-29 08:42

reporter   ~0024923

Last edited: 2010-03-29 08:48

Apache error-log shows:

PHP Fatal error: Uncaught exception 'ezcGraphUnregularStepsException' with message 'Bar charts do not support axis with unregular steps sizes.' in /srv/www/htdocs/mantis/library/ezc/Graph/src/charts/line.php:250\nStack trace:\n#0 /srv/www/htdocs/mantis/library/ezc/Graph/src/charts/line.php(668): ezcGraphLineChart->renderData(Object(ezcGraphRenderer2d), Object(ezcGraphBoundings), Object(ezcGraphBoundings))\n#1 /srv/www/htdocs/mantis/library/ezc/Graph/src/charts/line.php(711): ezcGraphLineChart->renderElements(450, 405)\n#2 /srv/www/htdocs/mantis/plugins/MantisGraph/core/graph_api.php(139): ezcGraphLineChart->renderToOutput(450, 405)\n#3 /srv/www/htdocs/mantis/plugins/MantisGraph/pages/summary_graph_bycategory.php(42): graph_bar(Array, 'By Category', 450, 405)\n#4 /srv/www/htdocs/mantis/plugin.php(52): include('/srv/www/htdocs...')\n#5 {main}\n thrown in /srv/www/htdocs/mantis/library/ezc/Graph/src/charts/line.php on line 250, referer: http://-------/mantis/plugin.php?page=MantisGraph/summary_graph_imp_category.php

djcarr

djcarr

2010-05-17 22:41

reporter   ~0025528

Last edited: 2010-05-18 00:33

I had the same problem with my Mantis 1.2.1 installation and made some progress.

I found that on projects where there were more than about 10 reporters, developers or categories, any or all of summary_graph_bydeveloper.php, summary_graph_byreporter.php and summary_graph_bycategory.php will fail to render, showing a "broken image" icon. Right-clicking the "broken image" icon and opening it in a new tab reveals the 'ezcGraphUnregularStepsException' error.

This is a known constraint of the library.

Sources here: http://issues.ez.no/IssueView.php?Id=11168&activeItem=47
and here: http://ezcomponents.org/docs/tutorials/Graph (section titled "Lots of bars")

To solve this we need to manually set the label count on the X-axis.

I am currently trialing the following changes:

(a) graph_api.php in graph_bar():

$graph->xAxis->axisLabelRenderer = new ezcGraphAxisRotatedLabelRenderer();
$graph->xAxis->axisLabelRenderer->angle = 45;
<b>#--BEGIN ADDITION
$t_label_count = count( $graph->data[0] );
$graph->xAxis->labelCount = $t_label_count;
#--END ADDITION</b>

(b) graph_api.php in graph_group():

$graph->xAxis->axisLabelRenderer = new ezcGraphAxisRotatedLabelRenderer();
$graph->xAxis->axisLabelRenderer->angle = 45;
<b>#--BEGIN ADDITION
$t_label_count = 0;
foreach( array( 'open', 'resolved', 'closed' ) as $t_label ) {
    if( isset( $p_metrics[$t_label] ) && is_array( $p_metrics[$t_label] ) ) {
        $t_label_count = max( $t_label_count, count( $graph->data[$t_label] ) );
    }
}
$graph->xAxis->labelCount = $t_label_count;
#--END ADDITION</b>

These changes now set the label count correctly. However, graphs with many labels will now fail to render the "tiny fonts" needed.

This produces a new error such as:

Uncaught exception 'ezcGraphFontRenderingException' with message 'Could not fit string 'mystring' with font size '6' in box '33.13223192291 * 2.3902201054193'. Possible solutions to solve this problem: - Decrease the amount of steps on the axis. - Increase the size of the chart. - Decrease the minimum font size. - Use a font which consumes less space for each character.'

I found the easiest way to address this was to exclude the developers and reporters with low levels of activity.

summary_graph_bydeveloper.php:

<b>#--BEGIN ADDITION
$t_largest_count = 0;
foreach( array( 'open', 'resolved', 'closed' ) as $t_label ) {
    if( isset( $t_metrics[$t_label] ) && is_array( $t_metrics[$t_label] ) ) {
        foreach( $t_metrics[$t_label] as $t_developer => $t_count ) {
            $t_largest_count = max( $t_largest_count, $t_count );
        }
    }
}
$t_cutoff_count = $t_largest_count * 0.1;   # exclude bottom 10%  
foreach( $t_metrics['open'] as $t_developer => $t_count ) {
    if ( ( $t_metrics['open'][$t_developer] < $t_cutoff_count ) 
      and ( $t_metrics['resolved'][$t_developer] < $t_cutoff_count )
      and ( $t_metrics['closed'][$t_developer] < $t_cutoff_count ) ) {
        unset( $t_metrics['open'][$t_developer] );
        unset( $t_metrics['resolved'][$t_developer] );
        unset( $t_metrics['closed'][$t_developer] );
    }
}
#--END ADDITION</b>
graph_group( $t_metrics, lang_get( 'by_developer' ), $f_width, $f_width * $t_ar );

summary_graph_byreporter.php:

<b>#--BEGIN ADDITION
$t_largest_count = 0;
foreach( $t_metrics as $t_reporter => $t_count ) {
    $t_largest_count = max( $t_largest_count, $t_count );
}
$t_cutoff_count = $t_largest_count * 0.10;  # exclude bottom 10% 
foreach( $t_metrics as $t_reporter => $t_count ) {
    if ( $t_count < $t_cutoff_count ) {
        unset( $t_metrics[$t_reporter] );
    }
}
#--END ADDITION</b>
graph_bar( $t_metrics, lang_get( 'by_reporter' ), $f_width, $f_width * $t_ar );

In this way you can exclude the users that don't contribute much to the graph.

If this still doesn't help, you will then need to increase the graph width and size until you achieve a successful render.

For a more robust Mantis implementation, I would suggest letting these graphs have their own row and spread across all the columns, in other words have them ignore the "graphs per row" configuration. This gives them the extra width they need for their X-axis.

djcarr

djcarr

2010-05-18 02:32

reporter   ~0025529

Last edited: 2010-05-18 02:39

Note that changing from the bundled ezComponents library to a JpGraph installation gives better looking graphs and does not suffer from the same scalability issues.

grangeway

grangeway

2012-01-22 18:29

reporter   ~0030996

Have commited the graph api for 1.3 - i need to think about the 'best' robust way to fix the actual graphs