score:14
tooltip: {
formatter: function() {
var s = '<b>'+ this.x +'</b>';
var chart = this.points[0].series.chart; //get the chart object
var categories = chart.xAxis[0].categories; //get the categories array
var index = 0;
while(this.x !== categories[index]){index++;} //compute the index of corr y value in each data arrays
$.each(chart.series, function(i, series) { //loop through series array
s += '<br/>'+ series.name +': ' +
series.data[index].y +'m'; //use index to get the y value
});
return s;
},
shared: true
}
score:0
Too late for the answer but this is what I did. Plot the chart and make the color transparent. Plotted it on the opposite y axis and set max to zero. Set alignTicks to false. Something like this.
chart: {
alignTicks: false,
type: 'line'
},
Then the only thing needed is to change the color value in tooltip formatter since the label will be transparent.
Hope this helps someone.
Happy Learning :)
score:2
Another way to go about this is to make certain attributes of the series invisible, rather than the entire series itself. This will allow you to see it in the tooltip and legend.
Here's what I did:
- First, I set the line color of the invisible series to "transparent."
- Next, I set the fill color for the invisible series markers to "transparent."
- Finally, I disabled the hover state for the markers. This prevents the shadowy highlight circles from appearing as you move your mouse cursor over each point in the visible series.
Here's a modified version of your original fiddle with these changes: http://jsfiddle.net/brightmatrix/fDNh9/184/
series: [{
data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4],
lineColor: 'transparent', // make the line invisible
marker: {
fillColor: 'transparent', // make the line markers invisible
states: {
hover: {
enabled: false // prevent the highlight circle on hover
}
}
}
}, {
data: [216.4, 194.1, 95.6, 54.4, 29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5]
}]
Two items to note:
- I've used the attribute
enableMouseTracking: false
with other invisible series to prevent users from interacting with them (to achieve visual effects). If you set this for your invisible series, it will prevent the series data from appearing in your tooltip. - If you wanted to keep your invisbile series from appearing in the legend, you can add the attribute
showInLegend: false
. Its data will still show in the tooltip.
I hope this helps others who come across this question.
score:4
The tooltip formatter is a function like any other function so if you just make the data available it can return a string with values for all series. In this example I moved the series arrays and categories to separate variables and the tooltip formatter uses an index into these arrays to find the values.
formatter: function() {
var index = $.inArray(this.x, categories);
var s = '<b>'+ this.x +'</b>';
s += '<br/>'+ chart.series[0].name + ': ' + data1[index];
s += '<br/>'+ chart.series[1].name + ': ' + data2[index];
return s;
}
Source: stackoverflow.com
Related Query
- Display tooltip for invisible series in Highcharts
- Highcharts shared tooltip for line series and scatter plot not working
- Highcharts JS- add third variable to tooltip for two series
- Highcharts - Aligning dateTime series for shared tooltip
- Changing tooltip shape for a series in Highcharts
- How to display line break for irregular time series with highcharts
- Highcharts Modify Tooltip for One Series
- Series for tooltip only in highcharts
- Show Data For Grouped Series in ToolTip Highcharts
- Highcharts display label for pie chart using html table as data source
- How to hide series name from tooltip in Highcharts scatter plots for linear regression
- How can I apply different background color to entire tooltip for different series in highcharts
- how to give different names on tooltip for one series in highcharts R
- Highcharts Highstock How do I change the label on top of tooltip for OHLC series data?
- Highcharts tooltip for single series always centre. Can I force it to be left hover of the marker?
- HighCharts - how to customize the tooltip for dynamically added series
- Highcharts - Add a tooltip suffix value dynamically for each series
- Highcharts tooltip for all series
- Tooltip to display middle points in a series in highcharts
- Changing data dynamically for a series in Highcharts
- Add additional data to a Highcharts series for use in formatters
- How to display highchart series line marker symbol from tooltip formatter?
- Weird character in front of Highcharts tooltip series names
- Highcharts doesn't display series with lots of data points
- Adding thousands separator for custom formatted highcharts tooltip
- Highcharts - How to display legend symbol inside the tooltip
- Highcharts - How to set custom colors for the series
- highcharts customize tooltip for a single point
- Highcharts - How to hide series name and Y value in tooltip
- highcharts - chart names for multiple pie chart series in one chart
More Query from same tag
- Want to set the y axis ticks to a fixed value Highcharts
- Highcharts addPoint function show nothing
- Highmaps, cannot access marker by id through javascript?
- Highchart legend over columns
- Show tooltip of a column chart programmatically in StockChart (highchart)
- Highchart tooltip show nearest point
- Highcharts tooltip date format when using pointFormat
- HighChart : plot line and plot click event
- How to display array in array on Highcharts? [JS]
- Outline or border for the spline series in highcharts
- R Highcharter margins go weird depending on y-max
- Highcharts; disabling the tooltip for a single point renders a random little box
- Highcharts - Axis minPadding and maxPadding not working
- highchart Axis values color
- Highcharts - Add Series Name As X-Axis Label
- Highcharts heatmap chart labels render extremely slow
- How to specify a range of data when using HighCharts with <table>?
- canvas image gets blurry
- Removing zoom in/out from Highmaps
- Data labels are repeated in IE
- Why try catch around highchart constructor does not catch error#12 but error#19?
- Posted value is not getting in the where clause with json highcharts-php and mysql
- Custom axis labels on Stacked bar chart
- Highcharts - Display only year in x axis and stop auto formatting
- HIghcharts export server hosting ph-batik
- To get the name of the series in bubble chart in highcharts
- Toggle between chart and table in panel
- Uncaught ReferenceError: Ajax is not defined onchange issue
- Highchart: add custom button to show/hide annotations?
- HighCharts Stock Chart fire event on chart redraw?