Self-adaptive rectangular tree graph layout method and device, computer equipment and storage medium

Through the adaptive rectangular tree diagram layout method, the problems of multi-row and column grid layout of hierarchical structure data display in the existing technology are solved, and compact and adaptive rectangular tree diagram display is realized.

CN120219569APending Publication Date: 2025-06-27BEIJING BAILONG MAYUN TECH CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202510228821.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-02-27
Publication Date
2025-06-27

AI Technical Summary

Technical Problem

When presenting hierarchical data, there are problems such as multi-row and multi-column grid layout not being supported, nodes are hidden, structural hierarchy is unclear, and relationship line drawing between nodes is not supported.

Method used

An adaptive rectangular tree diagram layout method is provided. By obtaining target data, converting it into a node tree, setting row and column configuration information, weight information and minimum size information, and finally performing layout calculations based on these information to display the rectangular tree diagram.

Benefits of technology

It realizes a compact rectangular tree diagram layout with multiple rows and multiple columns, supports adaptive width and height filling of nodes, and multi-level node nesting display, supports full display and clear architectural hierarchy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120219569A_ABST
    Figure CN120219569A_ABST
Patent Text Reader

Abstract

The invention relates to an adaptive rectangular tree graph layout method and device, computer equipment and a storage medium. The method comprises the steps of obtaining to-be-visualized target data; converting the target data into a node tree suitable for rectangular tree graph layout; setting row and column configuration information for each node according to preset row and column attribute information corresponding to each node in the node tree; setting weight information and minimum size information for each node according to row and column configuration information and sub-node distribution of each node in the node tree; setting layout information for each node according to the weight information and the inner margin of each node in the node tree; and obtaining the node tree and the row and column configuration information, the weight information, the minimum size information and the layout information corresponding to each node as tree structure data, and displaying the rectangular tree graph based on the tree structure data. According to the method, multi-row and multi-column compact rectangular tree graph layout can be realized, node adaptive width and height filling and multi-level node nested display are supported, full-amount display is supported, and the architecture hierarchy is clear.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the technical field of data visualization, and particularly to an adaptive rectangular tree map layout method, device, computer device, and storage medium. Background Art

[0002] For hierarchical data, it is currently often displayed in the form of a disk occupancy map (such as Figure 1-1 shown) or a grid layout map (such as Figure 1-2 shown). However, the disk occupancy map has the following drawbacks: 1) It does not support multi-row and multi-column grid layouts; 2) Smaller nodes will be hidden and not support full display; 3) The architecture hierarchy is not clear; 4) It does not support drawing relationship lines between nodes. The grid layout map has the following drawbacks: 1) It only supports evenly distributed layouts. When the number of nodes in a multi-layer architecture is unevenly distributed, the layout allocation is not compact enough; 2) Nested nodes do not provide the ability to layout tree-like multi-level nodes. Summary of the Invention

[0003] In view of the above deficiencies or drawbacks, this application provides an adaptive rectangular tree map layout method, device, computer device, and storage medium. This application can achieve a multi-row and multi-column compact rectangular tree map layout, support nodes to adaptively fill the width and height, and also support nested display of multi-level nodes, support full display, and have a clear architecture hierarchy.

[0004] According to a first aspect of this application, an adaptive rectangular tree map layout method is provided. In some embodiments, the method includes:

[0005] Obtain target data to be visualized;

[0006] Convert the target data into a node tree suitable for rectangular tree map layout;

[0007] Set row and column configuration information for each node according to the preset row and column attribute information corresponding to each node in the node tree;

[0008] Set weight information and minimum size information for each node according to the row and column configuration information and child node distribution of each node in the node tree;

[0009] Set layout information for each node according to the weight information and inner margin of each node in the node tree;

[0010] Obtain the node tree and the row and column configuration information, weight information, minimum size information, and layout information corresponding to each node as tree structure data, and display a rectangular tree map based on the tree structure data.

[0011] In some embodiments, setting row and column configuration information for each node according to the preset row and column attribute information corresponding to each node in the node tree includes:

[0012] Perform a breadth - first traversal of the node tree;

[0013] For each node traversed, check whether the node has child nodes;

[0014] When the node has child nodes, check whether the node has corresponding preset row - column attribute information. When the node has corresponding preset row - column attribute information, set row - column configuration information for the node according to the corresponding preset row - column attribute information of the node. When the node does not have corresponding preset row - column attribute information, set row - column configuration information for the node according to the number of child nodes of the node;

[0015] When the node has no child nodes, mark the node as a leaf node.

[0016] In some embodiments, set weight information and minimum size information for each node according to the row - column configuration information and child - node distribution of each node in the node tree, including:

[0017] Perform a depth - first traversal of the node tree;

[0018] For each node traversed, check whether the node has child nodes;

[0019] When the node has child nodes, set the x - axis weight, y - axis weight, minimum width, and minimum height for the node according to the row - column configuration information and child - node distribution of the node;

[0020] When the node has no child nodes, set the default x - axis weight, default y - axis weight, default minimum width, and default minimum height for the child node.

[0021] In some embodiments, the row - column configuration information includes row - number configuration and column - number configuration;

[0022] Set the x - axis weight, y - axis weight, minimum width, and minimum height for the node according to the row - column configuration information and child - node distribution of the node, including:

[0023] Set the x - axis weight for the node according to the column - number configuration, minimum leaf width, padding, and maximum row weight of the node;

[0024] Set the y - axis weight for the node according to the sum of the row - number configuration, minimum leaf height, padding, and maximum row weight of the node;

[0025] Set the minimum width for the node according to the column - number configuration, padding, and maximum row minimum width of the node;

[0026] Set the minimum height for the node according to the sum of the row - number configuration, padding, and maximum row minimum height of the node.

[0027] In some embodiments, the layout information includes node positions and width and height information; setting the layout information for each node according to the weight information and padding of each node in the node tree includes:

[0028] Constructing an x-axis weight matrix according to the x-axis weights of each node in the node tree;

[0029] Constructing a y-axis weight matrix according to the y-axis weights of each node in the node tree;

[0030] Determining the x-axis weight according to the maximum value of the row sums in the x-axis weight matrix, the minimum leaf width, and the padding;

[0031] Determining the y-axis weight according to the maximum value of the column sums in the y-axis weight matrix, the minimum leaf height, and the padding;

[0032] Determining the minimum width of the tree diagram according to the sum of the minimum widths of all nodes;

[0033] Determining the minimum height of the tree diagram according to the maximum value among the minimum heights of all nodes;

[0034] Determining the node position and width and height information of each node according to the x-axis weight matrix, the y-axis weight matrix, the x-axis weight, the y-axis weight, the minimum width of the tree diagram, and the minimum height of the tree diagram.

[0035] In some embodiments, the node position includes the upper left x-axis coordinate and the upper left y-axis coordinate; the width and height information includes the node width and the node height;

[0036] Determining the node position and width and height information of each node according to the x-axis weight matrix, the y-axis weight matrix, the x-axis weight, the y-axis weight, the minimum width of the tree diagram, and the minimum height of the tree diagram includes:

[0037] Performing a breadth-first traversal of the node tree;

[0038] For each node traversed, determining the upper left x-axis coordinate of the node based on the first rule, determining the upper left y-axis coordinate of the node based on the second rule, determining the node width of the node based on the third rule, and determining the node height of the node based on the fourth rule;

[0039] The first rule includes, when the current node is a node in the first column, taking the sum of the x-axis coordinate of the current node's parent node and the padding as the upper left x-axis coordinate of the node, and when the current node is not a node in the first column, taking the sum of the upper left x-axis coordinate of the previous node of the current node, the node width of the previous node, and the padding as the upper left x-axis coordinate of the current node;

[0040] The second rule includes that when the current node is the first row node, the sum of the y-axis coordinate of the parent node of the current node and the padding is taken as the y-axis coordinate of the upper left corner of the node; when the current node is not the first row node and is the first column node, the sum of the y-axis coordinate of the upper left corner of the previous node of the current node, the node height of the previous node, and the padding is taken as the y-axis coordinate of the upper left corner of the current node; when the current node is not the first row node and is not the first column node, the y-axis coordinate of the upper left corner of the previous node of the current node is taken as the y-axis coordinate of the upper left corner of the current node;

[0041] The third rule includes that when the current node is in the last row and the total number of nodes cannot be divided evenly by the number of columns, the node width of the current node is determined according to the actual number of nodes in the last row and the padding; otherwise, the node width of the current node is determined according to all the number of columns and the padding;

[0042] The fourth rule includes calculating the node height of the current node according to the proportion of the maximum y-axis weight value of the current row in the total weight and the actual available height of the layout area.

[0043] In some embodiments, determining the node width of the current node according to the actual number of nodes in the last row and the padding includes: taking the product of the node width of the parent node of the current node and the first weight ratio as the node width of the current node; the first weight ratio is equal to the quotient of the x-axis weight of the current node and the total x-axis weight of the row where the current node is located;

[0044] Determining the node width of the current node according to all the number of columns and the padding includes:

[0045] Taking the product of the node width of the parent node of the current node and the first weight ratio as the node width of the current node;

[0046] Calculating the node height of the current node according to the proportion of the maximum y-axis weight value of the current row in the total weight and the actual available height of the layout area includes:

[0047] Subtracting the product of the total spacing of all rows and the second weight ratio from the actual available height of the layout area to obtain the node height of the current node; the second weight ratio is equal to the quotient of the maximum y-axis weight of the current row and the sum of the maximum y-axis weights of all rows.

[0048] According to a second aspect of the present application, an adaptive rectangular tree map layout device is provided. In some embodiments, the device includes:

[0049] A target data acquisition module, configured to acquire target data to be visualized;

[0050] A conversion module, configured to convert the target data into a node tree suitable for rectangular tree map layout;

[0051] A row-column configuration setting module, configured to set row-column configuration information for each node according to the preset row-column attribute information corresponding to each node in the node tree;

[0052] A weight and minimum size setting module, configured to set weight information and minimum size information for each node according to the row-column configuration information of each node in the node tree and the child node distribution;

[0053] A layout information setting module, configured to set layout information for each node according to the weight information and padding of each node in the node tree;

[0054] A visualization module, configured to obtain the node tree and the corresponding row-column configuration information, weight information, minimum size information, and layout information of each node as tree-structured data, and display a rectangular tree map based on the tree-structured data.

[0055] According to a third aspect of the present application, a computer device is provided, including a memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor executes the computer program, the steps of the adaptive rectangular tree map layout method provided in any of the above embodiments are implemented.

[0056] According to a fourth aspect of the present application, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps of the adaptive rectangular tree map layout method provided in any of the above embodiments are implemented.

[0057] In the above embodiments of the present application, for the target data to be visualized, it is first converted into a node tree suitable for the rectangular tree map layout. Then, row-column configuration information is set for each node according to the preset row-column attribute information corresponding to each node in the node tree, weight information and minimum size information are set for each node according to the row-column configuration information of each node in the node tree and the child node distribution, and layout information is set for each node according to the weight information and padding of each node in the node tree. Finally, a corresponding rectangular tree map is displayed based on the node tree and the tree-structured data composed of the row-column configuration information, weight information, minimum size information, and layout information corresponding to each node. The embodiments of the present application can calculate and generate a multi-row and multi-column rectangular tree map layout upward based on the leaf nodes in the node tree, which not only supports the adaptive width and height filling of multi-row and multi-column layout nodes, but also supports the nested display of multi-level nodes, and supports full-scale display with clear architecture levels. Further, the embodiments of the present application will also implement layout adaptive width and height based on the node weight matrix, and improve the calculation logic of the node coordinates and node width and height of the rectangular tree map to adapt to the display of various uneven data structures. Description of the Drawings

[0058] Figure 1-1 Is an exemplary disk occupancy map;

[0059] Figure 1-2 is an exemplary grid layout diagram;

[0060] Figure 2 is a schematic flowchart of an adaptive rectangular tree map layout method provided by the present application according to one or more embodiments;

[0061] Figure 3 is an exemplary rectangular tree map provided by the present application according to one or more embodiments;

[0062] Figure 4 is a structural block diagram of an adaptive rectangular tree map layout device provided by the present application according to one or more embodiments;

[0063] Figure 5 is an internal structure diagram of a computer device provided by the present application according to one or more embodiments. Detailed implementation manners

[0064] To make the objectives, technical solutions, and advantages of the present application clearer, the following will further describe the embodiments of the present application in detail in conjunction with the accompanying drawings. It should be clear that the described embodiments are only a part of the embodiments of the present application, rather than all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present application.

[0065] When the following description involves the accompanying drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The implementation manners described in the following exemplary embodiments do not represent all the implementation manners consistent with the present application. On the contrary, they are only examples of the devices and methods consistent with some aspects of the present application as detailed in the appended claims.

[0066] In the description of the present application, it should be understood that the terms "first", "second", "third", etc. are only used to distinguish similar objects, and do not have to be used to describe a specific order or sequence, nor can they be understood as indicating or implying relative importance. For those of ordinary skill in the art, the specific meanings of the above terms in the present application can be understood according to specific circumstances. In addition, in the description of the present application, unless otherwise specified, "a plurality of" means two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships can exist. For example, A and / or B can represent: A exists alone, A and B exist simultaneously, and B exists alone. The character " / " generally represents an "or" relationship between the associated objects before and after.

[0067] In view of the deficiencies of the related art, the present application provides an adaptive rectangular tree map layout method. In some embodiments, this method can be applied to computer devices such as mobile intelligent devices (such as smart phones, tablets), personal computers, servers, etc. This method includes the steps as follows Figure 2 shown below. Each step of this method will be described below.

[0068] S110: Obtain the target data to be visualized.

[0069] The target data to be visualized is hierarchical data.

[0070] S120: Convert the target data into a node tree suitable for rectangular tree map layout.

[0071] The target data can be a data set, which includes multiple elements. A corresponding node can be created for each element in the target data. Each node represents a data item, and the node data of each node is the element information of each element. The top-level element in the target data is the root node. Then, according to the hierarchical structure of the target data, a parent-child relationship is established for each node. Specifically, the target data can be traversed, and then the corresponding parent element can be found for each sub-element.

[0072] S130: Set row and column configuration information for each node according to the preset row and column attribute information corresponding to each node in the node tree.

[0073] In some embodiments, the operation of setting row and column configuration information for each node according to the preset row and column attribute information corresponding to each node in the node tree can be to perform a breadth-first traversal of the node tree. For each node traversed, first check whether the node has child nodes. When the node has child nodes, it indicates that the node is not a leaf node. Further check whether the node has corresponding preset row and column attribute information. Among them, it can be queried whether there is information on row configuration (the attribute value represents the number of rows) or column configuration (the attribute value represents the number of columns) in the node data (i.e., the element information corresponding to the node) of the node to determine whether the node has corresponding preset row and column attribute information. When the node has corresponding preset row and column attribute information, set the row and column configuration information for the node according to the preset row and column attribute information corresponding to the node. When the node does not have corresponding preset row and column attribute information, set the row and column configuration information for the node according to the number of child nodes of the node. When the node has no child nodes (indicating that the node is a leaf node), mark the node as a leaf node.

[0074] When there is corresponding preset row and column attribute information for the node, the operation of setting row and column configuration information for the node according to the preset row and column attribute information corresponding to the node can be as follows: When there is row number configuration information for the node, calculate the column number configuration information according to the row number configuration information. Specifically, it can be to obtain the number of child nodes of the node, divide the number of child nodes by the row number configuration information of the node, and round up the obtained quotient to get an approximate number of columns. Take this number of columns as the column number configuration information of the node. By operating in this way, the number of columns of the node can be dynamically set to ensure that the child nodes are evenly distributed in each row when laying out the node. If the number of child nodes is not an integer multiple of the number of rows of the node, there may be empty spaces in the last row, but the number of columns of the node will be dynamically adjusted as needed to accommodate all the child nodes of the node. When there is column number configuration information for the node, calculate the row number configuration information according to the column number configuration information. Specifically, it can be to obtain the number of child nodes of the node, divide the number of child nodes by the column number configuration information of the node, and round up the obtained quotient to get an approximate number of rows. Take this number of rows as the row number configuration information of the node. By operating in this way, the number of rows of the node can be dynamically set to ensure that the child nodes of the node are evenly distributed in each column when laying out the node. If the number of child nodes is not an integer multiple of the number of columns, there may be empty spaces in the last column, but the number of rows will be dynamically adjusted as needed to accommodate all the child nodes.

[0075] When there is no corresponding preset row and column attribute information for the node, the operation of setting row and column configuration information for the node according to the number of child nodes of the node can be to calculate the row height and column number of the node according to the square function. Specifically, it can be to obtain the number of child nodes of the node, then calculate the square root of the number of child nodes of the node, round up the square root to get an approximate number of columns, take this approximate number of columns as the column number configuration information of the node, and then divide the number of child nodes of the node by the column number of the node, and round up the obtained quotient to get an approximate number of rows. Take this approximate number of rows as the row number configuration information of the node. The above operation determines the number of columns of the node by calculating the square root of the number of child nodes of the node, and then determines the number of rows of the node according to the number of columns, which can make the layout as close to a square as possible, so as to be more balanced and beautiful visually.

[0076] S140: Set weight information and minimum size information for each node according to the row and column configuration information and child node distribution of each node in the node tree.

[0077] In some embodiments, the operation of setting weight information and minimum size information for each node according to the row-column configuration information and child node distribution of each node in the node tree may be to perform a depth-first traversal of the node tree. For each node traversed, first check whether the node has child nodes; when the node has child nodes, it indicates that the node is not a leaf node, and set the x-axis weight, y-axis weight, minimum width, and minimum height for the node according to the row-column configuration information and child node distribution of the node; when the node has no child nodes, it indicates that the node is a leaf node, and set the default x-axis weight, default y-axis weight, default minimum width, and default minimum height for the child node.

[0078] As described above, the row-column configuration information includes row number configuration information and column number configuration information. The operation of setting the x-axis weight, y-axis weight, minimum width, and minimum height for the node according to the row-column configuration information and child node distribution of the node may be to first check whether the node has child nodes. If so, perform steps (1)-(4) to set the x-axis weight, y-axis weight, minimum width, and minimum height for the node. If not, set the default x-axis weight (such as 1), y-axis weight (such as 1), minimum width (such as the preset minimum leaf width, that is, the minimum node width), and minimum height (such as the preset minimum leaf height, that is, the minimum node height) for the node. Steps (1)-(4) are as follows:

[0079] (1) Set the x-axis weight for the node according to the column number configuration information, minimum leaf width, padding, and maximum row weight of the node.

[0080] Regarding the x-axis weight of the node, the x-axis weight of each child node of the node can be obtained, and a child node x-axis weight matrix can be constructed based on the row-column layout of all child nodes of the node and the x-axis weights of all child nodes of the node. Determine the maximum value of the sum of each row in the child node x-axis weight matrix as the maximum row weight. Calculate the initial x-axis weight of the node according to the column number configuration information, minimum leaf width, and padding of the node, and determine the x-axis weight of the node based on the initial x-axis weight and the maximum row weight. The above operation can consider the influence of spacing on the x-axis weight in layout calculation, thus avoiding overlap or unappealing layout between elements.

[0081] (2) Set the y-axis weight for the node according to the row number configuration information, minimum leaf height, padding, and sum of row maxima of the node.

[0082] Regarding the y-axis weight of a node, the y-axis weight of each child node of the node can be obtained, and a child node y-axis weight matrix can be constructed based on the row-column layout of all the child nodes of the node and the y-axis weights of all the child nodes of the node. The sum of the maximum values of each row in the child node y-axis weight matrix is determined as the sum of row maximum values. The initial y-axis weight of the node is calculated according to the column number configuration information, minimum leaf height, and padding of the node. The y-axis weight of the node is determined based on the initial y-axis weight and the sum of row maximum values. The above operations can consider the influence of spacing on the y-axis weight in layout calculation, thereby avoiding overlap or unappealing layout between elements.

[0083] (3) Set the minimum width for the node according to the column number configuration information, padding, and maximum row minimum width of the node.

[0084] Regarding the minimum width of a node, the minimum width of each child node of the node can be obtained, and a child node minimum width weight matrix can be constructed based on the row-column layout of all the child nodes of the node and the minimum widths of all the child nodes of the node. The maximum value of the sum of each row in the child node minimum width weight matrix is determined as the maximum row minimum width. The initial minimum width of the node is calculated according to the column number configuration information and padding of the node. The minimum width of the node is determined based on the initial minimum width and the maximum row minimum width. The above operations can consider the influence of spacing on the minimum width in layout calculation, thereby avoiding overlap or unappealing layout between elements.

[0085] (4) Set the minimum height for the node according to the row number configuration information, padding, and sum of maximum row minimum heights of the node.

[0086] Regarding the minimum height of a node, the minimum height of each child node of the node can be obtained, and a child node minimum height weight matrix can be constructed based on the row-column layout of all the child nodes of the node and the minimum heights of all the child nodes of the node. The sum of the maximum values of each row in the child node minimum height weight matrix is determined as the sum of maximum row minimum heights. The initial minimum height of the node is calculated according to the column number configuration information and padding of the node. The minimum height of the node is determined based on the initial minimum height and the sum of maximum row minimum heights. The above operations can consider the influence of spacing on the minimum height in layout calculation, thereby avoiding overlap or unappealing layout between elements.

[0087] S150: Set the layout information for each node according to the weight information and padding of each node in the node tree.

[0088] In some embodiments, the layout information includes node position (referring to the position of the node in the layout) and width-height information (referring to the node width and node height of the node). Setting the layout information for each node according to the weight information and padding of each node in the node tree includes:

[0089] (a) Construct an x-axis weight matrix based on the x-axis weights of each node in the node tree; the corresponding x-axis weight matrix can be constructed based on the node tree, the x-axis weights of each node, and the row and column layouts of the nodes in the node tree.

[0090] (b) Construct a y-axis weight matrix based on the y-axis weights of each node in the node tree; the corresponding y-axis weight matrix can be constructed based on the node tree, the y-axis weights of each node, and the row and column layouts of the nodes in the node tree.

[0091] (c) Determine the x-axis weight based on the maximum value of the row sums in the x-axis weight matrix, the minimum leaf width, and the padding. The maximum value of the row sums in the x-axis weight matrix refers to the maximum value among the sums of the weights of each row in the x-axis weight matrix.

[0092] (d) Determine the y-axis weight based on the maximum value of the column sums in the y-axis weight matrix, the minimum leaf height, and the padding; the maximum value of the column sums in the y-axis weight matrix refers to the maximum value among the sums of the weights of each row in the y-axis weight matrix.

[0093] (e) Determine the minimum width of the tree diagram based on the sum of the minimum widths of all nodes; where the minimum width of the tree diagram refers to the minimum width of the entire layout.

[0094] (f) Determine the minimum height of the tree diagram based on the maximum value among the minimum heights of all nodes; where the minimum height of the tree diagram refers to the minimum height of the entire layout.

[0095] (g) Determine the node position and width-height information of each node based on the x-axis weight matrix, y-axis weight matrix, x-axis weight, y-axis weight, minimum width of the tree diagram, and minimum height of the tree diagram.

[0096] The node position includes the x-axis coordinate of the upper left corner and the y-axis coordinate of the upper left corner; the width-height information includes the node width and the node height. The operation of determining the node position and width-height information of each node based on the x-axis weight matrix, y-axis weight matrix, x-axis weight, y-axis weight, minimum width of the tree diagram, and minimum height of the tree diagram can be to perform a breadth-first traversal of the node tree. For each node traversed, determine the x-axis coordinate of the upper left corner of the node based on the first rule, determine the y-axis coordinate of the upper left corner of the node based on the second rule, determine the node width of the node based on the third rule, and determine the node height of the node based on the fourth rule.

[0097] Among them, the first rule includes that when the current node is the first column node, take the sum of the x-axis coordinate of the current node's parent node and the padding as the x-axis coordinate of the upper left corner of the node; when the current node is not the first column node, take the sum of the x-axis coordinate of the upper left corner of the previous node of the current node, the node width of the previous node, and the padding as the x-axis coordinate of the upper left corner of the current node.

[0098] The second rule includes that when the current node is the first row node, the sum of the y-axis coordinate of the current node's parent node and the padding is taken as the y-axis coordinate of the upper left corner of the current node; when the current node is not the first row node but the first column node, the sum of the y-axis coordinate of the upper left corner of the previous node of the current node, the node height of the previous node, and the padding is taken as the y-axis coordinate of the upper left corner of the current node; when the current node is not the first row node and not the first column node, the y-axis coordinate of the upper left corner of the previous node of the current node is taken as the y-axis coordinate of the upper left corner of the current node.

[0099] The third rule includes that when the current node is in the last row and the total number of nodes cannot be divided evenly by the number of columns, the node width of the current node is determined according to the actual number of nodes in the last row and the padding. Among them, determining the node width of the current node according to the actual number of nodes in the last row and the padding includes: taking the product of the node width of the current node's parent node and the first weight ratio as the node width of the current node; the first weight ratio is equal to the quotient of the x-axis weight of the current node and the total x-axis weight of the row where the current node is located; when the current node is in the last row and the total number of nodes can be divided evenly by the number of columns, the node width of the current node is determined according to all the number of columns and the padding. Among them, determining the node width of the current node according to all the number of columns and the padding includes: taking the product of the node width of the current node's parent node and the first weight ratio as the node width of the current node.

[0100] The fourth rule includes calculating the node height of the current node according to the proportion of the maximum y-axis weight value of the current row in the total weight and the actual available height of the layout area. Among them, calculating the node height of the current node according to the proportion of the maximum y-axis weight value of the current row in the total weight and the actual available height of the layout area includes: subtracting the product of the total spacing of all rows and the second weight ratio from the actual available height of the layout area to obtain the node height of the current node; the second weight ratio is equal to the quotient of the maximum y-axis weight of the current row and the sum of the maximum y-axis weights of all rows.

[0101] S160: Obtain the node tree and the row-column configuration information, weight information, minimum size information, and layout information corresponding to each node as tree structure data, and display the rectangular tree diagram based on the tree structure data.

[0102] After calculating the row-column configuration information, weight information, minimum size information, and layout information of each node in the node tree, the corresponding rectangular tree diagram can be displayed. For example Figure 3 as shown. The related operations can be implemented using existing rendering technologies, which will not be elaborated in this embodiment.

[0103] It should be noted that for each step included in the adaptive rectangular tree diagram layout method provided in any of the above embodiments, unless otherwise clearly stated in this article, the execution of these steps has no strict order limit, and these steps can be executed in other orders. Moreover, at least some of these steps may include multiple sub-steps or multiple stages. These sub-steps or stages do not necessarily need to be completed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed alternately or in turn with at least a part of other steps or sub-steps or stages of other steps.

[0104] Based on the same inventive concept, the present application also provides an adaptive rectangular tree diagram layout device. In some embodiments, as Figure 4 shown, the adaptive rectangular tree diagram layout device includes the following modules:

[0105] A target data acquisition module 110, configured to acquire target data to be visualized;

[0106] A conversion module 120, configured to convert the target data into a node tree suitable for rectangular tree diagram layout;

[0107] A row and column configuration setting module 130, configured to set row and column configuration information for each node according to the preset row and column attribute information corresponding to each node in the node tree;

[0108] A weight and minimum size setting module 140, configured to set weight information and minimum size information for each node according to the row and column configuration information and child node distribution of each node in the node tree;

[0109] A layout information setting module 150, configured to set layout information for each node according to the weight information and inner margin of each node in the node tree;

[0110] A visualization module 160, configured to acquire the node tree and the corresponding row and column configuration information, weight information, minimum size information, and layout information of each node as tree structure data, and display a rectangular tree diagram based on the tree structure data.

[0111] In some embodiments, the row and column configuration setting module 130 includes:

[0112] A first traversal sub-module, configured to perform a breadth-first traversal on the node tree;

[0113] A first check sub-module, configured to check whether each traversed node has child nodes;

[0114] A row-column configuration setting sub-module, which is used to check whether the node has corresponding preset row-column attribute information when the node has child nodes. When the node has corresponding preset row-column attribute information, set the row-column configuration information for the node according to the corresponding preset row-column attribute information of the node. When the node does not have corresponding preset row-column attribute information, set the row-column configuration information for the node according to the number of child nodes of the node;

[0115] A leaf node marking sub-module, which is used to mark the node as a leaf node when the node has no child nodes.

[0116] In some embodiments, the weight and minimum size setting module 140 includes:

[0117] A second traversal sub-module, which is used to perform a depth-first traversal of the node tree;

[0118] A second check sub-module, which is used to check whether each traversed node has child nodes;

[0119] A weight and minimum size setting sub-module, which is used to set the x-axis weight, y-axis weight, minimum width, and minimum height for the node according to the row-column configuration information and child node distribution of the node when the node has child nodes; when the node has no child nodes, set the default x-axis weight, default y-axis weight, default minimum width, and default minimum height for the child node.

[0120] In some embodiments, the row-column configuration information includes row number configuration and column number configuration; the weight and minimum size setting sub-module includes:

[0121] An x-axis weight setting unit, which is used to set the x-axis weight for the node according to the column number configuration, minimum leaf width, inner margin, and maximum row weight of the node;

[0122] A y-axis weight setting unit, which is used to set the y-axis weight for the node according to the sum of the row number configuration, minimum leaf height, inner margin, and maximum row weight of the node;

[0123] A node minimum width setting unit, which is used to set the minimum width for the node according to the column number configuration, inner margin, and maximum row minimum width of the node;

[0124] A node minimum height setting unit, which is used to set the minimum height for the node according to the sum of the row number configuration, inner margin, and maximum row minimum height of the node.

[0125] In some embodiments, the layout information includes node position and width-height information; the layout information setting module 150 includes:

[0126] An x-axis weight matrix construction sub-module, which is used to construct an x-axis weight matrix according to the x-axis weights of each node in the node tree;

[0127] The y-axis weight matrix construction sub-module is used to construct a y-axis weight matrix according to the y-axis weights of each node in the node tree;

[0128] The x-axis weight determination sub-module is used to determine the x-axis weight according to the maximum value of the row sums in the x-axis weight matrix, the minimum leaf width, and the padding;

[0129] The y-axis weight determination sub-module is used to determine the y-axis weight according to the maximum value of the column sums in the y-axis weight matrix, the minimum leaf height, and the padding;

[0130] The minimum tree diagram width determination sub-module is used to determine the minimum tree diagram width according to the sum of the minimum widths of all nodes;

[0131] The minimum tree diagram height determination sub-module is used to determine the minimum tree diagram height according to the maximum value among the minimum heights of all nodes;

[0132] The node layout information setting sub-module is used to determine the node position and width-height information of each node according to the x-axis weight matrix, the y-axis weight matrix, the x-axis weight, the y-axis weight, the minimum tree diagram width, and the minimum tree diagram height.

[0133] In some embodiments, the node position includes the upper-left x-axis coordinate and the upper-left y-axis coordinate; the width-height information includes the node width and the node height; the node layout information setting sub-module includes:

[0134] The traversal unit is used to perform a breadth-first traversal of the node tree;

[0135] The node layout information setting unit is used to, for each node traversed, determine the upper-left x-axis coordinate of the node based on the first rule, determine the upper-left y-axis coordinate of the node based on the second rule, determine the node width of the node based on the third rule, and determine the node height of the node based on the fourth rule;

[0136] The first rule includes that when the current node is the first-column node, taking the sum of the x-axis coordinate of the current node's parent node and the padding as the upper-left x-axis coordinate of the node, and when the current node is not the first-column node, taking the sum of the upper-left x-axis coordinate of the previous node of the current node, the node width of the previous node, and the padding as the upper-left x-axis coordinate of the current node;

[0137] The second rule includes that when the current node is the first row node, the sum of the y-axis coordinate of the parent node of the current node and the padding is taken as the upper left y-axis coordinate of the node; when the current node is not the first row node and is the first column node, the sum of the upper left y-axis coordinate of the previous node of the current node, the node height of the previous node, and the padding is taken as the upper left y-axis coordinate of the current node; when the current node is not the first row node and is not the first column node, the upper left y-axis coordinate of the previous node of the current node is taken as the upper left y-axis coordinate of the current node;

[0138] The third rule includes that when the current node is in the last row and the total number of nodes cannot be divided evenly by the number of columns, the node width of the current node is determined according to the actual number of nodes in the last row and the padding; otherwise, the node width of the current node is determined according to all the number of columns and the padding;

[0139] The fourth rule includes calculating the node height of the current node according to the proportion of the maximum y-axis weight value of the current row in the total weight and the actual available height of the layout area.

[0140] In some embodiments, the operation of determining the node width of the current node according to the actual number of nodes in the last row and the padding in the third rule includes: taking the product of the node width of the parent node of the current node and the first weight ratio as the node width of the current node; the first weight ratio is equal to the quotient of the x-axis weight of the current node and the total x-axis weight of the row where the current node is located;

[0141] The operation of determining the node width of the current node according to all the number of columns and the padding in the third rule includes: taking the product of the node width of the parent node of the current node and the first weight ratio as the node width of the current node;

[0142] The operation of calculating the node height of the current node according to the proportion of the maximum y-axis weight value of the current row in the total weight and the actual available height of the layout area in the fourth rule includes: subtracting the product of the total spacing of all rows and the second weight ratio from the actual available height of the layout area to obtain the node height of the current node; the second weight ratio is equal to the quotient of the maximum y-axis weight of the current row and the sum of the maximum y-axis weights of all rows.

[0143] For the specific limitations of the adaptive rectangular tree map layout device, reference can be made to the limitations of the adaptive rectangular tree map layout method in the above text, which will not be elaborated here. Each module in the above adaptive rectangular tree map layout device can be implemented in whole or in part by software, hardware, and their combination. The above modules can be embedded in the processor of the computer device in hardware form or be independent of it, or be stored in the memory of the computer device in software form, so that the processor can call and execute the operations corresponding to the above modules.

[0144] The present application also provides a computer device. In some embodiments, the computer device includes a memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor executes the computer program, the steps of the clinical efficacy feature enhancement method provided in any of the above embodiments can be implemented.

[0145] Further, in some embodiments, the internal structure diagram of the computer device may be as Figure 5 shown. The computer device includes a processor, a memory, a network interface, and a database connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store data such as the node information of each node of the node tree. For the specific stored data, reference can also be made to the limitations in the above method embodiments. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, an adaptive rectangular tree diagram layout method is implemented.

[0146] Those skilled in the art can understand that Figure 5 the structure shown in merely represents a block diagram of some structures related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0147] The present application also provides a computer-readable storage medium. In some embodiments, a computer program is stored on the computer-readable storage medium. When the computer program is executed by a processor, the steps of the adaptive rectangular tree diagram layout method provided in any of the above embodiments are implemented.

[0148] In the above embodiments of the present application, the descriptions of each embodiment have their own emphases. For the parts not detailed in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0149] Those of ordinary skill in the art can understand that all or part of the processes in the above method embodiments can be completed by instructing relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the above method embodiments. Among them, any reference to a memory, storage, database, or other medium used in the embodiments provided in the present application can include non-volatile and / or volatile memories. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink), DRAM (SLDRAM), memory bus (Rambus), direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.

[0150] The technical features of the above embodiments can be combined arbitrarily. For the sake of concise description, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, it should be considered as the scope described in this specification.

[0151] The above-described embodiments merely represent several implementation manners of the present application. Their descriptions are relatively specific and detailed, but they should not be construed as limiting the scope of the invention patent. It should be noted that for those of ordinary skill in the art, without departing from the concept of the present application, several modifications and improvements can still be made, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the appended claims.

Claims

1. An adaptive rectangular treemap layout method, characterized in that: The method comprises: Obtain the target data to be visualized; Convert the target data into a node tree suitable for a rectangular treemap layout; Setting row and column configuration information for each node according to preset row and column attribute information corresponding to each node in the node tree; Setting weight information and minimum size information for each node according to row and column configuration information and child node distribution of each node in the node tree; Setting layout information for each node in the node tree according to weight information and inner margin of each node; The node tree and row and column configuration information, weight information, minimum size information and layout information corresponding to each node are obtained as tree structure data, and a rectangular tree diagram is displayed based on the tree structure data.

2. The method according to claim 1, characterized in that Setting row and column configuration information for each node according to preset row and column attribute information corresponding to each node in the node tree includes: Performing a breadth-first traversal on the node tree; For each node traversed, check whether the node has child nodes; When the node has child nodes, check whether the node has corresponding preset row and column attribute information. If the node has corresponding preset row and column attribute information, set row and column configuration information for the node according to the preset row and column attribute information corresponding to the node. If the node does not have corresponding preset row and column attribute information, set row and column configuration information for the node according to the number of child nodes of the node. When the node has no child nodes, the node is marked as a leaf node.

3. The method according to claim 1, characterized in that According to the row and column configuration information and child node distribution of each node in the node tree, weight information and minimum size information are set for each node, including: Performing a depth-first traversal on the node tree; For each node traversed, check whether the node has child nodes; When the node has child nodes, set the x-axis weight, y-axis weight, minimum width, and minimum height for the node according to the row and column configuration information of the node and the distribution of child nodes; When the node has no child nodes, set the default x-axis weight, default y-axis weight, default minimum width, and default minimum height for the child node.

4. The method according to claim 3, characterized in that The row and column configuration information includes row number configuration and column number configuration; Set the x-axis weight, y-axis weight, minimum width, and minimum height for the node according to the row and column configuration information of the node and the distribution of its child nodes, including: Set the x-axis weight for the node according to the node's column configuration, minimum leaf width, padding, and maximum row weight; Set the y-axis weight for the node based on the node's row configuration, minimum leaf height, padding, and the sum of the maximum row weight; Set the minimum width for the node according to the maximum values ​​of the number of columns, padding, and minimum row width of the node; Sets the minimum height for the node based on the node's row configuration, the sum of the padding and the maximum value of the minimum row height.

5. The method according to claim 4, characterized in that The layout information includes node position and width and height information; and the layout information is set for each node according to the weight information and inner margin of each node in the node tree, including: Constructing an x-axis weight matrix according to the x-axis weight of each node in the node tree; Constructing a y-axis weight matrix according to the y-axis weight of each node in the node tree; Determine the x-axis weight according to the maximum value of the row sum, the minimum leaf width and the inner margin in the x-axis weight matrix; Determine the y-axis weight according to the maximum value of the column sum, the minimum leaf height and the inner margin in the y-axis weight matrix; Determine the minimum width of the tree map based on the sum of the minimum widths of all nodes; Determine the minimum height of the tree graph according to the maximum value of the minimum heights of all nodes; The node position and width and height information of each node are determined according to the x-axis weight matrix, the y-axis weight matrix, the x-axis weight, the y-axis weight, the minimum width of the tree map, and the minimum height of the tree map.

6. The method according to claim 5, characterized in that The node position includes the upper left corner x-axis coordinate and the upper left corner y-axis coordinate; the width and height information includes the node width and the node height; Determining the node position and width and height information of each node according to the x-axis weight matrix, the y-axis weight matrix, the x-axis weight, the y-axis weight, the minimum width of the tree map, and the minimum height of the tree map includes: Performing a breadth-first traversal on the node tree; For each traversed node, determine the x-axis coordinate of the upper left corner of the node based on the first rule, determine the y-axis coordinate of the upper left corner of the node based on the second rule, determine the node width of the node based on the third rule, and determine the node height of the node based on the fourth rule; The first rule includes taking the sum of the x-axis coordinate of the parent node of the current node and the inner margin as the x-axis coordinate of the upper left corner of the node when the current node is the first column node, and taking the sum of the x-axis coordinate of the upper left corner of the previous node of the current node and the node width and inner margin of the previous node as the x-axis coordinate of the upper left corner of the current node when the current node is not the first column node; The second rule includes: when the current node is a node in the first row, taking the sum of the y-axis coordinate of the parent node of the current node and the inner margin as the y-axis coordinate of the upper left corner of the node; when the current node is not a node in the first row but a node in the first column, taking the sum of the y-axis coordinate of the upper left corner of the previous node of the current node and the node height and the inner margin of the previous node as the y-axis coordinate of the upper left corner of the current node; when the current node is not a node in the first row and not a node in the first column, taking the y-axis coordinate of the upper left corner of the previous node of the current node as the y-axis coordinate of the upper left corner of the current node; The third rule includes determining the node width of the current node according to the actual number of nodes and the inner margin of the last row when the current node is in the last row and the total number of nodes cannot be divided by the number of columns; otherwise, determining the node width of the current node according to all the number of columns and the inner margin; The fourth rule includes calculating the node height of the current node according to the ratio of the maximum y-axis weight value of the current row to the total weight and the actual available height of the layout area.

7. The method according to claim 6, characterized in that Determining the node width of the current node according to the actual number of nodes and the inner margin of the last row, including: taking the product of the node width of the parent node of the current node and a first weight ratio as the node width of the current node; the first weight ratio is equal to the quotient of the x-axis weight of the current node and the total x-axis weight of the row where the current node is located; Determines the node width of the current node based on all columns and padding, including: The product of the node width of the parent node of the current node and the first weight ratio is used as the node width of the current node; The node height of the current node is calculated based on the ratio of the maximum y-axis weight value of the current row to the total weight and the actual available height of the layout area, including: The actual available height of the layout area is subtracted from the product of the total spacing of all rows and the second weight ratio to obtain the node height of the current node; the second weight ratio is equal to the quotient of the maximum y-axis weight of the current row and the sum of the maximum y-axis weights of all rows.

8. An adaptive rectangular treemap layout device, characterized in that: The device comprises: A target data acquisition module, used to acquire target data to be visualized; A conversion module, used for converting the target data into a node tree suitable for a rectangular treemap layout; A row and column configuration setting module, used to set row and column configuration information for each node according to preset row and column attribute information corresponding to each node in the node tree; A weight and minimum size setting module, used to set weight information and minimum size information for each node according to row and column configuration information and subnode distribution of each node in the node tree; A layout information setting module, used to set layout information for each node in the node tree according to the weight information and the inner margin of each node; A visualization module is used to obtain the node tree and row and column configuration information, weight information, minimum size information and layout information corresponding to each node as tree structure data, and display a rectangular tree diagram based on the tree structure data.

9. A computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.

Citation Information

Cited By

  • Decision tree visualization method and device, equipment and storage medium

    CN120931838A