f26aed3e72b07f25f96b6e1e3bf69ad622561099f8c011ab97caaaa95f80dc3c7d62f6a4b1fb77e693bdf1f332b03d739dbaa20cbfcd62b9f5913fb5fcd039 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. import SeriesModel from '../../model/Series.js';
  2. import { SeriesOption, SymbolOptionMixin, BoxLayoutOptionMixin, RoamOptionMixin, LineStyleOption, ItemStyleOption, SeriesLabelOption, OptionDataValue, StatesOptionMixin, OptionDataItemObject, CallbackDataParams, DefaultEmphasisFocus } from '../../util/types.js';
  3. import SeriesData from '../../data/SeriesData.js';
  4. import View from '../../coord/View.js';
  5. import { LayoutRect } from '../../util/layout.js';
  6. interface CurveLineStyleOption extends LineStyleOption {
  7. curveness?: number;
  8. }
  9. export interface TreeSeriesStateOption<TCbParams = never> {
  10. itemStyle?: ItemStyleOption<TCbParams>;
  11. /**
  12. * Line style of the edge between node and it's parent.
  13. */
  14. lineStyle?: CurveLineStyleOption;
  15. label?: SeriesLabelOption;
  16. }
  17. interface TreeStatesMixin {
  18. emphasis?: {
  19. focus?: DefaultEmphasisFocus | 'ancestor' | 'descendant' | 'relative';
  20. scale?: boolean;
  21. };
  22. }
  23. export interface TreeSeriesNodeItemOption extends SymbolOptionMixin<CallbackDataParams>, TreeSeriesStateOption<CallbackDataParams>, StatesOptionMixin<TreeSeriesStateOption<CallbackDataParams>, TreeStatesMixin>, OptionDataItemObject<OptionDataValue> {
  24. children?: TreeSeriesNodeItemOption[];
  25. collapsed?: boolean;
  26. link?: string;
  27. target?: string;
  28. }
  29. /**
  30. * Configuration of leaves nodes.
  31. */
  32. export interface TreeSeriesLeavesOption extends TreeSeriesStateOption, StatesOptionMixin<TreeSeriesStateOption, TreeStatesMixin> {
  33. }
  34. export interface TreeSeriesOption extends SeriesOption<TreeSeriesStateOption, TreeStatesMixin>, TreeSeriesStateOption, SymbolOptionMixin, BoxLayoutOptionMixin, RoamOptionMixin {
  35. type?: 'tree';
  36. layout?: 'orthogonal' | 'radial';
  37. edgeShape?: 'polyline' | 'curve';
  38. /**
  39. * Available when edgeShape is polyline
  40. */
  41. edgeForkPosition?: string | number;
  42. nodeScaleRatio?: number;
  43. /**
  44. * The orient of orthoginal layout, can be setted to 'LR', 'TB', 'RL', 'BT'.
  45. * and the backward compatibility configuration 'horizontal = LR', 'vertical = TB'.
  46. */
  47. orient?: 'LR' | 'TB' | 'RL' | 'BT' | 'horizontal' | 'vertical';
  48. expandAndCollapse?: boolean;
  49. /**
  50. * The initial expanded depth of tree
  51. */
  52. initialTreeDepth?: number;
  53. leaves?: TreeSeriesLeavesOption;
  54. data?: TreeSeriesNodeItemOption[];
  55. }
  56. export interface TreeAncestors {
  57. name: string;
  58. dataIndex: number;
  59. value: number;
  60. }
  61. export interface TreeSeriesCallbackDataParams extends CallbackDataParams {
  62. collapsed: boolean;
  63. treeAncestors?: TreeAncestors[];
  64. }
  65. declare class TreeSeriesModel extends SeriesModel<TreeSeriesOption> {
  66. static readonly type = "series.tree";
  67. static readonly layoutMode = "box";
  68. coordinateSystem: View;
  69. layoutInfo: LayoutRect;
  70. hasSymbolVisual: boolean;
  71. ignoreStyleOnData: boolean;
  72. /**
  73. * Init a tree data structure from data in option series
  74. */
  75. getInitialData(option: TreeSeriesOption): SeriesData;
  76. /**
  77. * Make the configuration 'orient' backward compatibly, with 'horizontal = LR', 'vertical = TB'.
  78. * @returns {string} orient
  79. */
  80. getOrient(): "LR" | "TB" | "RL" | "BT";
  81. setZoom(zoom: number): void;
  82. setCenter(center: number[]): void;
  83. formatTooltip(dataIndex: number, multipleSeries: boolean, dataType: string): import("../../component/tooltip/tooltipMarkup").TooltipMarkupNameValueBlock;
  84. getDataParams(dataIndex: number): TreeSeriesCallbackDataParams;
  85. static defaultOption: TreeSeriesOption;
  86. }
  87. export default TreeSeriesModel;