If you find you need to do any form of conversion of the placeholder data within the tooltips string, such as formatting a number or uppercasing a string, you can use the tooltips.placeholderParser function. See below for a simple example: it adds an exclamation mark after the label, and adds decimal points to the percentage and values.
var pie = new d3pie("pie", {
data: {
content: [
{ label: "Elephants", value: 1 },
{ label: "Motmots", value: 2 },
{ label: "Pikas", value: 3 },
{ label: "Jays", value: 2 },
{ label: "Rhubarb", value: 5 },
{ label: "Tennis", value: 2 },
{ label: "Chickens", value: 1 }
]
},
tooltips: {
enabled: true,
type: "placeholder",
string: "{label}: {percentage}% ({value})",
// data is an object with the three properties listed below. Just modify the properties
// directly - there's no need to return anything
placeholderParser: function(index, data) {
data.label = data.label + "!";
data.percentage = data.percentage.toFixed(2);
data.value = data.value.toFixed(5);
}
}
});