Hitachi Vantara Pentaho Community Forums
Results 1 to 2 of 2

Thread: displaying the summed up valued in the center of a pie chart

  1. #1
    Join Date
    Jul 2014
    Posts
    15

    Default displaying the summed up valued in the center of a pie chart

    All,

    I am am using creating pie chart in CDE like the one in the below link
    http://pentaho-bi-suite.blogspot.com...ntaho-cde.html

    However, I am using the code like this below to get a value to display in the center of the pie graph

    http://jsfiddle.net/duarteleao/mx4pr55t/

    new pvc.PieChart({
    canvas: 'cccExample',
    width: 300,
    height: 300,

    animate: false,
    selectable: true,
    hoverable: true,

    valuesVisible: true,
    valuesLabelStyle: 'inside',
    valuesFont: '35px sans-serif',
    valuesMask: '{value.percent}',

    label_visible: function() { return !this.index; },
    label_left: null,
    label_top: null,
    label_textAngle: 0,
    label_textAlign: 'center',
    label_textBaseline: 'middle',
    label_strokeStyle: 'black',

    slice_innerRadiusEx: '85%',

    categoryRole: "series",

    slice_fillStyle: function() {
    return this.index === 0 ? this.delegate() : "lightgray";
    }
    })
    .setData(relational_04b, {crosstabMode: false})
    .render();



    However, is there a way to show the sum of all of the values in the center of my pie instead of just the percenter. So I have 4 values , each value is equal to 10, then I want the number 40 displayed in the center. any ideas?

  2. #2
    Join Date
    Mar 2012
    Posts
    645

    Default

    Hi, you must specify label_text, determine the total value and format it, like it is done in this fiddle: http://jsfiddle.net/duarteleao/0xvteacj/ .
    Note that the sum in the example is the sum of the absolute values of each category (slice). This is coherent with slices representing absolute values as well.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Privacy Policy | Legal Notices | Safe Harbor Privacy Policy

Copyright © 2005 - 2019 Hitachi Vantara Corporation. All Rights Reserved.