CN106997292A - The method and apparatus for handling rectangle tree graph - Google Patents
The method and apparatus for handling rectangle tree graph Download PDFInfo
- Publication number
- CN106997292A CN106997292A CN201610052102.7A CN201610052102A CN106997292A CN 106997292 A CN106997292 A CN 106997292A CN 201610052102 A CN201610052102 A CN 201610052102A CN 106997292 A CN106997292 A CN 106997292A
- Authority
- CN
- China
- Prior art keywords
- rectangle
- name
- current
- current rectangle
- width
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000000034 method Methods 0.000 claims abstract description 27
- 238000010586 diagram Methods 0.000 claims description 68
- 238000004364 calculation method Methods 0.000 claims description 2
- 238000004590 computer program Methods 0.000 description 8
- 238000009877 rendering Methods 0.000 description 6
- 230000006870 function Effects 0.000 description 5
- 230000008901 benefit Effects 0.000 description 3
- 230000008859 change Effects 0.000 description 3
- 238000005516 engineering process Methods 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 238000012986 modification Methods 0.000 description 2
- 230000003287 optical effect Effects 0.000 description 2
- 230000008569 process Effects 0.000 description 2
- 230000005540 biological transmission Effects 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 230000006872 improvement Effects 0.000 description 1
- 230000002452 interceptive effect Effects 0.000 description 1
- 238000004519 manufacturing process Methods 0.000 description 1
- 230000003068 static effect Effects 0.000 description 1
- 230000000007 visual effect Effects 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/90—Details of database functions independent of the retrieved data types
- G06F16/904—Browsing; Visualisation therefor
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
- G06F9/451—Execution arrangements for user interfaces
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Software Systems (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Databases & Information Systems (AREA)
- Human Computer Interaction (AREA)
- Data Mining & Analysis (AREA)
- Controls And Circuits For Display Device (AREA)
Abstract
The invention discloses a kind of method and apparatus for handling rectangle tree graph, it is related to Internet technical field, can solve the problem that and obtain the problem of rectangle name operation is cumbersome in the prior art.The method of the present invention includes:Each rectangle in traversal rectangle tree graph to be shown, obtains width, the text style of rectangle title and the rectangle title of the current rectangle of traversal, and text style includes character size and word spacing;According to the width of current rectangle and the text style of the rectangle title of current rectangle, the row number of words of current rectangle is determined, row number of words is the rectangle word number that often row can be accommodated;If the number of words of the rectangle title of current rectangle is more than row number of words, the rectangle title to current rectangle carries out line feed processing;After each rectangle traversal is finished in rectangle tree graph, rectangle tree graph is shown.The present invention is mainly suitable for rendered based on the treemap controls in ECharts in the scene of rectangle tree graph.
Description
Technical Field
The invention relates to the technical field of internet, in particular to a method and a device for processing a rectangular tree graph.
Background
Echarts (enterprise charts) is a business-level data diagram library that provides visual, animated, interactive, and personalizable data diagrams. Different types of charts may be rendered based on different controls in the ECharts, such as line charts, bar charts, pie charts, thermodynamic diagrams, and rectangular tree diagrams. And rendering the rectangular tree graph by using a treemap control. The rectangular tree graph is composed of a plurality of rectangles with different sizes, and the contrast of the same group of data can be visually seen through the rectangular tree graph. In practical application, the corresponding rectangle name is displayed in each rectangle, and a user can visually know the data represented by each rectangle; when the mouse cursor moves to the area where a certain rectangle is located, the name of the rectangle and the corresponding value are displayed on the upper layer of the rectangle, so that a user can visually know the value of the rectangle.
However, when the width of a rectangle in the rectangular tree diagram is smaller than the length of the rectangle name, the rectangle name cannot be displayed in the rectangle, and only when the user moves the cursor of the mouse to the rectangular area, the rectangle name and the corresponding value can be displayed on the upper layer of the rectangle. Therefore, when there are a plurality of rectangles in the rectangular tree diagram and the names of the rectangles cannot be displayed, the user needs to move the mouse cursor to the corresponding rectangular areas one by one to obtain the names of the rectangles, and the operation is very complicated.
Disclosure of Invention
In view of the above technical problems, the present invention provides a method and an apparatus for processing a rectangular tree diagram, which aim to solve the following problems existing in the prior art: when the width of a rectangle in the rectangular tree diagram is smaller than the length of the rectangle name, the rectangle name cannot be displayed in the rectangle, and only when a user moves a mouse cursor to the local area of the rectangle, the rectangle name and a corresponding value can be displayed on the upper layer of the rectangle, so that when a plurality of rectangles in the rectangular tree diagram cannot display the rectangle name, the user needs to move the mouse cursor to the corresponding rectangular areas one by one to obtain the rectangle name, and the operation is very complicated.
In one aspect, the present invention provides a method for processing a rectangular tree diagram, where the method includes:
traversing each rectangle in a rectangular tree diagram to be displayed, and obtaining the width of the current traversed rectangle, the character style of the rectangle name and the rectangle name, wherein the character style comprises the character size and the character spacing;
determining the line word number of the current rectangle according to the width of the current rectangle and the character style of the name of the current rectangle, wherein the line word number is the number of characters which can be contained in each line of the rectangle;
if the word number of the rectangular name of the current rectangle is larger than the line word number, performing line feed processing on the rectangular name of the current rectangle;
and after traversing all rectangles in the rectangular tree graph, displaying the rectangular tree graph.
In another aspect, the present invention provides an apparatus for processing a treemap, the apparatus comprising:
the traversal unit is used for traversing each rectangle in the rectangular tree diagram to be displayed to obtain the width of the traversed current rectangle, the character style of the rectangle name and the rectangle name, wherein the character style comprises the character size and the character spacing;
the determining unit is used for determining the line word number of the current rectangle according to the width of the current rectangle obtained by the traversing unit and the character style of the rectangle name of the current rectangle, wherein the line word number is the number of characters which can be contained in each line of the rectangle;
a processing unit, configured to perform line feed processing on the name of the current rectangle when the number of words of the name of the current rectangle is greater than the number of words of the line determined by the determining unit;
and the display unit is used for displaying the rectangular tree diagram after the processing unit finishes traversing all rectangles in the rectangular tree diagram.
By means of the technical scheme, the method and the device for processing the rectangular tree graph, provided by the invention, can traverse each rectangle in the rectangular tree graph before displaying the rectangular tree graph, obtain the width of the current rectangle traversed, the character style of the name of the rectangle and the name of the rectangle, determine the line word number of the current rectangle (namely the number of characters capable of being accommodated by each line of the current rectangle) according to the width of the current rectangle and the character style of the name of the rectangle of the current rectangle, perform line feed processing on the name of the rectangle of the current rectangle when the number of characters of the name of the rectangle of the current rectangle is greater than the line word number, and finally display the rectangular tree graph after traversing each rectangle in the rectangular tree graph. Therefore, when the length of the rectangular name is larger than the width of the rectangle and the rectangular name cannot be displayed in a single line, the invention can firstly carry out line feed processing on the rectangular name and then carry out display, so that a user can intuitively know the data represented by each rectangle through the rectangular tree diagram without moving a mouse cursor to a rectangular area of which the length of the rectangular name is larger than the width of the rectangle, the rectangular name can be known, the user operation is simplified, and the efficiency of obtaining the rectangular name is improved.
The foregoing description is only an overview of the technical solutions of the present invention, and the embodiments of the present invention are described below in order to make the technical means of the present invention more clearly understood and to make the above and other objects, features, and advantages of the present invention more clearly understandable.
Drawings
Various other advantages and benefits will become apparent to those of ordinary skill in the art upon reading the following detailed description of the preferred embodiments. The drawings are only for purposes of illustrating the preferred embodiments and are not to be construed as limiting the invention. Also, like reference numerals are used to refer to like parts throughout the drawings. In the drawings:
FIG. 1 is a flow chart illustrating a method for processing a treemap according to an embodiment of the present invention;
FIG. 2 is a schematic diagram of a rectangular tree diagram display according to an embodiment of the present invention;
FIG. 3 is a block diagram illustrating an apparatus for processing a treemap according to an embodiment of the present invention;
fig. 4 is a block diagram illustrating another apparatus for processing a treemap according to an embodiment of the present invention.
Detailed Description
Exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be embodied in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.
The embodiment of the invention provides a method for processing a rectangular tree diagram, which mainly comprises the following steps of:
101. and traversing each rectangle in the rectangular tree diagram to be displayed to obtain the width of the traversed current rectangle, the character style of the rectangle name and the rectangle name.
The text style may include text size and text interval, and may further include font, color, whether to be bolded, whether to be inclined, and the like. After the user sets parameters of all rectangles in the rectangular tree diagram, the treemap control needs to render the rectangular tree diagram, namely, dividing the frame rectangles in the rectangular tree diagram, and performing color filling on all rectangles generated after division so as to display the rectangular tree diagram after rendering is completed. Therefore, the treemap control may traverse each rectangle in the rectangular tree diagram before rendering the rectangular tree diagram, may also traverse each rectangle in the rectangular tree diagram in the process of rendering the rectangular tree diagram, and may also traverse each rectangle in the rectangular tree diagram after rendering the rectangular tree diagram and before displaying, which is not limited herein.
102. And determining the line word number of the current rectangle according to the width of the current rectangle and the character style of the name of the current rectangle.
The number of the line words is the number of characters which can be contained in each line of the rectangle. After the width of the current rectangle and the character style of the name of the current rectangle are obtained, the treemap control can acquire the character size and the character spacing from the character style, and calculate the number of characters (namely the row word number) which can be accommodated by a single row of the current rectangle based on the character size, the character spacing and the width of the current rectangle, so as to judge whether line feed processing needs to be carried out on the name of the current rectangle based on the row word number.
103. And if the word number of the name of the current rectangle is larger than the word number of the line, performing line feed processing on the name of the current rectangle.
If the word number of the name of the current rectangle is greater than the word number of the row, the name of the current rectangle cannot be displayed in a single row in the current rectangle, so that the treemap control needs to perform line feed processing on the name of the current rectangle, and the name of the current rectangle can be displayed in multiple rows in the current rectangle; and if the word number of the name of the current rectangle is less than or equal to the row word number, displaying the name of the current rectangle in a single row in the current rectangle.
104. And after traversing all rectangles in the rectangular tree graph, displaying the rectangular tree graph.
If the step 101-; if the step 101-; if the steps 101-103 are executed after rendering the rectangular tree diagram, the rectangular tree diagram is displayed after all rectangles in the rectangular tree diagram are processed in the processing manner described in the steps 101-103.
For example, as shown in fig. 2, the rectangular tree diagram is used to show sales volumes of four kinds of mobile phones, and the sales volumes of the mobile phones are, from the most to the least, the first mobile phone, the fourth mobile phone, the second mobile phone, and the third mobile phone in sequence according to comparison of sizes of the four rectangles. As can be seen from the figure, the lengths of the rectangle names of the rectangles positioned at the upper left corner and the lower right corner are smaller than the widths of the corresponding rectangles, so that the line feed processing is not required to be performed on the rectangle names of the two rectangles before the rectangular tree diagram is displayed; the lengths of the rectangle names of the rectangles positioned at the upper right corner and the lower left corner are greater than the widths of the corresponding rectangles, so before the rectangular tree diagram is displayed, the rectangle names of the two rectangles need to be subjected to line feed processing, so that the two rectangle names can be completely displayed in the corresponding rectangles (i.e., the display effect is as shown in fig. 2).
The method for processing the rectangular tree diagram provided by the embodiment of the invention can traverse each rectangle in the rectangular tree diagram before displaying the rectangular tree diagram, obtain the width of the current rectangle traversed, the character style of the name of the rectangle and the name of the rectangle, determine the line word number of the current rectangle (namely the number of characters which can be accommodated by each line of the current rectangle) according to the width of the current rectangle and the character style of the name of the rectangle of the current rectangle, then perform line feed processing on the name of the rectangle of the current rectangle when the number of characters of the name of the rectangle of the current rectangle is greater than the line word number, and finally display the rectangular tree diagram after traversing each rectangle in the rectangular tree diagram. Therefore, when the length of the rectangular name is larger than the width of the rectangle and the rectangular name cannot be displayed in a single line, the invention can firstly carry out line feed processing on the rectangular name and then carry out display, so that a user can intuitively know the data represented by each rectangle through the rectangular tree diagram without moving a mouse cursor to a rectangular area of which the length of the rectangular name is larger than the width of the rectangle, the rectangular name can be known, the user operation is simplified, and the efficiency of obtaining the rectangular name is improved.
Further, the specific implementation manner of the step 102 may be: calculating the text space width corresponding to the current rectangle according to the text size and the text interval in the text style corresponding to the rectangle name of the current rectangle, wherein the text space width is the average width of each text occupying the rectangle; and determining the row word number of the current rectangle based on the width of the current rectangle and the width of the character space.
Specifically, when a rectangle name is displayed in a rectangle, a width of 1/2 letter space is reserved before the head letter of each line, and a width of 1/2 letter space is reserved after the last letter of each line, the formula for calculating the letter space width may be "awitth" ("fontwidth" + distance "), where awitth denotes the letter space width, fontwidth denotes the letter width in the letter size, and distance denotes the letter space.
When the width of the character space is obtained, the formula can be usedAnd calculating the number of characters which can be accommodated in each row. Wherein,this means rounding down, for example, with width 210, awidth 20, and n 10.
In addition, if no gap is reserved before the first character of each line and a gap is reserved after the last character of each line when the name of the rectangle is displayed in the rectangle, the formula for calculating the number of the line characters can be
Further, a specific implementation manner of performing line feed processing on the name of the current rectangle may be: in the rectangular name of the current rectangle, a line break character (i.e., "\ n") is added every other line of words. For example, if the name of a rectangle is "XX brand smart phone of smart phone XX brand", and the number of characters that can be accommodated by each row of the rectangle is 6, it is necessary to perform line change processing on the name of the rectangle, that is, add a line change symbol every 6 characters, to obtain a processed name of "XX brand smart/n brand smart phone of smart/n phone XX article/n brand".
Further, in practical applications, there may be rectangles with small width and height in the rectangular tree diagram, so when the length of the rectangle name is long, multiple lines are required to be displayed, but the complete rectangle name may not be displayed because the height of the rectangle is small. As a result, even if the line feed processing is performed on the rectangular name, the rectangular name may not be displayed. Therefore, in order to determine that the name of the rectangle subjected to line feed processing can be completely displayed in the corresponding rectangle, before the name of the rectangle of the current rectangle is subjected to line feed processing, the height of the current rectangle can be obtained, and the number of the column words of the current rectangle is determined according to the height of the current rectangle and the character style of the name of the rectangle of the current rectangle, wherein the number of the column words is the number of characters which can be accommodated in each column of the rectangle; then multiplying the row word number and the column word number to obtain the total number of characters which can be contained by the current rectangle; and finally, when the total number of the characters is greater than or equal to the number of words of the name of the current rectangle, performing line feed processing on the name of the current rectangle, and when the total number of the characters is less than the number of words of the name of the current rectangle, not performing line feed processing on the name of the current rectangle.
The formula for calculating the number of column words of the current rectangle may be:where high denotes the height of the rectangle, fonthhigh denotes the character height in the character size, and m denotes the number of column characters.
Further, if the total number of characters is less than the number of words of the name of the current rectangle, the name of the rectangle cannot be displayed in the current rectangle in a multi-line display manner. Therefore, in order to further enable the rectangle name of each rectangle in the rectangular tree diagram to be displayed in the corresponding rectangle, the embodiment of the present invention improves the above scheme as follows: if the total number of the characters is less than the number of the words of the name of the current rectangle, replacing the character style corresponding to the name of the current rectangle according to the number of the words of the name of the current rectangle, the width of the current rectangle and the height of the current rectangle; and performing line feed processing on the name of the current rectangle based on the changed character style.
Wherein, the text style corresponding to the rectangle name for replacing the current rectangle comprises: the size and/or spacing of the letters in the letter pattern is changed. Specifically, the treemap control mayBy usingWhen the complete rectangular name is calculated and displayed, each character in the rectangular name occupies the maximum area of the current rectangle, and then whether the size (namely the character area) of the character in the current character style is larger than the maximum area is judged; if the maximum area is smaller than or equal to the maximum area, changing the character spacing to 0 without changing the character size; if the size is larger than the maximum area, the character spacing is changed to 0, and the character size is changed to be smaller than or equal to the maximum area. Where x represents the number of words of the rectangular name.
Further, according to the above method embodiment, another embodiment of the present invention further provides an apparatus for processing a rectangular tree diagram, as shown in fig. 3, the apparatus mainly includes: a traversing unit 21, a determining unit 22, a processing unit 23 and a display unit 24. Wherein,
the traversal unit 21 is configured to traverse each rectangle in the rectangular tree diagram to be displayed, and obtain the width of the current traversed rectangle, the character style of the rectangle name, and the rectangle name, where the character style includes a character size and a character pitch;
a determining unit 22, configured to determine, according to the width of the current rectangle obtained by the traversing unit 21 and the text style of the rectangle name of the current rectangle, the row number of words of the current rectangle, where the row number of words is the number of texts that can be accommodated in each row of the rectangle;
a processing unit 23, configured to perform line feed processing on the name of the current rectangle when the number of words of the name of the current rectangle is greater than the number of line words determined by the determining unit 22;
and the display unit 24 is configured to display the rectangular tree diagram after the processing unit 23 finishes traversing each rectangle in the rectangular tree diagram.
The apparatus for processing a rectangular tree diagram provided in the embodiments of the present invention may traverse each rectangle in the rectangular tree diagram before displaying the rectangular tree diagram, obtain the width of the current rectangle, the text style of the name of the rectangle, and the name of the rectangle traversed, determine the line word number of the current rectangle (i.e., the number of texts that can be accommodated by each line of the current rectangle) according to the width of the current rectangle and the text style of the name of the rectangle of the current rectangle, perform line feed processing on the name of the rectangle of the current rectangle when the number of words of the name of the rectangle of the current rectangle is greater than the number of line words, and finally display the rectangular tree diagram after traversing each rectangle in the rectangular tree diagram. Therefore, when the length of the rectangular name is larger than the width of the rectangle and the rectangular name cannot be displayed in a single line, the invention can firstly carry out line feed processing on the rectangular name and then carry out display, so that a user can intuitively know the data represented by each rectangle through the rectangular tree diagram without moving a mouse cursor to a rectangular area of which the length of the rectangular name is larger than the width of the rectangle, the rectangular name can be known, the user operation is simplified, and the efficiency of obtaining the rectangular name is improved.
Further, as shown in fig. 4, the determining unit 22 includes:
the calculation module 221 is configured to calculate a text space width corresponding to the current rectangle according to the size of the text in the text style corresponding to the name of the current rectangle and the text interval, where the text space width is an average width of the rectangle occupied by each text;
a determining module 222, configured to determine the number of line words of the current rectangle based on the width of the current rectangle and the width of the word space obtained by the calculating module 221.
Further, the processing unit 23 is configured to add a line break character to every other line of characters in the name of the current rectangle.
Further, as shown in fig. 4, the apparatus further includes:
an obtaining unit 25, configured to obtain a height of the current rectangle before performing line feed processing on the name of the current rectangle if the number of words of the name of the current rectangle is greater than the number of line words;
the determining unit 22 is further configured to determine the number of column words of the current rectangle according to the height of the current rectangle acquired by the acquiring unit 25 and the text style of the name of the current rectangle, where the number of column words is the number of texts that can be accommodated by each column of the rectangle;
an operation unit 26, for multiplying the row word number and the column word number obtained by the determination unit 22, to obtain the total number of characters that can be held by the current rectangle;
the processing unit 23 is further configured to perform line feed processing on the name of the current rectangle when the total number of characters obtained by the operation unit 26 is greater than or equal to the number of words of the name of the current rectangle.
Further, as shown in fig. 4, the apparatus further includes:
a replacing unit 27 configured to replace a character style corresponding to the name of the current rectangle according to the number of words of the name of the current rectangle, the width of the current rectangle, and the height of the current rectangle when the total number of characters obtained by the operation unit 26 is smaller than the number of words of the name of the current rectangle;
the processing unit 23 is further configured to perform line feed processing on the name of the current rectangle based on the character style replaced by the replacing unit 27.
The embodiment of the apparatus corresponds to the embodiment of the method, and for convenience of reading, details in the embodiment of the apparatus are not repeated one by one, but it should be clear that the apparatus in the embodiment can correspondingly implement all the contents in the embodiment of the method.
The device for processing the rectangular tree graph comprises a processor and a memory, wherein the traversing unit, the determining unit, the processing unit, the displaying unit and the like are stored in the memory as program units, and the processor executes the program units stored in the memory to realize corresponding functions.
The processor comprises a kernel, and the kernel calls the corresponding program unit from the memory. The kernel can be set to be one or more, and the user operation is simplified by adjusting the kernel parameters.
The memory may include volatile memory in a computer readable medium, Random Access Memory (RAM) and/or nonvolatile memory such as Read Only Memory (ROM) or flash memory (flash RAM), and the memory includes at least one memory chip.
The present application further provides a computer program product adapted to perform program code for initializing the following method steps when executed on a data processing device:
traversing each rectangle in a rectangular tree diagram to be displayed, and obtaining the width of the current traversed rectangle, the character style of the rectangle name and the rectangle name, wherein the character style comprises the character size and the character spacing;
determining the line word number of the current rectangle according to the width of the current rectangle and the character style of the name of the current rectangle, wherein the line word number is the number of characters which can be contained in each line of the rectangle;
if the word number of the rectangular name of the current rectangle is larger than the line word number, performing line feed processing on the rectangular name of the current rectangle;
and after traversing all rectangles in the rectangular tree graph, displaying the rectangular tree graph.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
In a typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include forms of volatile memory in a computer readable medium, Random Access Memory (RAM) and/or non-volatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM). The memory is an example of a computer-readable medium.
Computer-readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), Read Only Memory (ROM), Electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), Digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device. As defined herein, a computer readable medium does not include a transitory computer readable medium such as a modulated data signal and a carrier wave.
The above are merely examples of the present application and are not intended to limit the present application. Various modifications and changes may occur to those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.
Claims (10)
1. A method of processing a rectangular tree view, the method comprising:
traversing each rectangle in a rectangular tree diagram to be displayed, and obtaining the width of the current traversed rectangle, the character style of the rectangle name and the rectangle name, wherein the character style comprises the character size and the character spacing;
determining the line word number of the current rectangle according to the width of the current rectangle and the character style of the name of the current rectangle, wherein the line word number is the number of characters which can be contained in each line of the rectangle;
if the word number of the rectangular name of the current rectangle is larger than the line word number, performing line feed processing on the rectangular name of the current rectangle;
and after traversing all rectangles in the rectangular tree graph, displaying the rectangular tree graph.
2. The method of claim 1, wherein determining the row number of the current rectangle according to the width of the current rectangle and the text style of the name of the current rectangle comprises:
calculating the text space width corresponding to the current rectangle according to the text size and the text interval in the text style corresponding to the rectangle name of the current rectangle, wherein the text space width is the average width of each text occupying the rectangle;
and determining the row word number of the current rectangle based on the width of the current rectangle and the width of the word space.
3. The method of claim 1, wherein wrapping the name of the current rectangle comprises:
and adding a line feed character in the name of the rectangle of the current rectangle every other line word number characters.
4. The method of any one of claims 1 to 3, wherein before performing line wrapping processing on the rectangle name of the current rectangle if the word count of the rectangle name of the current rectangle is greater than the line word count, the method further comprises:
acquiring the height of the current rectangle;
determining the number of the words in the current rectangle according to the height of the current rectangle and the character style of the name of the current rectangle, wherein the number of the words in the current rectangle is the number of characters which can be accommodated in each column of the rectangle;
multiplying the row word number and the column word number to obtain the total number of characters which can be contained by the current rectangle;
if the word number of the rectangle name of the current rectangle is greater than the line word number, performing line feed processing on the rectangle name of the current rectangle, including:
and if the total number of the characters is more than or equal to the word number of the rectangular name of the current rectangle, performing line feed processing on the rectangular name of the current rectangle.
5. The method of claim 4, further comprising:
if the total number of the characters is less than the word number of the name of the current rectangle, replacing the character style corresponding to the name of the current rectangle according to the word number of the name of the current rectangle, the width of the current rectangle and the height of the current rectangle;
and performing line feed processing on the rectangle name of the current rectangle based on the changed character style.
6. An apparatus for processing a treemap, the apparatus comprising:
the traversal unit is used for traversing each rectangle in the rectangular tree diagram to be displayed to obtain the width of the traversed current rectangle, the character style of the rectangle name and the rectangle name, wherein the character style comprises the character size and the character spacing;
the determining unit is used for determining the row word number of the current rectangle according to the width of the current rectangle obtained by the traversing unit and the character style of the name of the current rectangle, wherein the row word number is the number of characters which can be contained in each row of the rectangle;
a processing unit, configured to perform line feed processing on the name of the current rectangle when the number of words of the name of the current rectangle is greater than the number of words of the line determined by the determining unit;
and the display unit is used for displaying the rectangular tree diagram after the processing unit finishes traversing all rectangles in the rectangular tree diagram.
7. The apparatus of claim 6, wherein the determining unit comprises:
the calculation module is used for calculating the text space width corresponding to the current rectangle according to the text size and the text interval in the text style corresponding to the rectangle name of the current rectangle, wherein the text space width is the average width of each text occupying the rectangle;
and the determining module is used for determining the row word number of the current rectangle based on the width of the current rectangle and the character space width obtained by the calculating module.
8. The apparatus of claim 6, wherein the processing unit is configured to add a line break character to the rectangle name of the current rectangle every other word of the line.
9. The apparatus of any one of claims 6 to 8, further comprising:
an obtaining unit, configured to obtain a height of the current rectangle before performing line feed processing on the name of the current rectangle if the number of words of the name of the current rectangle is greater than the number of words of the line;
the determining unit is further configured to determine the number of words in the current rectangle according to the height of the current rectangle and the text style of the name of the current rectangle, which are acquired by the acquiring unit, where the number of words in the current rectangle is the number of texts that can be accommodated in each column of the rectangle;
the operation unit is used for multiplying the row word number and the column word number obtained by the determination unit to obtain the total number of characters which can be contained in the current rectangle;
the processing unit is further configured to perform line feed processing on the name of the current rectangle when the total number of characters obtained by the operation unit is greater than or equal to the number of words of the name of the current rectangle.
10. The apparatus of claim 9, further comprising:
a replacing unit, configured to, when the arithmetic unit obtains that the total number of characters is less than the number of words of the name of the current rectangle, replace a character style corresponding to the name of the current rectangle according to the number of words of the name of the current rectangle, the width of the current rectangle, and the height of the current rectangle;
and the processing unit is also used for performing line feed processing on the rectangular name of the current rectangle based on the character style replaced by the replacing unit.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610052102.7A CN106997292A (en) | 2016-01-26 | 2016-01-26 | The method and apparatus for handling rectangle tree graph |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610052102.7A CN106997292A (en) | 2016-01-26 | 2016-01-26 | The method and apparatus for handling rectangle tree graph |
Publications (1)
Publication Number | Publication Date |
---|---|
CN106997292A true CN106997292A (en) | 2017-08-01 |
Family
ID=59428617
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201610052102.7A Pending CN106997292A (en) | 2016-01-26 | 2016-01-26 | The method and apparatus for handling rectangle tree graph |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN106997292A (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109522596A (en) * | 2018-10-15 | 2019-03-26 | 珠海格力电器股份有限公司 | Electric diagram generation method and electronic device |
CN111381822A (en) * | 2020-03-10 | 2020-07-07 | 四川长虹电器股份有限公司 | Implementation method of rectangular tree diagram component |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20030151613A1 (en) * | 1999-12-09 | 2003-08-14 | Takeshi Kanai | Information processing method and apparatus and medium |
CN101127035A (en) * | 2007-10-11 | 2008-02-20 | 金蝶软件(中国)有限公司 | Method and device drafting character string at targeted area |
CN102082930A (en) * | 2009-11-30 | 2011-06-01 | 新奥特(北京)视频技术有限公司 | Method and device for replacing caption text |
CN104915332A (en) * | 2015-06-15 | 2015-09-16 | 广东欧珀移动通信有限公司 | Method and device for generating composing template |
CN105159868A (en) * | 2015-09-01 | 2015-12-16 | 广东欧珀移动通信有限公司 | Text display method and system |
-
2016
- 2016-01-26 CN CN201610052102.7A patent/CN106997292A/en active Pending
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20030151613A1 (en) * | 1999-12-09 | 2003-08-14 | Takeshi Kanai | Information processing method and apparatus and medium |
CN101127035A (en) * | 2007-10-11 | 2008-02-20 | 金蝶软件(中国)有限公司 | Method and device drafting character string at targeted area |
CN102082930A (en) * | 2009-11-30 | 2011-06-01 | 新奥特(北京)视频技术有限公司 | Method and device for replacing caption text |
CN104915332A (en) * | 2015-06-15 | 2015-09-16 | 广东欧珀移动通信有限公司 | Method and device for generating composing template |
CN105159868A (en) * | 2015-09-01 | 2015-12-16 | 广东欧珀移动通信有限公司 | Text display method and system |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109522596A (en) * | 2018-10-15 | 2019-03-26 | 珠海格力电器股份有限公司 | Electric diagram generation method and electronic device |
CN111381822A (en) * | 2020-03-10 | 2020-07-07 | 四川长虹电器股份有限公司 | Implementation method of rectangular tree diagram component |
CN111381822B (en) * | 2020-03-10 | 2022-03-15 | 四川长虹电器股份有限公司 | Implementation method of rectangular tree diagram component |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
EP3618003B1 (en) | Method and apparatus for generating synthetic picture | |
CN107015788B (en) | Method and device for displaying images on mobile device in animation mode | |
CN105912227A (en) | Text information display method, device and mobile device | |
CN105373593B (en) | The method and device of object element in a kind of displayed web page | |
CN111428455B (en) | Form management method, device, equipment and storage medium | |
CN108460003B (en) | Text data processing method and device | |
CN109426415B (en) | Method and device for generating cascade selector | |
CN107168961B (en) | Data display method and device for chart | |
US9880086B2 (en) | Non-overlapping visualization of data records of a scatter plot | |
CN109857964B (en) | Thermodynamic diagram drawing method and device for page operation, storage medium and processor | |
CN106997292A (en) | The method and apparatus for handling rectangle tree graph | |
CN110020363A (en) | Draw the method and device of thermodynamic chart | |
CN110020291B (en) | Webpage layout processing method and device | |
CN109388306B (en) | Information display method and device | |
US20160370978A1 (en) | System, method, and apparatus for color selection | |
CN109522532B (en) | Method and device for calculating selection range of line drawing frame | |
CN109948083B (en) | Webpage processing method and device | |
CN111209066A (en) | Card layout method and device, electronic equipment and storage medium | |
CN112748917A (en) | Chart display method and device | |
CN106649348B (en) | Page form layout method and device | |
CN107818000B (en) | Operation method and device of page table | |
CN110020285B (en) | Histogram processing method and device | |
CN106610974B (en) | Webpage photo wall generation method and device | |
CN114281450B (en) | Chart visualization method, device, storage medium and processor | |
CN111381910A (en) | Thermodynamic diagram drawing method and device |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
CB02 | Change of applicant information | ||
CB02 | Change of applicant information |
Address after: 100083 No. 401, 4th Floor, Haitai Building, 229 North Fourth Ring Road, Haidian District, Beijing Applicant after: Beijing Guoshuang Technology Co.,Ltd. Address before: 100086 Cuigong Hotel, 76 Zhichun Road, Shuangyushu District, Haidian District, Beijing Applicant before: Beijing Guoshuang Technology Co.,Ltd. |
|
RJ01 | Rejection of invention patent application after publication | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20170801 |