score:-1
You can use tootlip formatter and useHTML, then return your cusomisted content, including images.
score:4
According to the docs, the tooltip.formatter
is:
... a subset of HTML. Unless
useHTML
is true, the HTML of the tooltip is parsed and converted to SVG, therefore this isn't a complete HTML renderer. The following tags are supported:<b>
,<strong>
,<i>
,<em>
,<br/>
,<span>
.
Spans can be styled with astyle
attribute, but only text-related CSS that is shared with SVG is handled.
So you should set tooltip like this:
tooltip: {
useHTML: true,
formatter: function () {
return '<b>' + this.point.name + "</b>: " + this.point.percentage + "%<br/>" +
"<img src='" + this.point.img + "'></img>";
}
},
Here's a demo in Stack Snippets
Highcharts.chart('container', {
chart: {
plotBackgroundColor: null,
plotBorderWidth: null,
plotShadow: false,
type: 'pie'
},
title: {
text: 'Favorite Fruits'
},
tooltip: {
useHTML: true,
formatter: function () {
return '<b>' + this.point.name + "</b>: " + this.point.percentage + "%<br/>" +
"<img src='" + this.point.img + "'></img>";
}
},
plotOptions: {
pie: {
allowPointSelect: true,
cursor: 'pointer',
dataLabels: {
enabled: false
},
showInLegend: true
}
},
series: [{
name: 'Fruits',
colorByPoint: true,
data: [{
name: 'Apple',
y: 50,
img: "https://i.imgur.com/MmK9Xkc.png"
}, {
name: 'Banana',
y: 25,
img: "https://i.imgur.com/0G6GXWf.png"
}, {
name: 'Orange',
y: 15,
img: "https://i.imgur.com/Dv4KoD5.png"
}, {
name: 'Watermelon',
y: 10,
img: "https://i.imgur.com/2LN8PfD.png"
}, ]
}]
});
<link href="https://cdnjs.cloudflare.com/ajax/libs/highcharts/6.1.2/css/highcharts.css" rel="stylesheet"/>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/highcharts/6.1.2/highcharts.js"></script>
<div id="container" style="min-width: 310px; height: 400px; max-width: 600px; margin: 0 auto"></div>
Source: stackoverflow.com
Related Query
- Highcharts tooltip using HTML allows advanced formatting like images
- Highcharts display label for pie chart using html table as data source
- Highcharts donut tooltip formatting using drilldown data
- Highcharts complex tooltip formatting issue with embedded html link
- HTML table as data source for highstock charts using highcharts
- Highcharts - HTML tooltip & datalabels render issue
- Highcharts Column chart with drilldown, remove hyperlink like formatting from x-axis labels
- create a sticky tooltip for a point or a permanent label using HighCharts
- Formatting JSON data monthwise for HighCharts using MySQL
- Using PhantomJS to create HighCharts grahps server side for use in PDF creation (PHP) - results in exit code 11 from PHPs exec();
- Highcharts tooltip date format when using pointFormat
- How to hide one series data info in tooltip using highcharts
- Need to make tooltip border color same as marker color using Highcharts
- Highcharts - Using a function to change the tooltip
- highcharts display in my render html page which i want to convert into PDF using wkhtmltopdf in rails
- I had created a scatterplot using Highcharts but the the point.z value is not getting displayed in tooltip
- Highcharts Tooltip formatting for shared Tooltips
- How to edit tooltip in Highcharts C# code
- Remove the second tooltip in Tree map using Highcharts
- how to use highcharts tooltip formatter in python code
- Highcharts - advanced tooltip functionality needed
- passing formatting JavaScript code to HighCharts with JSON
- Formatting data points and Y-axis labels using HighCharts
- Highchart - Custom Images for Labels by using html
- I'd like to use several Highcharts using different data but same options
- Formatting tooltip in Highcharts
- Getting Highcharts tooltip to return an angular directive using templeteUrl?
- Highcharts not formatting tooltip datetime according to xDateFormat setting
- Highcharts - tooltip using click event doesn't appear all times
- using dynamic data from highcharts in a html table
More Query from same tag
- Applying 'categories' to Y-Axis causes a gap between column start and X Axis in Highcharts?
- HighChat Heatmap: Tooltip
- highcharts error 14 when passing time
- Highcharts 7.0.3 with Xpages/dojo
- Set customize credits in Highcharts
- High-charts bar-chart bars overlap if height is not given in the config
- Draggable crosshair in Highcharts
- Highcharts Tooltip not rendering properly if it has material icons
- Load HighCharts Chart/Data on Form Submit with jQuery
- Highcharts Series - want to show/hide all EXCEPT selected series (reversal of default logic)
- React Highchart: Synchronized chart and tooltip is not highlighting the points
- Dates instead of values on Highchart labels in graph with multiple axis
- (jQuery Highchart) How to make this as Horizontal Bars?
- Why does highcharts sankey chart sometimes combine multiple nodes with same node name but different Id into one and hide the lines?
- Creating a ring chart with Highcharts
- How to redraw text rendered using SVGRenderer in Highcharts React?
- Resize Highcharts chart in Angular UI Modal
- How to call User Control from one of the Javascript function?
- Need to have Highcharts datalabels set differently to y axis
- Highcharts formatting data labels
- npm throws this error '"**/node_modules/@angular/core/core"' has no exported member 'ɵɵFactoryDef'
- Highcharts - Pass a dictionary as data for a timeline series
- Highcharts error 13, but rendering Div exists
- highcharts-export-server with highcharts-regression plugin in a node module throws an error
- Highstock area chart renders a gap, but there is data
- ES6 avoid that/self
- Display start and end date range in timeseries LineChart using HighCharts
- React Highcharts: How to display tooltip value to specific div outside of the chart
- Highcharts + set event click from options in jquery
- Java Client for HighChart Export server REST service