jQWidgets Forums
Forum Replies Created
-
Author
-
Any response to this issue available before it goes onto the previous page ?
Thanks
Hopefully formatted OK and clearer now.
When I swap my datafile, using eactly the same routine as in example here:
What happens when the data source is changed? How to refresh the Chart?
http://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxchart/jquery-chart-data-source.htm[Interestingly just noticed the demo does the same thing too.]
On initial load the toolTip works fine but after I swap the data file it stops working. If I don’t cause the tooltip to occur on the initial load then swap the data it works OK until I swap the data dile again. The data file loads 3 series (people, males, females) and calcs the percentage on males/females only, other wise it simply adds text, fomats the value and the background colors.
I’ve tried to refresh the tooltip function after the data swap but no joy:
$('#jqxChart').jqxChart({toolTipFormatFunction: toolTipFn}); $('#jqxChart').jqxChart('refresh');
Here’s the tooltip function:
var toolTipFn = function (value, itemIndex, serie, group, categoryValue, categoryAxis) { // set variables var percent; var calcpercent; var ValInt = parseInt(value); var dataItem = dataAdapter.records[itemIndex]; // check which series hit if (serie.dataField.charAt(0) == "p") { serie.toolTipLineColor = '228B22'; serie.toolTipBackground = '#228B22'; calcpercent = 0; } else if (serie.dataField.charAt(0) == "m"){ serie.toolTipLineColor = '#66658A'; serie.toolTipBackground = '#66658A'; calcpercent = ValInt * 100 / dataItem.pall; } else { serie.toolTipLineColor = '#8C3F8A'; serie.toolTipBackground = '#8C3F8A'; calcpercent = ValInt * 100 / dataItem.pall; } percent = calcpercent.toFixed(2); var ttoutput = '<DIV style="padding: 5px; font-weight: bold; color: #fff; text-align:left">' + serie.displayText +" "+ categoryValue + '<br />'+"for "+ ctyTitle +": " + dataAdapter.formatNumber(value, 'f') ; if (calcpercent == 0){ return ttoutput + '<br /><span style="font-style:italic;"</span>click for more info..' + '</DIV>'; } else { return ttoutput + " - " +percent + "%" // if persons = null + '</DIV>'; } };
RCW
-
AuthorPosts