score:8
one way is to create a tooltip formatter that checks if the current object is a point.
tooltip: {
formatter: function(){
if(this.point) {
return "this is a flag"
}
else {
return "this is a line"
}
}
}
you could go one step further and give your flags names and then check if the point has a name (instead of if it just exists) to prevent non-flag points from getting the same format.
here is your example modified to reflect the former http://jsfiddle.net/atcfe/
score:1
with highstock 2.1.7 you always get a this.point
object, so you should use this.series.type === 'flags'
to detect whether flags are present or not.
an example would be:
formatter: function () {
if (this.series.type === 'flags') {
// flags formatting
}
else {
// default formatting
}
}
score:11
use following function as tooltip formatter -
tooltip: {
shared:true,
formatter: function(){
var p = '';
console.log(this);
if(this.point) {
p += '<b>'+ highcharts.dateformat('%a, %b %e, %y', this.point.x) +'</b><br/>';
p += this.point.config.text // this will add the text on the flags
}
else {
p += '<b>'+ highcharts.dateformat('%a, %b %e, %y', this.x) +'</b><br/>';
$.each(this.points, function(i, series){
p += '<span style="color:' + this.series.color + '">' + this.series.name + '</span>: <b>'+ this.y + ' kwh ($' + highcharts.numberformat(this.y * rate, 0) + ')</b><br/>';
});
}
return p;
}}
also refer to this jsfiddle : http://jsfiddle.net/atcfe/
Source: stackoverflow.com
Related Query
- Highchart/stock tooltip formatter for both series and flags
- Highcharts shared tooltip for line series and scatter plot not working
- Format tooltip in highchart map for dynamic variables, some with commas and others with percents
- How to add a vertical plot line in multiple line series and show the tooltip on Plot line in highchart
- Ugly Highchart when using letter label for both xaxis and yaxis
- Javascript - Highchart - tooltip position of data points and flags
- I'm trying to use HighChart map and solid guage they both work for my data independetly but I get get lot of errors on I put them on a file
- Highchart with dynamic scale for both series
- Highchart for temperature and humidity does not share tooltip
- highchart Customclass css not applied to tooltip for dumbbell series
- Dynamic add series and categories for highchart drill down chart
- How to use the tooltip formatter and still display chart color (like it does by default)?
- How to display highchart series line marker symbol from tooltip formatter?
- Display tooltip for invisible series in Highcharts
- Highcharts - How to hide series name and Y value in tooltip
- Highchart (Column Chart) : Few data labels are not appearing for a series
- Series markers disable on lines and enable on legend in Highchart
- Border Styles for the Highchart tooltip
- Columns HighChart remove spacing for empty data series
- Highchart - tooltip for legends
- How to use add series and update methods in the high chart wrapper for angular?
- Highcharts JS- add third variable to tooltip for two series
- HighCharts: Mouse click event is handled by both Series handler and Point handler
- Tooltip formatter for multiple axes in Highcharts.js
- Highchart Zoom and X-Axis with String Array for Categories
- How do you show grid lines for both x axis and y axis in highchart?
- Highcharts - Tooltip and series name are out of their boxes in chrome
- How to set series-label to false by default and change the color of series label text in highchart
- Highcharts shared tooltip between charts with multiple series and shared tooltip
- Highcharts - Hide series "points" (labels) on both x- and y-axis
More Query from same tag
- Setting data chart color - Highcharts
- How to make highcharts with dynamic datetime range with monthly interval
- Reloading HighCharts data using Ajax
- Click a point on a highcharts graph from outside of the chart
- How to add literals to panels in codebehind, in order to create a dashboard-like layout grid?
- creating a bar chart using Highcharts with React - getting an error that rendering div isn't found
- PIE Chart is not working in IE 8 with HighCharts
- Highcharts: Duplicate X-Axis Labels when dataGrouping is enabled (by Month)
- Highchart crashing with multiple Y axis
- Change graph color above and below plot-line in Column chart in Highcharts
- How to disable certain option in the exporting option of Highcharts?
- How to sort objects by creation date to plug into high charts with Meteor
- Dashboard using highcharts.js
- Stacked Bar Highcharts how to show the values
- (how) can we create semi circle donut chart, with range labels?
- How to set different colors for bars based on value in Highchart bar chart?
- Getting error 'Cannot read property 'document' of undefined' (to export highchart charts)
- Set position for each flag in highstock
- Highcharts enable pan without holding panKey
- add text under the bar with plotOptions highchart (BAR)
- HighCharts performance issue and alternative
- Xaxis data given to highcharts in descending order but still xaxis appears in ascending order
- Highcharts Legend: Overlapping Chart on Small Screens
- Highcharts set xAxis values starting 12am and ends in 11pm
- Highcharts not working in ie 11
- 'ManyToOneRel' object has no attribute 'parent_model' error with django chartit
- Drop down menu disappears after the chart is created
- Highcharts 100% (height width) in Card from ng2-admin - Angular2 ng2-admin Template
- How to make a multi pane on highstock (highcharts) which contain a stacked area graph?
- Display Google spreadsheet data using Highcharts library