Table data display method and device
By calculating the width percentage of each column in the table data and dynamically adjusting the table display in combination with the device resolution, the problem of uneven table data display and low space utilization in the existing technology is solved, and the visual effect and user experience are improved.
Patent Information
- Application Number
- CN202310165970.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-02-15
- Publication Date
- 2024-08-23
AI Technical Summary
In the existing technology, the column width of tabular data display is fixed, resulting in uneven width ratio of a certain column relative to the entire row of data, poor visual effects, low utilization of display space, and poor user experience, and adjusting column width requires hard-coding procedures. Control leads to high operation and maintenance costs and narrow applicable scenarios.
Calculate the percentage of the column header width of each column relative to the width of the row based on the table data information to be displayed, determine the pixel width of each column in each row based on the resolution of the current device, and dynamically adjust the table data display.
It improves the visual effect of table data display, improves the utilization of display space, reduces operation and maintenance costs, expands applicable scenarios, and improves user experience.
Smart Images

Figure CN118536486A
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a table data display method and device. Background Art
[0002] With the development of Internet technology and the explosive growth of online data, data visualization is achieved by displaying tabular data in the form of data lists on the web. This display method is not only more intuitive and effective, but also helps to reduce memory usage.
[0003] In the prior art, tabular data is displayed on the web by supporting a fixed column header width. Since the column width of the tabular data displayed in the prior art is fixed, it is often the case that the width of a certain column relative to the entire row of data is uneven, the visual effect is poor, and the user experience cannot be satisfied in the actual application scenario. On the other hand, the table display space utilization rate of the prior art is low, and it is impossible to maximize the display of the table data content. If the width of the display column is to be adjusted, the developer needs to perform hard-coded program control, resulting in high operation and maintenance costs and narrow application scenarios. Summary of the invention
[0004] In view of this, an embodiment of the present invention provides a method and device for displaying table data, which can determine the ratio of the width of each column header relative to the width of the row where it is located according to the actual number of characters in the table data information to be displayed, and then display the table data, thereby improving the visual effect of the table data display, improving the utilization rate of the display space, reducing operation and maintenance costs, expanding the applicable scenarios, and improving the user experience.
[0005] To achieve the above object, according to one aspect of an embodiment of the present invention, a table data display method is provided, comprising:
[0006] Receive table data information to be displayed; wherein the table data information to be displayed indicates a row number, a column header type, and column data corresponding to the column header type;
[0007] According to the table data information to be displayed, calculate the percentage of the width of each column header relative to the width of the row;
[0008] Get the resolution of the current display device, determine the pixel width of each column in each row based on the resolution and width percentage, and display the table data information to be displayed based on the pixel width.
[0009] Furthermore, the step of calculating the percentage of the width of each column header relative to the width of the row in which the column header is located according to the table data information to be displayed includes:
[0010] According to the table data information to be displayed, calculate the total number of characters corresponding to all columns in each row, and calculate the average character length of the column data in each column;
[0011] Based on the average character length of the column data, calculate the width percentage of each column relative to the row in which it resides.
[0012] Furthermore, the step of calculating the total number of characters corresponding to all columns in each row according to the table data information to be displayed includes:
[0013] According to the table data information to be displayed corresponding to each row, the number of characters of the column data of all columns corresponding to each row is accumulated and calculated to obtain the total number of characters corresponding to all columns in each row.
[0014] Furthermore, the step of calculating the average character length of column data of each column includes:
[0015] According to the total number of characters corresponding to all columns in each row, remove the two columns with the highest and lowest total number of characters;
[0016] According to the table data information to be displayed corresponding to the remaining columns, the average character length of the column data of each column is calculated.
[0017] Furthermore, the step of calculating the width percentage of each column relative to the row in which it is located according to the average character length of the column data includes:
[0018] Round the average character length of the column data to an integer;
[0019] According to the average character length of the column data corresponding to each column after processing, the average character length of the column data of each column is divided by the sum of the average character lengths of the column data of all columns to obtain the width percentage of each column relative to the row in which it is located; among which, the sum of the width percentages of all columns is 100%.
[0020] Further, the step of determining the pixel width of each column in each row according to the resolution and the width percentage includes:
[0021] Multiply the percentage of the column header width of each column relative to the width of the row it is in by the resolution to get the pixel width of each column.
[0022] According to another aspect of an embodiment of the present invention, there is provided a table data display device, comprising:
[0023] A receiving module, used for receiving table data information to be displayed; wherein the table data information to be displayed indicates a row number, a column header type, and column data corresponding to the column header type;
[0024] The calculation module is used to calculate the percentage of the width of each column header relative to the width of the row in which it is located based on the table data information to be displayed;
[0025] The display module is used to obtain the resolution of the current display device, determine the pixel width of each column in each row according to the resolution and width percentage, and display the table data information to be displayed according to the pixel width.
[0026] Furthermore, the computing module is also used for:
[0027] According to the table data information to be displayed, calculate the total number of characters corresponding to all columns in each row, and calculate the average character length of the column data in each column;
[0028] Based on the average character length of the column data, calculate the width percentage of each column relative to the row in which it resides.
[0029] According to another aspect of an embodiment of the present invention, there is provided an electronic device for displaying table data, comprising:
[0030] one or more processors;
[0031] a storage device for storing one or more programs,
[0032] When one or more programs are executed by one or more processors, the one or more processors implement any of the above-mentioned table data display methods.
[0033] According to another aspect of the embodiments of the present invention, a computer-readable medium is provided, on which a computer program is stored. When the program is executed by a processor, any of the above-mentioned table data display methods is implemented.
[0034] An embodiment of the above invention has the following advantages or beneficial effects: because it adopts receiving table data information to be displayed; wherein the table data information to be displayed indicates the row number, the column header type and the column data corresponding to the column header type; according to the table data information to be displayed, the percentage of the width of the column header of each column relative to the width of the row is calculated; the resolution of the current display device is obtained, and the pixel width of each column in each row is determined according to the resolution and the width ratio, and the technical means of displaying the table data information to be displayed according to the pixel width is overcome. Therefore, due to only supporting a fixed column header width in the prior art, the width of a certain column relative to the entire row of data is often uneven, the visual effect is poor, the display space utilization rate is low, and the user experience is poor. In addition, if the column header width is to be adjusted, hard-coded program control is required, resulting in high operation and maintenance costs and narrow application scenarios. Technical problems, thereby achieving the ability to determine the width of each column header relative to the width of the row according to the actual number of characters in the table data information to be displayed, and then combining the resolution of the device to display the table data, thereby improving the visual effect of the table data display, improving the utilization rate of the display space, reducing the operation and maintenance cost, expanding the applicable scenarios, and improving the technical effect of user experience.
[0035] The further effects of the above-mentioned non-conventional optional manner will be described below in conjunction with the specific implementation manner. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] The accompanying drawings are used to better understand the present invention and do not constitute an improper limitation of the present invention.
[0037] Figure 1 is a schematic diagram of the main process of a table data display method provided according to an embodiment of the present invention;
[0038] Figure 2 is a schematic diagram of the main process of a table data display method provided according to another embodiment of the present invention;
[0039] Figure 3 is a schematic diagram of main modules of a table data display device provided according to an embodiment of the present invention;
[0040] Figure 4 is an exemplary system architecture diagram to which embodiments of the present invention may be applied;
[0041] Figure 5 It is a schematic diagram of the structure of a computer system of a terminal device or a server suitable for implementing an embodiment of the present invention. DETAILED DESCRIPTION
[0042] The following is a description of exemplary embodiments of the present invention in conjunction with the accompanying drawings, including various details of the embodiments of the present invention to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present invention. Similarly, for clarity and conciseness, the description of well-known functions and structures is omitted in the following description.
[0043] Figure 1 is a schematic diagram of the main process of a table data display method provided according to an embodiment of the present invention; Figure 1 As shown, the table data display method provided by the embodiment of the present invention mainly includes:
[0044] Step S101 : receiving table data information to be displayed; wherein the table data information to be displayed indicates the row number, the column header type, and the column data corresponding to the column header type.
[0045] Specifically, the initially received table data information to be displayed is original data, and the data format indicated by the original data is the same, that is, it indicates the row number, the column header type of all columns corresponding to the row number, and the column data corresponding to the column header type. The above table data information to be displayed indicates at least one row of data, wherein, in the first row of data, the column data corresponding to each column is consistent with the name of the column header type of the column. The column header type indicates the data type corresponding to the column. Exemplarily, the column header type can be: ID (Identity document, user number), use case name, label, resource, method, creator, etc.
[0046] Step S102: Calculate the percentage of the width of each column header relative to the width of the row where the column header is located according to the table data information to be displayed.
[0047] Specifically, according to an embodiment of the present invention, the step of calculating the percentage of the width of the column header of each column relative to the width of the row in which the column header is located according to the table data information to be displayed includes:
[0048] According to the table data information to be displayed, calculate the total number of characters corresponding to all columns in each row, and calculate the average character length of the column data in each column;
[0049] Based on the average character length of the column data, calculate the width percentage of each column relative to the row in which it resides.
[0050] Through the above settings, based on the original data (i.e., the table data information to be displayed), the total number of characters in all columns in each row is determined, and then the average character length of each column is determined. The width percentage of each column relative to the row in the table data information to be displayed can be determined, which is helpful for subsequent display of the table data according to the width percentage, avoiding the poor visual effect and insufficient display space utilization caused by only using a fixed column width in the prior art.
[0051] Further, according to an embodiment of the present invention, the step of calculating the total number of characters corresponding to all columns in each row according to the table data information to be displayed includes:
[0052] According to the table data information to be displayed corresponding to each row, the number of characters of the column data of all columns corresponding to each row is accumulated and calculated to obtain the total number of characters corresponding to all columns in each row.
[0053] Since the data in each row may vary greatly, and the data in all rows needs to be displayed uniformly (when there are many rows involved, it can be displayed in pages). Therefore, the number of characters in the column data of all columns corresponding to each row is accumulated and calculated to determine the total number of all characters included in each row, which provides a basis for determining the width percentage of each column relative to the row in which it is located.
[0054] Preferably, according to an embodiment of the present invention, the step of calculating the average character length of column data of each column includes:
[0055] According to the total number of characters corresponding to all columns in each row, remove the two columns with the highest and lowest total number of characters;
[0056] According to the table data information to be displayed corresponding to the remaining columns, the average character length of the column data of each column is calculated.
[0057] Through the above settings, the row with the highest total number of characters and the row with the least total number of characters are first removed, and then the average character length of the column data in each column is calculated. This can make the width of each column in the final displayed table data more uniform, further improve the visual effect, increase the utilization rate of the display space, and expand the applicable scenarios.
[0058] Optionally, according to an embodiment of the present invention, the step of calculating the width percentage of each column relative to the row in which it is located according to the average character length of the column data includes:
[0059] Round the average character length of the column data to an integer;
[0060] According to the average character length of the column data corresponding to each column after processing, the average character length of the column data of each column is divided by the sum of the average character lengths of the column data of all columns to obtain the width percentage of each column relative to the row in which it is located; among which, the sum of the width percentages of all columns is 100%.
[0061] Rounding the average character length of column data to an integer can improve the calculation efficiency of the final determination of the width percentage of each column relative to the row it is in, thereby improving the display efficiency. In the process of determining the width percentage of each column relative to the row it is in turn, in order to ensure that the sum of the width percentages of all columns is 100%, the width percentage of the last column relative to the row it is in can be calculated without using the method of "dividing the average character length of column data of each column by the sum of the average character lengths of column data of all columns". Instead, it is only necessary to subtract the width percentages of the previous columns from 100% to obtain the width percentage corresponding to the last column.
[0062] Step S103, obtaining the resolution of the current display device, determining the pixel width of each column in each row according to the resolution and the width percentage, and displaying the table data information to be displayed according to the pixel width.
[0063] Specifically, according to an embodiment of the present invention, the step of determining the pixel width of each column in each row according to the resolution and the width percentage includes:
[0064] Multiply the percentage of the column header width of each column relative to the width of the row it is in by the resolution to get the pixel width of each column.
[0065] Through the above settings, after determining the width percentage of each column relative to the row, the resolution of the current display device is taken into consideration, and the pixel width of each column is calculated. The table data is displayed in pixel width, which further improves the display visual effect, improves the user experience, and expands the applicable scenarios of table data display.
[0066] According to the technical solution of the embodiment of the present invention, because the table data information to be displayed is received, wherein the table data information to be displayed indicates the row number, the column header type and the column data corresponding to the column header type; according to the table data information to be displayed, the percentage of the width of the column header of each column relative to the width of the row is calculated; the resolution of the current display device is obtained, and the pixel width of each column in each row is determined according to the resolution and the width ratio, and the table data information to be displayed is displayed according to the pixel width. Therefore, the technical means overcomes the problem that only a fixed column header width is supported in the prior art, resulting in an uneven width ratio of a certain column relative to the entire row of data, poor visual effects, low display space utilization, and poor user experience in actual applications, and that hard-coded program control is required to adjust the column header width, resulting in high operation and maintenance costs and narrow applicable scenarios. The technical problem is achieved by being able to determine the percentage of the width of the column header of each column relative to the width of the row according to the actual number of characters in the table data information to be displayed, and then combining the resolution of the device to display the table data, thereby improving the visual effect of the table data display, improving the utilization of the display space, reducing the operation and maintenance costs, expanding the applicable scenarios, and improving the technical effect of user experience.
[0067] Figure 2 is a schematic diagram of the main process of a table data display method provided according to another embodiment of the present invention; Figure 2 As shown, the table data display method provided by the embodiment of the present invention mainly includes:
[0068] Step S201 : receiving table data information to be displayed; wherein the table data information to be displayed indicates the row number, the column header type, and the column data corresponding to the column header type.
[0069] Specifically, the above table data information to be displayed indicates at least one row of data, wherein in the first row of data, the column data corresponding to each column is consistent with the name of the column header type of the column.
[0070] According to a specific implementation of an embodiment of the present invention, the initially received table data information to be displayed is original data, and the data format indicated by the original data is the same, that is, it indicates the row number, the column header type of all columns corresponding to the row number, and the column data corresponding to the column header type.
[0071] Taking the column header types such as ID (Identity document, user number), use case name, label, resource, method, creator, etc. as an example, the received table data information to be displayed can be in the following data format: [
[0073] / / This is the first row of data
[0074] {ID:1608, use case name: "Test-jsf input and output parameters", label: "test environment, JSF", resource: "0-expample...", method: "0-method...", creator: "wang---0"},
[0075] / / This is the second row of data
[0076] {ID: 1602, Use case name: "JSF [Quick creation - data synchronization]", Label: "Test environment, pre-release environment, JSF", Resource: "1-expample...", Method: "1-method...", Creator: "wang---1"}]
[0077] Step S202 , according to the table data information to be displayed corresponding to each row, the number of characters of the column data of all columns corresponding to each row is accumulated and calculated to obtain the total number of characters corresponding to all columns in each row.
[0078] Since the data in each row may vary greatly, and the data in all rows needs to be displayed uniformly (when there are many rows involved, it can be displayed in pages). Therefore, the number of characters in the column data of all columns corresponding to each row is accumulated and calculated to determine the total number of all characters included in each row, which provides a basis for determining the width percentage of each column relative to the row in which it is located.
[0079] Step S203, according to the total number of characters corresponding to all columns in each row, remove the two columns with the highest and lowest total number of characters; and calculate the average character length of the column data of each column according to the table data information to be displayed corresponding to the remaining columns.
[0080] Through the above settings, the row with the highest total number of characters and the row with the least total number of characters are first removed, and then the average character length of the column data in each column is calculated. This can make the width of each column in the final displayed table data more uniform, further improve the visual effect, increase the utilization rate of the display space, and expand the applicable scenarios.
[0081] Step S204, rounding the average character length of the column data to an integer; based on the average character length of the column data corresponding to each column after processing, divide the average character length of the column data of each column by the sum of the average character lengths of the column data of all columns to obtain the width percentage of each column relative to the row in which it is located; wherein the sum of the width percentages of all columns is 100%.
[0082] Rounding the average character length of column data to an integer can improve the calculation efficiency of the final determination of the width percentage of each column relative to the row it is in, thereby improving the display efficiency. In the process of determining the width percentage of each column relative to the row it is in turn, in order to ensure that the sum of the width percentages of all columns is 100%, the width percentage of the last column relative to the row it is in can be calculated without using the method of "dividing the average character length of column data of each column by the sum of the average character lengths of column data of all columns". Instead, it is only necessary to subtract the width percentages of the previous columns from 100% to obtain the width percentage corresponding to the last column.
[0083] Step S205 , obtaining the resolution of the current display device, multiplying the percentage of the width of the column header of each column relative to the width of the row where it is located by the resolution, and obtaining the pixel width of each column in turn.
[0084] Step S206: display the table data information to be displayed according to the pixel width.
[0085] Through the above settings, after determining the width percentage of each column relative to the row, the resolution of the current display device is taken into consideration, and the pixel width of each column is calculated. The table data is displayed in pixel width, which further improves the display visual effect, improves the user experience, and expands the applicable scenarios of table data display.
[0086] According to the technical solution of the embodiment of the present invention, because the table data information to be displayed is received, wherein the table data information to be displayed indicates the row number, the column header type and the column data corresponding to the column header type; according to the table data information to be displayed, the percentage of the width of the column header of each column relative to the width of the row is calculated; the resolution of the current display device is obtained, and the pixel width of each column in each row is determined according to the resolution and the width ratio, and the table data information to be displayed is displayed according to the pixel width. Therefore, the technical means overcomes the problem that only a fixed column header width is supported in the prior art, resulting in an uneven width ratio of a certain column relative to the entire row of data, poor visual effects, low display space utilization, and poor user experience in actual applications, and that hard-coded program control is required to adjust the column header width, resulting in high operation and maintenance costs and narrow applicable scenarios. The technical problem is achieved by being able to determine the percentage of the width of the column header of each column relative to the width of the row according to the actual number of characters in the table data information to be displayed, and then combining the resolution of the device to display the table data, thereby improving the visual effect of the table data display, improving the utilization of the display space, reducing the operation and maintenance costs, expanding the applicable scenarios, and improving the technical effect of user experience.
[0087] Figure 3 is a schematic diagram of the main modules of the table data display device provided according to an embodiment of the present invention; Figure 3 As shown, the table data display device 300 provided in the embodiment of the present invention mainly includes:
[0088] The receiving module 301 is used to receive table data information to be displayed; wherein the table data information to be displayed indicates the row number, the column header type and the column data corresponding to the column header type.
[0089] Specifically, the initially received table data information to be displayed is original data, and the data format indicated by the original data is the same, that is, it indicates the row number, the column header types of all columns corresponding to the row number, and the column data corresponding to the column header type. The above table data information to be displayed indicates at least one row of data, wherein in the first row of data, the column data corresponding to each column is consistent with the name of the column header type of the column; the column header type indicates the data type corresponding to the column.
[0090] The calculation module 302 is used to calculate the percentage of the width of each column header relative to the width of the row where the column header is located according to the table data information to be displayed.
[0091] Specifically, according to an embodiment of the present invention, the calculation module 302 is used to:
[0092] According to the table data information to be displayed, calculate the total number of characters corresponding to all columns in each row, and calculate the average character length of the column data in each column;
[0093] Based on the average character length of the column data, calculate the width percentage of each column relative to the row in which it resides.
[0094] Through the above settings, based on the original data (i.e., the table data information to be displayed), the total number of characters in all columns in each row is determined, and then the average character length of each column is determined. The width percentage of each column relative to the row in the table data information to be displayed can be determined, which is helpful for subsequent display of the table data according to the width percentage, avoiding the poor visual effect and insufficient display space utilization caused by only using a fixed column width in the prior art.
[0095] Further, according to an embodiment of the present invention, the calculation module 302 is used to:
[0096] According to the table data information to be displayed corresponding to each row, the number of characters of the column data of all columns corresponding to each row is accumulated and calculated to obtain the total number of characters corresponding to all columns in each row.
[0097] Since the data in each row may vary greatly, and the data in all rows needs to be displayed uniformly (when there are many rows involved, it can be displayed in pages). Therefore, the number of characters in the column data of all columns corresponding to each row is accumulated and calculated to determine the total number of all characters included in each row, which provides a basis for determining the width percentage of each column relative to the row in which it is located.
[0098] Preferably, according to an embodiment of the present invention, the calculation module 302 is further used for:
[0099] According to the total number of characters corresponding to all columns in each row, remove the two columns with the highest and lowest total number of characters;
[0100] According to the table data information to be displayed corresponding to the remaining columns, the average character length of the column data of each column is calculated.
[0101] Through the above settings, the row with the highest total number of characters and the row with the least total number of characters are first removed, and then the average character length of the column data in each column is calculated. This can make the width of each column in the final displayed table data more uniform, further improve the visual effect, increase the utilization rate of the display space, and expand the applicable scenarios.
[0102] Optionally, according to an embodiment of the present invention, the calculation module 302 is further used for:
[0103] Round the average character length of the column data to an integer;
[0104] According to the average character length of the column data corresponding to each column after processing, the average character length of the column data of each column is divided by the sum of the average character lengths of the column data of all columns to obtain the width percentage of each column relative to the row in which it is located; among which, the sum of the width percentages of all columns is 100%.
[0105] Rounding the average character length of column data to an integer can improve the calculation efficiency of the final determination of the width percentage of each column relative to the row it is in, thereby improving the display efficiency. In the process of determining the width percentage of each column relative to the row it is in turn, in order to ensure that the sum of the width percentages of all columns is 100%, the width percentage of the last column relative to the row it is in can be calculated without using the method of "dividing the average character length of column data of each column by the sum of the average character lengths of column data of all columns". Instead, it is only necessary to subtract the width percentages of the previous columns from 100% to obtain the width percentage corresponding to the last column.
[0106] The display module 303 is used to obtain the resolution of the current display device, determine the pixel width of each column in each row according to the resolution and the width percentage, and display the table data information to be displayed according to the pixel width.
[0107] Specifically, according to an embodiment of the present invention, the display module 303 is also used for:
[0108] Multiply the percentage of the column header width of each column relative to the width of the row it is in by the resolution to get the pixel width of each column.
[0109] Through the above settings, after determining the width percentage of each column relative to the row, the resolution of the current display device is taken into consideration, and the pixel width of each column is calculated. The table data is displayed in pixel width, which further improves the display visual effect, improves the user experience, and expands the applicable scenarios of table data display.
[0110] According to the technical solution of the embodiment of the present invention, because the table data information to be displayed is received, wherein the table data information to be displayed indicates the row number, the column header type and the column data corresponding to the column header type; according to the table data information to be displayed, the percentage of the width of the column header of each column relative to the width of the row is calculated; the resolution of the current display device is obtained, and the pixel width of each column in each row is determined according to the resolution and the width ratio, and the table data information to be displayed is displayed according to the pixel width. Therefore, the technical means overcomes the problem that only a fixed column header width is supported in the prior art, resulting in an uneven width ratio of a certain column relative to the entire row of data, poor visual effects, low display space utilization, and poor user experience in actual applications, and that hard-coded program control is required to adjust the column header width, resulting in high operation and maintenance costs and narrow applicable scenarios. The technical problem is achieved by being able to determine the percentage of the width of the column header of each column relative to the width of the row according to the actual number of characters in the table data information to be displayed, and then combining the resolution of the device to display the table data, thereby improving the visual effect of the table data display, improving the utilization of the display space, reducing the operation and maintenance costs, expanding the applicable scenarios, and improving the technical effect of user experience.
[0111] Figure 4 An exemplary system architecture 400 is shown to which the table data presentation method or table data presentation device according to the embodiment of the present invention can be applied.
[0112] like Figure 4 As shown, system architecture 400 may include terminal devices 401, 402, 403, network 404 and server 405. Network 404 is used to provide a medium for communication links between terminal devices 401, 402, 403 and server 405. Network 404 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc.
[0113] Users can use terminal devices 401, 402, 403 to interact with server 405 through network 404 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 401, 402, 403, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social platform software, etc. (only as examples).
[0114] The terminal devices 401 , 402 , and 403 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, and desktop computers.
[0115] The server 405 may be a server that provides various services, such as a server that (displays table data / processes data) for users using the terminal devices 401, 402, and 403 (only as an example). The server may analyze and process the received data such as the table data information to be displayed, and feed back the processing result (such as width percentage, pixel width - only as an example) to the terminal device.
[0116] It should be noted that the table data display method provided in the embodiment of the present invention is generally executed by the server 405 , and accordingly, the table data display device is generally disposed in the server 405 .
[0117] It should be understood that Figure 4 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to implementation requirements.
[0118] Reference below Figure 5 , which shows a schematic diagram of the structure of a computer system 500 of a terminal device or a server suitable for implementing an embodiment of the present invention. Figure 5 The terminal device or server shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.
[0119] like Figure 5 As shown, the computer system 500 includes a central processing unit (CPU) 501, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 502 or a program loaded from a storage part 508 into a random access memory (RAM) 503. In the RAM 503, various programs and data required for the operation of the system 500 are also stored. The CPU 501, the ROM 502, and the RAM 503 are connected to each other via a bus 504. An input / output (I / O) interface 505 is also connected to the bus 504.
[0120] The following components are connected to the I / O interface 505: an input section 506 including a keyboard, a mouse, etc.; an output section 507 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 508 including a hard disk, etc.; and a communication section 509 including a network interface card such as a LAN card, a modem, etc. The communication section 509 performs communication processing via a network such as the Internet. A drive 510 is also connected to the I / O interface 505 as needed. A removable medium 511, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 510 as needed, so that a computer program read therefrom is installed into the storage section 508 as needed.
[0121] In particular, according to the embodiments disclosed in the present invention, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present invention include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 509, and / or installed from the removable medium 511. When the computer program is executed by the central processing unit (CPU) 501, the above-mentioned functions defined in the system of the present invention are executed.
[0122] It should be noted that the computer-readable medium shown in the present invention may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present invention, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present invention, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.
[0123] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present invention. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0124] The modules involved in the embodiments of the present invention may be implemented in software or hardware. The modules described may also be set in a processor, for example, they may be described as: a processor includes a receiving module, a computing module and a display module. The names of these modules do not constitute limitations on the modules themselves in certain cases. For example, the receiving module may also be described as "a module for receiving table data information to be displayed; wherein the table data information to be displayed indicates the row number, the column header type and the column data corresponding to the column header type".
[0125] As another aspect, the present invention also provides a computer-readable medium, which may be included in the device described in the above embodiment; or it may exist independently without being assembled into the device. The above computer-readable medium carries one or more programs, and when the above one or more programs are executed by a device, the device includes: receiving table data information to be displayed; wherein the table data information to be displayed indicates the row number, the column header type, and the column data corresponding to the column header type; according to the table data information to be displayed, calculating the percentage of the column header width of each column relative to the width of the row; obtaining the resolution of the current display device, determining the pixel width of each column in each row according to the resolution and width ratio, and displaying the table data information to be displayed according to the pixel width.
[0126] According to the technical solution of the embodiment of the present invention, because the table data information to be displayed is received, wherein the table data information to be displayed indicates the row number, the column header type and the column data corresponding to the column header type; according to the table data information to be displayed, the percentage of the width of the column header of each column relative to the width of the row is calculated; the resolution of the current display device is obtained, and the pixel width of each column in each row is determined according to the resolution and the width ratio, and the table data information to be displayed is displayed according to the pixel width. Therefore, the technical means overcomes the problem that only a fixed column header width is supported in the prior art, resulting in an uneven width ratio of a certain column relative to the entire row of data, poor visual effects, low display space utilization, and poor user experience in actual applications, and that hard-coded program control is required to adjust the column header width, resulting in high operation and maintenance costs and narrow applicable scenarios. The technical problem is achieved by being able to determine the percentage of the width of the column header of each column relative to the width of the row according to the actual number of characters in the table data information to be displayed, and then combining the resolution of the device to display the table data, thereby improving the visual effect of the table data display, improving the utilization of the display space, reducing the operation and maintenance costs, expanding the applicable scenarios, and improving the technical effect of user experience.
[0127] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may occur depending on design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A method for displaying tabular data, characterized in that: include: Receive table data information to be displayed; wherein the table data information to be displayed indicates a row number, a column header type, and column data corresponding to the column header type; According to the table data information to be displayed, the percentage of the column header width of each column relative to the width of the row in which it is located is calculated; The resolution of the current display device is obtained, the pixel width of each column in each row is determined according to the resolution and the width ratio, and the table data information to be displayed is displayed according to the pixel width.
2. The table data display method according to claim 1, characterized in that: The step of calculating the percentage of the width of the column header of each column relative to the width of the row in which the column header is located according to the table data information to be displayed includes: According to the table data information to be displayed, the total number of characters corresponding to all columns in each row is calculated respectively, and the average character length of the column data of each column is calculated; The width percentage of each column relative to the row is calculated based on the average character length of the column data.
3. The table data display method according to claim 2, characterized in that: The step of calculating the total number of characters corresponding to all columns in each row according to the table data information to be displayed includes: According to the table data information to be displayed corresponding to each row, the number of characters of the column data of all columns corresponding to each row is accumulated and calculated to obtain the total number of characters corresponding to all columns in each row.
4. The table data display method according to claim 2 or 3, characterized in that: The step of calculating the average character length of column data in each column includes: According to the total number of characters corresponding to all columns in each row, remove the two columns with the highest total number of characters and the two columns with the lowest total number of characters; According to the table data information to be displayed corresponding to the remaining columns, the average character length of the column data of each column is calculated.
5. The table data display method according to claim 2, characterized in that: The step of calculating the width percentage of each column relative to the row in which it is located according to the average character length of the column data comprises: Rounding the average character length of the column data to an integer; According to the average character length of the column data corresponding to each column after processing, the average character length of the column data of each column is divided by the sum of the average character lengths of the column data of all columns to obtain the width percentage of each column relative to the row in which it is located; among which, the sum of the width percentages of all columns is 100%.
6. The table data display method according to claim 1, characterized in that: The step of determining the pixel width of each column in each row according to the resolution and the width percentage comprises: The percentage of the width of the column header of each column relative to the width of the row in which it is located is multiplied by the resolution to obtain the pixel width of each column in turn.
7. A tabular data display device, characterized in that: include: A receiving module, configured to receive table data information to be displayed; wherein the table data information to be displayed indicates a row number, a column header type, and column data corresponding to the column header type; A calculation module, used for calculating the percentage of the width of each column header relative to the width of the row in which the column header is located according to the table data information to be displayed; The display module is used to obtain the resolution of the current display device, determine the pixel width of each column in each row according to the resolution and the width percentage, and display the table data information to be displayed according to the pixel width.
8. The table data display device according to claim 7, characterized in that: The computing module is further used for: According to the table data information to be displayed, the total number of characters corresponding to all columns in each row is calculated respectively, and the average character length of the column data of each column is calculated; The width percentage of each column relative to the row is calculated based on the average character length of the column data.
9. An electronic device for displaying tabular data, characterized in that: include: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 6.
10. A computer readable medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.
