Object relationship diagram drawing method, device, equipment and readable storage medium
Through hierarchical division, insertion algorithm sorting and echarts plug-in drawing methods, the problem of high error rate and time-consuming and labor-intensive object relationship chart drawing in the existing technology is solved, and efficient and automated chart drawing is achieved, reducing costs.
Patent Information
- Application Number
- CN202011377619.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-11-30
- Publication Date
- 2025-04-04
- Estimated Expiration
- 2040-11-30
AI Technical Summary
The existing object relationship chart drawing method has high error rate, time-consuming and labor-intensive, and high cost, making it difficult to effectively display the complex relationship between multiple objects.
Through hierarchical division, insertion algorithm sorting, preset coordinate calculation and echarts plug-in drawing methods, we can automatically draw object relationship charts to reduce error rates and improve efficiency.
It significantly reduces the error rate, improves the drawing efficiency, saves labor and costs, and realizes efficient and automated drawing of object relationship charts.
Smart Images

Figure CN112417833B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer application technology, and in particular to an object relationship diagram drawing method, device, equipment and computer-readable storage medium. Background Art
[0002] There are certain relationships between objects in an object set with multiple objects. Sometimes, according to some scene requirements, it is necessary to perform statistical analysis on the relationships between objects. In order to fully display the relationships between objects in the object set, most of the relationships between objects are analyzed by drawing object relationship charts.
[0003] Most of the existing object relationship diagram drawing methods use flowcharts or Word tools. The drawing process requires users to organize it themselves. When the amount of data is large, the content is complicated, the error rate is high in the organization process, and it is time-consuming, labor-intensive, and costly.
[0004] In summary, how to effectively solve the problems of high error rate, time-consuming and labor-intensive, and high cost in existing object relationship diagram drawing methods is an urgent problem that technicians in this field need to solve. Summary of the invention
[0005] The object of the present invention is to provide a method for drawing an object relationship diagram, which greatly reduces the error rate, improves the drawing efficiency, saves manpower and saves costs; another object of the present invention is to provide an object relationship diagram drawing device, equipment and computer-readable storage medium.
[0006] In order to solve the above technical problems, the present invention provides the following technical solutions:
[0007] A method for drawing an object relationship diagram, comprising:
[0008] According to the hierarchical identification information corresponding to each object, each object is hierarchically divided, and the upper-layer object identification of the target upper-layer object corresponding to each object is obtained;
[0009] According to the upper layer object identifiers corresponding to the objects, the objects in each layer are sorted by using an insertion algorithm to obtain a sorting result;
[0010] Obtaining preset same-layer object intervals, preset adjacent layer heights, and preset reference coordinates of reference objects;
[0011] Calculate the coordinates of other objects except the preset reference object according to the sorting result, the preset same-layer object interval, the preset adjacent layer height and the reference coordinate;
[0012] The echarts plug-in is used to draw an object relationship diagram according to the coordinates of each object.
[0013] In a specific implementation of the present invention, hierarchical division of each object according to hierarchical identification information corresponding to each object includes:
[0014] Each of the objects is hierarchically divided according to the hierarchical identification information in the JSON array format corresponding to each of the objects.
[0015] In a specific embodiment of the present invention, after calculating the coordinates of other objects except the preset reference object, before using the echarts plug-in to draw an object relationship diagram according to the coordinates of each object, it also includes:
[0016] Obtaining the minimum coordinate among the coordinates of each of the objects;
[0017] Determine whether the minimum horizontal coordinate and the minimum vertical coordinate in the minimum coordinate are both positive numbers;
[0018] If not, obtaining preset replacement coordinates, and replacing the minimum coordinates with the preset replacement coordinates;
[0019] The coordinates of the objects except the target object corresponding to the minimum coordinates are adjusted according to the preset replacement coordinates.
[0020] In a specific implementation of the present invention, the object relationship diagram is drawn using the echarts plug-in according to the coordinates of each object, including:
[0021] Calculate the coordinates of each path node according to the coordinates of each object, the preset same-layer object interval, and the preset adjacent layer height;
[0022] The echarts plug-in is used to draw an object relationship diagram according to the coordinates of each object and the coordinates of each path node.
[0023] In a specific embodiment of the present invention, after using the echarts plug-in to draw an object relationship graph according to the coordinates of each object and the coordinates of each path node, it also includes:
[0024] Obtaining a first object type corresponding to each object in the drawn target object relationship diagram;
[0025] Receive object insertion request;
[0026] Parsing the object insertion request to obtain a second object type of the object to be inserted;
[0027] Determining whether the second object type is consistent with the first object type;
[0028] If yes, insert the object to be inserted into the target object relationship graph.
[0029] In a specific implementation of the present invention, inserting the object to be inserted into the target object relationship graph includes:
[0030] Obtaining target level identification information and target upper layer object identification corresponding to the object to be inserted;
[0031] The object to be inserted is inserted into the target object relationship graph according to the target level identification information and the target upper-layer object identification.
[0032] An object relationship diagram drawing device, comprising:
[0033] An identification acquisition module, used to classify each object according to the hierarchical identification information corresponding to each object, and obtain the upper-level object identification of the target upper-level object corresponding to each object;
[0034] A sorting result obtaining module is used to sort the objects in each level by using an insertion algorithm according to the upper layer object identifiers corresponding to the objects, so as to obtain a sorting result;
[0035] A preset value acquisition module, used to acquire preset same-layer object intervals, preset adjacent layer heights, and preset reference coordinates of reference objects;
[0036] A coordinate calculation module, used to calculate the coordinates of other objects except the preset reference object according to the sorting result, the preset same-layer object interval, the preset adjacent layer height and the reference coordinate;
[0037] The chart drawing module is used to draw an object relationship chart according to the coordinates of each object using the echarts plug-in.
[0038] In a specific implementation of the present invention, the identification acquisition module includes a hierarchical division submodule, and the hierarchical division submodule is specifically a module for hierarchically dividing each of the objects according to hierarchical identification information in a JSON array format corresponding to each of the objects.
[0039] An object relationship diagram drawing device, comprising:
[0040] Memory for storing computer programs;
[0041] The processor is used to implement the steps of the object relationship diagram drawing method as described above when executing the computer program.
[0042] A computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the object relationship diagram drawing method as described above are implemented.
[0043] The object relationship diagram drawing method provided by the present invention divides each object into levels according to the level identification information corresponding to each object, and obtains the upper-level object identification of the target upper-level object corresponding to each object; according to the upper-level object identification corresponding to each object, the objects in each level are sorted by using an insertion algorithm to obtain a sorting result; a preset same-layer object interval, a preset adjacent layer height, and a preset reference coordinate of a reference object are obtained; according to the sorting result, the preset same-layer object interval, the preset adjacent layer height, and the reference coordinates, the coordinates of other objects except the preset reference object are calculated; and an echarts plug-in is used to draw an object relationship diagram according to the coordinates of each object.
[0044] Through the above technical solution, we can know that each object is divided into levels according to the level identification information, and the objects in the same level are sorted by the insertion algorithm according to the upper-level object identification, and the coordinates corresponding to each object are calculated by using the preset same-level object interval, the preset adjacent layer height, and the reference coordinates, and the object relationship diagram is automatically drawn according to each coordinate using the echarts plug-in. This greatly reduces the error rate, improves the drawing efficiency, saves manpower, and saves costs.
[0045] Correspondingly, the present invention also provides an object relationship diagram drawing device, equipment and computer-readable storage medium corresponding to the above-mentioned object relationship diagram drawing method, which have the above-mentioned technical effects and are not repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0047] Figure 1 A flowchart of an implementation of the object relationship diagram drawing method in an embodiment of the present invention;
[0048] Figure 2 Another implementation flow chart of the object relationship diagram drawing method in the embodiment of the present invention;
[0049] Figure 3 is a schematic diagram of an object relationship diagram in an embodiment of the present invention;
[0050] Figure 4It is a structural block diagram of an object relationship graph drawing device in an embodiment of the present invention;
[0051] Figure 5 The present invention is a block diagram of an object relationship diagram drawing device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0052] In order to enable those skilled in the art to better understand the scheme of the present invention, the present invention is further described in detail below in conjunction with the accompanying drawings and specific implementation methods. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.
[0053] Embodiment 1:
[0054] See also Figure 1 , Figure 1 This is a flowchart of an implementation of a method for drawing an object relationship diagram in an embodiment of the present invention. The method may include the following steps:
[0055] S101: hierarchically classify each object according to hierarchical identification information corresponding to each object, and obtain an upper-level object identification of a target upper-level object corresponding to each object.
[0056] Each object carries the identification information of the level to which it belongs. When it is necessary to draw an object relationship diagram, the level identification information corresponding to each object is obtained. The objects are divided into levels according to the level identification information corresponding to each object to obtain the level to which each object belongs. There is a corresponding correspondence between objects in adjacent levels. Each object also carries the upper-level object identification of its corresponding target upper-level object. After dividing the objects into levels, the upper-level object identification of the target upper-level object corresponding to each object is obtained.
[0057] S102: sorting the objects in each level using an insertion algorithm according to the upper-level object identifiers corresponding to the objects, to obtain a sorting result.
[0058] After dividing each object into levels and obtaining the upper-level object identifiers of the target upper-level objects corresponding to each object, the objects in each level are sorted using an insertion algorithm according to the upper-level object identifiers corresponding to each object to obtain the sorting results, thereby completing the sorting of the objects in each level in combination with the upper-level object identifiers.
[0059] S103: Obtaining a preset same-layer object interval, a preset adjacent layer height, and a preset reference coordinate of a reference object.
[0060] The same-layer object interval and adjacent-layer height of the object relationship graph are pre-set, and the reference object is pre-selected from each object. After the objects in each layer are sorted by the insertion algorithm and the sorting result is obtained, the preset same-layer object interval, the preset adjacent-layer height, and the reference coordinates of the preset reference object are obtained.
[0061] S104: Calculate the coordinates of other objects except the preset reference object according to the sorting result, the preset interval between objects in the same layer, the preset height of the adjacent layer and the reference coordinates.
[0062] After obtaining the preset same-layer object interval, preset adjacent layer height, and the reference coordinates of the preset reference object, the coordinates of other objects except the preset reference object are calculated according to the sorting results, the preset same-layer object interval, the preset adjacent layer height, and the reference coordinates, thereby completing the coordinate calculation of each object.
[0063] S105: Use the echarts plug-in to draw an object relationship diagram according to the coordinates of each object.
[0064] Pre-deploy the echarts plug-in for object relationship diagram drawing. After calculating the coordinates of each object, use the echarts plug-in to draw the object relationship diagram according to the coordinates of each object. As a pure JavaScript icon library, the echarts plug-in relies on a lightweight canvas drawing plug-in at the bottom layer. It is compatible with most browsers on the market and can be copied and used in various frameworks without conflict. Its innovative drag-and-drop recalculation, rich data views, and powerful value range roaming features enhance the user experience and also give users the ability to mine and integrate data.
[0065] By using the echarts plug-in to draw object relationship diagrams, each object has its own unique corresponding coordinates, ensuring that each object is clearly visible in the object relationship diagram, improving drawing efficiency, and enhancing user experience.
[0066] Through the above technical solution, we can know that each object is divided into levels according to the level identification information, and the objects in the same level are sorted by the insertion algorithm according to the upper-level object identification, and the coordinates corresponding to each object are calculated by using the preset same-level object interval, the preset adjacent layer height, and the reference coordinates, and the object relationship diagram is automatically drawn according to each coordinate using the echarts plug-in. This greatly reduces the error rate, improves the drawing efficiency, saves manpower, and saves costs.
[0067] It should be noted that, based on the above-mentioned embodiment 1, the embodiment of the present invention also provides a corresponding improvement scheme. In the subsequent embodiments, the same steps or corresponding steps as those in the above-mentioned embodiment 1 can be referenced to each other, and the corresponding beneficial effects can also be referenced to each other, and will not be repeated one by one in the following improved embodiments.
[0068] Embodiment 2:
[0069] See also Figure 2 , Figure 2 This is another implementation flow chart of the method for drawing an object relationship diagram in an embodiment of the present invention. The method may include the following steps:
[0070] S201: hierarchically classify each object according to the hierarchical identification information in the JSON array format corresponding to each object.
[0071] The identification information of each object is stored in advance in JSON array format, making the object relationship data planning clear and more hierarchical, and being able to clearly depict the target upper-level object of the current object, the level to which the current object belongs, and other information, enhancing the readability of each identification information and improving the efficiency of subsequent acquisition of hierarchical identification information, upper-level object identification, etc. Before dividing each object into levels, the original traffic data can also be filtered by specific conditions, and the key indicators of each person can be quickly screened and counted to indicate their behavioral characteristics.
[0072] S202: Obtain the upper-layer object identifier of the target upper-layer object corresponding to each object.
[0073] S203: sorting the objects in each level using an insertion algorithm according to the upper-level object identifiers corresponding to the objects, to obtain a sorting result.
[0074] S204: Obtaining a preset same-layer object interval, a preset adjacent layer height, and a preset reference coordinate of a reference object.
[0075] S205: Calculate the coordinates of other objects except the preset reference object according to the sorting result, the preset interval between objects in the same layer, the preset height of the adjacent layer and the reference coordinates.
[0076] S206: Obtain the minimum coordinate among the coordinates of each object.
[0077] After calculating the coordinates of each object, the minimum coordinate among the coordinates of each object is obtained. Since the number of objects in each level from top to bottom is increasing in most cases, the minimum coordinate is generally the coordinate of the lower left corner by default.
[0078] S207: Determine whether the minimum horizontal coordinate and the minimum vertical coordinate in the minimum coordinate are both positive numbers, if not, execute step S208, if yes, execute step S210.
[0079] After obtaining the minimum coordinates of the coordinates of each object, it is determined whether the minimum horizontal coordinate and the minimum vertical coordinate in the minimum coordinates are both positive numbers. If not, step S208 is executed; if so, step S210 is executed.
[0080] S208: Obtain preset replacement coordinates, and replace the minimum coordinates with the preset replacement coordinates.
[0081] Preset replacement coordinates are pre-set to replace the calculated minimum coordinates of each object. When it is determined that the minimum horizontal coordinate and the minimum vertical coordinate in the minimum coordinate are non-positive numbers, the preset replacement coordinates are obtained and the minimum coordinates are replaced by the preset replacement coordinates.
[0082] S209: adjusting the coordinates of each object except the target object corresponding to the minimum coordinate according to the preset replacement coordinates.
[0083] After the minimum coordinates are replaced with the preset replacement coordinates, the coordinates of each object except the target object corresponding to the minimum coordinates are adjusted according to the preset replacement coordinates. For example, the coordinates of each object except the target object corresponding to the minimum coordinates can be adjusted according to the difference between the horizontal coordinates of the preset replacement coordinates and the horizontal coordinates of the original minimum coordinates, and the difference between the vertical coordinates of the preset replacement coordinates and the vertical coordinates of the original minimum coordinates.
[0084] S210: Calculate the coordinates of each path node according to the coordinates of each object, the preset same-layer object interval, and the preset adjacent layer height.
[0085] After the coordinates of each object are adjusted to positive numbers, the coordinates of each path node are calculated according to the coordinates of each object, the preset interval between objects in the same layer, and the preset height of the adjacent layer.
[0086] See also Figure 3 , Figure 3 Schematic diagram of an object relationship diagram in an embodiment of the present invention. Assume that the data interval of the same bucket is w, the height of the adjacent level is h, and X 11 , X 12 , X 21 , X 22 , X 23 Represents each object. There are five nodes: node 0, node 1, node 2, node 3, node 4, and node 5. The coordinates of each object and each node are X 11 :(x 11 ,y 11 ), Node 0: Node 2: X 12 :(x 11 +w,y 11 ), Node 1: Node 4: Node 3: Node 5: Where n is the number of levels.
[0087] S211: Use the echarts plug-in to draw an object relationship diagram according to the coordinates of each object and the coordinates of each path node.
[0088] After calculating the coordinates of each object and each path node, the echarts plug-in is used to draw the object relationship diagram according to the coordinates of each object and each path node. By calculating the path node coordinates and drawing the object relationship diagram according to the calculated coordinates of each object and each path node, the efficiency of relationship diagram drawing is greatly improved, and the accuracy of relationship diagram drawing is improved.
[0089] S212: Obtaining a first object type corresponding to each object in the drawn target object relationship diagram.
[0090] Each object also carries its own object type information, and the object type information of each object in an object relationship diagram is the same. The first object type corresponding to each object in the drawn target object relationship diagram is obtained.
[0091] S213: Receive an object insertion request.
[0092] When a new object needs to be added to the target object relationship diagram, an object insertion request is generated and sent to the object relationship diagram drawing center. The object relationship diagram drawing center receives the object insertion request.
[0093] S214: Parse the object insertion request to obtain a second object type of the object to be inserted.
[0094] After receiving the object insertion request, the object relationship diagram drawing center parses the object insertion request to obtain the second object type of the object to be inserted.
[0095] S215: Determine whether the second object type is consistent with the first object type, if not, execute step S216, if yes, execute step S217.
[0096] After obtaining the first object type corresponding to each object in the target object relationship diagram and parsing to obtain the second object type of the object to be inserted, determine whether the second object type is consistent with the first object type. If not, it means that the object to be inserted does not belong to the target object relationship diagram, and execute step S216. If so, it means that the object to be inserted belongs to the target object relationship diagram, and execute step S217.
[0097] S216: Output object type inconsistency prompt information.
[0098] When it is determined that the second object type is inconsistent with the first object type, object type inconsistency prompt information is output, thereby prompting the object inserting party that the object to be inserted cannot be inserted into the target object relationship graph.
[0099] S217: Obtain target level identification information and target upper-level object identification corresponding to the object to be inserted.
[0100] When it is determined that the second object type is consistent with the first object type, it indicates that the object to be inserted belongs to the target object relationship graph, and the target level identification information and the target upper layer object identification corresponding to the object to be inserted are obtained.
[0101] S218: inserting the object to be inserted into the target object relationship graph according to the target level identification information and the target upper-level object identification.
[0102] After obtaining the target level identification information and the target upper object identification corresponding to the object to be inserted, the object to be inserted is inserted into the target object relationship diagram according to the target level identification information and the target upper object identification, thereby completing the dynamic drawing of the object relationship diagram.
[0103] This embodiment is different from the embodiment 1 corresponding to the technical solution claimed for protection by the independent claim 1, and further adds the technical solution claimed for protection by the dependent claims 2 to 6. Of course, according to different actual conditions and requirements, the technical solutions claimed for protection by the dependent claims can be flexibly combined without affecting the integrity of the solutions, so as to better meet the requirements of different usage scenarios. This embodiment only provides one of the solutions with the most solutions and the best effects. Due to the complexity of the situation, it is impossible to list all possible solutions one by one. Those skilled in the art should be able to realize that there can be many examples based on the basic method principles provided by this application in combination with actual conditions, and they should all be within the scope of protection of this application without sufficient creative work.
[0104] In a specific example application, the object relationship diagram can be a family tree, and each object is a person in a family. Correspondingly, the hierarchical identification information is the person's generation information, the upper object identification is the parent of the current person, and the object type is the family information.
[0105] The steps of drawing a family tree include:
[0106] (1) Set a fixed array as an empty bucket;
[0107] (2) Search the sequence and put the character information into the corresponding bucket one by one;
[0108] (3) Sort the buckets according to the parents of the character information.
[0109] Assume that the character information obtained is as follows:
[0110] parents name seniority in the family Logo 11,12 Zhang Saner's son 2 23 Zhang San's Wife 1 12 11,12 Zhang San's son 2 21 Zhang San's daughter-in-law 2 22 Zhang San 1 11 The eldest son's child
[0111] The character information after sorting is as follows:
[0112] parents name seniority in the family Logo Zhang San 1 11 Zhang San's Wife 1 12 11,12 Zhang Saner's son 2 23 11,12 Zhang San's son 2 21 Zhang San's daughter-in-law 2 22 21,22 The eldest son's child 3 31
[0113] The character information is grouped through bucket sorting and quick sorting, and the path node coordinates are calculated by quick sorting. The family tree is drawn according to the calculated coordinates of each character and each path node.
[0114] Corresponding to the above method embodiment, the present invention further provides an object relationship diagram drawing device. The object relationship diagram drawing device described below and the object relationship diagram drawing method described above can be referred to each other.
[0115] See also Figure 4 , Figure 4 This is a structural block diagram of an object relationship diagram drawing device in an embodiment of the present invention, and the device may include:
[0116] The identification acquisition module 41 is used to classify each object according to the hierarchical identification information corresponding to each object, and obtain the upper-level object identification of the target upper-level object corresponding to each object;
[0117] The sorting result obtaining module 42 is used to sort the objects in each level by using the insertion algorithm according to the upper layer object identifiers corresponding to the objects, and obtain the sorting result;
[0118] A preset value acquisition module 43 is used to acquire a preset same-layer object interval, a preset adjacent layer height, and a preset reference coordinate of a reference object;
[0119] A coordinate calculation module 44, used to calculate the coordinates of other objects except the preset reference object according to the sorting result, the preset same-layer object interval, the preset adjacent layer height and the reference coordinate;
[0120] The chart drawing module 45 is used to draw an object relationship chart according to the coordinates of each object using the echarts plug-in.
[0121] Through the above technical solution, we can know that each object is divided into levels according to the level identification information, and the objects in the same level are sorted by the insertion algorithm according to the upper-level object identification, and the coordinates corresponding to each object are calculated by using the preset same-level object interval, the preset adjacent layer height, and the reference coordinates, and the object relationship diagram is automatically drawn according to each coordinate using the echarts plug-in. This greatly reduces the error rate, improves the drawing efficiency, saves manpower, and saves costs.
[0122] In a specific implementation of the present invention, the identification acquisition module 41 includes a hierarchical division submodule, which is specifically a module for hierarchically dividing each object according to hierarchical identification information in a JSON array format corresponding to each object.
[0123] In a specific embodiment of the present invention, the device may further include:
[0124] A coordinate acquisition module is used to obtain the minimum coordinates of the coordinates of each object after calculating the coordinates of other objects except the preset reference object and before drawing the object relationship diagram according to the coordinates of each object using the echarts plug-in;
[0125] A first judgment module is used to judge whether the minimum horizontal coordinate and the minimum vertical coordinate in the minimum coordinate are both positive numbers;
[0126] A coordinate replacement module, used for obtaining preset replacement coordinates and replacing the minimum coordinates with the preset replacement coordinates when it is determined that the minimum horizontal coordinate and the minimum vertical coordinate in the minimum coordinates are not both positive numbers;
[0127] The coordinate adjustment module is used to adjust the coordinates of each object except the target object corresponding to the minimum coordinate according to the preset replacement coordinates.
[0128] In a specific embodiment of the present invention, the chart drawing module 45 includes:
[0129] The node coordinate calculation submodule is used to calculate the coordinates of each path node according to the coordinates of each object, the preset interval between objects on the same layer, and the preset height of the adjacent layer;
[0130] The chart drawing submodule is used to use the echarts plug-in to draw object relationship charts according to the coordinates of each object and the coordinates of each path node.
[0131] In a specific embodiment of the present invention, the device may further include:
[0132] A first object type acquisition module is used to acquire the first object type corresponding to each object in the drawn target object relationship diagram after drawing the object relationship diagram according to the coordinates of each object and the coordinates of each path node using the echarts plug-in;
[0133] A request receiving module, used for receiving an object insertion request;
[0134] A second object type acquisition module, used to parse the object insertion request to obtain a second object type of the object to be inserted;
[0135] A second determination module, used to determine whether the second object type is consistent with the first object type;
[0136] The object insertion module is used to insert the object to be inserted into the target object relationship graph when it is determined that the second object type is consistent with the first object type.
[0137] In a specific embodiment of the present invention, the object insertion module includes:
[0138] The identification acquisition submodule is used to obtain the target level identification information and the target upper layer object identification corresponding to the object to be inserted;
[0139] The object insertion submodule is used to insert the object to be inserted into the target object relationship diagram according to the target level identification information and the target upper-level object identification.
[0140] Corresponding to the above method embodiment, see Figure 5 , Figure 5 This is a schematic diagram of an object relationship diagram drawing device provided by the present invention, and the device may include:
[0141] A memory 51, used for storing computer programs;
[0142] The processor 52, when used to execute the computer program stored in the memory 51, can implement the following steps:
[0143] Divide each object into levels according to the level identification information corresponding to each object, and obtain the upper-level object identification of the target upper-level object corresponding to each object; sort the objects in each level according to the upper-level object identification corresponding to each object using the insertion algorithm to obtain the sorting result; obtain the preset same-level object interval, preset adjacent layer height, and preset reference coordinates of the reference object; calculate the coordinates of other objects except the preset reference object according to the sorting result, the preset same-level object interval, the preset adjacent layer height and the reference coordinates; use the echarts plug-in to draw an object relationship chart according to the coordinates of each object.
[0144] For an introduction to the device provided by the present invention, please refer to the above method embodiment, and the present invention will not be elaborated here.
[0145] Corresponding to the above method embodiment, the present invention further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the following steps can be implemented:
[0146] Divide each object into levels according to the level identification information corresponding to each object, and obtain the upper-level object identification of the target upper-level object corresponding to each object; sort the objects in each level according to the upper-level object identification corresponding to each object using the insertion algorithm to obtain the sorting result; obtain the preset same-level object interval, preset adjacent layer height, and preset reference coordinates of the reference object; calculate the coordinates of other objects except the preset reference object according to the sorting result, the preset same-level object interval, the preset adjacent layer height and the reference coordinates; use the echarts plug-in to draw an object relationship chart according to the coordinates of each object.
[0147] The computer-readable storage medium may include: a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and other media that can store program codes.
[0148] For an introduction to the computer-readable storage medium provided by the present invention, please refer to the above method embodiment, and the present invention will not be elaborated here.
[0149] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the devices, equipment and computer-readable storage media disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the description is relatively simple, and the relevant parts can be referred to the method part description.
[0150] The principles and implementation methods of the present invention are described in this article using specific examples. The description of the above embodiments is only used to help understand the technical solution and core ideas of the present invention. It should be pointed out that for ordinary technicians in this technical field, the present invention can also be improved and modified without departing from the principles of the present invention, and these improvements and modifications also fall within the scope of protection of the claims of the present invention.
Claims
1. A method for drawing an object relationship diagram, characterized in that: include: According to the hierarchical identification information corresponding to each object, each object is hierarchically divided, and the upper-layer object identification of the target upper-layer object corresponding to each object is obtained; According to the upper layer object identifiers corresponding to the objects, the objects in each layer are sorted by using an insertion algorithm to obtain a sorting result; Obtaining preset same-layer object intervals, preset adjacent layer heights, and preset reference coordinates of reference objects; Calculate the coordinates of other objects except the preset reference object according to the sorting result, the preset same-layer object interval, the preset adjacent layer height and the reference coordinate; Obtaining the minimum coordinate among the coordinates of each of the objects; Determine whether the minimum horizontal coordinate and the minimum vertical coordinate in the minimum coordinate are both positive numbers; If not, obtaining preset replacement coordinates, and replacing the minimum coordinates with the preset replacement coordinates; According to the difference between the horizontal coordinate of the preset replacement coordinate and the horizontal coordinate of the original minimum coordinate, and the difference between the vertical coordinate of the preset replacement coordinate and the vertical coordinate of the original minimum coordinate, coordinates of each object except the target object corresponding to the minimum coordinate are adjusted; Use the echarts plug-in to draw an object relationship diagram according to the coordinates of each object; Wherein, the object relationship diagram is drawn according to the coordinates of each object using the echarts plug-in, including: Calculate the coordinates of each path node according to the coordinates of each object, the preset same-layer object interval, and the preset adjacent layer height; The echarts plug-in is used to draw an object relationship diagram according to the coordinates of each object and the coordinates of each path node.
2. The object relationship diagram drawing method according to claim 1, characterized in that: The objects are divided into different levels according to the level identification information corresponding to each object, including: Each of the objects is hierarchically divided according to the hierarchical identification information in the JSON array format corresponding to each of the objects.
3. The object relationship diagram drawing method according to claim 1, characterized in that: After drawing the object relationship graph according to the coordinates of each object and the coordinates of each path node using the echarts plug-in, the method further includes: Obtaining a first object type corresponding to each object in the drawn target object relationship diagram; Receive object insertion request; Parsing the object insertion request to obtain a second object type of the object to be inserted; Determining whether the second object type is consistent with the first object type; If yes, insert the object to be inserted into the target object relationship graph.
4. The object relationship diagram drawing method according to claim 3, characterized in that: Inserting the object to be inserted into the target object relationship graph includes: Obtaining target level identification information and target upper layer object identification corresponding to the object to be inserted; The object to be inserted is inserted into the target object relationship graph according to the target level identification information and the target upper-layer object identification.
5. An object relationship diagram drawing device, characterized in that: include: An identification acquisition module, used to classify each object according to the hierarchical identification information corresponding to each object, and obtain the upper-level object identification of the target upper-level object corresponding to each object; A sorting result obtaining module is used to sort the objects in each level by using an insertion algorithm according to the upper layer object identifiers corresponding to the objects, so as to obtain a sorting result; A preset value acquisition module, used to acquire preset same-layer object intervals, preset adjacent layer heights, and preset reference coordinates of reference objects; A coordinate calculation module, used to calculate the coordinates of other objects except the preset reference object according to the sorting result, the preset same-layer object interval, the preset adjacent layer height and the reference coordinate; A coordinate acquisition module, used to acquire the minimum coordinate among the coordinates of each object; A first judgment module is used to judge whether the minimum horizontal coordinate and the minimum vertical coordinate in the minimum coordinate are both positive numbers; A coordinate replacement module, used for obtaining preset replacement coordinates and replacing the minimum coordinates with the preset replacement coordinates when it is determined that the minimum horizontal coordinate and the minimum vertical coordinate in the minimum coordinates are not both positive numbers; A coordinate adjustment module, used to adjust the coordinates of each object except the target object corresponding to the minimum coordinate according to the difference between the horizontal coordinate of the preset replacement coordinate and the horizontal coordinate of the original minimum coordinate, and the difference between the vertical coordinate of the preset replacement coordinate and the vertical coordinate of the original minimum coordinate; A chart drawing module, the chart drawing module includes: The node coordinate calculation submodule is used to calculate the coordinates of each path node according to the coordinates of each object, the preset interval between objects on the same layer, and the preset height of the adjacent layer; The chart drawing submodule is used to use the echarts plug-in to draw object relationship charts according to the coordinates of each object and the coordinates of each path node.
6. The object relationship diagram drawing device according to claim 5, characterized in that: The identification acquisition module includes a hierarchical division submodule, and the hierarchical division submodule is specifically a module for hierarchically dividing each of the objects according to the hierarchical identification information in the JSON array format corresponding to each of the objects.
7. An object relationship diagram drawing device, characterized in that: include: Memory for storing computer programs; A processor is used to implement the steps of the object relationship diagram drawing method according to any one of claims 1 to 4 when executing the computer program.
8. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the object relationship diagram drawing method according to any one of claims 1 to 4 are implemented.