Okay
  Public Ticket #2722722
wpDataCharts callbacks
Closed

Comments

  • Kevin Quilliam started the conversation

    I had callbacks set up on several pages in order to access the HighCharts obj.options.legend.reversed = true feature in order to reverse the order of the legend on my charts. It suddenly stopped working in the last few weeks on every page over multiple charts despite not changes in the site. The charts still work fine, so the number is correct, just the callbacks don't work. I'm using the following code, which again worked before and follows the sample on your site (see "Related URL). It now doesn't have an effect on any aspect of the chart, i.e. the background color isn't set either. Do you have any suggestions for why this would stop working? 


    <script type="text/javascript">
    jQuery(window).load(function(){
        if( typeof wpDataChartsCallbacks == 'undefined' ){ wpDataChartsCallbacks = {}; }
        wpDataChartsCallbacks[2] = function(obj){
    obj.options.legend.reversed = true;
            obj.options.chart.backgroundColor = '#F7F7F7';
            obj.options.chart.zoomType = 'x';
            obj.options.chart.panning = true;
            obj.options.chart.panKey = 'shift';
            obj.options.tooltip = {
                formatter: function () {
                var s = '<b>' + this.y + '</b>';
                return s;
                }
            }
        }
    });
    </script>

    [wpdatachart id=2]

  • [deleted] replied

    Hi Kevin

    Thank you for reaching out to us. 

    From what we can see the script is no longer valid, please update this line 

    jQuery(window).load(function(){

    to

    jQuery(window).on('load',function(){ 

    and this should solve the issue.

    Do let us know if you need any further assistance.

  • Kevin Quilliam replied

    That worked, thank you! 

    You may want to update the sample code on your site at the page I referenced to reflect this.

  • [deleted] replied

    I'm glad I could be of servicesmile.png 

    Do let us know if there is anything else we can assist you with.

    Have a wonderful day!