Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#469 Welcome block: google_charts.php

closed-accepted
Greg Roach
5
2009-01-26
2008-03-31
Greg Roach
No

I've written a new block for the welcome pages, which displays pretty charts using "Google Charts". These are "eye candy" rather than serious genealogical tools, but they can easily brighten up a dull welcome page.

The google-charts API is fairly well documented, so it should be straightforward to add all sorts of pretty charts.

I've written two so far; global individual distribution and surname distribution. They look this: (apologies if the long URL stretches the screen)

http://chart.apis.google.com/chart?cht=t&chtm=world&chco=ffffff,edf0d4,13390a&chf=bg,s,EAF7FE&chs=400x220&chld=GBUSKEAUFRZADEINCALBNZBEMUATMTEGBRNOPLRUNLIELTVNSGMY&chd=s:9EACAAAAAAAAAAAAAAAAAAAAAA

To use, just save the attached file in your /blocks/ directory.

Discussion

  • kiwi_pgv
    kiwi_pgv
    2008-04-01

    Logged In: YES
    user_id=1910459
    Originator: NO

    An interesting addition Greg. The individual one works OK, although 95% of my INDIs are from England, so it doesn't show much. Can't get anything from the Surname option though - just the 'red-X' and the file name.

     
  • kiwi_pgv
    kiwi_pgv
    2008-04-01

    Logged In: YES
    user_id=1910459
    Originator: NO

    OK - forget that comment. You know I never read instructions properly :-)

    Now that I have added a valid surname in the 'Surname' box it works fine.

     
  • kiwi_pgv
    kiwi_pgv
    2008-04-01

    Logged In: YES
    user_id=1910459
    Originator: NO

    Now that I've got my head properly round this, and knowing you have soooo much spare time <G>,a couple of suggestions:

    1 - your code comments say : "Count how many people were born in each country" but you appear to actually count all events (or all 2 PLAC tags) in each country. I tried this with the surname version. In my own surname group the country Iraq only appears once, as the place below a 1 _MILI tag. But Iraq was shaded on the map, until I removed it from that persons data. I think 'born' would be a more useful limitation

    2 - A further useful option might be to exclude surnames found through the _MARNM tags - or perhaps even permanently ignore these.

    3 - a simple key alongside the map to indicate roughly what the different colours mean would be useful. It could either be a sophisticated list that uses each shade actually on the map plus percenatges or numbers, or just the three hard-coded extremes ffffff,edf0d4,13390a and their meanings. I see Google don't have this as an option in the Chart API for maps, so it would have to be something coded. You might also need to turn this off if the block is used on the narrow (right) side of the page.

    4 - combining this with your comments on the Google charts on the indi/fam lists - what about including those here as well, and have a different (random?) one appear each time the page is refreshed?

     
  • kiwi_pgv
    kiwi_pgv
    2008-04-01

    Logged In: YES
    user_id=1910459
    Originator: NO

    Just to explain item 3 better, I put the following very basic solution (after row 209) on a block on my own Welcome page at www.our-families.info (you'll have to scroll right to the bottom)

    echo '<table align="center" border="0" cellpadding="3" cellspacing="0"><tr>';
    echo '<td><b>Key:</b>&nbsp;&nbsp;</td>';
    echo '<td bgcolor="13390a" width="15"></td><td>Highest Population&nbsp;&nbsp;</td>';
    echo '<td bgcolor="edf0d4" width="15"></td><td>Lowest Population&nbsp;&nbsp;</td>';
    echo '<td bgcolor="ffffff" width="15"></td><td>Nobody at all&nbsp;&nbsp;</td>';
    echo '</tr></table>';

     
  • Greg Roach
    Greg Roach
    2008-04-01

    Logged In: YES
    user_id=1466942
    Originator: YES

    Thanks for the feedback.

    (1) I started with BIRT, then realised I needed DEAT. Then I found that I needed EMIG and IMIG. Then I found someone who has no EMIG, but has a CENS in their new country. All PLAC just seemed easiest!

    (2) This should take account of the "SHOW MARRIED SURNAMES" option.

    (3) Since the numbers are merely "indicative" (see point 1), I'm not sure a key would acutally help.

    (4) This would make caching difficult, and it can take many seconds to process common surnames.

     
  • kiwi_pgv
    kiwi_pgv
    2008-04-01

    Logged In: YES
    user_id=1910459
    Originator: NO

    Greg

    I see your point on 4), and happy to agree to disagree on 3) (as I have it on my own copy now anyway).My own thinking on 2) was that for this display I would prefer to depart from the SHOW MARRIED NAMES setting that I prefer for the rest of the site. I thought it would be a useful tool to display where all my family members 'came' from. Hence I would only want BIRT, and only those born with the chosen surname.

    So - any tips on how to a) change from all 2 PLAC tags to BIRT only; and b) to exclude MARNM 's? I suspect a) would be simple (a variable change?) but perhaps b) is quite complex?

     
  • Logged In: YES
    user_id=1946672
    Originator: NO

    I copy google_charts.php to blocks directory and moved $pgv_lang's to language extra.en file. I made translate to polish and save in extra.pl.
    Blocks replaces all data from polish extra language file with english. Not only used by google_charts but everything from extra files.

     
  • Greg Roach
    Greg Roach
    2008-06-03

    • status: open --> wont-fix-rejected
     
  • Greg Roach
    Greg Roach
    2008-06-03

    Logged In: YES
    user_id=1466942
    Originator: YES

    The functionality of this block has been incorporated into the stats class - hence into the advanced html block.

    This block causes issues with the latest SVN code.

    Please don't use it any more.

     
  • kiwi_pgv
    kiwi_pgv
    2008-06-04

    Logged In: YES
    user_id=1910459
    Originator: NO

    Greg

    I know various google chart options have been added for the advanced html block, but I don't see one that does what this did (showing the map chart).

    I realise this can't be a priority, but it would be good to have its functionality back one day.

     
  • Google chart block

     
    Attachments
  • I made changes in the functionality of this block. Now it is compatible with ver. 4.2 svn 4900

     
    • status: wont-fix-rejected --> open
     
  • Greg Roach
    Greg Roach
    2009-01-25

    I wrote this block to see if the charts would work.

    They did, and all these functions are now part of the advanced-stats block.

    I guess we don't need it any more.

     
  • Greg Roach
    Greg Roach
    2009-01-25

    • status: open --> open-accepted
     
  • ok

     
    • status: open-accepted --> closed-accepted