cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Pie Chart with count

Former Member
0 Likes
532

Hello Experts,

I'm working on pie chart and able to get the result without any issues.

I have a below issue, please help me to resolve this.

     1. When I mouse over on pie chart it displays relevant count.

         Will it be possible to display count inside pie chart on initial load?

          If so, could you please let me know how to do the same?

Thanks.

View Entire Topic
Former Member
0 Likes
Former Member
0 Likes

Thanks for your quick reply.

When I use the same code in project I'm getting below error

1. Error: Invalid value for <text> attribute transform="translate(NaN,NaN)"

2. Uncaught TypeError: Cannot read property 'Count' of undefined

but the same code is working here

http://jsbin.com/dekeh/2/edit

Do I need to add any script file?

Former Member
0 Likes

Resolved this error.

In project, I have Stack bar chart and pie chart.

d3.selectAll(".v-datashape"); This code returns all datashape.

when I loop json with all datashape it throws "count undefined error"

So, modified the code like this,

var arcs = d3.select("#__pie1").selectAll(".v-datashape");

it works fine now.

former_member391686
Discoverer
0 Likes

Hello Sakthivel,

Since now the charts have been migrate to VizFrame,

Could you please let me know how can we achieve this in VizFrame?

Thanks a lot!

Best Regards,

Madeleine

saivellanki
Active Contributor
0 Likes

Hi Zeng,

You could try like this in your onInit() function of controller -



var oVizFrame = this.getView().byId("yourVizFrameID");

oVizFrame.setVizProperties({

  dataLabel:{

  visible:true

  }

});

Regards,

Sai Vellanki.

former_member391686
Discoverer
0 Likes

Hi Sai,

Thank you for your reply!

In the sample code provided by Sakthivel above, we can select any element in the svg and change its property in initialize phase, see below:

Could you please let me know if we can achieve this in VizFrame? Thanks a lot!

----------------------------------------------------------------

pie.attachInitialized(this, function() {

  var arcs  = d3.selectAll(".v-datashape");

  debugger;

  var radius = 400 / 2 ; // Height --> 400px

  var arc = d3.svg.arc().outerRadius(radius);

  arcs.append("svg:text").attr("transform", function(d){

  d.innerRadius = 0;

  d.outerRadius = 200;

  return "translate(" + arc.centroid(d) + ")";}).attr("text-anchor", "middle").text(function(d,i){

  return oBusinessData[i].revenue;

  });

  });

Best Regards,

Madeleine