score:4
Hopefully This Fiddle answers your question.
The effect you want was achieved by using the plotOptions
API link here directive in highcharts.
$(document).ready(function() {
var chart_data;
chart_data = {
chart: {
type: 'column',
backgroundColor: '#FBFBFB',
plotBackgroundColor: '#FBFBFB'
},
title: {
text: '<b>Category-Wise APF</b>',
verticalAlign: 'bottom',
useHTML: true,
style: {
color: '#454545',
fontSize: '14px'
},
y: 13
},
xAxis: {
type: 'category'
},
yAxis: {
labels: {
enabled: false
},
title: '',
gridLineColor: '#EFEFEF'
},
credits: {
enabled: false
},
legend: {
enabled: false
},
plotOptions: {
series: {
dataLabels: {
align: 'left',
enabled: true
}
}
},
series: [{
colorByPoint: true,
data: [{
name: 'Sports & Fitness',
y: 1.34,
color: '#2E91A4'
}, {
name: 'Fashion Apparels',
y: 1.29,
color: '#3196A5'
}, {
name: 'Women\'s Clothing',
y: 1.24,
color: '#2F9BA6'
}, {
name: 'Footwear',
y: 1.23,
color: '#319FA7'
}, {
name: 'Clothing & Apparels',
y: 1.21,
color: '#34A3A8'
}, {
name: 'Audio Equipments',
y: 1.20,
color: '#36A3A8'
}, {
name: 'Home Decor',
y: 1.13,
color: '#38ADAA'
}, {
name: 'Health & Personal Care',
y: 1.12,
color: '#38B1AB'
}, {
name: 'Mobile Accessories',
y: 1.12,
color: '#39B7AB'
}, {
name: 'Computer Accessories',
y: 1.11,
color: '#3DBBAD'
}]
}]
};
$('#categorywise-apf-graph').highcharts(chart_data);
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/highcharts-more.js"></script>
<script src="https://code.highcharts.com/highcharts-3d.js"></script>
<div style="width: 500px; height: 500px;" id="categorywise-apf-graph"></div>
score:10
For the sake of clarity and posterity:
You can turn off the standard tooltip
, and use the dataLabels
to accomplish your goal.
tooltip: {
enabled: false,
crosshairs: true
},
plotOptions: {
series: {
dataLabels: {
enabled: true
}
}
}
By default, a small label with the y value of the column will be placed above the column.
You can use the extensive configuration options, and the formatter
function, to customize this label in a wide variety of ways, making it more like the standard tooltip
Example of a highly customized version of the dataLabel
:
Code:
plotOptions: {
series: {
dataLabels: {
enabled: true,
inside: false,
overflow: 'none',
crop: true,
shape: 'callout',
backgroundColor:'rgba(0,0,0,0.8)',
borderColor: 'rgba(0,0,0,0.9)',
color: 'rgba(255,255,255,0.75)',
borderWidth: .5,
borderRadius: 5,
y: -10,
style: {
fontFamily: 'Helvetica, sans-serif',
fontSize: '10px',
fontWeight: 'normal',
textShadow: 'none'
},
formatter: function() {
return '<strong>'+this.series.name+'</strong>'
+'<br/>Group: <strong>'+ this.x+'</strong>'
+'<br/>Value: <strong>'+ Highcharts.numberFormat(this.y,0)+'</strong>';
}
}
}
},
Fiddle:
Output:
[{ EDIT --
And, since having big labels like this can be distracting when what you really want to do is just see the data plotted, here's a version with a button to toggle the visibility of the labels:
Fiddle:
Code:
<button id="toggle">Toggle Data Labels</button>
$('#toggle').click(function() {
var enabled = chart.series[0].options.dataLabels.enabled;
console.log(enabled);
chart.series[0].update({ dataLabels: { enabled: !enabled }});
});
-- /EDIT }]
Source: stackoverflow.com
Related Query
- Always showing tooltip on all columns in Highcharts
- Shared tooltip positioner point.plotY is always 0 in Highcharts Stacked columns
- Always display data labels above columns in HighCharts
- Highcharts tooltip always on right side of cursor
- Highcharts - Keep tooltip showing on click
- Highcharts not showing tooltip after update from null
- Highcharts column tooltip - always on top + fit the container
- HighCharts Pie chart, 50+ labels, not showing all of them
- Highcharts tooltip not showing on chrome
- How to edit tooltip in Highcharts C# code
- how to use highcharts tooltip formatter in python code
- Highcharts dataLabels not showing in all levels of drilldown
- Highcharts not showing value when two stacked columns have value = 1
- How to configure highcharts so that all the curves are always displayed / highlighted?
- HighCharts Pie chart is not showing all of dataLabels, it's cut off
- Showing arrays in an array in tooltip in Highcharts
- Highcharts - tooltip using click event doesn't appear all times
- Highcharts tooltip showing selected points
- Highcharts exportchart PDF not showing all categories
- Highcharts - Highstock chart showing double line on hovering data points to show tooltip
- Highcharts Showing negative values on tooltip
- Showing only one tooltip for all. Highstock highcharts
- Why code of Horizonal line(y-axis) on a single in Highcharts get applied to all other charts integrated with Webdatarocks
- Highcharts tooltip for single series always centre. Can I force it to be left hover of the marker?
- Highcharts not showing all labels for rows
- Highcharts do not hold all the values of stacked columns chart with data time axes
- Showing tooltip with two or more stack columns
- Highcharts tooltip is always the same
- Firefox Highcharts is not showing up but it's all OK in Chrome and Edge
- Highcharts - Columns Showing Negative When Data is Zero
More Query from same tag
- How to add point to the beginning of series, Highcharts
- Highmaps with rich information in separate container
- How can I force multiple y-axis in Highcharts to have a common zero
- HighChart- Plot Stacked Bar Chart on Status for Every Minute
- How to integrate market depth chart using highchart?
- Need to put border on variablepie highchart?
- Override default highlighting on hover in networkgraph
- datatable inside Highcharts-Pie chart
- How to set Highcharts labels width to 50%
- Dynamic tooltip for Dynamic Highchart
- Highcharts - null values are plotted on stacked area chart, in latest version
- How to add text when exporting a chart in highcharts?
- Highcharts will not render if element in series data is empty
- How to add background colors to category groupings in Highcharts
- How to apply borderRadius only for top side of Column or Bar in Highchart
- How to make drill down in stacked Column Line chart in Highchart
- Highcharts - mouse event in chart - e.Offset solution across browsers
- Highcharts: multiple heatmaps with shared color bar
- How to get the series' x-axis values into the lower part of the tooltip in Highcharts?
- Highcharts: Is it possible to show Sunburst chart series data labels outside the leaf level nodes with connectors?
- Build a highchart chart using data from an external JSON
- Highcharts show days of month dates in X axis (from JSON file). tickInterval: not work?
- Highchart uncaught error - Uncaught TypeError: $(...).highcharts is not a function
- Update all Highcharts chart series synchronously
- Highcharts - Change column color If data.point equal to string
- Arched square chart using high charts
- Highcharts CSV export, incorrect date
- Position Highcharts label to right side
- How to make map with overlaid column charts using highmaps
- Highcharter package not found - highchart function not available