SitePoint Sponsor

User Tag List

Results 1 to 10 of 10

Thread: Creating Charts

  1. #1
    SitePoint Wizard tgavin's Avatar
    Join Date
    Feb 2003
    Location
    FL
    Posts
    1,051
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Creating Charts

    I want to create charts based on the amount of visitors, clicks, etc. There are plenty or resources out there, but none that I've found tell me what kind of data to use.

    Currently I'm capturing data by incrementing $value + 1 whenever a link is clicked, or a page loaded, etc., so that my db records basically look like

    links clicked: 4
    articles read: 24
    subscribers: 200

    and so on. Can a chart be created with this type of information? Or do I need to do it some other way? Basically, I have no idea where to begin on creating charts.

  2. #2
    hi galen's Avatar
    Join Date
    Jan 2006
    Location
    New Haven, CT
    Posts
    1,228
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    you can create charts with anything pretty much, but how useful the charts are depends on the data. For example... If you keep date stats with your info you can make a graph to compare months.

  3. #3
    SitePoint Wizard silver trophybronze trophy Cups's Avatar
    Join Date
    Oct 2006
    Location
    France, deep rural.
    Posts
    6,869
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    Many charts like that are time based.

    Clicks on this page so far today vs last month, same month last year etc.

    Top 10 pages clicked shown as a pie chart etc.

    ps Google charts looks nice and simple.

  4. #4
    SitePoint Wizard tgavin's Avatar
    Join Date
    Feb 2003
    Location
    FL
    Posts
    1,051
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for the replies.

    So, gathering information the way I am is OK then? Good.
    I guess when I'm ready to start I'll get a better understanding of it.

  5. #5
    SitePoint Enthusiast
    Join Date
    Sep 2005
    Posts
    75
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    other than Google chart there are many good resources available

    www.aditus.nu/jpgraph/
    http://teethgrinder.co.uk/open-flash-chart
    http://www.maani.us/charts/index.php

  6. #6
    SitePoint Wizard silver trophybronze trophy Cups's Avatar
    Join Date
    Oct 2006
    Location
    France, deep rural.
    Posts
    6,869
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by tgavin View Post
    So, gathering information the way I am is OK then? Good.
    I guess when I'm ready to start I'll get a better understanding of it.
    Yes, the more information you start gathering the more options you have.

    Sometimes the relevance of the information is hard to glean till you start analysing it.

    Sometimes messing around with the figures or a sample of them in a spreadsheet is a good way to get started - that can lead to accidentally spotting correlations you hadn't originally seen.

    Then you could move onto putting it into a database for more analysis.

    Be careful though, its easy to get swamped with info you don't need - cant see the wood for the trees kinda thing.

  7. #7
    SitePoint Wizard tgavin's Avatar
    Join Date
    Feb 2003
    Location
    FL
    Posts
    1,051
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I just had a thought. I have a stats table that gathers the above-mentioned counts. However, there's really no way to be able to compare them on a month-by-month basis, as there's no date field. Just counts.

    Any suggestions on creating a stats table in mysql so that monthly comparisons can be made?

  8. #8
    SitePoint Wizard silver trophybronze trophy Cups's Avatar
    Join Date
    Oct 2006
    Location
    France, deep rural.
    Posts
    6,869
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    So whats in the stats table then? Just one big number?

  9. #9
    SitePoint Wizard tgavin's Avatar
    Join Date
    Feb 2003
    Location
    FL
    Posts
    1,051
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Nothing but numbers. When something happens, that value is incremented by 1.

    Code MySQL:
    CREATE TABLE `stats` (
      `id` int(10) unsigned NOT NULL auto_increment,
      `home_page` int(10) unsigned NOT NULL default '0',
      `articles` int(10) unsigned NOT NULL default '0',
      `friend_page` int(10) unsigned NOT NULL default '0',
      `friend_ref` int(10) unsigned NOT NULL default '0',
      `friend_sub` int(10) unsigned NOT NULL default '0',
      `subscribed` int(10) unsigned NOT NULL default '0',
      `admin_subscribed` int(10) unsigned NOT NULL default '0',
      `activated` int(10) unsigned NOT NULL default '0',
      `unsubscribed` int(10) unsigned NOT NULL default '0',
      `bounced` int(10) unsigned NOT NULL default '0',
      `bounced_del` int(10) unsigned NOT NULL default '0',
      `stats_total_sent` int(10) unsigned NOT NULL default '0',
      PRIMARY KEY  (`id`)
    ) ENGINE=MyISAM  DEFAULT CHARSET=latin1 ;

  10. #10
    SitePoint Addict Wildhoney's Avatar
    Join Date
    Apr 2006
    Location
    Nottingham
    Posts
    246
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    As someone's already mentioned, Google Charts is actually really nice. There is actually a PHP wrapper class for the Google Chart API that's nice and simple to use, and beautifully coded -- loosely coupled and all that. In addition, there is also an informative article on how to use Google Charts in your PHP applications.
    TalkPHP.com - The Friendly PHP Community

    Watch Reaper Online - Watch Chuck Online


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
  •