Results 1 to 4 of 4

Thread: What is graphs in admin area best practice?

  1. #1
    Rarst's Avatar
    Rarst is offline Big Tipper
    Join Date
    Jul 2009
    Posts
    322

    Icon5 What is graphs in admin area best practice?

    I have some pending plugin ideas (nearest one being antispam plugin for diploma on programming courses) that will require some graphs, mostly in admin area.

    For my own use I have Google Charts class that works reasonably well. But will have to either stick it into every plugin, or require it as dependency for graphs to show. There is also privacy implication (graph data transferred in the open) some people might mind for admin area grade information.

    WP has number of bundled JS... any of those capable of building graphs natively? Or will I have to bundle additional plugin for jQuery or something with my plugin?

    PHP itself can also generate images but that seems like reinventing the wheel for the task.

    What do you think would be best practice in this case?
    Rarst.net - cynical thoughts on software and web (and sometimes WP) | @Rarst | I seem to be non-GPL-compliant person. Beware my poisonous thoughts.

  2. #2
    Otto's Avatar
    Otto is offline On The Rocks
    Join Date
    Apr 2009
    Location
    Memphis, TN
    Posts
    862

    Default

    If you don't want to rely on Google, then just grab a jQuery based chart library and include that with your plugin:
    http://www.reynoldsftw.com/2009/02/6...gins-reviewed/

    It's not hard to bundle a JS library with the plugin. Just put it in there then use wp_enqueue_script to include it on the pages where you need it.

  3. #3
    Rarst's Avatar
    Rarst is offline Big Tipper
    Join Date
    Jul 2009
    Posts
    322

    Default

    @Otto

    Yeah, I think I saw that post. Even downloaded or bookmarked Flot somewhere.

    Just thought maybe some of bundled script bunch can do that natively.
    Rarst.net - cynical thoughts on software and web (and sometimes WP) | @Rarst | I seem to be non-GPL-compliant person. Beware my poisonous thoughts.

  4. #4
    Otto's Avatar
    Otto is offline On The Rocks
    Join Date
    Apr 2009
    Location
    Memphis, TN
    Posts
    862

    Default

    No, there's nothing native in there along those lines.

    Still, just include the file in the plugin directory, then do:
    PHP Code:
    wp_enqueue_script('jquery-chart',plugins_url('chart.js',__FILE__), array('jquery')); 
    Easy.

Posting Permissions

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