Title: external data into chart
Last modified: August 21, 2016

---

# external data into chart

 *  Resolved [jimlongo](https://wordpress.org/support/users/jimlongo/)
 * (@jimlongo)
 * [11 years, 11 months ago](https://wordpress.org/support/topic/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/](https://wordpress.org/plugins/wp-charts/)

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Thread Starter [jimlongo](https://wordpress.org/support/users/jimlongo/)
 * (@jimlongo)
 * [11 years, 11 months ago](https://wordpress.org/support/topic/external-data-into-chart/#post-5022990)
 * 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!
 *  [Paul van Zyl](https://wordpress.org/support/users/pushplaybang/)
 * (@pushplaybang)
 * [11 years, 10 months ago](https://wordpress.org/support/topic/external-data-into-chart/#post-5023240)
 * 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 ‘external data into chart’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/wp-charts_b1d6e1.svg)
 * [WordPress Charts](https://wordpress.org/plugins/wp-charts/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-charts/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-charts/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-charts/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-charts/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-charts/reviews/)

## Tags

 * [external data](https://wordpress.org/support/topic-tag/external-data/)

 * 2 replies
 * 2 participants
 * Last reply from: [Paul van Zyl](https://wordpress.org/support/users/pushplaybang/)
 * Last activity: [11 years, 10 months ago](https://wordpress.org/support/topic/external-data-into-chart/#post-5023240)
 * Status: resolved