Open Source Training Seminar FreePBX Paid Support

Ticket #2792 (closed Bugs: fixed)

Opened 4 months ago

Last modified 3 weeks ago

graph pie error

Reported by: lanzaandrea Assigned to:
Priority: minor Milestone: 2.5
Component: Reports Version: 2.4-branch
Keywords: Cc:
Confirmation: Need testing SVN Revision (if applicable):
Backend Engine: All Backend Engine Version:

Description

This error was also present if earlier versions (2.2x, 2.3x)

When looking at the traffic pie, the legends and colours are wrong

it seems the colors are wrong bt one position clockwise. the percentage legends are correct the "extracted" piece is wrong by one position anticlockwise

I think that you can easily reproduce this behaviour, selecting i.e.

Laps of month to compare 6 months

I attach an image of a wrong pie.

Attachments

graph_pie.jpg (21.0 kB) - added by lanzaandrea on 04/16/08 07:50:41.
wrong pie

Change History

04/16/08 07:50:41 changed by lanzaandrea

  • attachment graph_pie.jpg added.

wrong pie

06/03/08 04:50:39 changed by lanzaandrea

Ok, I find the error(s) I will post them here, hoping somebody could merge these fix in a new release.

3 lines to modify in file /admin/cdr/graph_pie.php

1) The year is badly displayed if crossing year (current_myyear used instead of current_myyear2) 2) (trivial) the slice to explode is the 0 and not the 1 3) The legend are completly wrong becouse need to be reversed

this is the diff file:

diff ../modules/framework/htdocs/admin/cdr/graph_pie.php graph_pie.php

191c191 < $mylegend[] = $months[$current_mymonth2-1]." $current_myyear : ".intval($list_total[0][0]/60)." min"; ---

$mylegend[] = $months[$current_mymonth2-1]." $current_myyear2 : ".intval($list_total[0][0]/60)." min";

210c210 < $p1->ExplodeSlice?(1); ---

$p1->ExplodeSlice?(0);

215c215 < $p1->SetLegends?($mylegend); ---

$p1->SetLegends?(array_reverse ($mylegend));

06/03/08 04:55:21 changed by lanzaandrea

I will post diff again using WikiFormatting:

diff ../modules/framework/htdocs/admin/cdr/graph_pie.php graph_pie.php

191c191
<       $mylegend[] = $months[$current_mymonth2-1]." $current_myyear : ".intval($list_total[0][0]/60)." min";
---
>       $mylegend[] = $months[$current_mymonth2-1]." $current_myyear2 : ".intval($list_total[0][0]/60)." min";
210c210
< $p1->ExplodeSlice(1);
---
> $p1->ExplodeSlice(0);
215c215
< $p1->SetLegends($mylegend);
---
> $p1->SetLegends(array_reverse ($mylegend));

06/03/08 18:24:46 changed by p_lindheimer

  • confirmation changed from Unreviewed to Need Feedback.
  • milestone changed from Cut Line to 3.0.

lanzaandrea, any chance you can resubmit this using "diff -ubB orignal_file modfied_file" format to make sure it will apply. That would be appreciated, then we can have a look.

06/03/08 20:23:37 changed by p_lindheimer

  • confirmation changed from Need Feedback to Need testing.

lanzaandrea, Your patch applied, here is the equivalent:

Index: graph_pie.php
===================================================================
--- graph_pie.php       (revision 5763)
+++ graph_pie.php       (working copy)
@@ -188,7 +188,7 @@
 
        $list_total = $instance_table_graph -> Get_list ($FG_TABLE_CLAUSE, null, null, null, null, null, null);
        $data[] = $list_total[0][0];
-       $mylegend[] = $months[$current_mymonth2-1]." $current_myyear : ".intval($list_total[0][0]/60)." min";
+      $mylegend[] = $months[$current_mymonth2-1]." $current_myyear2 : ".intval($list_total[0][0]/60)." min";
 
 }
 //print_r($data);
@@ -207,12 +207,12 @@
 $graph->title->SetFont(FF_FONT1,FS_BOLD);
 
 $p1 = new PiePlot3D($data);
-$p1->ExplodeSlice(1);
+$p1->ExplodeSlice(0);
 $p1->SetCenter(0.35);
 //print_r($gDateLocale->GetShortMonth());
 //Array ( [0] => Jan [1] => Feb [2] => Mar [3] => Apr [4] => May [5] => Jun [6] => Jul [7] => Aug [8] => Sep [9] => Oct [10] => Nov [11] => Dec )
 //$p1->SetLegends($gDateLocale->GetShortMonth());
-$p1->SetLegends($mylegend);
+$p1->SetLegends(array_reverse ($mylegend));
 
 
 // Format the legend box

However, I'm not sure I'm seeing the issue or I am seeing this patch make my pie chart look wrong. The graph I chose was:

  • Monthly Traffic
  • Laps of month to compare: 6 months

When I do that, your patch seems incorrect on my display and the current code looks correct. Can some other people take a look at this and give some feedback, maybe I'm missing something or getting confused.

06/23/08 20:49:09 changed by p_lindheimer

Can anyone else have a look at this. As mentioned, my data looks correct and wrong with the patch, we need another set of eyes or two to tell us what the right answer is so we can close this bug either with our without the supplied patch.

08/02/08 19:22:16 changed by p_lindheimer

  • status changed from new to closed.
  • resolution set to fixed.

with the fix in r6272 this looks like it has also been addressed. Please review and if not, please provide some specific data to help track it down. Ref #2635

08/02/08 19:25:59 changed by p_lindheimer

(In [6273]) prepare to publish to address re #2635, re #2792 and error introduced re #2963

Donate



Support
Download
Develop
Forums
News
Documentation
Paid Support
About

Paid Ads