jQuery UI Widgets › Forums › Chart › toolTip issues
This topic contains 6 replies, has 2 voices, and was last updated by Peter Stoev 11 years, 5 months ago.
-
AuthortoolTip issues Posts
-
I have a custom tooltip function for a spline graph which works fine on intial load.
I load a single series of data and then have a function based on user input (radio button) to swap the dataField and displayText from an array:
var dataSeries = $(‘#jqxChart’).jqxChart(‘seriesGroups’);
dataSeries[0].series[0] = ageGroup[1];
$(‘#jqxChart’).jqxChart(‘refresh’);ageGroup being the array.
However after I swap the data the toolTip doesn’t show if I have activated the toolTip on first load. If I swap data having not used the toolTip it does. I’ve refreshed the chart and tooltip function on change of data:
dataSeries[0].series[0] = ageGroup[2];
$(‘#jqxChart’).jqxChart({toolTipFormatFunction: toolTipFn});
$(‘#jqxChart’).jqxChart(‘refresh’);But no joy there either.
Tooltip function is nothing special shows the value and calculates a percentage so should refresh OK on data change:
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; // no percentage on persons required
}
else if (serie.dataField.charAt(0) == “m”){
serie.toolTipLineColor = ‘#66658A’;
serie.toolTipBackground = ‘#66658A’;
calcpercent = ValInt * 100 / dataItem.pall; // percentage of males
}
else {
serie.toolTipLineColor = ‘#8C3F8A’;
serie.toolTipBackground = ‘#8C3F8A’;
calcpercent = ValInt * 100 / dataItem.pall; // percentage of females
}
percent = calcpercent.toFixed(2);
var ttoutput = ‘‘
+ serie.displayText +” “+ categoryValue + ”+”for “+ ctyTitle +”: ” + dataAdapter.formatNumber(value, ‘f’) ;
if (calcpercent == 0){
return ttoutput + ‘‘;
}
else {
return ttoutput
+ ” – ” +percent + “%” + ”;}
};Any ideas why the toolTip stops working when I change the data in the series. All delays have been switched off too.
Thanks
Hi rcwebdev,
Welcome to jQWidgets Forum.
Unfortunately, the provided information in your post is not sufficient for testing your scenario.
Please, follow the instructions for reporting an issue as pointed out here: http://www.jqwidgets.com/community/topic/welcome-to-jqwidgets-forum-2/Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.com/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
Any response to this issue available before it goes onto the previous page ?
Thanks
Hi rcwebdev,
We added a work item about the reported Tooltip issue and will resolve it in one of the next versions. At present, we cannot suggest a workaround.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.com/OK thanks for letting me know Peter, just wanted to clarify it’s not my issue. Is there a workaround I can do as a temporary fix ?
Should also mention I have another small issue with the toolTip that maybe related – I’ll post a new topic separately later.
Any timeframe on the next version update ?
Regards
RCW
Hi rcwebdev,
We will resolve it in one of the next versions. I cannot provide an exact time-frame and as I written in the previous post, we cannot suggest you a workaround.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.com/ -
AuthorPosts
You must be logged in to reply to this topic.