WordPress.org

Forums

WordPress Charts
[resolved] external data into chart (3 posts)

  1. jimlongo
    Member
    Posted 10 months ago #

    Hi, This is a very nice plugin and fills a need that I've previously executed using a jQuery plugin in a hand coded site (but doesn't seem to work in a WordPress context).

    What I would like to have is a pie chart to display donations and the remaining amount to reach a goal.

    So if the goal was $1000 I could statically display that with a short code like [wp_charts title="mypie" type="pie" data="530,1000-530"]

    Now say I have a sql query that returns the amount donated so far (530 in my example).

    Do you have any tip on how I could use that variable in my chart?

    I saw a previous post about do_shortcode() and using that in the page template, except it's not clear from the documentation how to do that with a short code with attributes.

    Thanks for any insight you can offer me.

    jim

    https://wordpress.org/plugins/wp-charts/

  2. jimlongo
    Member
    Posted 10 months ago #

    I guess I should have tried a bit before asking, but in case it helps anyone else.

    Say I have a variable returned from a query = $total

    then I can generate a chart with that data
    <?php echo do_shortcode('[wp_charts title="mypie" type="pie" align="alignright" margin="5px 20px" data=" ' . $total . ' ,1000 - ' . $total . ' "] ') ;?>

    Thanks for the plugin!

  3. Paul van Zyl
    Member
    Plugin Author

    Posted 9 months ago #

    Absolutely, and thanks for trying WP Charts, I'm glad you like it.

    Kind Regards

    Paul.

Reply

You must log in to post.

About this Plugin

  • WordPress Charts
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic