Rank: Member
Groups: Registered
Joined: 11/4/2015(UTC) Posts: 17 Thanks: 4 times Was thanked: 1 time(s) in 1 post(s)
|
Hi epf, I am working with NVD3 line chart. My x-axis is time and y-axis is amount. I am trying to add '$' as prefix to y-axis values and to tooltip text. Please find the code snippet as below chart.xAxis.axisLabel('Time Periods'); chart.yAxis.axisLabel('Amount($)').tickFormat(d3.format('$,')); chart.margin({left: 100}); Above code snippet gives caption for axis, but "tickFormat(d3.format('$,'))" is not appending $ as prefix. Please help me get the prefix to values. Edited by user Wednesday, November 18, 2015 8:13:11 AM(UTC)
| Reason: Not specified
|
|
|
|
Rank: Administration
Groups: Administrators
Joined: 12/20/2013(UTC) Posts: 1,209 Thanks: 14 times Was thanked: 206 time(s) in 199 post(s)
|
Yes I had a try with this: Code://Axis format
chart.xAxis.axisLabel('Time Periods');
chart.yAxis.axisLabel('Amount($)');
chart.margin({left: 100});
YPrimaryValueFormatter = function(value) {
return d3.format(',')(value).valueFormat();
}
if (chart.xAxis != null && chart.xAxis.tickFormat != null) chart.xAxis.tickFormat(XValueFormatter);
if (chart.yAxis != null && chart.yAxis.tickFormat != null) chart.yAxis.tickFormat(YPrimaryValueFormatter);
But it looks like the d3.format('$,') does not work...it should be a bug in the d3 library currently in use in Seal Report. Perhaps you can find a workaround, otherwise wait for the next update of SR if the nvd3 library is updated...
|
1 user thanked epf for this useful post.
|
|
|
Rank: Member
Groups: Registered
Joined: 11/4/2015(UTC) Posts: 17 Thanks: 4 times Was thanked: 1 time(s) in 1 post(s)
|
Thanks a lot!
To have $ as prefix, before returning pre-appended the '$' it worked fine for me.
YPrimaryValueFormatter = function(value) { varible = d3.format(',')(value); return '$'+varible; }
|
1 user thanked Aruna for this useful post.
|
|
|
Rank: Member
Groups: Registered
Joined: 11/4/2015(UTC) Posts: 17 Thanks: 4 times Was thanked: 1 time(s) in 1 post(s)
|
Sorry,i need one more info; how can i get the $ amounts on summary table? In summary table of the charts, $ symbol is not displayed. Is there any property to customize the format of the data table content?
|
|
|
|
Rank: Member
Groups: Registered
Joined: 11/4/2015(UTC) Posts: 17 Thanks: 4 times Was thanked: 1 time(s) in 1 post(s)
|
I got the answer for my question;We can format the value by writing "Cell script".
|
|
|
|
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.