WordPress.org

Support

Support » Plugins and Hacks » [Resolved] external data into chart

[Resolved] external data into chart

  • 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/

Viewing 2 replies - 1 through 2 (of 2 total)
  • 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!

    Plugin Author Paul van Zyl
    Member

    @pushplaybang

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

    Kind Regards

    Paul.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Resolved] external data into chart’ is closed to new replies.