A table color scale setting method, device, equipment and system

Through the color level processing function, the RGB value of the table data is calculated and the color level is set, which solves the problems of slow setting of table color level, long calculation time and large memory usage in the existing technology, and the fast and efficient setting of table color level is achieved, improving the user experience.

CN119026585BActive Publication Date: 2025-04-04SUZHOU WANDIANZHANG NETWORK TECH CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202411505388.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-10-28
Publication Date
2025-04-04
Estimated Expiration
2044-10-28

AI Technical Summary

Technical Problem

The existing table color level setting method requires repeated traversal loops of all data attributes, resulting in slower color level setting, longer calculation time, more memory occupancy, resulting in lag and bad user experience.

Method used

The table data is obtained through the color level processing function, the RGB value of each cell is calculated, and the table color level is set based on the RGB value. The color level processing function is used to traverse the table data, calculate the color coefficient and RGB value, and then set the color level.

Benefits of technology

It realizes the rapid setting of colors for each cell, improves the efficiency of setting the table color level, reduces calculation time and memory usage, and improves the user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119026585B_ABST
    Figure CN119026585B_ABST
Patent Text Reader

Abstract

The present invention relates to the technical field of computer table data processing, and in particular to a table color scale setting method, device, equipment and medium, the method comprising: a table color scale setting method comprising: obtaining table data; calling a color scale processing function to calculate the table data to obtain RGB values; and setting the table color scale based on the RGB values. The table color scale setting method provided by the present invention processes the table data through a color scale processing function, and quickly sets the color for each cell according to the size of the table data, thereby realizing the table color scale setting; the method of the present invention can be used to quickly set the color scale of a large amount of table data, and the table color scale can be quickly rendered when the table switches the display conditions, thereby improving the user experience.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of computer table data processing, and in particular to a table color scale setting method, a table color scale setting device, a table color scale setting equipment and a table color scale setting system. Background Art

[0002] In spreadsheet software, when processing table data, it is sometimes necessary to color the table. The colored table is divided into different shades of color according to different data to form a color scale, so that people can intuitively see the distribution of the table data.

[0003] In order to obtain effective color scale division, the existing table color scale setting method needs to repeatedly traverse the attributes of all data for multiple times, which results in slow color scale setting, long calculation time, and more memory usage. In actual practical use, it will cause lag and cause a bad experience for users.

[0004] In summary, a table color scale setting method is urgently needed to solve the above problems. Summary of the invention

[0005] The purpose of the present invention is to provide a table color scale setting method, which solves the problem of table coloring through a color scale processing function.

[0006] In order to solve the above technical problems, the present invention provides a table color scale setting method, comprising:

[0007] Get table data;

[0008] Call the color scale processing function to calculate the table data and get the RGB value;

[0009] Sets the table color scale based on RGB values.

[0010] Optionally, the process of calling the color scale processing function to calculate the table data is as follows:

[0011] Traverse the table data and find the maximum and minimum values;

[0012] Calculate the color coefficient of each table data based on the maximum and minimum values;

[0013] Calculate the RGB value corresponding to each table data based on the color coefficient.

[0014] Optionally, the table data includes cell positions and cell values, and the table data is traversed based on the cell positions to find the maximum and minimum values ​​in the cell values.

[0015] Optionally, the table data also includes the array length. The process of calculating the color coefficient of each table data is as follows:

[0016] Divide the cell position by the length of the array minus one to get the first scale value;

[0017] Divide the value of the cell value minus the minimum value by the value of the maximum value minus the minimum value to obtain the second proportional value;

[0018] The first ratio value plus the second ratio value divided by 2 gives the color coefficient.

[0019] Optionally, the process of calculating the RGB value corresponding to each table data based on the color coefficient is as follows:

[0020] Set the start RGB and end RGB;

[0021] Subtract the starting RGB from the ending RGB, multiply it by the color coefficient, and then add the starting RGB to get the RGB value corresponding to the table data.

[0022] Optionally, after traversing the table data and finding the maximum and minimum values, the maximum value is set as the starting RGB, and the minimum value is set as the ending RGB, and the RGB values ​​of the maximum and minimum values ​​are not calculated.

[0023] Optionally, the process of setting the table color scale based on RGB values ​​is as follows:

[0024] Convert the RGB value to hexadecimal color code;

[0025] Set the table color scale based on the color code, and store the color corresponding to the cell by saving key-value pairs.

[0026] In addition, the present invention also discloses a table color scale setting device, which is used to implement the table color scale setting method as described above, and the device comprises:

[0027] Table data acquisition module, used to acquire table data;

[0028] The table data processing module is used to call the color scale processing function to calculate the table data and obtain the RGB value;

[0029] The table color scale setting module is used to set the table color scale based on RGB values.

[0030] In addition, the present invention also discloses a table color scale setting device, comprising:

[0031] Memory, used to store computer programs;

[0032] The processor is used to execute the computer program to implement the steps of the table color scale setting method as described above.

[0033] In addition, the present invention also discloses a computer-readable storage medium for storing a computer program; wherein, when the computer program is executed by a processor, the steps of the above-mentioned method for setting the color scale of a table are implemented.

[0034] A table color scale setting method provided by the present invention processes table data through a color scale processing function, quickly sets the color for each cell, thereby realizing table color scale setting.

[0035] The present invention also provides a table color scale setting device, a table color scale setting equipment and a computer-readable storage medium, which also have the above-mentioned beneficial effects and will not be described in detail here. BRIEF DESCRIPTION OF THE DRAWINGS

[0036] In order to more clearly illustrate the embodiments of the present invention or the technical solutions of the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0037] Figure 1 A flowchart of a table color scale setting method provided by an embodiment of the present invention;

[0038] Figure 2 A structural block diagram of a table color scale setting device provided by an embodiment of the present invention;

[0039] Figure 3 A structural block diagram of a table color scale setting device provided in an embodiment of the present invention. DETAILED DESCRIPTION

[0040] The core of the present invention is to provide a method for setting the color scale of a table, which solves the problems of slow setting of the color scale of table data in the prior art, long calculation time and large memory usage.

[0041] In order to enable those skilled in the art to better understand the scheme of the present invention, the present invention is further described in detail below in conjunction with the accompanying drawings and specific implementation methods. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.

[0042] Please refer to Figure 1 , Figure 2 , Figure 3 , Figure 1 A flowchart of a table color scale setting method provided by an embodiment of the present invention; Figure 2A structural block diagram of a table color scale setting device provided by an embodiment of the present invention; Figure 3 A structural block diagram of a table color scale setting device provided in an embodiment of the present invention.

[0043] See also Figure 1 In an embodiment of the present invention, the table color scale setting method includes:

[0044] S1: Get table data.

[0045] In some embodiments, the table data can be rendered in a custom format, and the backend return data is processed into a custom format (time, value), where time represents time. In the table data, the position of the cell in the table can be obtained through the time attribute, and value represents the value, specifically the size of the table data in the cell. In addition, in this embodiment, when processing data, all data is flatly stored in Set (which allows the storage of unique values ​​of any type (whether primitive values ​​or object references)), and then all data is stored in Class (the memory of the js runtime).

[0046] Specifically, this embodiment processes the table data into a custom target format, uses Set to store all the values ​​of the current table, and finally stores them in the running memory; this embodiment implements high-performance data color scale processing through the front end without relying on other component libraries.

[0047] S2: Call the color scale processing function to calculate the table data and obtain the RGB value.

[0048] In some embodiments, the process of calling the color scale processing function to calculate the table data is as follows:

[0049] The table data is traversed to find the maximum and minimum values; in some more specific embodiments, the table data includes cell positions and cell values, and the table data is traversed based on the cell positions to find the maximum and minimum values ​​in the cell values.

[0050] The color coefficient of each table data is calculated based on the maximum and minimum values; the table data also includes the array length, and the process of calculating the color coefficient of each table data is as follows:

[0051] Divide the cell position by the value of the array length minus one to get the first proportional value. The calculation expression is as follows:

[0052] ratioIndex=index / (steps-1);

[0053] Among them, ratioIndex represents the first ratio value, index represents the cell position, and steps represents the array length.

[0054] Divide the value of the cell value minus the minimum value by the value of the maximum value minus the minimum value to get the second proportional value. The calculation expression of the second proportional value is as follows:

[0055] ratioValue=(value-minValue) / (maxValue-minValue);

[0056] Among them, ratioValue represents the second ratio value, value represents the cell value, minValue represents the minimum value, and maxValue represents the maximum value.

[0057] The first ratio value plus the second ratio value divided by 2 gives the color coefficient. The calculation expression of the color coefficient is as follows:

[0058] ratio=(ratioIndex+ratioValue) / 2;

[0059] Among them, ratio represents the color coefficient.

[0060] Calculate the RGB value corresponding to each table data based on the color coefficient. The process of calculating the RGB value corresponding to each table data based on the color coefficient is as follows:

[0061] Set the start RGB and end RGB;

[0062] Subtract the starting RGB from the ending RGB, multiply it by the color coefficient, and then add the starting RGB to get the RGB value corresponding to the table data.

[0063] It should be noted that the process of calculating the RGB value in this embodiment is specifically to calculate the RGB components corresponding to the table data based on the color coefficient.

[0064] In some more specific embodiments, after traversing the table data to find the maximum and minimum values, the maximum value is set as the starting RGB, the minimum value is set as the ending RGB, and the RGB value calculation is not performed for the maximum and minimum values. This embodiment avoids the calculation of the maximum and minimum values ​​by directly setting the maximum and minimum values ​​as the starting color, thereby improving the efficiency of the table data color scale setting. In addition, this embodiment sets the maximum and minimum values ​​as the starting color, which can also facilitate intuitive viewing of the corresponding relationship between the color scale distribution and the value, so that the color scale transition is natural.

[0065] It should be noted that the color scale processing function in this embodiment is input in HEX format (color code, expressed in hexadecimal numbers, consisting of a `#` symbol followed by 6 hexadecimal digits). During the calculation process, the proportional value of the data in HEX format is calculated, and then based on the fact that the data in RGB format (expressed in decimal numbers, consisting of three numerical values, representing the intensity of red, green and blue, respectively, ranging from 0 to 255) has clear upper and lower limits, the RGB value of the table data is calculated.

[0066] Furthermore, the color scale processing function in this embodiment uses a Map (which stores key-value pairs and can remember the original insertion order of the keys) to store the colors corresponding to the cells.

[0067] S3: Set the table color scale based on RGB values. The process of setting the table color scale based on RGB values ​​is as follows:

[0068] Convert the RGB value to a hexadecimal value, specifically convert the three components of the RGB value to a hexadecimal color representation, i.e., a color code (HEX format);

[0069] Set the table color scale based on the color code, and store the color corresponding to the cell by saving key-value pairs.

[0070] The method of this embodiment is used to render the table data, which takes a very short time, and the processing time complexity is (O(n^4)). When n = 90, the processing time is as low as 0.0001 seconds (based on the function execution time statistics, because it is basically negligible in the cache). The method of this embodiment can render a large amount of table data, set the table color scale based on the cell value size, and use the cache to achieve the synchronous completion of the table color scale change when switching the display conditions.

[0071] A table color scale setting device provided by an embodiment of the present invention is introduced below. The table color scale setting device described below and the table color scale setting method described above can be referred to each other.

[0072] Please refer to Figure 2 , Figure 2 This is a structural block diagram of a table color scale setting device provided by an embodiment of the present invention. Figure 2 , the device comprises:

[0073] The table data acquisition module 100 is used to acquire table data;

[0074] The table data processing module 200 is used to call the color scale processing function to calculate the table data and obtain the RGB value;

[0075] The table color scale setting module 300 is used to set the table color scale based on the RGB value.

[0076] The table color scale setting device of the present embodiment is used to implement the aforementioned table color scale setting method. Therefore, the specific implementation method of the table color scale setting device can be seen in the embodiment part of the table color scale setting method in the previous text. For example, the table data acquisition module 100, the table data processing module 200, and the table color scale setting module 300 are respectively used to implement steps S1 to S3 in the above-mentioned table color scale setting method. Therefore, its specific implementation method can refer to the description of the corresponding various partial embodiments and will not be repeated here.

[0077] A table color scale setting device provided by an embodiment of the present invention is introduced below. The table color scale setting device described below and the table color scale setting method and table color scale setting apparatus described above can be referenced to each other.

[0078] Please refer to Figure 3 , Figure 3 This is a structural block diagram of a table color scale setting device provided by an embodiment of the present invention. Figure 3 , a table color scale setting device, comprising:

[0079] A memory 11, used for storing computer programs;

[0080] The processor 12 is used to execute the computer program to implement the steps of the table color scale setting method as described above.

[0081] The table color scale setting device of this embodiment is used to implement the aforementioned table color scale setting method. Therefore, the specific implementation method of the table color scale setting device can be seen in the embodiment part of the table color scale setting method in the previous text. Therefore, its specific implementation method can refer to the description of the corresponding embodiments of each part and will not be repeated here.

[0082] The embodiment of the present invention further discloses a computer-readable storage medium for storing a computer program; wherein, when the computer program is executed by the processor 12, the steps of the method for setting the color scale of a table as described above are implemented.

[0083] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.

[0084] 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.

[0085] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.

[0086] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.

[0087] The above is a detailed introduction to a table color scale setting method, a table color scale setting device, and a table color scale setting system provided by the present invention. This article uses specific examples to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea. It should be pointed out that for ordinary technicians in this technical field, without departing from the principle of the present invention, the present invention can also be improved and modified, and these improvements and modifications also fall within the scope of protection of the claims of the present invention.

Claims

1. A method for setting color scale of a table, characterized in that: include: Get table data; Calling the color scale processing function to calculate the table data to obtain the RGB value; wherein the color coefficient of the table is calculated by dividing the cell position by the value of the array length minus one to obtain the first proportional value; Divide the value of the cell value minus the minimum value by the value of the maximum value minus the minimum value to obtain the second proportional value; The first ratio value plus the second ratio value divided by 2 obtains the color coefficient; Calculate and obtain RGB value based on the color coefficient; Sets the table color scale based on RGB values.

2. The table color scale setting method according to claim 1, characterized in that: The process of calling the color scale processing function to calculate the table data is as follows: Traverse the table data and find the maximum and minimum values; Calculate the color coefficient of each table data based on the maximum and minimum values; Calculate the RGB value corresponding to each table data based on the color coefficient.

3. The table color scale setting method according to claim 2, characterized in that: Table data includes cell locations and cell values.

4. The table color scale setting method according to claim 3, characterized in that: The process of calculating the RGB value corresponding to each table data based on the color coefficient is as follows: Set the start RGB and end RGB; Subtract the starting RGB from the ending RGB, multiply it by the color coefficient, and then add the starting RGB to get the RGB value corresponding to the table data.

5. The table color scale setting method according to claim 4, characterized in that: After traversing the table data and finding the maximum and minimum values, the maximum value is set as the starting RGB and the minimum value is set as the ending RGB. The RGB values ​​of the maximum and minimum values ​​are not calculated.

6. The table color scale setting method according to claim 4, characterized in that: The process of setting the color scale of a table based on RGB values ​​is as follows: Convert the RGB value to hexadecimal color code; Set the table color scale based on the color code, and store the color corresponding to the cell by saving key-value pairs.

7. A table color scale setting device, characterized in that: Used to implement the table color scale setting method according to any one of claims 1 to 6, the device comprises: Table data acquisition module, used to acquire table data; The table data processing module is used to call the color scale processing function to calculate the table data and obtain the RGB value; The table color scale setting module is used to set the table color scale based on RGB values.

8. A table color scale setting device, characterized in that: include: Memory, used to store computer programs; A processor is used to execute the computer program to implement the steps of the table color scale setting method as described in any one of claims 1 to 6.

9. A computer-readable storage medium, characterized in that: Used to store computer programs; wherein, when the computer program is executed by a processor, the steps of the table color scale setting method as described in any one of claims 1 to 6 are implemented.

Citation Information

Patent Citations

  • VBA-based matrix chart generation method and system

    CN113420535A

  • Auto-formatting of a data table

    US20220027740A1

  • Method and system for graphical representation

    US7363306B1