Okay
  Public Ticket #1093781
Changing Slice labels
Closed

Comments

  •  2
    darimany started the conversation

    Some Pie Charts (highcharts.com) are only displaying "Slice" as label. I'm wondering how to address this.

    Using only 2 columns (string and integer), but what to do? It displays the Label properly when using a Bar-chart.

  • [deleted] replied

    Hi darimany,
    Thank you for the purchase.

    Can you please send me the link where you have chart so I can take a look? Also can you please send me the file from you've created wpDataTable that you are using to create chart?

  •  2
    darimany replied

    On a second note, the "string" column are ID numbers; if they start with a CHAR, the label "slice" changes value (Pie chart).

    However, the ID numbers are displayed as a label for a Bar-chart.

  •  2
    darimany replied

    https://sba4lenders.com/test-pie-chart/

    The attachment is my last attempt, as normally I only quote (") literal strings.

  • [deleted] replied

    Hi darimany,

    You can add this little Jquery snippet directly on your page to change the name of the label so that slices names will be ID's:

    <script type="text/javascript">
    jQuery(window).load(function(){
        if( typeof wpDataChartsCallbacks == 'undefined' ){ wpDataChartsCallbacks = {}; }
        wpDataChartsCallbacks[1] = function(obj){
            obj.options.plotOptions.pie = {
                dataLabels: {
                    format: '<b>{point.x}</b>: {point.percentage:.1f} %'
                }
            }
        }
    });
    </script>

    Just change  wpDataChartsCallbacks[1] this ID from code with your actual chart ID.

    You can also see usage of wpDataChart callback at this link.

  •  2
    darimany replied

    Hi Milos,

    I did ADD the javascript (jQuery) - see sourcecode line 560 (https://sba4lenders.com/test-pie-chart/).

    Also changed the ID from 1 to 17 as that is the ID of the Pie Chart, in 'wpDataChartsCallbacks[17]'

    But still cannot get it to display. I'll read the link on callbacks that you posted.

    Diego

  • [deleted] replied

    Hi darimany,

    You made some JS error in the code and because of that it's not working. Can you please send me your login credentials so I can take a look at the jQuery that you have added. You can write credentials here in the ticket, just check PRIVATE so nobody can see it except us. 

    Thanks.

  •  2
    darimany replied

    Thank you Milos it works.

    I had to use the "Text" editor (not "Visual") to simply copy/paste the JavaScript you posted.

    And of course, change the ID number of the chart.

    This is solved.

    Diego

  • [deleted] replied

    Hi darimany,

    You are welcome. We'd greatly appreciate it if you could take a minute and leave a review on CodeCanyon on this link. Thanks!