How to add labels on two Y axes (Highcharts)?By Aleksandar Vukovic on 18/10/19 in

If you add a prefix or a suffix to values in the table, they won’t be carried over to the chart. This is the default behavior of the chart engine, but you can use wpdatachart callbacks to get them to display. Every chart exposes several options that customize its look and feel. Charts usually support custom options appropriate to that visualization. You can use it for adding options that are available in Highcharts API.

In this example we will show you how to use Highcharts.setOptions to add these labels on a chart which has two Y axes.

<script type="text/javascript">
jQuery(window).load(function(){
    if( typeof wpDataChartsCallbacks == 'undefined' ){ wpDataChartsCallbacks = {}; }
    wpDataChartsCallbacks[94] = function(obj){
        obj.options.yAxis[0] = {
           labels: {
             format: '$ {value}'
           }
        }
        obj.options.yAxis[1] = {
           opposite: true,
           labels: {
             format: '{value} %'
           }
        }
    }
});
</script>

Was this answer helpful ? Yes (0) No (0)

Comments are closed.

Do you have the best

essential plugins installed?

Grab the best 46 plugins. Tested and sorted.

Plugins for SEO, Caching, Security, Design and UX, Stats & analytics, Social sharing. Only the best ones.

By clicking "subscribe" you consent that the information you provide via this form will be securely processed and stored in compliance with EU privacy laws (GDPR).

Thank you for subscribing! Please check your inbox to download the WordPress goodies.