logo

Warning: The forum is now for consultation only. Please use GitHub Discussions to post any questions or comments.


Welcome Guest ! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
fourfruit  
#1 Posted : Tuesday, February 7, 2017 3:42:28 AM(UTC)
fourfruit

Rank: Member

Groups: Registered
Joined: 1/18/2017(UTC)
Posts: 11
Taiwan, Province Of China
Location: Maoli

Thanks: 4 times
I use NVD3 bar+line chart to form a view.
the y-axis of bar series is yAxis1 with number format.
the y-axis of line series is yAxis2 with percent format.
When I move cursor to display dynamic data labels. The data format is error.
I use custom code to change axis.tickformat
Code:
chart.yAxis1.tickFormat(d3.format("0f"));
chart.yAxis2.tickFormat(d3.format("1%"));

however, it doesn't work.
They all become percent formats.
Would you like to tell me how to fix this problem?
Thanks for helps.
Chart

Edited by user Tuesday, February 7, 2017 4:02:09 AM(UTC)  | Reason: Not specified

epf  
#2 Posted : Tuesday, February 7, 2017 9:57:40 AM(UTC)
epf

Rank: Administration

Groups: Administrators
Joined: 12/20/2013(UTC)
Posts: 1,209
Switzerland

Thanks: 14 times
Was thanked: 206 time(s) in 199 post(s)
Yes, it looks like a bug in NVD3 multichart with multiple axis: the format for the secondary axis is used for the tooltip of the series defined as primary axis...

Can you investigate if there is a workaround (may be an upgrade of the nvd3 library may fix this) ?
I will list that as bug 77...

Edited by user Tuesday, February 7, 2017 9:58:14 AM(UTC)  | Reason: Not specified

fourfruit  
#3 Posted : Wednesday, February 8, 2017 9:29:54 AM(UTC)
fourfruit

Rank: Member

Groups: Registered
Joined: 1/18/2017(UTC)
Posts: 11
Taiwan, Province Of China
Location: Maoli

Thanks: 4 times
I download the lastest library and update today. It remains error.(Google Chrome browser)
But it works normally with IE browser. :(

Edited by user Thursday, February 9, 2017 6:00:07 AM(UTC)  | Reason: Not specified

epf  
#4 Posted : Wednesday, February 15, 2017 8:57:34 AM(UTC)
epf

Rank: Administration

Groups: Administrators
Joined: 12/20/2013(UTC)
Posts: 1,209
Switzerland

Thanks: 14 times
Was thanked: 206 time(s) in 199 post(s)
I worked on this bug and here is the workaround (this solution will be probably part of the 3.1).
First open the following JavaScript file <Repository Folder>\Views\Scripts\nvd3.js and add the following function:

Code:
function nvd3TooltipGenerator(data, series, xvalformatter, y1formatter, y2formatter) {
		var header =xvalformatter(data.value);
		var headerhtml = '<thead><tr><td colspan=3><strong class="x-value">' + header + '</strong></td></tr></thead>';
		var bodyhtml = '<tbody>';
		data.series.forEach(function(dataSerie) {
			var formatter = y1formatter;
			series.forEach(function(serie) {
				 if (dataSerie.key.indexOf(serie.key) == 0 && serie.yAxis == 2) formatter = y2formatter;
			});	
			bodyhtml = bodyhtml + '<tr><td class="legend-color-guide"><div style="background-color: ' + dataSerie.color + ';"></div></td><td class="key">' + dataSerie.key + '</td><td class="value">' + formatter(dataSerie.value) + '</td></tr>';
		});
		bodyhtml = bodyhtml+'</tbody>';
		return '<table>'+headerhtml+''+bodyhtml+'</table>';
};		


Then in your report, select the view displaying the chart, type F13 for the NVD3 PAramters, then edit the 'Script: Additional Options' property to ad the following script:

Code:
if (chartType == 'multiChart') {
	chart.tooltip.contentGenerator(function(data) {
		return nvd3TooltipGenerator(data, series, XValueFormatter, YPrimaryValueFormatter, YSecondaryValueFormatter);
	});
}


And this should fix the bug...

Users browsing this topic
Guest (2)
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.