Page 1 of 7 12345 ... LastLast
Results 1 to 10 of 67

Thread: Flexible / Generic Chart Dashlet

  1. #1
    mvngti is offline Sugar Community Member
    Join Date
    Oct 2007
    Location
    South Africa
    Posts
    510

    Smile Flexible / Generic Chart Dashlet

    Hi,

    I have created a flexible chart dashlet (called FlexibileCharDashlet) that can be used to add chart onto the home page for anything that can be extracted with a sql query.

    Simply unzip the file in your sugar_root - it will not overwrite any existing files - and rebuild the Dashlets from the repair menu.
    Then you can create new charts by just adding their metadata to custom/Charts/chartDefs.ext.php with two extra things in the metadata (compared to modules/Charts/chartdefs.php)

    1) 'query' => contains the sql query that should run to get the chart data - it may contain smarty style variables that will get replaced by the dashlet options.
    2) 'searchFields; => can define additional searchFields that will appear on the dashlet's options

    There are two working samples in custom/Charts/chartDefs.ext.php in the archive. The first sample simply replicates the built in "Closed by Month" chart in sugar and the second example creates a chart called "New Opportunities by Month".

    When you add the Flexible Chart dashlet it will allow you to choose one the charts you have defined in the options screen.

    Right now it is just a zip file but if I get good feedback I will make it into a fully fledged project on sugarforge.

    M
    Attached Files Attached Files
    --


    Marnus van Niekerk

    There are only 10 types of people in the world
    those who can read binary and those who don't

    Modules:
    CE Teams - Upgrade safe teams module for Community Edition
    FieldACL - Field Level Access Control for Community Edition
    EditLogicHooks - Create and edit Logic Hooks from the Admin GUI
    FlexibleChartDashlet - Display any data in a Dashlet Chart
    DocumentThumbnails - Thumbnails for Documents module

    Many questions can be answered by reading the Developers Manual

  2. #2
    mvngti is offline Sugar Community Member
    Join Date
    Oct 2007
    Location
    South Africa
    Posts
    510

    Default Re: Flexible / Generic Chart Dashlet

    PS: May I ask everybody to post working samples of the metadata here if you build a useful chart using this.
    That way we build up an easy to use and reference set of custom charts :-)
    --


    Marnus van Niekerk

    There are only 10 types of people in the world
    those who can read binary and those who don't

    Modules:
    CE Teams - Upgrade safe teams module for Community Edition
    FieldACL - Field Level Access Control for Community Edition
    EditLogicHooks - Create and edit Logic Hooks from the Admin GUI
    FlexibleChartDashlet - Display any data in a Dashlet Chart
    DocumentThumbnails - Thumbnails for Documents module

    Many questions can be answered by reading the Developers Manual

  3. #3
    ckd1987 is offline Sugar Community Member
    Join Date
    Jan 2008
    Posts
    88

    Default Re: Flexible / Generic Chart Dashlet

    i will test your plugin at this weekend and reporting sunday/monday.

    thx 4 your work

  4. #4
    ckd1987 is offline Sugar Community Member
    Join Date
    Jan 2008
    Posts
    88

    Default Re: Flexible / Generic Chart Dashlet

    Greetings,

    since a few hours I'm woring at your custon chart, here some breaks...

    PHP Code:
    $chartDefs['Agenten-Abfrage'] = array(
                    
    'type' => 'code',
                    
    'id' => 'Chart_Agenten_Abfrage',
                    
    'label' => 'Agenten Abfrage',
                    
    'chartUnits' => 'Leads Size in 1',                
                    
    'chartType' => 'stacked group by chart',
                    
    'groupBy' => array( 'm''cc_nummer_c', ),
                    
    'base_url'=> 
                        array(     
    'module' => 'Leads',
                                
    'action' => 'index',
                                
    'query' => 'true',
                                
    'searchFormTab' => 'advanced_search',
                             ),
                    
    'url_params' => array( 'date_entered', ),
                    
    'query' => 'SELECT leads_cstm.cc_nummer_c,  count(leads_cstm.lead_cnt) as m 
    FROM leads,leads_cstm WHERE leads.id = leads_cstm.id_c AND 
    leads.date_entered >= DATE_FORMAT("{$fcd_date_start}", "%Y-%m-%d %H:%i:%s") 
    AND leads.date_entered <= DATE_FORMAT("{$fcd_date_end}", "%Y-%m-%d %H:%i:%s")
    AND leads.deleted=0
    GROUP by leads_cstm.cc_nummer_c ORDER BY `m` DESC'
                 
    ); 
    if i use the generated code from sugarcrm.log in phpmyadmin, i will get the right answer something like this:

    Code:
    cc_nummer_c 	m
    501 	62
    164 	59
    502 	45
    147 	38
    163 	34
    162 	31
    148 	18
    128 	16
    129 	16
      	2
    999 	1
    but if i on the Dashlets view I see something like this



    I think its really easy to fix. but I dont know the right part...

  5. #5
    vishwasrao's Avatar
    vishwasrao is offline A Prolific Poster
    Join Date
    Sep 2008
    Location
    Pune,Maharashtra,India
    Posts
    385

    Smile Re: Flexible / Generic Chart Dashlet

    Hi ,
    this seems to be great idea.
    I am going through it.
    will be back with feedback.
    Last edited by vishwasrao; 2009-05-04 at 05:17 AM.
    Vishwasrao Salunkhe
    vishwasrao.salunkhe@gmail.com
    Fan Of Sachin Tendulkar
    Operating System :- Windows XP
    PHP Version:- 5.3
    Apache :-2.2.11
    MYSQL :-5.1.36

  6. #6
    mvngti is offline Sugar Community Member
    Join Date
    Oct 2007
    Location
    South Africa
    Posts
    510

    Default Re: Flexible / Generic Chart Dashlet

    You query has to return two group columns and the total column must be called "total".
    That is built into the sugar code unfortunately.

    Quote Originally Posted by vishwasrao View Post
    Hi ,
    this seems to be great idea.
    I am going through it.
    will be back with feedback.
    --


    Marnus van Niekerk

    There are only 10 types of people in the world
    those who can read binary and those who don't

    Modules:
    CE Teams - Upgrade safe teams module for Community Edition
    FieldACL - Field Level Access Control for Community Edition
    EditLogicHooks - Create and edit Logic Hooks from the Admin GUI
    FlexibleChartDashlet - Display any data in a Dashlet Chart
    DocumentThumbnails - Thumbnails for Documents module

    Many questions can be answered by reading the Developers Manual

  7. #7
    vishwasrao's Avatar
    vishwasrao is offline A Prolific Poster
    Join Date
    Sep 2008
    Location
    Pune,Maharashtra,India
    Posts
    385

    Smile Re: Flexible / Generic Chart Dashlet

    Hi,
    I think this is thing i am watching for ,
    I have done as u said unziped ur zip in my sugar root .
    & created custom/Charts/chartdefs.ext.php

    Can u tell me further steps todo so that i can create my own custom dashlet.
    Thanx in advance.
    Vishwasrao Salunkhe
    vishwasrao.salunkhe@gmail.com
    Fan Of Sachin Tendulkar
    Operating System :- Windows XP
    PHP Version:- 5.3
    Apache :-2.2.11
    MYSQL :-5.1.36

  8. #8
    ckd1987 is offline Sugar Community Member
    Join Date
    Jan 2008
    Posts
    88

    Default Re: Flexible / Generic Chart Dashlet

    In witch part i have to change this ?

  9. #9
    mvngti is offline Sugar Community Member
    Join Date
    Oct 2007
    Location
    South Africa
    Posts
    510

    Default Re: Flexible / Generic Chart Dashlet

    Quote Originally Posted by vishwasrao View Post
    Hi,
    Can u tell me further steps todo so that i can create my own custom dashlet.
    Thanx in advance.
    Test if one of the examples works and then start edting the metadata of the example step by step until you get the chart you want. Test the query in mysql to make sure the query works first!

    M
    --


    Marnus van Niekerk

    There are only 10 types of people in the world
    those who can read binary and those who don't

    Modules:
    CE Teams - Upgrade safe teams module for Community Edition
    FieldACL - Field Level Access Control for Community Edition
    EditLogicHooks - Create and edit Logic Hooks from the Admin GUI
    FlexibleChartDashlet - Display any data in a Dashlet Chart
    DocumentThumbnails - Thumbnails for Documents module

    Many questions can be answered by reading the Developers Manual

  10. #10
    ckd1987 is offline Sugar Community Member
    Join Date
    Jan 2008
    Posts
    88

    Default Re: Flexible / Generic Chart Dashlet

    okay, my first own chart was build like this code

    Code:
    $chartDefs['Agenten-Abfrage'] = array(
    				'type' => 'code',
    				'id' => 'Chart_Agenten_Abfrage',
    				'label' => 'Agenten Abfrage',
    				'chartUnits' => '',				
    				'chartType' => 'stacked group by chart',
    				'groupBy' => array( 'm', 'cc_nummer_c', ),
    				'base_url'=> 
    					array( 	'module' => 'Leads',
    							'action' => 'index',
    							'query' => 'true',
    							'searchFormTab' => 'advanced_search',
    						 ),
    				'url_params' => array( 'date_entered', ),
    				'query' => 'SELECT leads_cstm.cc_nummer_c,sum(leads_cstm.lead_cnt) as total,  count(leads_cstm.lead_cnt) as m 
    FROM leads,leads_cstm WHERE leads.id = leads_cstm.id_c AND 
    leads.date_entered >= DATE_FORMAT("{$fcd_date_start}", "%Y-%m-%d %H:%i:%s") 
    AND leads.date_entered <= DATE_FORMAT("{$fcd_date_end}", "%Y-%m-%d %H:%i:%s")
    AND leads.deleted=0
    AND leads_cstm.lead_berechnen_c=0
    GROUP by leads_cstm.cc_nummer_c ORDER BY `m` DESC'
    			 );
    THX

Page 1 of 7 12345 ... LastLast

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. How to create an own chart Dashlet in 5.0.0c
    By kuske in forum Developer Tutorials
    Replies: 38
    Last Post: 2012-03-24, 12:57 PM
  2. Replies: 1
    Last Post: 2008-03-31, 08:33 AM
  3. Dashlet Chart Permissioning
    By mvanbergen in forum General Discussion
    Replies: 1
    Last Post: 2008-03-19, 12:11 AM
  4. Replies: 0
    Last Post: 2007-02-15, 04:53 PM
  5. More Flexible Lead/Contact/Target
    By devecon in forum Feature Requests
    Replies: 0
    Last Post: 2006-02-23, 06:03 PM

Tags for this Thread

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
  •