score:60
I found the documentation for this (http://api.highcharts.com/highcharts#tooltip.pointFormat). The HTML they're using is located under pointFormat, not formatter:
<span style="color:{point.color}">\u25CF</span> {series.name}: <b>{point.y}</b><br/>
Here's the updated code to use to get the colored circles in the tooltip:
tooltip: {
formatter: function() {
var s = '<b>'+ this.x +'</b>';
$.each(this.points, function(i, point) {
s += '<br/><span style="color:' + point.color + '">\u25CF</span> ' + point.series.name + ': ' + point.y;
});
return s;
},
shared: true
},
score:0
You may use:
> $.each(this.points, function () {
> s += '<br/><span style="color:' + this.series.color + '">\u25CF</span>' + this.series.name + ': ' + '<b>' + this.y + '</b>';
> });
score:2
You may try this -
tooltip: {
formatter() {
const tooltipTemp = '<span style="font-size: 10px">' + this.x +
'</span><br/><span style="color:' + this.point.color +
'">●</span> ' + this.series.name +
': <b>' + this.point.y + '</b><br/>';
return tooltipTemp;
}
}
For me output of this piece code looks similar like default template. Hope this will help others :)
score:3
If you want the main part of the tooltip look the same, and just the x-value to be formatted differently, you can use the headerFormat property instead and use point.key rather than this.x. This will accomplish the same thing without having to reproduce the series body.
tooltip: {
headerFormat: '<b>{point.key}</b><br/>'
}
score:8
Improving upon WOUNDEDStevenJones answer, but with a non-jQuery specific solution:
To imitate the following HTML in pointFormat (http://api.highcharts.com/highcharts#tooltip.pointFormat):
<span style="color:{series.color}">\u25CF</span>
I created this non-jQuery reliant code for a tooltip formatter function:
formatter: function() {
/* Build the 'header'. Note that you can wrap this.x in something
* like Highcharts.dateFormat('%A, %b %e, %H:%M:%S', this.x)
* if you are dealing with a time series to display a more
* prettily-formatted date value.
*/
var s = '<span style="font-size: 10px">' + this.x + '</span><br/>';
for ( var i = 0; i < this.points.length; i++ ) {
var myPoint = this.points[i];
s += '<br/><span style="color:'
+ myPoint.series.color
+ '">\u25CF</span>'
+ myPoint.series.name + ': ';
/* Need to check whether or not we are dealing with an
* area range plot and display a range if we are
*/
if ( myPoint.point.low && myPoint.point.high ) {
s += myPoint.point.low + ' - ' + myPoint.point.high;
} else {
s += myPoint.y;
}
}
return s;
},
shared: true
Source: stackoverflow.com
Related Query
- How to use the tooltip formatter and still display chart color (like it does by default)?
- How can I use chart tooltip formatter in react-highcharts?
- How to use add series and update methods in the high chart wrapper for angular?
- How to do In highchart tooltip display the first 100 characters and then say "See more .."?
- how to use highcharts tooltip formatter in python code
- How to show open, close, high and low in tooltip when the chart type is 'line' in highstocks?
- Highstock And Highcharts: How I use StockChart and pie chart on the same page
- How to remove default Hover text and display the custom text title on hover Donut chart Highcharts
- How to change the series color and mark after I draw the line chart in highcharts?Does it has databound event?
- React Highcharts: How to display tooltip value to specific div outside of the chart
- how can I use rangeselector and navigation in highcharts in the given code
- How to display legend in Highcharts Waterfall Chart and make the sum column of waterfall appear in multiple colors?
- How to display the value instead of percentage in a pie chart using jquery Highcharts
- How do you increase the performance of highcharts chart creation and rendering
- Highcharts - How to display legend symbol inside the tooltip
- How do you add text to the bottom center of legend and bottom center of chart under legend?
- Use single color for all series in the same chart
- How do I reduce the space between title and chart of a High Chart?
- High chart - Column Range Chart with Time range. How to get tooltip as Start and End time
- How to set series-label to false by default and change the color of series label text in highchart
- how to display the title in the middle of a donut chart with legend?(react-highcharts)
- how to display 2 same highcharts without duplicate the code
- Highcharts - In area chart how to use gradient color for multiple series?
- How to change the background color of measure tool in stock chart in highstock?
- With HighCharts, how can I have the same tooltip formatter as my y axis
- How to display a clickable pie chart in the cell of a html table?
- In Highcharts, how can we separatedly set up the border color of each block in a Pyramid chart
- Why does this Highcharts graph only show tooltip for the first and last nodes?
- How to Change the color of the text in donut chart
- How to display the total of the series values for a donut chart in Highcharts?
More Query from same tag
- How to use date range for highcharter columnrange plot?
- highchart export button not show
- Highcharts chart not displaying data from csv file
- Highlighting Highcharts series from a remote element
- drilldown feature with url property for column graph in Highcharts
- Adding color to the max value in a dynamically generated chart?
- JavaScript/Hightables - Add unique items with time and output percentage
- Highcharts - time off by 1 hour
- Highcharts: send chart object as Javascript variable?
- How to extend yAxis grid Line to full plot area in Highcharts?
- Highcharts and Extjs 4
- Cannot read property 'addEvent' of undefined
- highcharts how to make x and y axis starting on the same zero using categories on yAxis
- how to get chart object inside a point event function in Highcharts
- HighCharts. How to set a fixed width for a chart grid, not including labels?
- problems charts jquery highcharts
- Highchart: Ceiling and Max
- Yii vs Highcharts vs Ajax
- Highcharts: Symbol markers for dynamic data?
- Highstock change xAxis minRange after chart is loaded
- how to use the total property in highcharts point
- Highcharts.js question: is it possible to add blank space from the left and right side of chart that will be visible only during panning?
- How to show full date to my labels and each x axis in different colour in highcharts?
- Highcharts.js - Background color of axis only
- highchart exporting with phantomjs implementation
- Using Highcharts (and modules) with lit-element
- Vue.js - Highmaps - Redraw map on series change
- HighCharts - how to set labels font color for printing?
- HighCharts showLoading() not working as expected
- How to restyle tooltip color context label for series?