config/Options/shape/treemap.ts

  1. /**
  2. * Copyright (c) 2017 ~ present NAVER Corp.
  3. * billboard.js project is licensed under the MIT license
  4. */
  5. /**
  6. * treemap config options
  7. */
  8. export default {
  9. /**
  10. * Set treemap options
  11. * @name treemap
  12. * @memberof Options
  13. * @type {object}
  14. * @property {object} treemap Treemap object
  15. * @property {string} [treemap.tile="binary"] Treemap tile type
  16. * - **Available tile type values:**
  17. * - binary ([d3.treemapBinary](https://github.com/d3/d3-hierarchy/blob/main/README.md#treemapBinary))
  18. * - dice ([d3.treemapDice](https://github.com/d3/d3-hierarchy/blob/main/README.md#treemapDice))
  19. * - slice ([d3.treemapSlice](https://github.com/d3/d3-hierarchy/blob/main/README.md#treemapSlice))
  20. * - sliceDice ([d3.treemapSliceDice](https://github.com/d3/d3-hierarchy/blob/main/README.md#treemapSliceDice))
  21. * - squrify ([d3.treemapSquarify](https://github.com/d3/d3-hierarchy/blob/main/README.md#treemapSquarify))
  22. * - resquarify ([d3.treemapResquarify](https://github.com/d3/d3-hierarchy/blob/main/README.md#treemapResquarify))
  23. * @property {Function} [treemap.label.format] Set formatter for the label text.
  24. * @property {number} [treemap.label.threshold=0.05] Set threshold ratio to show/hide labels text.
  25. * @property {number} [treemap.label.show=true] Show or hide label text.
  26. * @see [Demo: treemap](https://naver.github.io/billboard.js/demo/#Chart.TreemapChart)
  27. * @example
  28. * treemap: {
  29. * // "binary", "dice", "slice", "sliceDice", "squrify", "resquarify"
  30. * tile: "dice",
  31. *
  32. * label: {
  33. * // show or hide label text
  34. * show: false,
  35. *
  36. * // set label text formatter
  37. * format: function(value, ratio, id) {
  38. * return d3.format("$")(value);
  39. *
  40. * // to multiline, return with '\n' character
  41. * // return value +"%\nLine1\n2Line2";
  42. * },
  43. *
  44. * // set ratio number
  45. * ratio: 0.05
  46. * }
  47. * }
  48. */
  49. treemap_tile: "binary",
  50. treemap_label_format: <(() => number | string) | undefined>undefined,
  51. treemap_label_threshold: 0.05,
  52. treemap_label_show: true
  53. };