How to move tooltip position in Highchart? -


i using highcharts.js build horizontal bar chart. working correctly default tooltip appears horizontally want tooltip position vertical instead of horizontal.

is possible achieve that? appreciated! jsfiddle - example

sample code:

$(function () {     var chart;      $(document).ready(function() {          chart = new highcharts.chart({              chart: {                  renderto: 'container',                  type: 'bar'              },              title: {                  text: 'stacked bar chart'              },              xaxis: {                  categories: ['apples', 'oranges', 'pears', 'grapes', 'bananas']              },              yaxis: {                  min: 0,                  title: {                      text: 'total fruit consumption'                  },                 stacklabels: {                 enabled: true,                 style: {                     fontweight: 'bold',                     color: (highcharts.theme && highcharts.theme.textcolor) || 'gray'                 }             }              },              legend: {                 align: 'right',             x: -100,             verticalalign: 'top',             y: 20,             floating: true,             backgroundcolor: (highcharts.theme && highcharts.theme.legendbackgroundcolorsolid) || 'white',             bordercolor: '#ccc',             borderwidth: 1,             shadow: false              },              tooltip: {                formatter: function() {                 return '<b>'+ this.x +'</b><br/>'+                     this.series.name +': '+ this.y +'<br/>'+                     'total: '+ this.point.stacktotal;             }              },              plotoptions: {                  series: {                      stacking: 'normal',                     datalabels: {                     enabled: true,                     color: (highcharts.theme && highcharts.theme.datalabelscolor) || 'white'                 }                   }              },                  series: [{                  name: 'john',                  data: [5, 3, 4, 7, 2]              }, {                  name: 'jane',                  data: [2, 2, 3, 2, 1]              }, {                  name: 'joe',                  data: [3, 4, 4, 2, 5]              }]          });      });   }); 

expected output: enter image description here

i able fix issue using tooltip.positioner following -

tooltip: {      formatter: function() {         return '<b>' + this.x + '</b><br/>' +             this.series.name + ': ' + this.y + '<br/>' +             'total: ' + this.point.stacktotal;     },     positioner: function(labelwidth, labelheight, point) {         var tooltipx = point.plotx + 20;         var tooltipy = point.ploty - 30;         return {             x: tooltipx,             y: tooltipy         };     } }, 

Comments

Popular posts from this blog

amazon web services - S3 Pre-signed POST validate file type? -

c# - Check Keyboard Input Winforms -