Results 1 to 9 of 9

Thread: How to create new chart but show cases module

  1. #1
    taarus is offline Junior Member
    Join Date
    May 2007
    Posts
    2

    Default How to create new chart but show cases module

    Hi
    My project is about creating a new chart by show the cases module. I look in the forum and there're only how to create new chart but there's no about How to use database and variables. I don't know how to change the variables. There's no the munual for developer, How to create module.
    Would you help me to create a new chart,please
    And I need manual for developer. Would you send me at my e-mail aommy3129@hotmail.com
    I'm really sorry if you don't understand my word. I'm Thai people and I'm not storng in English .

    TaaruS
    undefined

  2. #2
    lehoangngochan is offline Sugar Community Member
    Join Date
    Mar 2007
    Posts
    12

    Default Re: How to create new chart but show cases module

    Dear taarus,

    You can do as the following :


    CREATE A NEW CHART IN DASHBOARD MODULE


    Instruction :

    1- Copy one of the chart files in modules/Charts/code that you want to create new chart. (There are 3 type of chart in modules/Charts/code is : Vertical bar chart (vBarF), pie chart (pieF), horizontal bar chart (hBarF)).

    2- Rename it (for example: Chart_mychart.php).

    3- Go into “predefined_charts.php” in modules/Charts/code and add new entry to $predefined_charts array: 'Chart_mychart' => array('type'=>'code','id'=>'Chart_mychart','label' =>'My Chart').

    4- Go to your newly created “Chart-mychart.php” and replace all “original_chart”-variables with your “mychart”-term.

    5- In modules/Charts/language/en_us.lang.php (or whatever language file you are using) you'll find variables to set titles and descriptions of your new chart. You need to search for the affected variables and add your names (e.g. LBL_MYCHART_TITLE and the value for it) and adjust the variables in the “Chart-mychart.php”

    6- Go to your sugar system and open dashboard module.

    7- “your chart” should now be visible in the “add a chart”-dropdown (the name in the menu is the “label” value you add in “predefined_charts.php).

    8- Once your new chart is visible you can go on adding the required functionality to your file or adjusting the existing one.

    9- The function ‘gen_xml’ generates the XML that is used to create the Flash-chart.

    10- Create_chart at the very end of the file defines the type of chart being displayed.

    11- The .fla-files are saved in include/charts.

    12- To check your xml file has been create in the progress create new chart in ‘gen_xml’ function in C:\Program Files\sugarcrm-4.5.1b\htdocs\sugarcrm\cache\xml\ e19c31c8-526b-ae27-fabd-46112c233961_pipeline_by_mychart_2007_04_30_2010_0 1_01.xml.


    CODING : (Example the Chart_pipeline_by_case_status)

    Go to gen_xml() function to replace the query for your chart as below :

    $query = " SELECT cases.status, users.user_name, cases.assigned_user_id, count(*) AS opp_count, count(*) AS total FROM users,cases ";

    and in


    PHP Code:
    while($row $opp->db->fetchByAssoc($result, -1false))  {

    // You need add the  value important to support your chart here .
    $sum $row['total'];
    if(!isset(
    $stageArr[$row['status']]['row_total'])) {$stageArr[$row['status']]['row_total']=0;}
    $stageArr[$row['status']][$row['assigned_user_id']]['opp_count'] = $row['opp_count'];
    $stageArr[$row['status']][$row['assigned_user_id']]['total'] = $sum;
    $stageArr[$row['status']]['people'][$row['assigned_user_id']] = $row['user_name'];
    $stageArr[$row['status']]['row_total'] += $sum;
    $usernameArr[$row['assigned_user_id']] = $row['user_name'];
    $total += $sum;


    PHP Code:
    foreach ($datax as $key=>$translation) {

    // You need add the  value important to support your chart here to create a xml file.

                    
    if(isset($stageArr[$key]['row_total'])){$rowTotalArr[]=$stageArr[$key]['row_total'];}
                    
                    
    $fileContents .= '     <dataRow title="'.$translation.'" endLabel="';
                    if(isset(
    $stageArr[$key]['row_total'])){$fileContents .= $stageArr[$key]['row_total'];}
                    
    $fileContents .= '">'."\n";
                    if(isset(
    $stageArr[$key]['people'])){
                        
    asort($stageArr[$key]['people']);
                        
    reset($stageArr[$key]['people']);
                        foreach (
    $stageArr[$key]['people'] as $nameKey=>$nameValue) {
                            
    $fileContents .= '           <bar id="'.$nameKey.'" totalSize="'.$stageArr[$key][$nameKey]['total'].'" altText="'.$nameValue.': '.format_number($stageArr[$key][$nameKey]['opp_count'], 00).' '.$current_module_strings['LBL_CAS_NUMBER'].' '.$current_module_strings['LBL_CAS_IN_STATUS'].' '.$translation.'" url="index.php?module=Cases&action=index&assigned_user_id[]='.$nameKey.'&status='.urlencode($key).'&date_start='.$date_start.'&date_closed='.$date_end.'&query=true&searchFormTab=advanced_search"/>'."\n";
                        }
                    }
                    
    $fileContents .= '     </dataRow>'."\n";
                } 
    and the last
    PHP Code:
    $return create_chart($chart_size,$cache_file_name,$width,$height);    // draw the chart. 
    Regards
    Hanny
    Attached Images Attached Images  
    Last edited by lehoangngochan; 2007-05-07 at 03:45 PM.

  3. #3
    taarus is offline Junior Member
    Join Date
    May 2007
    Posts
    2

    Default Re: How to create new chart but show cases module

    Dear lehoangngochan
    I've already done your following, Thanks for your advices.

    TaaruS
    Last edited by taarus; 2007-05-11 at 05:42 AM.

  4. #4
    Thraxxus is offline Junior Member
    Join Date
    Dec 2007
    Posts
    2

    Default Re: How to create new chart but show cases module

    lehoangngochan,

    I have followed your instructions for adding a chart, and tragically, the chart does not show up in my Add Dashlets menu. thoughts? I am using 5.0.

  5. #5
    Kalendrinn is offline Sugar Community Member
    Join Date
    Jul 2007
    Posts
    200

    Default Re: How to create new chart but show cases module

    I tried doing this in an upgrade safe manner for v5 and it didn't work. I did notice there seems to be a duplication of files in the Charts module...so I'm not yet sure what's up with that. When I get more time to spend on it I'll see if I can't figure out what's going on.
    Win2k3
    SugarCE v5b
    IIS 6
    PHP 5.2.3
    MySQL 5.0.27-community

  6. #6
    fernando.sahagun is offline Sugar Community Member
    Join Date
    Dec 2007
    Posts
    17

    Question Re: How to create new chart but show cases module

    I try to update my custom charts to v5.0.0b.

    How i can do this?

    Thaks for the help

  7. #7
    rel08SE is offline Member
    Join Date
    Mar 2008
    Posts
    7

    Default Re: How to create new chart but show cases module

    Quote Originally Posted by lehoangngochan
    Dear taarus,

    You can do as the following :


    CREATE A NEW CHART IN DASHBOARD MODULE


    Instruction :

    1- Copy one of the chart files in modules/Charts/code that you want to create new chart. (There are 3 type of chart in modules/Charts/code is : Vertical bar chart (vBarF), pie chart (pieF), horizontal bar chart (hBarF)).

    2- Rename it (for example: Chart_mychart.php).

    3- Go into “predefined_charts.php” in modules/Charts/code and add new entry to $predefined_charts array: 'Chart_mychart' => array('type'=>'code','id'=>'Chart_mychart','label' =>'My Chart').

    4- Go to your newly created “Chart-mychart.php” and replace all “original_chart”-variables with your “mychart”-term.

    5- In modules/Charts/language/en_us.lang.php (or whatever language file you are using) you'll find variables to set titles and descriptions of your new chart. You need to search for the affected variables and add your names (e.g. LBL_MYCHART_TITLE and the value for it) and adjust the variables in the “Chart-mychart.php”

    6- Go to your sugar system and open dashboard module.

    7- “your chart” should now be visible in the “add a chart”-dropdown (the name in the menu is the “label” value you add in “predefined_charts.php).

    8- Once your new chart is visible you can go on adding the required functionality to your file or adjusting the existing one.

    9- The function ‘gen_xml’ generates the XML that is used to create the Flash-chart.

    10- Create_chart at the very end of the file defines the type of chart being displayed.

    11- The .fla-files are saved in include/charts.

    12- To check your xml file has been create in the progress create new chart in ‘gen_xml’ function in C:\Program Files\sugarcrm-4.5.1b\htdocs\sugarcrm\cache\xml\ e19c31c8-526b-ae27-fabd-46112c233961_pipeline_by_mychart_2007_04_30_2010_0 1_01.xml.


    CODING : (Example the Chart_pipeline_by_case_status)

    Go to gen_xml() function to replace the query for your chart as below :

    $query = " SELECT cases.status, users.user_name, cases.assigned_user_id, count(*) AS opp_count, count(*) AS total FROM users,cases ";

    and in


    PHP Code:
    while($row $opp->db->fetchByAssoc($result, -1false))  {

    // You need add the  value important to support your chart here .
    $sum $row['total'];
    if(!isset(
    $stageArr[$row['status']]['row_total'])) {$stageArr[$row['status']]['row_total']=0;}
    $stageArr[$row['status']][$row['assigned_user_id']]['opp_count'] = $row['opp_count'];
    $stageArr[$row['status']][$row['assigned_user_id']]['total'] = $sum;
    $stageArr[$row['status']]['people'][$row['assigned_user_id']] = $row['user_name'];
    $stageArr[$row['status']]['row_total'] += $sum;
    $usernameArr[$row['assigned_user_id']] = $row['user_name'];
    $total += $sum;


    PHP Code:
    foreach ($datax as $key=>$translation) {

    // You need add the  value important to support your chart here to create a xml file.

                    
    if(isset($stageArr[$key]['row_total'])){$rowTotalArr[]=$stageArr[$key]['row_total'];}
                    
                    
    $fileContents .= '     <dataRow title="'.$translation.'" endLabel="';
                    if(isset(
    $stageArr[$key]['row_total'])){$fileContents .= $stageArr[$key]['row_total'];}
                    
    $fileContents .= '">'."\n";
                    if(isset(
    $stageArr[$key]['people'])){
                        
    asort($stageArr[$key]['people']);
                        
    reset($stageArr[$key]['people']);
                        foreach (
    $stageArr[$key]['people'] as $nameKey=>$nameValue) {
                            
    $fileContents .= '           <bar id="'.$nameKey.'" totalSize="'.$stageArr[$key][$nameKey]['total'].'" altText="'.$nameValue.': '.format_number($stageArr[$key][$nameKey]['opp_count'], 00).' '.$current_module_strings['LBL_CAS_NUMBER'].' '.$current_module_strings['LBL_CAS_IN_STATUS'].' '.$translation.'" url="index.php?module=Cases&action=index&assigned_user_id[]='.$nameKey.'&status='.urlencode($key).'&date_start='.$date_start.'&date_closed='.$date_end.'&query=true&searchFormTab=advanced_search"/>'."\n";
                        }
                    }
                    
    $fileContents .= '     </dataRow>'."\n";
                } 
    and the last
    PHP Code:
    $return create_chart($chart_size,$cache_file_name,$width,$height);    // draw the chart. 
    Regards
    Hanny

    Hello, I also need to create a custom chart. This will be an aging chart (days since) based on stages of activity based on win opportunities. 0-5 days, 10-20 days etc. Would I use the same process to create this chart? Thanks.

  8. #8
    tbivans's Avatar
    tbivans is offline Sugar Community Member
    Join Date
    Dec 2006
    Location
    Ayden, NC
    Posts
    224

    Default Re: How to create new chart but show cases module

    Hi, I have this problem as well. I created three custom charts in 4.5.1 and they have since broken in my test 5.0.0b migration. I desperately need some help here as well. Really GOOD documentation would be very welcome. But someone with knowledge in this area would be welcome as well.

    Anybody?

    Thanks in advance.

  9. #9
    yoursiddhu is offline Junior Member
    Join Date
    Feb 2009
    Posts
    1

    Default Re: How to create new chart but show cases module

    Quote Originally Posted by lehoangngochan View Post
    Dear taarus,

    You can do as the following :


    CREATE A NEW CHART IN DASHBOARD MODULE


    Instruction :

    1- Copy one of the chart files in modules/Charts/code that you want to create new chart. (There are 3 type of chart in modules/Charts/code is : Vertical bar chart (vBarF), pie chart (pieF), horizontal bar chart (hBarF)).

    2- Rename it (for example: Chart_mychart.php).

    3- Go into “predefined_charts.php” in modules/Charts/code and add new entry to $predefined_charts array: 'Chart_mychart' => array('type'=>'code','id'=>'Chart_mychart','label' =>'My Chart').

    4- Go to your newly created “Chart-mychart.php” and replace all “original_chart”-variables with your “mychart”-term.

    5- In modules/Charts/language/en_us.lang.php (or whatever language file you are using) you'll find variables to set titles and descriptions of your new chart. You need to search for the affected variables and add your names (e.g. LBL_MYCHART_TITLE and the value for it) and adjust the variables in the “Chart-mychart.php”

    6- Go to your sugar system and open dashboard module.

    7- “your chart” should now be visible in the “add a chart”-dropdown (the name in the menu is the “label” value you add in “predefined_charts.php).

    8- Once your new chart is visible you can go on adding the required functionality to your file or adjusting the existing one.

    9- The function ‘gen_xml’ generates the XML that is used to create the Flash-chart.

    10- Create_chart at the very end of the file defines the type of chart being displayed.

    11- The .fla-files are saved in include/charts.

    12- To check your xml file has been create in the progress create new chart in ‘gen_xml’ function in C:\Program Files\sugarcrm-4.5.1b\htdocs\sugarcrm\cache\xml\ e19c31c8-526b-ae27-fabd-46112c233961_pipeline_by_mychart_2007_04_30_2010_0 1_01.xml.


    CODING : (Example the Chart_pipeline_by_case_status)

    Go to gen_xml() function to replace the query for your chart as below :

    $query = " SELECT cases.status, users.user_name, cases.assigned_user_id, count(*) AS opp_count, count(*) AS total FROM users,cases ";

    and in


    PHP Code:
    while($row $opp->db->fetchByAssoc($result, -1false))  {

    // You need add the  value important to support your chart here .
    $sum $row['total'];
    if(!isset(
    $stageArr[$row['status']]['row_total'])) {$stageArr[$row['status']]['row_total']=0;}
    $stageArr[$row['status']][$row['assigned_user_id']]['opp_count'] = $row['opp_count'];
    $stageArr[$row['status']][$row['assigned_user_id']]['total'] = $sum;
    $stageArr[$row['status']]['people'][$row['assigned_user_id']] = $row['user_name'];
    $stageArr[$row['status']]['row_total'] += $sum;
    $usernameArr[$row['assigned_user_id']] = $row['user_name'];
    $total += $sum;


    PHP Code:
    foreach ($datax as $key=>$translation) {

    // You need add the  value important to support your chart here to create a xml file.

                    
    if(isset($stageArr[$key]['row_total'])){$rowTotalArr[]=$stageArr[$key]['row_total'];}
                    
                    
    $fileContents .= '     <dataRow title="'.$translation.'" endLabel="';
                    if(isset(
    $stageArr[$key]['row_total'])){$fileContents .= $stageArr[$key]['row_total'];}
                    
    $fileContents .= '">'."\n";
                    if(isset(
    $stageArr[$key]['people'])){
                        
    asort($stageArr[$key]['people']);
                        
    reset($stageArr[$key]['people']);
                        foreach (
    $stageArr[$key]['people'] as $nameKey=>$nameValue) {
                            
    $fileContents .= '           <bar id="'.$nameKey.'" totalSize="'.$stageArr[$key][$nameKey]['total'].'" altText="'.$nameValue.': '.format_number($stageArr[$key][$nameKey]['opp_count'], 00).' '.$current_module_strings['LBL_CAS_NUMBER'].' '.$current_module_strings['LBL_CAS_IN_STATUS'].' '.$translation.'" url="index.php?module=Cases&action=index&assigned_user_id[]='.$nameKey.'&status='.urlencode($key).'&date_start='.$date_start.'&date_closed='.$date_end.'&query=true&searchFormTab=advanced_search"/>'."\n";
                        }
                    }
                    
    $fileContents .= '     </dataRow>'."\n";
                } 
    and the last
    PHP Code:
    $return create_chart($chart_size,$cache_file_name,$width,$height);    // draw the chart. 
    Regards
    Hanny
    Hi Hanny,
    I have followed your procedure to create a chat for cases module. but its not working.
    can you please help me.

    Regards,
    Siddharth

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Module Builder
    By Olavo in forum Downloads
    Replies: 418
    Last Post: 2009-02-26, 06:36 AM
  2. Replies: 4
    Last Post: 2007-09-10, 02:14 PM
  3. Replies: 1
    Last Post: 2006-09-11, 03:38 PM
  4. Replies: 23
    Last Post: 2006-08-30, 05:32 PM
  5. Make a new Cases Module
    By clahti in forum Developer Help
    Replies: 1
    Last Post: 2006-06-08, 11:29 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •