3D dynamic display method, device, electronic device and storage medium of word cloud
By using 3D animation technology to generate a dynamic display method for word clouds in the front-end graph data visualization interface, the problem of dull word cloud display is solved and the user experience is improved.
Patent Information
- Application Number
- CN202210282932.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-22
- Publication Date
- 2025-02-21
- Estimated Expiration
- 2042-03-22
AI Technical Summary
The existing front-end graph data visualization interface displays word clouds in a 2D static manner, lacking dynamic effects, resulting in a poor user experience.
The method of generating word cloud data in 3D dynamic display utilizes 3D animation technology to dynamically display word cloud data in a container. This includes determining the target word cloud data, generating display information and text label information, and dynamically displaying the data by combining font color, coordinate position, transparency, and scaling information.
It improves the user experience by enhancing the dynamism and attractiveness of the interface through dynamic display.
Smart Images

Figure CN114648600B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of data visualization, and more specifically to a 3D dynamic display method, device, electronic device and storage medium for a word cloud. Background Art
[0002] The front-end graph data visualization interface is composed of many elements, such as maps, data charts, word clouds, etc.
[0003] The display mode of word cloud in the existing front-end graph data visualization interface is basically 2D, without dynamic effects. For large screens that require coolness, it appears rather dull and lacks flexibility, which greatly reduces the user experience.
[0004] Therefore, how to provide a 3D dynamic display mode for the word cloud to provide users with a better experience is a problem that needs to be solved urgently. Summary of the invention
[0005] In view of this, the present invention provides a 3D dynamic display method, device, electronic device and storage medium of a word cloud, aiming to improve user experience.
[0006] The first aspect of the present invention discloses a 3D dynamic display method of a word cloud, the method comprising:
[0007] Obtain input word cloud source data, wherein the word cloud source data includes a plurality of word cloud data;
[0008] Determine first target word cloud data and second target word cloud data from each of the word cloud data, wherein the first target word cloud data is the word cloud data with the largest value among each of the word cloud data, and the second target word cloud data is the word cloud data with the smallest value among each of the word cloud data;
[0009] For each word cloud data, generating display information of the word cloud data according to a preset word cloud container, a value of the word cloud data, a value of the first target word cloud data, and a value of the second target word cloud data;
[0010] Generating text label information corresponding to each word cloud data according to the display information of each word cloud data;
[0011] According to the text label information of each word cloud data, the business indicators corresponding to each word cloud data are dynamically displayed in the word cloud container in 3D by using 3D animation display technology.
[0012] Optionally, before determining the first target word cloud data and the second target word cloud data from each of the word cloud data, the method further includes:
[0013] Determining whether the data format of each word cloud data in the word cloud source data satisfies a preset data format, wherein each word cloud data includes a business indicator corresponding to the word cloud data and a value of the business indicator;
[0014] The step of determining the first target word cloud data and the second target word cloud data from each of the word cloud data includes:
[0015] In response to the data format of each word cloud data satisfying the preset data format, first target word cloud data and second target word cloud data are determined from each word cloud data.
[0016] Optionally, determining the first target word cloud data and the second target word cloud data from each of the word cloud data includes:
[0017] According to the value of each word cloud data, sort the word cloud data from large to small to obtain an indicator sequence;
[0018] The first word cloud data in the indicator sequence is used as the first target word cloud data, and the last word cloud data in the indicator sequence is used as the second target word cloud data.
[0019] Optionally, for each word cloud data, generating display information of the word cloud data according to a preset word cloud container, a value of the word cloud data, a value of the first target word cloud data, and a value of the second target word cloud data includes:
[0020] For each word cloud data, generating font size information of the word cloud data and transparency information of the word cloud data according to the value of the word cloud data, the value of the first target word cloud data and the value of the second target word cloud data;
[0021] Determining coordinate position information of the word cloud data and dynamic display information of the word cloud data according to a preset word cloud container, font size information of the word cloud data and a value of the word cloud data;
[0022] Using random numbers, generating scaling information of the word cloud data and a font color corresponding to the word cloud data;
[0023] The display information of the word cloud data is generated according to the transparency information of the word cloud data, the coordinate position information of the word cloud data, the dynamic display information of the word cloud data, the scaling information of the word cloud data, and the font color corresponding to the word cloud data.
[0024] Optionally, the calculating the font size information of the word cloud data and the transparency information of the word cloud data according to the value of the word cloud data, the value of the first target word cloud data and the value of the second target word cloud data includes:
[0025] Calculating a font size slope and a transparency slope respectively according to the value of the first target word cloud data and the value of the second target word cloud data;
[0026] Based on a first preset formula, generating font size information of the word cloud data according to the font size slope, the value of the first target word cloud data, and the value of the second target word cloud data;
[0027] Based on a second preset formula, transparency information of the word cloud data is generated according to the transparency slope, the value of the first target word cloud data, and the value of the second target word cloud data.
[0028] Optionally, determining the coordinate position information of the word cloud data and the dynamic display information of the word cloud data according to a preset word cloud container, the font size information of the word cloud data and the value of the word cloud data includes:
[0029] Calculate the width and height of the preset word cloud container;
[0030] According to the height of the word cloud container and the preset height of each row, the total number of rows of the word cloud container is calculated, and a corresponding word cloud array is initialized according to the total number of rows of the word cloud container, wherein the number of rows of the word cloud array is equal to the total number of rows;
[0031] Calculating the character length of the word cloud data according to the font size information of the word cloud data and the value of the word cloud data;
[0032] Randomly determine a target row from the word cloud array, and store the word cloud data character length in the target row, wherein the target row is any row in the word cloud array whose current character length is not less than the word cloud data character length;
[0033] Acquire position information of the word cloud data in the target row, and determine a position index corresponding to the word cloud data in the target row according to the position information;
[0034] Calculate the median of the word cloud array according to the total number of rows;
[0035] Generate coordinate position information of the word cloud data according to the position index, the median line of the word cloud array, the row number corresponding to the target row, and the font size information of the word cloud data;
[0036] The word cloud container is divided into regions, and dynamic display information of the word cloud data is generated according to the obtained region information, the width of the word cloud container, the number of rows corresponding to the target row, the position index, and the font size information of the word cloud data.
[0037] Optionally, the using of random numbers to generate scaling information of the word cloud data and font color corresponding to the word cloud data includes:
[0038] Generate a color value index of the word cloud data according to a random number;
[0039] According to the color value index, determine a target color value corresponding to the color value index from various preset color values, and determine a font color corresponding to the word cloud data according to the target color value;
[0040] generating a scaling value of the word cloud data according to the random number;
[0041] The scaling information of the word cloud data is generated according to the scaling value and a plurality of preset 3D display styles.
[0042] A second aspect of the present invention discloses a 3D dynamic display device for a word cloud, the device comprising:
[0043] A word cloud source data acquisition unit, used to obtain input word cloud source data, wherein the word cloud source data includes a plurality of word cloud data;
[0044] A first determining unit is used to determine first target word cloud data and second target word cloud data from each of the word cloud data, wherein the first target word cloud data is the word cloud data with the largest value among each of the word cloud data, and the second target word cloud data is the word cloud data with the smallest value among each of the word cloud data;
[0045] A display information generating unit, for each of the word cloud data, generating display information of the word cloud data according to a preset word cloud container, a value of the word cloud data, a value of the first target word cloud data, and a value of the second target word cloud data;
[0046] A label information generating unit, configured to generate text label information corresponding to each word cloud data according to the display information of each word cloud data;
[0047] The 3D dynamic display unit is used to dynamically display the business indicators corresponding to each word cloud data in the word cloud container by using 3D animation display technology according to the text label information of each word cloud data.
[0048] The third aspect of the present invention discloses an electronic device, which includes a processor and a memory, wherein the memory is used to store program code and data for 3D dynamic display of a word cloud, and the processor is used to call the program instructions in the memory to execute a 3D dynamic display method of a word cloud as disclosed in the first aspect of the present invention.
[0049] The fourth aspect of the present invention discloses a storage medium, characterized in that the storage medium includes a storage program, wherein when the program is running, the device where the storage medium is located is controlled to execute a 3D dynamic display method of a word cloud as disclosed in the first aspect of the present invention.
[0050] The present invention provides a 3D dynamic display method, device, electronic device and storage medium of a word cloud. After input word cloud source data is obtained, the word cloud data with the largest value among each word cloud data in the obtained word cloud source data is determined as the first target word cloud data, and the word cloud data with the smallest value among each word cloud data is determined as the second target word cloud data. Then, for each word cloud data, display information of the word cloud data can be generated according to a preset word cloud container, the value of the word cloud data, the value of the first target word cloud data and the value of the second target word cloud data, so as to display information according to each word cloud data and generate text label information corresponding to each word cloud data. Finally, according to the text label information of each word cloud data, the business indicators corresponding to each word cloud data are 3D dynamically displayed in the word cloud container, thereby improving the user experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0051] 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 embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.
[0052] Figure 1 A schematic diagram of a flow chart of a 3D dynamic display method of a word cloud provided by an embodiment of the present invention;
[0053] Figure 2 A flowchart of a method for generating display information of word cloud data according to a preset word cloud container, a value of word cloud data, a value of first target word cloud data, and a value of second target word cloud data provided by an embodiment of the present invention;
[0054] Figure 3 A flow chart of a method for determining coordinate position information of word cloud data and dynamic display information of word cloud data according to a preset word cloud container, font size information of word cloud data and numerical value of word cloud data provided by an embodiment of the present invention;
[0055] Figure 4 An example diagram of initializing a line[N] array according to the total number of lines of a preset word cloud container provided by an embodiment of the present invention;
[0056] Figure 5 An example diagram of an embodiment of the present invention for determining the median of a word cloud array by dividing the total number of rows in a word cloud container by 2 and rounding up;
[0057] Figure 6 An example diagram of dividing a word cloud array area into four areas provided in an embodiment of the present invention;
[0058] Figure 7a-Figure 7b A rendering of a 3D dynamic display method of a word cloud provided by an embodiment of the present invention;
[0059] Figure 8 A structural schematic diagram of a 3D dynamic display method of a word cloud provided by an embodiment of the present invention;
[0060] Fig. 9 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0061] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0062] The term "including" and its variations used herein are open inclusions, i.e., "including but not limited to". The term "based on" means "based at least in part on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". The relevant definitions of other terms will be given in the following description.
[0063] It should be noted that the concepts such as "first" and "second" mentioned in the disclosure of the present invention are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.
[0064] It should be noted that the modifications of "one" and "plurality" mentioned in the disclosure of the present invention are illustrative rather than restrictive, and those skilled in the art should understand that unless otherwise clearly indicated in the context, it should be understood as "one or more".
[0065] See also Figure 1 , shows a flow chart of a 3D dynamic display method of a word cloud provided by an embodiment of the present invention, and the 3D dynamic display method of the word cloud specifically comprises the following steps:
[0066] S101: Obtain input word cloud source data, and determine whether the data format of each word cloud data in the input word cloud source data satisfies a preset data format; if the data format of each word cloud data satisfies the preset data format of the word cloud data, execute step S102.
[0067] In an embodiment of the present application, a preset data format is pre-set, and the pre-set data format can be {"word": string; "value": number}[], wherein word is the display name of the word cloud data, that is, a business indicator, and value is the numerical value of the word cloud data.
[0068] It should be noted that the numerical value of the word cloud data may be a pixel value.
[0069] For example, a business indicator of a word cloud data may be JD.com, Taobao, Alipay, etc. If the business indicator of the word cloud data is JD.com, correspondingly, the pixel value of the word cloud data may be 28, that is, the value of the word cloud data is 28.
[0070] In the specific process of executing step S101, when input word cloud source data is detected, the input word cloud data is obtained, and it is determined whether the data format of each word cloud data in the input word cloud source data satisfies the pre-set preset data format. When each word cloud data in the word cloud source data satisfies the pre-set preset data format, step S102 is executed.
[0071] It should be noted that if there is any word cloud data in the word cloud source data that does not meet the preset data format, this process is terminated.
[0072] S102: Determine first target word cloud data and second target word cloud data from each word cloud data.
[0073] Among them, the first target word cloud data of the word cloud data is the word cloud data with the largest value among all the word cloud data, and the second target word cloud data of the word cloud data is the word cloud data with the smallest value among all the word cloud data.
[0074] Optionally, as a preferred method of an embodiment of the present application, when the data format of each word cloud data in the input word cloud source data satisfies a pre-set preset data format, the word cloud data are sorted from large to small according to the numerical value of each word cloud data to obtain an indicator sequence; the first word cloud data in the indicator sequence is used as the first target word cloud data, and the last word cloud data in the indicator sequence is used as the second target word cloud data, that is, the word cloud data with the largest numerical value among all the word cloud data is determined as the first target word cloud data, and the word cloud data with the smallest numerical value among all the word cloud data is determined as the second target word cloud data.
[0075] As another preferred method of the embodiment of the present application, when the data format of each word cloud data in the input word cloud source data satisfies the pre-set preset data format, each word cloud data can also be sorted from small to large according to the numerical value of each word cloud data to obtain an indicator sequence; at this time, the first word cloud data in the indicator sequence can be used as the second target word cloud data, and the last word cloud data in the indicator sequence can be used as the first target word cloud data.
[0076] S103: For each word cloud data, display information of the word cloud data is generated according to a preset word cloud container, a value of the word cloud data, a value of the first target word cloud data, and a value of the second target word cloud data.
[0077] The display information of the word cloud data includes at least the font color, coordinate position information, transparency information, scaling information and dynamic display information corresponding to the word cloud data.
[0078] In the embodiment of the present application, for each word cloud data, a method of generating display information of the word cloud data is performed according to the preset word cloud container, the value of the word cloud data, the value of the first target word cloud data, and the value of the second target word cloud data, such as Figure 2 As shown, the specific steps include:
[0079] S201: For each word cloud data, calculate the font size information and transparency information of the word cloud data according to the value of the word cloud data, the value of the first target word cloud data of the word cloud data and the value of the second target word cloud data of the word cloud data.
[0080] In the specific process of executing step S201, after determining the first target word cloud data and the second target word cloud data from each word cloud data, the font size slope and the transparency slope can be calculated respectively according to the values of the first target word cloud data and the values of the second target word cloud data.
[0081] In the embodiment of the present application, the font size slope is calculated according to the value of the first target word cloud data and the value of the second target word cloud data, as shown in formula (1); the transparency slope is calculated according to the value of the first target word cloud data and the value of the second target word cloud data, as shown in formula (2). Wherein, formula (1) and formula (2) are as follows.
[0082]
[0083] Among them, fontRate is the font size slope, maxFont is the preset maximum font size value, minFont is the preset minimum font size value, maxValue is the value of the first target word cloud data, and minValue is the value of the second target word cloud data.
[0084]
[0085] Among them, ocRate is the transparency slope, maxValue is the value of the first target word cloud data, minValue is the value of the second target word cloud data, 0.2 is the minimum transparency, and 1 is the maximum transparency. The closer the transparency is to 1, the clearer the business indicators in the word cloud data are. That is, the closer the transparency is to 1, the clearer the business indicators in the word cloud data are displayed in the word cloud container.
[0086] In the embodiment of the present application, for each word cloud data, after calculating the font size slope and transparency slope corresponding to the word cloud data, the font size information of the word cloud data can be calculated based on the first preset formula according to the font size slope, the value of the first target word cloud data and the value of the second target word cloud data; based on the second preset formula, the transparency information of the word cloud data can be calculated according to the transparency slope, the value of the first target word cloud data and the value of the second target word cloud data. The first preset formula is shown in formula (3), and the second preset formula is shown in formula (4).
[0087] fontSize=value-fontRate+(minFont-minVaue*fontRate) (3)
[0088] Wherein, value is the value of the word cloud data, fontRate is the font size slope of the word cloud data, minFont is the preset minimum font size value, minValue is the value of the second target word cloud data, and fontSize is the font size information of the word cloud data. The font size information includes the font size of the business indicator in the word cloud data.
[0089] Rate=value*coRate+(0.2-minVaue*ocRate) (4)
[0090] Wherein, value is the value of the word cloud data, ocRate is the transparency slope of the word cloud data, minValue is the value of the second target word cloud data, and Rate is the transparency information of the word cloud data. The transparency information includes the transparency of the business indicators in the word cloud data.
[0091] S202: Determine coordinate position information of the word cloud data and dynamic display information of the word cloud data according to a preset word cloud container, font size information of the word cloud data, and numerical value of the word cloud data.
[0092] In the embodiment of the present application, for each word cloud data, the coordinate position information of the word cloud data and the dynamic display information of the word cloud data are determined according to the preset word cloud container, the font size information of the word cloud data and the value of the word cloud data, such as Figure 3 As shown, the specific steps include:
[0093] S301: Calculate the width and height of a preset word cloud container.
[0094] In the embodiment of the present application, a word cloud container is pre-set, and the pre-set word cloud container is used to display the business indicators corresponding to each word cloud data in the word cloud source data.
[0095] In the specific process of executing step S301, the width and height of the preset word cloud container may be calculated by a tool, for example, the tool may be getBoundingClientRect of CSS.
[0096] S302: Calculate the total number of rows in the word cloud container according to the height of the word cloud container and the preset height of each row, and initialize a corresponding word cloud array according to the total number of rows in the word cloud container, wherein the number of rows in the word cloud array is equal to the total number of rows in the word cloud data.
[0097] In the specific process of executing step S302, the total number of lines of the preset word cloud container is calculated according to the calculated height of the word cloud container and the preset height of each line, so as to initialize the line[N] array according to the total number of lines of the preset word cloud container, such as Figure 4 As shown, each line in the line[N] array is used to store the word length of each line.
[0098] The number of rows in the word cloud array is equal to the total number of rows in the word cloud container.
[0099] S303: Calculate the character length of the word cloud data according to the font size information of the word cloud data and the value of the word cloud data.
[0100] In the specific process of executing step S303, the character length of the word cloud data is calculated according to the font size information of the word cloud data and the value of the word cloud data, as shown in formula (5).
[0101] L = fontSize * value + x (5)
[0102] Among them, fontSize is the font size information of the word cloud data, value is the numerical value of the word cloud data, and x is the offset.
[0103] It should be noted that x can be set to 4.
[0104] S304: Randomly determine a target row from the word cloud array, and store the text length in the target row.
[0105] The target behavior is any row in the word cloud array whose current word length is not less than the text length of the word cloud data.
[0106] In the specific process of executing step S304, a target row whose current word length is not less than the text length of the word cloud data is randomly determined from each row of the word cloud array, so that the text length of the word cloud data is stored in the target row.
[0107] S305: Acquire the position information of the word cloud data in the target row, and determine the position index corresponding to the word cloud data in the target row according to the position information.
[0108] In the specific process of executing step S305, the position information of the word cloud data in the target row is obtained according to the position where the text length of the word cloud data is stored in the target row, and the position index corresponding to the word cloud data in the target row is determined according to the position information of the word cloud data.
[0109] For example, the target row storing the text length of word cloud data is the first row in the word cloud array, the target row stores the text length of 3 word cloud data, the position where the text length of the word cloud data is stored in the target row is the first, and the position information of the word cloud data in the target row is (0,0), and then the corresponding position index in the target row can be 0 according to the obtained position information (0,0) of the word cloud data.
[0110] S306: Calculate the median of the word cloud array according to the total number of rows.
[0111] In the specific process of executing step S306, the total number of rows in the word cloud container is divided by 2, and the result is rounded up to determine the median of the word cloud array, such as Figure 5 shown.
[0112] S307: Generate coordinate position information of the word cloud data according to the word cloud data position index, the median line of the word cloud array of the word cloud data, the row number corresponding to the target row of the word cloud data and the font size information of the word cloud data.
[0113] In the specific process of executing step S307, the X coordinate corresponding to the word cloud data is determined according to the word cloud data position index, the font size information of the word cloud data, the number of rows corresponding to the target row of the word cloud data, and the width of the word cloud data word cloud container; the Y coordinate corresponding to the word cloud data is determined according to the number of rows corresponding to the target row of the word cloud data, the height of the word cloud data word cloud container, and the median line of the word cloud array; and the position coordinate information of the word cloud data is generated according to the X coordinate of the word cloud data and the Y coordinate of the word cloud data.
[0114] Among them, according to the word cloud data position index, the number of rows corresponding to the word cloud data target row and the width of the word cloud data word cloud container, the method of determining the X coordinate corresponding to the word cloud data is shown in formula (6); according to the number of rows corresponding to the word cloud data target row, the height of the word cloud data word cloud container and the median line of the word cloud array, the method of determining the Y coordinate corresponding to the word cloud data is shown in formula (7).
[0115] X=w / 2+(index%2)===0? line[lineNum]:-1*line[line*Num] (6)
[0116] Among them, X is the X coordinate of the word cloud data, index is the position index corresponding to the word cloud data, line[] is the font size information of the word cloud data, and lineNum is the row number of the target row in the word cloud array.
[0117] It should be noted that, if index%2 is 0, then X=w / 2+line[lineNum]; if index%2 is not 0, then X=w / 2-1*line[lineNum].
[0118] It should be noted that if the target row is an even number in the word cloud array, that is, lineNum is an even number, then the business indicators corresponding to the word cloud data are distributed on the right side of the word cloud container; if the target row is an odd number in the word cloud array, that is, lineNum is an odd number, then the business indicators corresponding to the word cloud data are distributed on the left side of the word cloud container.
[0119] Y=h / 2+(lineNum%2)===0? baseH:-1*baseH (7)
[0120] Among them, Y is the Y coordinate of the word cloud data, lineNum is the row number of the target row in the word cloud array, and baseH is the median line of the word cloud array.
[0121] It should be noted that if ilineNum%2 is 0, then Y=h / 2+baseH; if index%2 is not 0, then Y=h / 2-1*baseH.
[0122] It should be noted that if the target row is an even number in the word cloud array, that is, lineNum is an even number, then the business indicators corresponding to the word cloud data are distributed at the bottom of the word cloud container; if the target row is an odd number in the word cloud array, that is, lineNum is an odd number, then the business indicators corresponding to the word cloud data are distributed at the top of the word cloud container.
[0123] S308: Divide the word cloud array of the word cloud data into regions, and generate dynamic display information of the word cloud data according to the obtained region information, the width of the word cloud container, the number of rows corresponding to the target row of the word cloud data, the position index of the word cloud data, and the font size information of the word cloud data.
[0124] In the specific process of executing step S307, the word cloud array is divided into regions. Specifically, it can be divided into four regions, namely L1, L2, R1, and R2. Figure 6 As shown; based on the width of the word cloud container, the area information of the word cloud data, the number of rows corresponding to the target row of the word cloud data, the position index of the word cloud data, and the font size information of the word cloud data, the dynamic display sub-information of the word cloud data is generated, and based on the area information of the word cloud data and the dynamic display sub-information of the word cloud data, the corresponding movement information of the word cloud data is generated, so as to generate the dynamic display information of the word cloud data based on the generated dynamic display sub-information and the movement information.
[0125] Among them, according to the width of the word cloud container, the area information, the number of rows corresponding to the target row of the word cloud data, the position index of the word cloud data, and the font size information of the word cloud data, a method of generating dynamic display sub-information of the word cloud data is shown in formula (8).
[0126] index%2===0? line[lineNum]>w / 4? "R2":"R1":line[lineNum]>w / 4? "L1":"L2" (8)
[0127] Among them, w is the width of the word cloud container, index is the position index corresponding to the word cloud data, line[] is the font size information of the word cloud data, and lineNum is the row number of the target row in the word cloud array.
[0128] It should be noted that, if index%2 is 0, the dynamic display sub-information of the word cloud data is determined by line[lineNum]>w / 4? "R2":"R1". If line[lineNum] is greater than w / 4, it can be determined that the dynamic display sub-information of the word cloud data is "R2", and the movement information generated according to the dynamic display sub-information of the word cloud data can be moving slowly from the right side from large to small to the middle position; if line[lineNum] is not greater than w / 4, it can be determined that the dynamic display sub-information of the word cloud data is "R1", and the movement information generated according to the dynamic display sub-information of the word cloud data can be moving slowly from the right side from large to small to the middle position.
[0129] If index%2 is not 0, the dynamic display sub-information of the word cloud data is determined by line[lineNum]>w / 4? "L1":"L2". If line[lineNum] is greater than w / 4, it can be determined that the dynamic display sub-information of the word cloud data is "L1", and the movement information generated according to the dynamic display sub-information of the word cloud data can be moving slowly from the left side from large to small to the middle position; if line[lineNum] is not greater than w / 4, it can be determined that the dynamic display sub-information of the word cloud data is "L2", and the movement information generated according to the dynamic display sub-information of the word cloud data can be moving slowly from the left side from large to small to the middle position.
[0130] S203: Generate scaling information of the word cloud data and font color corresponding to the word cloud data using random numbers.
[0131] In the embodiment of the present application, multiple color values may be preset, each color value corresponding to a different color. For example, 10 color values may be preset.
[0132] In an embodiment of the present application, a color value index of word cloud data is randomly generated according to a random number, and based on the color value index of the word cloud data, a target color value corresponding to the color value index of the word cloud data is determined from various pre-set color values, so as to determine the font color corresponding to the word cloud data according to the target color value of the word cloud data.
[0133] In an embodiment of the present application, a scaling value of the word cloud data is generated according to a random number of the word cloud data; scaling information of the word cloud data is generated according to the scaling value of the word cloud data combined with a plurality of pre-set 3D display styles.
[0134] It should be noted that the preset multiple 3D display styles may be two styles: transform:scale(0.2); transform-style:preserve-3d.
[0135] It should be noted that the scaling value of the word cloud data can be any value between 0.6 and 1.2. The closer the scaling value is to 0.6, the shallower the business indicators of the word cloud data are displayed in the word cloud container, and the closer the scaling value is to 1.2, the deeper the business indicators of the word cloud data are displayed in the word cloud container.
[0136] S204: generating display information of the word cloud data according to transparency information of the word cloud data, coordinate position information of the word cloud data, dynamic display information of the word cloud data, scaling information of the word cloud data, and font color corresponding to the word cloud data.
[0137] S104: Generate text label information corresponding to each word cloud data according to the display information of each word cloud data.
[0138] In the specific process of executing step S104, the svg->text rendering method is adopted to traverse the font color, coordinate position information, transparency information, scaling information and word cloud data dynamic display information corresponding to each word cloud data to generate text label information corresponding to each word cloud data.
[0139] S105: Based on the text label information of each word cloud data, the business indicators corresponding to each word cloud data are dynamically displayed in the word cloud container by using 3D animation display technology.
[0140] In the specific process of executing step S105, the text label information of each word cloud data is dynamically displayed in the word cloud data container in 3D by using the CSS3 style sheet and animation attributes using the 3D animation display technology.
[0141] It should be noted that 3D animation display technology can be CSS3 animations technology, which can convert from one CSS3 style configuration to another CSS3 style configuration. Animation animations include two parts: style rules that describe the animation and keyframes that are used to specify the styles of the start, end, and midpoints of the animation.
[0142] It should be noted that the business indicators corresponding to each word cloud data are displayed in the word cloud container in the form of text of different sizes, brightness and darkness; from the front to the deepest, from the brightest to the darkest, and then back and forth. Figure 7a-Figure 7b shown.
[0143] The present invention provides a 3D dynamic display method for a word cloud. After input word cloud source data is obtained, the word cloud data with the largest value among various word cloud data in the obtained word cloud source data is determined as the first target word cloud data, and the word cloud data with the smallest value among various word cloud data is determined as the second target word cloud data. Then, for each word cloud data, display information of the word cloud data can be generated according to a preset word cloud container, the value of the word cloud data, the value of the first target word cloud data, and the value of the second target word cloud data, so as to display information according to each word cloud data and generate text label information corresponding to each word cloud data. Finally, according to the text label information of each word cloud data, the business indicators corresponding to each word cloud data are 3D dynamically displayed in the word cloud container, thereby improving the user experience.
[0144] Based on a 3D dynamic display method of a word cloud disclosed in an embodiment of the present application, an embodiment of the present invention also discloses a 3D dynamic display device of a word cloud, such as Figure 8 As shown, the 3D dynamic display device of a word cloud includes:
[0145] A word cloud source data acquisition unit 81 is used to obtain input word cloud source data, wherein the word cloud source data includes a plurality of word cloud data;
[0146] A first determining unit 82 is used to determine first target word cloud data and second target word cloud data from each word cloud data, wherein the first target word cloud data is the word cloud data with the largest value among each word cloud data, and the second target word cloud data is the word cloud data with the smallest value among each word cloud data;
[0147] A display information generating unit 83 is used to generate display information of the word cloud data for each word cloud data according to a preset word cloud container, a value of the word cloud data, a value of the first target word cloud data, and a value of the second target word cloud data, wherein the display information at least includes font color, coordinate position information, transparency information, scaling information, and dynamic display information corresponding to the word cloud data;
[0148] The label information generating unit 84 is used to generate text label information corresponding to each word cloud data according to the font color, coordinate position information, transparency information, scaling information and dynamic display information corresponding to each word cloud data;
[0149] The 3D dynamic display unit 85 is used to dynamically display the business indicators corresponding to each word cloud data in the word cloud container in 3D by using 3D animation display technology according to the text label information of each word cloud data.
[0150] The specific principles and execution processes of each unit in the 3D dynamic display device of the word cloud disclosed in the above embodiment of the present invention are the same as those of the 3D dynamic display method of the word cloud disclosed in the above embodiment of the present invention. Please refer to the corresponding parts of the 3D dynamic display method of the word cloud disclosed in the above embodiment of the present invention, and will not be repeated here.
[0151] The present invention provides a 3D dynamic display device for a word cloud. After acquiring input word cloud source data, the word cloud data with the largest value among various word cloud data in the acquired word cloud source data is determined as the first target word cloud data, and the word cloud data with the smallest value among various word cloud data is determined as the second target word cloud data. Then, for each word cloud data, display information of the word cloud data can be generated according to a preset word cloud container, the value of the word cloud data, the value of the first target word cloud data, and the value of the second target word cloud data, so as to display information according to each word cloud data and generate text label information corresponding to each word cloud data. Finally, according to the text label information of each word cloud data, the business indicators corresponding to each word cloud data are 3D dynamically displayed in the word cloud container, thereby improving the user experience.
[0152] Optionally, the 3D dynamic display device of the word cloud provided by the present invention further includes:
[0153] A judgment unit, used to judge whether the data format of each word cloud data in the word cloud source data satisfies the preset data format, and each word cloud data of the business indicator includes a business indicator corresponding to the word cloud data and a value of the business indicator;
[0154] The first determining unit is further configured to determine the first target word cloud data and the second target word cloud data from each word cloud data in response to the data format of each word cloud data satisfying the preset data format.
[0155] Optionally, the first determining unit includes:
[0156] A sorting unit is used to sort each word cloud data from large to small according to the value of each word cloud data to obtain an indicator sequence;
[0157] The second determining unit is used to use the first word cloud data in the business indicator sequence as the first target word cloud data, and use the last word cloud data in the business indicator sequence as the second target word cloud data.
[0158] Optionally, the display information generating unit includes:
[0159] A font size information and transparency information generating unit, for generating, for each word cloud data, font size information of the word cloud data and transparency information of the word cloud data according to the value of the word cloud data, the value of the first target word cloud data, and the value of the second target word cloud data;
[0160] A third determining unit is used to determine the coordinate position information of the word cloud data and the dynamic display information of the word cloud data according to the preset word cloud container, the font size information of the word cloud data and the value of the word cloud data;
[0161] A scaling information and font color generating unit, used to generate scaling information of word cloud data and font color corresponding to the word cloud data using random numbers;
[0162] The display information generating subunit is used to generate display information of the word cloud data according to transparency information of the word cloud data, coordinate position information of the word cloud data, dynamic display information of the word cloud data, scaling information of the word cloud data, and font color corresponding to the word cloud data.
[0163] Optionally, the font size information and transparency information generating unit includes:
[0164] A slope calculation unit, used to calculate a font size slope and a transparency slope according to a value of the first target word cloud data and a value of the second target word cloud data;
[0165] A font size information generating unit, configured to calculate the font size information of the word cloud data based on a first preset formula, according to the font size slope, the value of the first target word cloud data, and the value of the second target word cloud data;
[0166] The transparency group information generating unit is used to calculate the transparency information of the word cloud data based on the second preset formula according to the transparency slope, the value of the first target word cloud data and the value of the second target word cloud data.
[0167] Optionally, the third determining unit includes:
[0168] A word cloud container width and height calculation unit, used to calculate the width and height of a preset word cloud container;
[0169] A total row number calculation unit, used to calculate the total number of rows in the word cloud container according to the height of the word cloud container and the preset row height of each row, and initialize a corresponding word cloud array according to the total number of rows in the word cloud container, wherein the number of rows in the word cloud array is equal to the total number of rows;
[0170] A character length calculation unit, used for calculating the character length of the word cloud data according to the font size information of the word cloud data and the value of the word cloud data;
[0171] A storage unit, used to randomly determine a target row from the word cloud array, and store the word cloud data character length in the target row, wherein the target row is any row in the word cloud array whose current character length is not less than the word cloud data character length;
[0172] An acquisition unit, used to acquire position information of the word cloud data in the target row, and determine a position index corresponding to the word cloud data in the target row according to the position information;
[0173] The median calculation unit is used to calculate the median of the word cloud array according to the total number of rows;
[0174] A coordinate position information generating unit, used for generating coordinate position information of the word cloud data according to the position index, the median line of the word cloud array, the number of rows corresponding to the target row and the font size information of the word cloud data;
[0175] The dynamic display information generating unit is used to divide the word cloud container into regions, and generate dynamic display information of the word cloud data according to the obtained region information, the width of the word cloud container, the number of rows corresponding to the target row, the position index, and the font size information of the word cloud data.
[0176] Optional, scaling information and font color generation unit, including:
[0177] A color value index generating unit, used for generating a color value index of word cloud data according to a random number;
[0178] A fourth determining unit, configured to determine, according to the color value index, a target color value corresponding to the color value index from various preset color values, and determine a font color corresponding to the word cloud data according to the target color value;
[0179] A scaling value generating unit, used for generating a scaling value of the word cloud data according to a random number;
[0180] The scaling information generating unit is used to generate scaling information of the word cloud data according to the scaling value and a plurality of preset 3D display styles.
[0181] The present application embodiment provides an electronic device, such as Fig. 9 As shown, the electronic device includes a processor 901 and a memory 902, the memory 902 is used to store program codes and data for 3D dynamic display of word clouds, and the processor 901 is used to call program instructions in the memory to execute the steps shown in the 3D dynamic display method of word clouds in the above embodiment.
[0182] An embodiment of the present application provides a storage medium, which includes a stored program, wherein when the program is running, the device where the storage medium is located is controlled to execute the 3D dynamic display method of the word cloud shown in the above embodiment.
[0183] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system or system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment. The system and system embodiments described above are merely schematic, in which the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.
[0184] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.
[0185] The above description of the disclosed embodiments enables one skilled in the art to implement or use the present invention. Various modifications to these embodiments will be apparent to one skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features disclosed herein.
[0186] The above are only preferred embodiments of the present invention. It should be pointed out that, for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.
Claims
1. A 3D dynamic display method of a word cloud, characterized in that: The method comprises: Obtain input word cloud source data, wherein the word cloud source data includes a plurality of word cloud data; Determine first target word cloud data and second target word cloud data from each of the word cloud data, wherein the first target word cloud data is the word cloud data with the largest value among each of the word cloud data, and the second target word cloud data is the word cloud data with the smallest value among each of the word cloud data; For each word cloud data, calculating the font size information of the word cloud data and the transparency information of the word cloud data according to the value of the word cloud data, the value of the first target word cloud data and the value of the second target word cloud data; Determining coordinate position information of the word cloud data and dynamic display information of the word cloud data according to a preset word cloud container, font size information of the word cloud data and a value of the word cloud data; Using random numbers, generating scaling information of the word cloud data and a font color corresponding to the word cloud data; Generate display information of the word cloud data according to transparency information of the word cloud data, coordinate position information of the word cloud data, dynamic display information of the word cloud data, scaling information of the word cloud data, and font color corresponding to the word cloud data; Generating text label information corresponding to each word cloud data according to the display information of each word cloud data; According to the text label information of each word cloud data, the business indicators corresponding to each word cloud data are dynamically displayed in the word cloud container in 3D by using 3D animation display technology.
2. The method according to claim 1, characterized in that Before determining the first target word cloud data and the second target word cloud data from each of the word cloud data, the method further includes: Determine whether the data format of each word cloud data in the word cloud source data satisfies a preset data format, wherein each word cloud data includes a business indicator corresponding to the word cloud data and a value of the business indicator; The step of determining the first target word cloud data and the second target word cloud data from each of the word cloud data includes: In response to the data format of each word cloud data satisfying the preset data format, first target word cloud data and second target word cloud data are determined from each word cloud data.
3. The method according to claim 1, characterized in that The step of determining the first target word cloud data and the second target word cloud data from each of the word cloud data includes: According to the value of each word cloud data, sort the word cloud data from large to small to obtain an indicator sequence; The first word cloud data in the indicator sequence is used as the first target word cloud data, and the last word cloud data in the indicator sequence is used as the second target word cloud data.
4. The method according to claim 1, characterized in that: The calculating, according to the value of the word cloud data, the value of the first target word cloud data and the value of the second target word cloud data, the font size information of the word cloud data and the transparency information of the word cloud data comprises: Calculating a font size slope and a transparency slope respectively according to the value of the first target word cloud data and the value of the second target word cloud data; Based on a first preset formula, generating font size information of the word cloud data according to the font size slope, the value of the first target word cloud data, and the value of the second target word cloud data; Based on a second preset formula, transparency information of the word cloud data is generated according to the transparency slope, the value of the first target word cloud data, and the value of the second target word cloud data.
5. The method according to claim 4, characterized in that The determining, according to the preset word cloud container, the font size information of the word cloud data and the value of the word cloud data, the coordinate position information of the word cloud data and the dynamic display information of the word cloud data comprises: Calculate the width and height of the preset word cloud container; According to the height of the word cloud container and the preset height of each row, the total number of rows of the word cloud container is calculated, and a corresponding word cloud array is initialized according to the total number of rows of the word cloud container, wherein the number of rows of the word cloud array is equal to the total number of rows; Calculating the character length of the word cloud data according to the font size information of the word cloud data and the value of the word cloud data; Randomly determine a target row from the word cloud array, and store the word cloud data character length in the target row, wherein the target row is any row in the word cloud array whose current character length is not less than the word cloud data character length; Acquire position information of the word cloud data in the target row, and determine a position index corresponding to the word cloud data in the target row according to the position information; Calculate the median of the word cloud array according to the total number of rows; Generate coordinate position information of the word cloud data according to the position index, the median line of the word cloud array, the row number corresponding to the target row, and the font size information of the word cloud data; The word cloud container is divided into regions, and dynamic display information of the word cloud data is generated according to the obtained region information, the width of the word cloud container, the number of rows corresponding to the target row, the position index, and the font size information of the word cloud data.
6. The method according to claim 1, characterized in that The step of using random numbers to generate scaling information of the word cloud data and font colors corresponding to the word cloud data includes: Generate a color value index of the word cloud data according to a random number; According to the color value index, determine a target color value corresponding to the color value index from various preset color values, and determine a font color corresponding to the word cloud data according to the target color value; generating a scaling value of the word cloud data according to the random number; The scaling information of the word cloud data is generated according to the scaling value and a plurality of preset 3D display styles.
7. A 3D dynamic display device for word cloud, characterized in that: The device comprises: A word cloud source data acquisition unit, used to obtain input word cloud source data, wherein the word cloud source data includes a plurality of word cloud data; A first determining unit is used to determine first target word cloud data and second target word cloud data from each of the word cloud data, wherein the first target word cloud data is the word cloud data with the largest value among each of the word cloud data, and the second target word cloud data is the word cloud data with the smallest value among each of the word cloud data; The display information generating unit is used to calculate the font size information of the word cloud data and the transparency information of the word cloud data according to the numerical value of the word cloud data, the numerical value of the first target word cloud data and the numerical value of the second target word cloud data for each word cloud data; determine the coordinate position information of the word cloud data and the dynamic display information of the word cloud data according to the preset word cloud container, the font size information of the word cloud data and the numerical value of the word cloud data; generate the scaling information of the word cloud data and the font color corresponding to the word cloud data by using random numbers; generate the display information of the word cloud data according to the transparency information of the word cloud data, the coordinate position information of the word cloud data, the dynamic display information of the word cloud data, the scaling information of the word cloud data and the font color corresponding to the word cloud data; A label information generating unit, configured to generate text label information corresponding to each word cloud data according to the display information of each word cloud data; The 3D dynamic display unit is used to dynamically display the business indicators corresponding to each word cloud data in the word cloud container by using 3D animation display technology according to the text label information of each word cloud data.
8. An electronic device, characterized in that: The electronic device includes a processor and a memory, the memory is used to store program code and data for 3D dynamic display of word clouds, and the processor is used to call program instructions in the memory to execute a 3D dynamic display method for word clouds according to any one of claims 1-6.
9. A storage medium, characterized in that: The storage medium includes a storage program, wherein when the program is running, the device where the storage medium is located is controlled to execute a 3D dynamic display method of a word cloud as described in any one of claims 1-6.
Citation Information
Patent Citations
Method, device and equipment for generating word cloud map, and storage medium
CN109511006A