Okay
  Public Ticket #1543638
using placeholders with charts
Closed

Comments

  • danbarejr started the conversation

    I'm trying to use the placeholders (i.e., var1) with a chart.

    The chart is based on a table (wpdatatable) that uses var1, but when I try a shortcode of [wpdatachart id=1 var1=22] the var1 doesn't work.  The var1 only uses the default in the table definition.

    Is there something I'm not doing right?

    Thanks - Dan 

  •  443
    Bogdan replied

    Hi Dan,
    Thank you for your purchase.

    Sorry to disappoint you but unfortunately using placeholders with charts are not possible with the plugin built in features at the moment.

    Best regards.

    Check out our new Support Help Center!

    Check out our newest product - Amelia - Enterprise-Level WordPress Appointment Booking Plugin - promo price for launch period!

    Kind Regards,
    Bogdan Radusinovic
    bogdan@touchmesoft.net

  • danbarejr replied

    I have an easy work-around for this you should check out.

    This code could be modified in a number of ways.

    1) I pass variables on the url, as in www.example.com/?var1=33&var2=123

    2) I register the variables in my theme functions.php by adding this:

    function add_query_vars_filter( $vars ){
      $vars[] = "var1";
      $vars[] = "var2";
      $vars[] = "var3";
      return $vars;
    }
    add_filter( 'query_vars', 'add_query_vars_filter' );

    3) I add a plugin for shortcode as:

    <?php
    /*
    Plugin Name: wpsetvars
    Description: Custom vars in URL to Global vars
    Version: 0.1
    Author: Daniel Bare
    Text Domain: wpsetvars
    */

    function wpsetvars_func($params) {
    global $wdtVar1, $wdtVar2, $wdtVar3;
    if (get_query_var(var1')) {
    $var1 = get_query_var('var1'); // get var1 from url line
    //*** $params['var1']  -- could scrape from shortcode instead
    $wdtVar1 = $var1;
    }
    if (get_query_var('var2')) {
    $var2 = get_query_var('var2'); 
    //*** $params['var2']
    set_query_var('var2', $var2);
    $wdtVar2 = $var2;
    }
    if (get_query_var('var3')) {
    $var3 = get_query_var('var3'); 
    //*** $params['var3'] 
    $wdtVar3 = $var3;
    }
    return;
    }

    add_shortcode( 'wpsetvars', 'wpsetvars_func' );

    ?>

    4) Activate Shortcode wpsetvars

    5) in page - note - wpdatachart is based on a table that uses var1 

    [wpsetvars][wpdatachart id=1]

    6) use url www.example.com/?var1=3  

    depending on what is var1 in in the url, the chart changes

    done.

    -------------

    I suspect this would be easy to implement into the wpdatacharts, as it's so easy to do this.

    I haven't tested this with wpdatatables, but it might work as well - to put the vars on the URL as well.

  •  443
    Bogdan replied

    Hi Dan,

    Thank you for your feedback and suggestion. 
    I will forward this to my team and also this ticket is public so the other users can see it in case they want to implement something similar.

    Thank you again.

    Best regards.

    Check out our new Support Help Center!

    Check out our newest product - Amelia - Enterprise-Level WordPress Appointment Booking Plugin - promo price for launch period!

    Kind Regards,
    Bogdan Radusinovic
    bogdan@touchmesoft.net

  • Alan Tin replied

    Hi,

    I am currently using wpDataTables with placeholders to retrieve json data from my backend WebService. I found this feature is easy to use and flexible and this is one of the reason we decided to buy and use your product.

    However, I found that I cannot use this placeholders when creating wpDataChart and I am very disappointed when I see your reply that using placeholders with charts are currently not supported.

    When will this feature be added? Or do you have any workaround recommended?