TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Kavya Durgam
NA
26
40.1k
Pie Chart Label Lines with key and y value
Dec 13 2017 2:57 AM
I need to print the label with both key and value and also with the label line.and legends should display on the right side of the pie chart.What are the changed i have to do in js files?
<
head
>
<
meta
charset
=
"utf-8"
/>
<
title
>
Angular-nvD3 Donut Charttitle
>
<
script
>
document.write('+ document.location + '"
/>
');
</
script
>
<
link
rel
=
"stylesheet"
href
=
"style.css"
/>
<
link
rel
=
"stylesheet"
href
=
"https://cdnjs.cloudflare.com/ajax/libs/nvd3/1.8.1/nv.d3.min.css"
/>
<
script
src
=
"//ajax.googleapis.com/ajax/libs/angularjs/1.3.9/angular.min.js"
>
</
script
>
<
script
src
=
"https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.6/d3.min.js"
charset
=
"utf-8"
>
</
script
>
<
script
src
=
"https://cdnjs.cloudflare.com/ajax/libs/nvd3/1.8.1/nv.d3.min.js"
>
</
script
>
<
script
src
=
"https://rawgit.com/krispo/angular-nvd3/v1.0.5/dist/angular-nvd3.js"
>
</
script
>
<
script
src
=
"app.js"
>
<
head
>
<
body
ng-controller
=
"MainCtrl"
>
<
nvd3
options
=
"options"
data
=
"data"
>
</
nvd3
>
</
body
>
</
html
>
this is the code i am using in my controller
var
app = angular.module(
'plunker'
, [
'nvd3'
]);
app.controller(
'MainCtrl'
,
function
($scope)
{
$scope.options =
{
chart: {
type:
'pieChart'
,
height: 450,
x:
function
(d){
return
d.key;},
y:
function
(d){
return
d.y;},
showLabels:
true
,
labelsOutside:
true
,
legend: {
margin: { top: 5, right: 70, bottom: 5, left: 0 } } } };
$scope.xFunction =
function
()
{
return
function
(d)
{
return
d.key }
//.legendPosition("right"); };
$scope.yFunction =
function
()
{
return
function
(d)
{
return
d.y }
//.legendPosition("right"); };
$scope.data = [ { key:
"One"
, y: 5 }, { key:
"Two"
, y: 2 }, { key:
"Three"
, y: 9 }, { key:
"Four"
, y: 7 }, { key:
"Five"
, y: 4 }, { key:
"Six"
, y: 3 }, { key:
"Seven"
, y: .5 } ]; });
Please, anyone, help me..I am looking for the solution. you can run this code in plunker editor.
Reply
Answers (
0
)
AngularJS tempate output
Angular JS App to be tested with Javascript