score:6
three solutions:
1.) forget the ajax call. you just cache all the "tooltip" data in memory on page load and load it using the formatter function.
2.) you make the ajax call in the formatter synchronous. this will stall the tooltip from popping up (and it will be "jerky"):
formatter: function() {
var rv = null;
$.ajax({
datatype: "json",
url: 'ajax.json',
async: false, // this will stall the tooltip
success: function(ajax){
rv = ajax.someproperty;
}
});
return rv;
}
example here.
3.) you keep the ajax async, display loading
in the tooltip, and then manipulate the tooltip after the ajax call completes. be careful with this, you'll have a race condition on the ajax call and it will be possible to have the wrong data retreived for a tooltip.
formatter: function() {
$.getjson('ajax.json', function(ajax){
var tt = highcharts.charts[0].tooltip;
var label = tt.label.element.lastchild; // find contents of tooltip
$(label).text(ajax.someproperty);
});
return "...loading...";
}
example here.
score:0
mark give me the right solution thats why i market it..
if you wanna show html in the tooltip at this
usehtml: true,
this is the solution for me. i use dataformat now because i switch to utc time stamp
tooltip: {
usehtml: true,
formatter: function() {
var msg ="<span>"+highcharts.dateformat('%a , %d %b', this.x)+'</span><br/>';
msg = msg +"<b> totaal: </b>" + this.y +'<br/><br />';
msg = msg +'<table><body >';
var msgend= '</body></table>';
console.log('a');
jquery.getjson("getdatachar.php?datedetailparam="+highcharts.dateformat('%y-%m-%d', this.x), function(json)
{
console.log('c');
var timearray = "";
jquery.each(json.dagen.dagen, function(i,times){
timearray = timearray + '<tr><td>'+times+ '</td></tr>';
});
console.log(timearray);
chart.tooltip.label.textsetter(msg+timearray+msgend);
});
console.log('b');
return "loading..";
}
}
Source: stackoverflow.com
Related Query
- Highcharts load data with ajax to populate the tooltip
- Load data into Highcharts with Ajax
- Highcharts populate the categories with live data from MySQL
- Load highcharts data with laravel and ajax
- HighCharts load data via ajax
- Ajax and Highcharts - Display 'loading' until data is retrieved, then populate chart
- Highcharts - Global configuration with common code and unique data & Headings
- How to populate a Highcharts axis with string formatted data from a PHP array
- AngularJS for Highcharts with dynamic ajax data
- Highcharts with ajax and json data what am i doing wrong?
- Highcharts tooltip in scrollable container scrolls with the content
- Highcharts show the same yAxis start and end value with multiple data series
- Highchart not displaying the pie chart with Ajax data
- Compare two data points inside the tooltip in a Highcharts combination chart
- HighCharts & MVC: How to load whole graph definition and data with JSON?
- Is it possible to load tooltip with external data with React-Native-HighCharts?
- Load CSV data via Ajax for display in Highcharts
- highcharts Gauge live data with ajax
- JSON Data Map Issue with HighCharts + Ajax
- Have an issue with JavaScript, AJAX code displaying data
- HighCharts populate Pie Chart with data from SQL Database
- Highcharts IE issues with jQuery ajax load
- highcharts how to load data via ajax
- Highcharts with data populated by php generated html table - only one will load
- In highcharts how can I provide data with values x, y, title so that I can put the title in the tooltip?
- Highcharts series visibility with csv data source
- How can I make HighCharts 4.2.5 with boost.js invoke the tooltip formatter?
- No data to display in highcharts showing up with the data in Bubble Chart
- How can i load external json data in highcharts to show the bar chart
- Using JSON data with the jQuery highcharts plugin
More Query from same tag
- Highcharts - Line breaks from node to node in sankey diagram
- How can I display the current value from a chart?
- Display start and end date range in timeseries LineChart using HighCharts
- Angular Highcharts Reading from multi objects elements
- How to change border radius of legend symbol
- How to change data format?
- Dynamically adding to Highcharts
- High chart spline chart is not plotting with single data
- HighMaps - need to make datalabels clickable
- iOS Highcharts Library - Hiding layout elements & Y Axis precision
- Multiple series in drilldown
- Legend and Axis titles not showing in Highcharts Graph
- Highcharts, labeling axes, last label not shown correctly, potential bug
- hchart Error in mutate_impl(.data, dots) : Column `x` is of unsupported type quoted call
- DataLabels in Highcharts are outside the container / not showing
- Creating Treemap with distinct colors using hctreemap2 in R
- Highcharts Series Margins
- Highstock Shared Tooltip This Index
- A Challenge? converting mysql rows to very specific format with php
- How to call a JS function every 10 sec which then activates a function in angular
- Highcharts Activity Gauge - how to get different behaviors while hover over
- Highcharts filter string x-axis
- Highcharts - dynamic data label positioning on multi series doughtnut charts
- Ruby on Rails: Passing string array to highchart function
- Make HighCharts Axis Labels being and end at my min/max
- Highcharts y-axis plotlines label hides the tooltip
- HighCharts - Add dynamic new functions
- set different colors for each column in highcharts
- Highcharts/Highstocks: How to manually set the X-axis range
- Highcharts JS - share legend color between pie charts