Okay
  Public Ticket #1004863
wpDataCharts callbacks
Closed

Comments

  •  2
    Michelle Lawson started the conversation

    Is there a way to turn on

    • plotOptions.bar.dataLabels 
    • plotOptions.column.dataLabels 
    • plotOptions.series.dataLabels 

    using the wpDataCharts callbacks feature?  

    I know you can turn them on for Export, but I was wanting to turn them on in GUI display.

  • [deleted] replied

    Hi Michelle Lawson,
    Happy New Year and Thank you for your purchase.

    Yes it is possible to enable data labels with callback. Here you can find example how to use wpDataCharts callback for Highcharts - http://wpdatatables.com/documentation/information-for-developers/wpdatacharts-callbacks/

    And here you can find in Highcharts documentation and in JSFiddle how you can enable them data lables - Link - JSFiddle

  •  2
    Michelle Lawson replied

    Yep, I tried that.  It didn't work.  I even cut/pasted your example exactly (except I changed the chart ID) and nothing happens.

    I am putting the javascript at the bottom of the page that has the chart, so it loads after highcharts.js loads. There are no javascript errors, but there is also no change to the chart what-so-ever.  The chart is generated via JSON data.

    Any ideas on what could be going wrong would be greatly appreciated.

  • [deleted] replied

    Hi Michelle Lawson,

    Please provide me a temporary WP-admin login for your site where this happens, so we could log in and take a look ‘from the inside’ as that’s the most efficient way to see and resolve the issue. You can write credentials here just check PRIVATE  so nobody can see it except us.

  •  2
    Michelle Lawson replied

    Unfortunately it is on an internal site that is behind a firewall.  What would you do to analyze, where would you start?  Could it be a plugin conflict?

  • [deleted] replied

    Hi Michelle Lawson,

    What version of the plugin do you have? wpDataChart callback is implemented from version 1.6.2. Please send me the code that you added to customize your chart so I can take a look.

    You tried also example from our documentation and it's not working?

  •  2
    Michelle Lawson replied

    I deactivated every plugin except wpDataTables and it still doesn't work.  So I assume a plugin conflict is not the issue.

  • [deleted] replied

    Hi Michelle Lawson,

    No plugin conflict can't be an issue with wpDataChart callback. What version of the plugin do you have? 

    Please send me the code that you added to customize your chart so I can take a look. You tried example from our documentation and it's not working?


  •  2
    Michelle Lawson replied

    I am running Version 1.7.


    At this point I  am just trying something simple from your example like:  

    [wpdatachart id=2]

    which is a "Basic Column Chart"

    here is JSON that I am using:

    [{"date_mo":"Jan","date_dow":"Sun","date_dom":"01","initiated_ts":"2017-01-01","app_count":"35"},{"date_mo":"Jan","date_dow":"Mon","date_dom":"02","initiated_ts":"2017-01-02","app_count":"856"},{"date_mo":"Jan","date_dow":"Tue","date_dom":"03","initiated_ts":"2017-01-03","app_count":"638"},{"date_mo":"Jan","date_dow":"Wed","date_dom":"04","initiated_ts":"2017-01-04","app_count":"18"}]

    columns used in chart are:

    • initiated_ts
    • app_count

    and in javascript I have


    jQuery(window).load(function() {
    if (typeof wpDataChartsCallbacks == 'undefined') {
    wpDataChartsCallbacks = {};
    }
    wpDataChartsCallbacks[2] = function(obj) {
            obj.options.chart.backgroundColor = '#F7F7F7';
    }
    });


  • [deleted] replied

    Hi Michelle Lawson,

    Do you maybe have Team Viewer? If you have please send me your Team Viewer login and I will login to take a look. Just check PRIVATE so nobody else can see them.

  •   Michelle Lawson replied privately
  •  2
    Michelle Lawson replied

    Thanks for your assistance Milos in resolving location of javascript.

    Back to my original issue, I am trying to display the dataLabels on the graph.  That still doesn't work and I'm sure its something simple I'm doing wrong.


    <script>
    jQuery(window).load(function() {
        if (typeof wpDataChartsCallbacks == 'undefined') {
            wpDataChartsCallbacks = {};
        }
        wpDataChartsCallbacks[2] = function(obj) {
            obj.options.chart.backgroundColor = '#F7F7F7';
            obj.plotOptions = {
                series: {
                    dataLabels: {
                        enabled: true,
                        color: '#FF0000'
                    }
                }
            }
        }
    });

    </script>


    I've tried series and bar.

    I also tried plotOptions.series.dataLabels.enabled = true (which throws all kinds of errors because its trying to reference null objects).  On the other hand, the above does not throw an error, but also does not display dataLabels.


  •  2
    Michelle Lawson replied

    Nevermind, I got it!


    obj.options.plotOptions


    duh!


    Thanks for all your help!

  • [deleted] replied

    Hi Michelle Lawson,

    You should write obj.options.plotOptions instead obj.plotOptions and it will work.