• Resolved manasluminary

    (@manasluminary)


    Hello,

    I am trying to follow the recommendations from below link to populate the data in the output.
    https://docs.themeisle.com/article/605-how-can-i-populate-chart-series-and-data-dynamically

    What I have done so far is,
    1) created a chart and use the short code <?php echo do_shortcode( ‘[visualizer id= 9242 series=”mycustom_series_filter” data=”mycustom_data_filter” settings=”mycustom_filter_settings”]’ ); ?>
    2) Added code in the theme;s function.php to see if the code gets called .
    I have added .

    However I do not see any effect on the graph. Is it possible that I have missed something in my code ?

    // filter for chart
    add_filter( 'mycustom_series_filter', 'myplugin_filter_chart_series', 10, 3 );
    function myplugin_filter_chart_series( $series, $chart_id, $type ) {
        // do your stuff here
        echo "Hello world";
    	$series = array("Volvo", "BMW", "Toyota");
        return $series;
    }
    
    add_filter( 'mycustom_data_filter', 'myplugin_filter_chart_data', 10, 3 );
    function myplugin_filter_chart_data( $data, $chart_id, $type ) {
        // do your stuff here
        echo "Hello world";
        return $data;
    }
    
    add_filter( 'mycustom_filter_settings', 'myplugin_filter_chart_settings', 10, 3 );
    function myplugin_filter_chart_settings( $data, $chart_id, $type ) {
        // do your stuff here
        echo "Hello world";
        return $data;
    }

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support Vytis

    (@bvytis)

    Hi @manasluminary,

    We apologize for the confusion and that our documentation was not updated.
    We have removed these arguments from the shortcode some time ago.

    Please refer to this thread for more information:
    https://ww.wp.xz.cn/support/topic/graphs-from-shortcodes-and-filters-not-dynamic-should-be/

    We have now updated the documentation and removed the examples that are no longer working.

    Thread Starter manasluminary

    (@manasluminary)

    Thank you so much for fixing the documentation. It worked. Now I am trying to print the shortcode in my function.php

    The set up I have now is that I call an ajax function and it returns the HTML as below and I set this to the HTML.

    However when I look at the inspect mode, I see

    <div id=”visualizer-9242-887479811″ class=”visualizer-front visualizer-front-9242″></div>

    <!– Not showing structured data for chart 9242 because title is empty –>

    Is there any limitation around shortcode which can make this happen ?

    https://luminaryproperties.co.uk/check-average-rent-in-a-postcode/

    var data = {	
    			          'action': 'hmorent_data',
    			          'postcode': postcode,
    			        };
    			        jQuery.post(ajaxurl, data, function(response) {
    			            if(response != ''){
    			                jQuery('.ajaxpostresponce_hmo').html(response);
    			            }else{
    			                jQuery('.ajaxpostresponce_hmo').html("No Results Found");
    			            }
    			        }).fail(function(xhr, status, error) {
    			            console.log(status);
    			            console.log(error);
    			        });
    function hmorent_data()
    {
    
        $postcode = $_POST['postcode'];
    	$_SESSION["hmorentdata_postcode"] = $postcode ;   
    	echo "<div class='mortgage'><label>Monthly Mortgage Payment(£):</label>" . round($mortgage, 2) . "</div>";
    	//echo do_shortcode( '[contact-form-7 id="91" title="quote"]' );
    	echo do_shortcode( '[visualizer id= 9242 title="HMO Rent"]' );  
        exit();
    }
    Plugin Support Vytis

    (@bvytis)

    @manasluminary,

    We do have a feature request to make Visualizer work with AJAX, however, we do not have this implemented yet so at least for now we do not have a method to refresh and reload charts properly (based on the tests that I made).

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

The topic ‘Populate series data dynamically’ is closed to new replies.