Standalone Examples » Tooltips #1: custom captions

This example shows how to define tooltips by including caption properties to your data sets. This is useful if you want some unique tooltips per item.



var pie = new d3pie("pie", {
  header: {
    title: {
      text: "Tooltips: example #1",
      fontSize: 20
    }
  },
  labels: {
    inner: {
      format: "none"
    }
  },
  data: {
    content: [
      { label: "JavaScript", value: 1, caption: "New and shiny despite its age." },
      { label: "Ruby", value: 2, caption: "Foreign and strange" },
      { label: "Java", value: 3, caption: "Old and verbose (buuuuurn!)" }
    ]
  },
  tooltips: {
    enabled: true,
    type: "caption"
  }
});