7be0b40bbc4f9f6931f255290e3617bd10fc68f8ef4b5457676dfff019e00a1d1dffdd48487e0ffa753f1aea88da4423daa53bec5c86a4bc499683aa63e193 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. import SeriesModel from '../../model/Series.js';
  2. import { TreeNode } from '../../data/Tree.js';
  3. import Model from '../../model/Model.js';
  4. import { SeriesOption, BoxLayoutOptionMixin, ItemStyleOption, LabelOption, RoamOptionMixin, CallbackDataParams, ColorString, StatesOptionMixin, OptionId, OptionName, DecalObject, SeriesLabelOption, DefaultEmphasisFocus, BlurScope } from '../../util/types.js';
  5. import GlobalModel from '../../model/Global.js';
  6. import { LayoutRect } from '../../util/layout.js';
  7. import SeriesData from '../../data/SeriesData.js';
  8. declare type TreemapSeriesDataValue = number | number[];
  9. interface BreadcrumbItemStyleOption extends ItemStyleOption {
  10. textStyle?: LabelOption;
  11. }
  12. interface TreemapSeriesLabelOption extends SeriesLabelOption {
  13. formatter?: string | ((params: CallbackDataParams) => string);
  14. }
  15. interface TreemapSeriesItemStyleOption<TCbParams = never> extends ItemStyleOption<TCbParams> {
  16. borderRadius?: number | number[];
  17. colorAlpha?: number;
  18. colorSaturation?: number;
  19. borderColorSaturation?: number;
  20. gapWidth?: number;
  21. }
  22. interface TreePathInfo {
  23. name: string;
  24. dataIndex: number;
  25. value: TreemapSeriesDataValue;
  26. }
  27. interface TreemapSeriesCallbackDataParams extends CallbackDataParams {
  28. /**
  29. * @deprecated
  30. */
  31. treePathInfo?: TreePathInfo[];
  32. treeAncestors?: TreePathInfo[];
  33. }
  34. interface ExtraStateOption {
  35. emphasis?: {
  36. focus?: DefaultEmphasisFocus | 'descendant' | 'ancestor';
  37. };
  38. }
  39. export interface TreemapStateOption<TCbParams = never> {
  40. itemStyle?: TreemapSeriesItemStyleOption<TCbParams>;
  41. label?: TreemapSeriesLabelOption;
  42. upperLabel?: TreemapSeriesLabelOption;
  43. }
  44. export interface TreemapSeriesVisualOption {
  45. /**
  46. * Which dimension will be applied with the visual properties.
  47. */
  48. visualDimension?: number | string;
  49. /**
  50. * @deprecated Use colorBy instead
  51. */
  52. colorMappingBy?: 'value' | 'index' | 'id';
  53. visualMin?: number;
  54. visualMax?: number;
  55. colorAlpha?: number[] | 'none';
  56. colorSaturation?: number[] | 'none';
  57. /**
  58. * A node will not be shown when its area size is smaller than this value (unit: px square).
  59. */
  60. visibleMin?: number;
  61. /**
  62. * Children will not be shown when area size of a node is smaller than this value (unit: px square).
  63. */
  64. childrenVisibleMin?: number;
  65. }
  66. export interface TreemapSeriesLevelOption extends TreemapSeriesVisualOption, TreemapStateOption, StatesOptionMixin<TreemapStateOption, ExtraStateOption> {
  67. color?: ColorString[] | 'none';
  68. decal?: DecalObject[] | 'none';
  69. }
  70. export interface TreemapSeriesNodeItemOption extends TreemapSeriesVisualOption, TreemapStateOption, StatesOptionMixin<TreemapStateOption, ExtraStateOption> {
  71. id?: OptionId;
  72. name?: OptionName;
  73. value?: TreemapSeriesDataValue;
  74. children?: TreemapSeriesNodeItemOption[];
  75. color?: ColorString[] | 'none';
  76. decal?: DecalObject[] | 'none';
  77. }
  78. export interface TreemapSeriesOption extends SeriesOption<TreemapStateOption<TreemapSeriesCallbackDataParams>, ExtraStateOption>, TreemapStateOption<TreemapSeriesCallbackDataParams>, BoxLayoutOptionMixin, RoamOptionMixin, TreemapSeriesVisualOption {
  79. type?: 'treemap';
  80. /**
  81. * configuration in echarts2
  82. * @deprecated
  83. */
  84. size?: (number | string)[];
  85. /**
  86. * If sort in desc order.
  87. * Default to be desc. asc has strange effect
  88. */
  89. sort?: boolean | 'asc' | 'desc';
  90. /**
  91. * Size of clipped window when zooming. 'origin' or 'fullscreen'
  92. */
  93. clipWindow?: 'origin' | 'fullscreen';
  94. squareRatio?: number;
  95. /**
  96. * Nodes on depth from root are regarded as leaves.
  97. * Count from zero (zero represents only view root).
  98. */
  99. leafDepth?: number;
  100. drillDownIcon?: string;
  101. /**
  102. * Be effective when using zoomToNode. Specify the proportion of the
  103. * target node area in the view area.
  104. */
  105. zoomToNodeRatio?: number;
  106. /**
  107. * Leaf node click behaviour: 'zoomToNode', 'link', false.
  108. * If leafDepth is set and clicking a node which has children but
  109. * be on left depth, the behaviour would be changing root. Otherwise
  110. * use behavious defined above.
  111. */
  112. nodeClick?: 'zoomToNode' | 'link' | false;
  113. breadcrumb?: BoxLayoutOptionMixin & {
  114. show?: boolean;
  115. height?: number;
  116. emptyItemWidth?: number;
  117. itemStyle?: BreadcrumbItemStyleOption;
  118. emphasis?: {
  119. disabled?: boolean;
  120. focus?: DefaultEmphasisFocus;
  121. blurScope?: BlurScope;
  122. itemStyle?: BreadcrumbItemStyleOption;
  123. };
  124. };
  125. levels?: TreemapSeriesLevelOption[];
  126. data?: TreemapSeriesNodeItemOption[];
  127. }
  128. declare class TreemapSeriesModel extends SeriesModel<TreemapSeriesOption> {
  129. static type: string;
  130. type: string;
  131. static layoutMode: "box";
  132. preventUsingHoverLayer: boolean;
  133. layoutInfo: LayoutRect;
  134. designatedVisualItemStyle: TreemapSeriesItemStyleOption;
  135. private _viewRoot;
  136. private _idIndexMap;
  137. private _idIndexMapCount;
  138. static defaultOption: TreemapSeriesOption;
  139. /**
  140. * @override
  141. */
  142. getInitialData(option: TreemapSeriesOption, ecModel: GlobalModel): SeriesData<Model<any>, import("../../data/SeriesData").DefaultDataVisual>;
  143. optionUpdated(): void;
  144. /**
  145. * @override
  146. * @param {number} dataIndex
  147. * @param {boolean} [mutipleSeries=false]
  148. */
  149. formatTooltip(dataIndex: number, multipleSeries: boolean, dataType: string): import("../../component/tooltip/tooltipMarkup").TooltipMarkupNameValueBlock;
  150. /**
  151. * Add tree path to tooltip param
  152. *
  153. * @override
  154. * @param {number} dataIndex
  155. * @return {Object}
  156. */
  157. getDataParams(dataIndex: number): TreemapSeriesCallbackDataParams;
  158. /**
  159. * @public
  160. * @param {Object} layoutInfo {
  161. * x: containerGroup x
  162. * y: containerGroup y
  163. * width: containerGroup width
  164. * height: containerGroup height
  165. * }
  166. */
  167. setLayoutInfo(layoutInfo: LayoutRect): void;
  168. /**
  169. * @param {string} id
  170. * @return {number} index
  171. */
  172. mapIdToIndex(id: string): number;
  173. getViewRoot(): TreeNode;
  174. resetViewRoot(viewRoot?: TreeNode): void;
  175. enableAriaDecal(): void;
  176. }
  177. export default TreemapSeriesModel;