score:4
You have no possibility to set double datalabels, but you can use workaround, which is not perfect but maybe will be helpful. So you can set useHTML, then in formater return two divs, first appropriate datalabel (outside) and second with inside. Then set id with counter which define each div's id as unique, then only what you need is set appropriate CSS. Example of position one datalabel is available here: http://jsfiddle.net/4RKF4/
$(function () {
var chart,
counter = 0;
$(document).ready(function() {
chart = new Highcharts.Chart({
chart: {
renderTo: 'container',
plotBackgroundColor: null,
plotBorderWidth: null,
plotShadow: false
},
title: {
text: 'Browser market shares at a specific website, 2010'
},
tooltip: {
pointFormat: '{series.name}: <b>{point.percentage}%</b>',
percentageDecimals: 1
},
plotOptions: {
pie: {
allowPointSelect: true,
cursor: 'pointer',
dataLabels: {
enabled: true,
color: '#000000',
connectorColor: '#000000',
useHTML:true,
formatter: function() {
counter++;
return '<div class="datalabel"><b>'+ this.point.name +'</b>: '+ this.percentage +' %</div><div class="datalabelInside" id="datalabelInside'+counter+'"><b>'+ this.point.name +'</b>: '+ this.percentage +' %</div>';
}
}
}
},
series: [{
type: 'pie',
name: 'Browser share',
data: [
['Firefox', 45.0],
['IE', 26.8],
{
name: 'Chrome',
y: 12.8,
sliced: true,
selected: true
},
['Safari', 8.5],
['Opera', 6.2],
['Others', 0.7]
]
}]
});
});
});
CSS styles:
.datalabelInside {
position:absolute;
}
#datalabelInside1 {
color:#fff;
left:-150px;
}
score:5
there is a easy work arround for it
that is you overlay 2 pie with diferent datalabels
$(function () {
// Create the chart
$('#container').highcharts({
chart: {
type: 'pie',
backgroundColor: 'rgba(0,0,0,0)',
y:100
},
title: {
text: 'sfs '
},
yAxis: {
title: {
text: ' '
}
},
plotOptions: {
pie: {
// y:1,
shadow: false,
// center: ['50%', '50%'],
borderWidth: 0,
showInLegend: false,
size: '80%',
innerSize: '60%'
,
data: [
['allo', 18],
['asdad', 14],
['asdad', 11],
['asdasd', 10],
['adad', 8],
['asdada', 7],
['adada ada', 7],
['adad', 5],
['asdas',7],
['ada', 3]
]
}
},
tooltip: {
valueSuffix: '%'
},
series: [
{
type: 'pie',
name: 'Browser share',
dataLabels: {
color:'white',
distance: -20,
formatter: function () {
if(this.percentage!=0) return Math.round(this.percentage) + '%';
}
}
},
{
type: 'pie',
name: 'Browser share',
dataLabels: {
connectorColor: 'grey',
color:'black',
// y:-10,
softConnector: false,
connectorWidth:1,
verticalAlign:'top',
distance: 20,
formatter: function () {
if(this.percentage!=0) return this.point.name;
}
}
}
]
});
});
Source: stackoverflow.com
Related Query
- Highcharts pie dataLabels inside and outside
- Highcharts - labels inside and outside a pie chart
- highcharts pie dynamic label inside and outside for each slice
- highcharts - donut chart - Labels inside and outside
- realign Labels inside and outside the bar chart on highcharts
- Displaying percentage inside pie item for highcharts
- Highcharts Pie Chart ignores percentageDecimals tooltip setting and has floating point inaccuracy issue
- HighCharts Pie Chart - Add text inside each slice
- Can color of data label be different inside and outside of the bar in Highchart
- how to make highcharts pie datalabels always in center of each slice?
- Rotating dataLabels in a Highcharts pie chart
- Highcharts connecting scatter chart and pie chart with single legend
- Highcharts - Global configuration with common code and unique data & Headings
- How to center chart title position dynamically inside pie chart in highcharts
- Highcharts datalabels outside of plot area?
- display pie chart using highcharts api and mysql
- DataLabels in Highcharts are outside the container / not showing
- How to center highcharts pie chart and legend on a page?
- Show tootip and select pie slice on legend click of pie chart in HighCharts
- Highcharts semi-pie - remove space between pie and legend
- Drilldown and title update in Highcharts pie
- Highcharts - where to place style and changing style for one wedge in a pie chart
- Radial Pie Chart Datalabels in Highcharts
- Highcharts display label for pie chart using html table as data source
- Switch between pie charts and bar chart in highcharts
- Can we have tickposition both outside and inside in highcharts?
- HighCharts - making a Pie with MySQL and PHP
- Highcharts how to make a set number of colors for pie chart data and drilldown data
- Highcharts issue when dealing with 3D pie and large labels
- Highcharts issue when dealing with 3D pie and large labels
More Query from same tag
- Dynamically draw marker on last point in highcharts
- Color grouped bars slightly different in HighCharts
- Javascript array of arrays query
- Exporting highcharts data to CSV file
- Highchart don't show line if Y.axis is the same
- Set custom symbol to HighCharts legend
- Highcharts horizontal scroll
- How to properly set datetime as x-axis value on Highcharts(React JS)
- How to format Ruby array to be used as data in Highcharts
- Enlarge points in highcharts
- Making a Highcharts plot with Python
- custom ticks based on selected range from rangeSelector in Highstock
- create a sticky tooltip for a point or a permanent label using HighCharts
- How to generate Highcharts JS live data graphs from data on other website?
- Re-loading high charts with subsection of json data
- IE < 9 + HighCharts don't render series
- Highcharts organization chart (org chart) with React Native
- Format function for y-axis title text in highcharts.js
- Highchart error make the whole page breakdown
- highstock grouping without zoom
- Make Highchart and Highstock Have a Uniform Time X-Axis for Disparate Data Points
- Chart Maximizing
- Unable to correctly position the tooltip content in HighCharts
- Receiving NaN error when running javascript function
- Shared tooltip on multiple charts not formatting correctly
- Changing backgroundcolor of tooltip for a specific data point in Highcharts
- HighCharts long title text overlapping on some elements
- Can't access custom point variable inside Highcharts tooltip.headerFormat
- Highcharts scrollbar not appearing
- Django Chartit Not Displaying