A method and related apparatus for processing and rendering table segments.
By using a fragmented processing and rendering method, the problem of JS thread blocking caused by rendering large amounts of data tables is solved, achieving seamless fast rendering and efficient interaction.
Patent Information
- Application Number
- CN202512009280.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-29
- Publication Date
- 2026-11-10
- Estimated Expiration
- 2045-12-29
AI Technical Summary
Existing technologies often cause JavaScript threads to be blocked for extended periods and the user interface to become unresponsive when processing large tables.
The method employs a sliced processing and rendering approach. By acquiring interactive operations, the source table data is sliced, loaded, and merged under non-scroll offset operations to generate off-screen Canvas data, and the target data is drawn in the Canvas rendering engine. Under scroll offset operations, the target data to be displayed is determined from the off-screen Canvas data and rendered.
It effectively avoids JS thread blocking, improves the smoothness of user interaction, makes the table scrolling rendering process imperceptible, and improves rendering efficiency and performance.
Smart Images

Figure CN121723987B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of software technology, and in particular to a method and apparatus for processing and rendering tables in segments. Background Technology
[0002] Currently, when front-end developers process large amounts of data (especially tables with thousands of rows or more), they often load and render the entire table at once. Because massive amounts of table data undergo structural transformations, cell merging calculations, and sticker processing all at once in the JS thread, this can easily lead to problems such as the JS thread being blocked for a long time and the user interface becoming unresponsive. Summary of the Invention
[0003] In view of the above problems, this application provides a method and related apparatus for table fragmentation processing and rendering, so as to achieve the purpose of fragmented data processing and rendering of large data tables. The specific solution is as follows:
[0004] The first aspect of this application provides a method for processing and rendering table segments, the method comprising:
[0005] Get the interactive operations for the target table;
[0006] If the interactive operation is not a scroll offset operation, the source data of the target table is split, loaded, and merged to obtain off-screen Canvas data;
[0007] When the interactive operation is the scroll offset operation, the target off-screen Canvas data to be displayed is determined from the off-screen Canvas data, and the target off-screen Canvas data is drawn in the Canvas rendering engine.
[0008] In one possible implementation, the step of loading and merging the source data of the target table in segments to obtain off-screen Canvas data includes:
[0009] If this is the first time this segmentation is performed, the size of the first segmentation is determined based on the size of the visible area.
[0010] The first segment data of this segment is loaded from the source data according to the first segment size, and the format of the first segment data is converted to obtain the first sub-off-screen Canvas data of this segment;
[0011] The first off-screen Canvas data is used as the off-screen Canvas data after this segmentation, and the off-screen Canvas data after this segmentation is drawn in the Canvas rendering engine.
[0012] In one possible implementation, the step of loading and merging the source data of the target table in segments to obtain off-screen Canvas data includes:
[0013] If this fragmentation is not the first fragmentation, the size of the second fragmentation in this fragmentation is determined based on the device performance;
[0014] The second fragment data of this fragment is loaded from the source data according to the second fragment size, and the format of the second fragment data is converted to obtain the second sub-off-screen Canvas data of this fragment;
[0015] Retrieve the off-screen Canvas data obtained after the last fragmentation, and concatenate the retrieved off-screen Canvas data with the second sub-off-screen Canvas data to obtain the off-screen Canvas data after the current fragmentation.
[0016] In one possible implementation, determining the second fragment size based on device performance includes:
[0017] Obtain network parameters and CPU operating parameters;
[0018] The size of the second slice is determined based on the network parameters and the CPU operating parameters.
[0019] In one possible implementation, the step of concatenating the retrieved off-screen Canvas data with the second sub-off-screen Canvas data to obtain the off-screen Canvas data after this segmentation includes:
[0020] The table style data in the retrieved off-screen Canvas data and the second sub-off-screen Canvas data are deconstructed respectively to obtain the first content data in the retrieved off-screen Canvas data and the second content data in the second sub-off-screen Canvas data.
[0021] The first content data and the second content data are concatenated to obtain the third content data;
[0022] The merged area in the third content data is repaired and reorganized to obtain the off-screen Canvas data after this segmentation.
[0023] In one possible implementation, determining the target off-screen Canvas data to be displayed from the off-screen Canvas data includes:
[0024] Get the scroll offset direction and scroll offset value;
[0025] The target area to be displayed in the target table is determined based on the scroll offset direction and the scroll offset value;
[0026] The portion of the off-screen Canvas data corresponding to the target region is used as the target off-screen Canvas data.
[0027] A second aspect of this application provides a table segmentation processing and rendering apparatus, the table segmentation processing and rendering apparatus comprising:
[0028] The interaction module is used to obtain interactive operations for the target table;
[0029] The slicing and rendering module is used to slice and merge the source data of the target table to obtain off-screen Canvas data when the interaction operation is not a scroll offset operation; when the interaction operation is the scroll offset operation, it determines the target off-screen Canvas data to be displayed from the off-screen Canvas data and draws the target off-screen Canvas data in the Canvas rendering engine.
[0030] A third aspect of this application provides a computer program product including computer-readable instructions that, when executed on an electronic device, cause the electronic device to implement the table segmentation and rendering method of the first aspect or any implementation thereof.
[0031] A fourth aspect of this application provides an electronic device, including at least one processor and a memory connected to the processor, wherein:
[0032] The memory is used to store computer programs;
[0033] The processor is used to execute the computer program so that the electronic device can implement the table segmentation and rendering method of the first aspect or any implementation thereof.
[0034] The fifth aspect of this application provides a computer storage medium carrying one or more computer programs, which, when executed by an electronic device, enable the electronic device to implement the table segmentation and rendering method described in the first aspect or any implementation thereof.
[0035] By employing the above technical solutions, this application provides a method and related apparatus for table segmentation and rendering, comprising: acquiring an interactive operation for a target table; when the interactive operation is not a scroll offset operation, performing segmented loading and merging of the source data of the target table to obtain off-screen Canvas data; when the interactive operation is a scroll offset operation, determining the target off-screen Canvas data to be displayed from the off-screen Canvas data, and drawing the target off-screen Canvas data in the Canvas rendering engine. With this application, during the rendering and output of the table, the front end executes a segmented loading and merging strategy to obtain off-screen Canvas data when the user is not scrolling the table, and selects the target object from the off-screen Canvas data for rendering when the user scrolls the table. This application, on the one hand, divides large tables into small blocks for asynchronous processing, and then splices them together after segmentation, thereby avoiding JS thread blocking; on the other hand, the off-screen Canvas data consists of unrendered Canvas elements, and operations such as drawing and temporarily storing it do not affect visible Canvas elements. Therefore, by using off-screen Canvas technology, data loading can be completed without the user's awareness, enabling rapid rendering when the user scrolls the table and improving the smoothness of the interaction. Attached Figure Description
[0036] The above and other features, advantages, and aspects of the embodiments of this disclosure will become more apparent from the accompanying drawings and the following detailed description. Throughout the drawings, the same or similar reference numerals denote the same or similar elements. It should be understood that the drawings are schematic, and the originals and elements are not necessarily drawn to scale.
[0037] Figure 1 A flowchart illustrating a table segmentation and rendering method provided in an embodiment of this application;
[0038] Figure 2 A partial flowchart illustrating a table segmentation and rendering method provided in an embodiment of this application;
[0039] Figure 3 This is another part of the flowchart illustrating a table segmentation and rendering method provided in an embodiment of this application;
[0040] Figure 4 Another part of the flowchart of a table segmentation and rendering method provided in the embodiments of this application;
[0041] Figure 5 Another part of the flowchart of a table segmentation and rendering method provided in the embodiments of this application;
[0042] Figure 6Another part of the flowchart of a table segmentation and rendering method provided in the embodiments of this application;
[0043] Figure 7 A schematic diagram of the structure of a table segmentation and rendering apparatus provided in an embodiment of this application;
[0044] Figure 8 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation
[0045] The embodiments of this application are described below with reference to the accompanying drawings. The terminology used in the implementation section of this application is for explaining specific embodiments only and is not intended to limit the scope of this application.
[0046] The embodiments of this application will now be described with reference to the accompanying drawings. Those skilled in the art will recognize that, with technological advancements and the emergence of new scenarios, the technical solutions provided in the embodiments of this application are equally applicable to similar technical problems.
[0047] The terms "first," "second," etc., used in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such terms are interchangeable where appropriate; this is merely a way of distinguishing objects with the same attributes in the embodiments of this application. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion, so that a process, method, system, product, or apparatus that comprises a series of elements is not necessarily limited to those elements but may include other elements not explicitly listed or inherent to those processes, methods, products, or apparatuses.
[0048] To facilitate understanding of this application, the relevant concepts involved in this application will be explained below:
[0049] JS (JavaScript): JavaScript is a lightweight, interpreted or just-in-time compiled programming language that is widely used in web development, primarily to enhance the interactivity and dynamism of web pages.
[0050] Canvas: Refers to the graphics drawing element provided by the HTML5 standard, used to render dynamic images on web pages via JavaScript. Its core feature is pixel-by-pixel manipulation based on bitmaps. After drawing, the graphics are converted to static bitmaps, requiring redrawing to update the content, making it suitable for dynamic rendering. Off-screen Canvas can be used to optimize rendering efficiency.
[0051] merges (merged area): refers to the area occupied by a merged cell in a table.
[0052] Sticker: A dynamic element that can be attached to a cell, such as rich text or interactive controls.
[0053] To address the issue of prolonged JavaScript thread blocking and unresponsive user interface during full loading and rendering of large datasets, this application provides a method for table segmentation and rendering. The table segmentation and rendering method of this application embodiment is described in detail below with reference to the accompanying drawings.
[0054] See Figure 1 , Figure 1 This is a flowchart illustrating a table segmentation and rendering method provided in an embodiment of this application. Figure 1 As shown in the figure, the table segmentation and rendering method provided in this application embodiment may include steps S101 to S103, which are described in detail below.
[0055] S101, obtain the interactive operation for the target table.
[0056] In this embodiment, the target table is the table to be displayed on the front end. By monitoring user input, interactive operations on the target table can be obtained. These interactive operations are divided into scroll offset operations and non-scroll offset operations. Specifically, when the user inputs a scroll offset operation, part of the target table's data is already displayed in the visible area, and the user views the undisplayed data through scrolling interaction.
[0057] S102, when the interactive operation is not a scroll offset operation, the source data of the target table is loaded and merged in segments to obtain off-screen Canvas data.
[0058] In this embodiment of the application, if the interactive operation is not a scroll offset operation, the shard loading and merging strategy is executed. The source data of the target table is sharded and loaded according to the strategy (such as according to a fixed number of rows). This can divide a large amount of data table into small blocks for asynchronous processing. After the sharding is completed, the off-screen Canvas data is obtained by splicing them together, thereby avoiding JS thread blocking.
[0059] It should be noted that the source data of the target table consists of metadata of cells under different indexes. The cells in the source data can be divided into two categories: the first category of cells, which represent the table style, and the second category of cells, which represent the table content. The metadata of the first category of cells includes table style data such as borders and margins, while the metadata of the second category of cells includes cell style data such as row height and column width, as well as cell content data such as text, images, links, and stickers.
[0060] It should also be noted that off-screen Canvas data is the standard data format required by the Canvas rendering engine. It consists of unrendered Canvas elements, and drawing, storing, and other operations on it will not affect the visible Canvas elements already drawn by the Canvas rendering engine. With the help of off-screen Canvas technology, users can complete data loading without realizing it.
[0061] In one possible implementation, the table is loaded in chunks according to the size of the visible area when it is first displayed on the screen, and then drawn and displayed in the Canvas rendering engine. See also Figure 2 , Figure 2 This is a partial flowchart illustrating a table segmentation and rendering method provided in an embodiment of this application. Figure 2 As shown in the embodiment of this application, a method for processing and rendering a table by splitting is provided. In step S102, "splitting and merging the source data of the target table to obtain off-screen Canvas data" may include steps S201 to S203. These steps are described in detail below.
[0062] S201, In the case that this is the first fragmentation, the size of the first fragmentation is determined based on the size of the visible area.
[0063] In this embodiment of the application, if this is the first time the table is being loaded, meaning the target table is the first screen display, the size of this first load (i.e., the size of the first load) can be determined according to the size of the visible area. Specifically, the row heights of cells in different rows of the source data are traversed in ascending order of row number to determine the number of rows in the source data that match the size of the visible area as the size of the first load. This ensures that the table can be rendered on the first screen when the first load is performed.
[0064] S202, load the first fragment data of this fragment from the source data according to the size of the first fragment, and perform format conversion on the first fragment data to obtain the first sub-off-screen Canvas data of this fragment.
[0065] In this embodiment, the source data is divided into segments according to the first segment size. Taking a first segment size of 50 rows as an example, the metadata of the cells with position indices in the first 50 rows can be loaded from the source data, and the metadata of all loaded cells is used as the first segment data. Furthermore, to ensure that the first segment data can be directly used by the Canvas rendering engine, the first segment data is format-converted to obtain the sub-off-screen Canvas data (i.e., the first sub-off-screen Canvas data) that can be parsed by the Canvas rendering engine.
[0066] Specifically, the format conversion involves recording the row height of each row in the first data segment using the rows array and the column width of each column using the cols array. When there are merged cells, the number of rows to be merged is recorded in the merges array in the form of [x1,x2] and the number of columns is recorded in the merges array in the form of [y1,y2]. For sticker-type cells, the detailed sticker content is recorded using the sticker (e.g., rich text cells need to record their rich text content).
[0067] S203: Use the first off-screen Canvas data as the off-screen Canvas data after this segmentation, and draw the off-screen Canvas data after this segmentation in the Canvas rendering engine.
[0068] In this embodiment, the first off-screen Canvas data is used as the off-screen Canvas data after this segmentation, and the off-screen Canvas data after this segmentation is drawn using the Canvas rendering engine, thereby outputting the target table's first screen. This achieves fast first-screen loading and smooth interaction.
[0069] In one possible implementation, when the table is not displayed on the first screen, it can be loaded in chunks based on device performance, and the newly loaded chunks can be incrementally merged with the already loaded data according to their position. See also Figure 3 , Figure 3 This is another schematic flowchart illustrating a table segmentation and rendering method provided in an embodiment of this application. For example... Figure 3 As shown in the embodiment of this application, a method for processing and rendering a table by splitting is provided. In step S102, "splitting and merging the source data of the target table to obtain off-screen Canvas data" may include steps S301 to S303. These steps are described in detail below.
[0070] S301, if this fragmentation is not the first fragmentation, determine the size of the second fragmentation based on the device performance.
[0071] In this embodiment of the application, if the current fragment is not the first fragment, that is, the target table has been displayed on the first screen, the fragment size (i.e. the second fragment size) of the current fragment can be determined according to the device performance. Specifically, the device performance can be evaluated according to the network conditions and hardware conditions to determine the second fragment size. The second fragment size is positively correlated with the device performance, that is, the better the device performance, the larger the second fragment size.
[0072] In one possible implementation, chunked loading relies primarily on network transmission speed and CPU performance. The size of the second chunk can be dynamically determined based on network and CPU operating parameters, allowing for adaptive adjustment of data loading and merging for non-first-screen content. See also Figure 4 , Figure 4 This is another part of the flowchart illustrating a table segmentation and rendering method provided in an embodiment of this application. For example... Figure 4 As shown in the embodiment of this application, a method for processing and rendering a table by slicing is provided. In step S301, "determine the size of the second slice of this slice according to the device performance" may include steps S401 to S402. These steps are described in detail below.
[0073] S401 retrieves network parameters and CPU operating parameters.
[0074] In this embodiment, network parameters (such as upload speed, download speed, bandwidth, etc.) can be monitored, and CPU operating parameters (such as CPU frequency, number of threads, etc.) can be collected.
[0075] S402 determines the size of the second fragment based on network parameters and CPU operating parameters.
[0076] In this embodiment, the second fragment size can be determined by a search method or a model prediction method, which matches the network parameters and CPU operating parameters. The higher the network transmission speed indicated by the network parameters and the better the CPU performance indicated by the CPU operating parameters, the larger the number of rows corresponding to the second fragment size.
[0077] It should be noted that when determining the size of the second slice using the model prediction method, a prediction model can be trained based on machine learning algorithms. Training samples can be generated by labeling the slice size with different network parameters and CPU running parameters, and the prediction model can be obtained by training in this way.
[0078] S302, load the second fragment data of this fragment from the source data according to the size of the second fragment, and perform format conversion on the second fragment data to obtain the second sub-off-screen Canvas data of this fragment.
[0079] In this embodiment, the source data is divided into two parts according to the second part size. Taking this part as the second part and the corresponding second part size as 30 rows as an example, the metadata of the cells with position indices located in rows 51 to 80 can be loaded from the source data, and the metadata of all loaded cells is used as the second part data. Furthermore, to ensure that the second part data can be directly used by the Canvas rendering engine, the second part data is formatted to obtain the sub-off-screen Canvas data (i.e., the second sub-off-screen Canvas data) that can be parsed by the Canvas rendering engine.
[0080] It should be noted that the format conversion process of the second data segment can refer to the format conversion process of the first data segment, and will not be described again in this embodiment.
[0081] S303: Retrieve the off-screen Canvas data obtained after the last segmentation, and concatenate the retrieved off-screen Canvas data with the second sub-off-screen Canvas data to obtain the off-screen Canvas data after the current segmentation.
[0082] In this embodiment, the off-screen Canvas data obtained from the previous segmentation can be retrieved, and the retrieved off-screen Canvas data can be concatenated with the second sub-off-screen Canvas data to obtain the off-screen Canvas data after the current segmentation. At this time, the information such as rows array, cols array, merges and sticker in the off-screen Canvas data is also updated accordingly. This allows the newly loaded segmented data to be concatenated according to position based on the existing table data.
[0083] In one possible implementation, a complete structure can be built on the first screen, and subsequent displays can only merge the core content areas. This avoids redundant boundary calculations, reduces computational overhead, and improves performance. See also Figure 5 , Figure 5 This is another part of the flowchart illustrating a table segmentation and rendering method provided in an embodiment of this application. For example... Figure 5 As shown in the embodiment of this application, a table segmentation and rendering method is provided. In step S303, "the retrieved off-screen Canvas data and the second sub-off-screen Canvas data are concatenated to obtain the off-screen Canvas data after this segmentation" can include steps S501 to S503. These steps are described in detail below.
[0084] S501, deconstruct the table style data in the retrieved off-screen Canvas data and the second sub-off-screen Canvas data respectively to obtain the first content data in the retrieved off-screen Canvas data and the second content data in the second sub-off-screen Canvas data.
[0085] In this embodiment, the retrieved off-screen Canvas data and second sub-off-screen Canvas data can be deconstructed to extract table style data such as borders and margins. This involves retrieving the relevant information of cells whose metadata is table style data, thereby obtaining the relevant data for the actual content area (including rows, cols, merges, and sticker information), namely, the first content data in the off-screen Canvas data and the second content data in the second sub-off-screen Canvas data. This allows the table style data representing the table boundary structure, such as the first N rows and the last M rows, to be preserved during merging, ensuring that key structures such as frozen rows and total rows are not overwritten. This supports complex enterprise-level reports and offers strong robustness.
[0086] S502, the first content data and the second content data are concatenated to obtain the third content data.
[0087] In this embodiment of the application, the first content data and the second content data are concatenated to obtain the content data (i.e., the third content data) in the off-screen Canvas data after this segmentation.
[0088] S503, repair and reorganize the merged area in the third content data to obtain the off-screen Canvas data after this segmentation.
[0089] In this embodiment of the application, the third content data obtained by splicing is repaired and reorganized, mainly processing the merged area (merges) and row and column indexes. For example, a merged cell spans four rows, but during sharding, the merged cell is divided into two shards. At this time, after format conversion, the merged cell will be split into [0,1] and [1,4] and recorded in two merges. After splicing and repairing and reorganizing, it can be repaired to [0,4] and recorded in the merges after this sharding.
[0090] S103, when the interactive operation is a scroll offset operation, determine the target off-screen Canvas data to be displayed from the off-screen Canvas data, and draw the target off-screen Canvas data in the Canvas rendering engine.
[0091] In this embodiment of the application, if the interactive operation is a scroll offset operation, the target off-screen Canvas data to be displayed can be determined from the obtained off-screen Canvas data based on the motion trajectory of the scroll offset operation. The target off-screen Canvas data is converted into coordinate data in the Canvas rendering engine according to the size of the visible area, so as to complete the table drawing and the filling of the corresponding cell content data in the Canvas rendering engine.
[0092] In one possible implementation, the target off-screen Canvas data can be precisely determined by monitoring the direction and amount of the scroll offset operation. See also Figure 6 , Figure 6 This is another part of the flowchart illustrating a table segmentation and rendering method provided in an embodiment of this application. For example... Figure 6 As shown in the embodiment of this application, a method for processing and rendering a table by segmentation is provided. In step S103, "determine the target off-screen Canvas data to be displayed from the off-screen Canvas data" can include steps S601 to S603. These steps are described in detail below.
[0093] S601, obtain the scroll offset direction and scroll offset value.
[0094] In this embodiment of the application, the scroll offset direction corresponding to the scroll offset operation and the scroll offset value under the scroll offset direction can be obtained through state awareness.
[0095] S602, determine the target area to be displayed in the target table based on the scroll offset direction and scroll offset value.
[0096] In this embodiment of the application, a region in the target table that matches the scroll offset value is determined as the target region to be displayed under the scroll offset direction, and the size of the target region is the same as the size of the visible region.
[0097] S603, take the portion of the off-screen Canvas data that corresponds to the target area as the target off-screen Canvas data.
[0098] In this embodiment, the data corresponding to the target area in the off-screen Canvas data (including rows array, cols array, merges and sticker information, etc.) is used as the target off-screen Canvas data. The target off-screen Canvas data is then drawn in the Canvas rendering engine. This allows for rapid rendering when the user scrolls the table, improving the smoothness of the interaction and avoiding visual jumps.
[0099] Based on the above description, the table segmentation and rendering method provided in this application can, on the one hand, divide a large table into small blocks for asynchronous processing, and then concatenate them after segmentation, thereby avoiding JS thread blocking; on the other hand, off-screen Canvas data consists of unrendered Canvas elements, and operations such as drawing and temporarily storing them do not affect visible Canvas elements. Therefore, by using off-screen Canvas technology, data loading can be completed without the user's awareness, and rendering can be completed quickly when the user scrolls the table, improving the smoothness of interaction. In addition, based on building a complete structure on the first screen, subsequent merging only the core content area can avoid repeated boundary calculations, reduce computational overhead, and improve performance. Furthermore, it can also achieve seamless support for complex table structures (such as merged cells, stickers, etc.) in segmentation scenarios, ensuring the consistency between the data model and the rendering result.
[0100] The above describes a method for processing and rendering a table by slicing according to an embodiment of this application. The following describes the apparatus for performing the above method for processing and rendering a table by slicing.
[0101] See Figure 7 , Figure 7 This is a schematic diagram of a table segmentation and rendering apparatus provided in an embodiment of this application. Figure 7 As shown in the embodiment of this application, a table fragmentation processing and rendering apparatus includes:
[0102] Interaction module 701 is used to obtain interactive operations for the target table;
[0103] The slicing and rendering module 702 is used to slice and merge the source data of the target table to obtain off-screen Canvas data when the interactive operation is not a scroll offset operation; when the interactive operation is a scroll offset operation, it determines the target off-screen Canvas data to be displayed from the off-screen Canvas data and draws the target off-screen Canvas data in the Canvas rendering engine.
[0104] In one possible implementation, the fragmentation and rendering module 702, used to load and merge the source data of the target table into off-screen Canvas data, is specifically used for:
[0105] In the case that this is the first fragment, the size of the first fragment is determined according to the size of the visible area; the first fragment data of this fragment is loaded from the source data according to the first fragment size, and the format of the first fragment data is converted to obtain the first sub-off-screen Canvas data of this fragment; the first sub-off-screen Canvas data is used as the off-screen Canvas data after this fragment, and the off-screen Canvas data after this fragment is drawn in the Canvas rendering engine.
[0106] In one possible implementation, the fragmentation and rendering module 702, used to load and merge the source data of the target table into off-screen Canvas data, is specifically used for:
[0107] If this fragment is not the first fragment, the size of the second fragment is determined based on device performance; the second fragment data is loaded from the source data according to the second fragment size, and the format of the second fragment data is converted to obtain the second sub-off-screen Canvas data of this fragment; the off-screen Canvas data obtained after the last fragment is retrieved, and the retrieved off-screen Canvas data is concatenated with the second sub-off-screen Canvas data to obtain the off-screen Canvas data after this fragment.
[0108] In one possible implementation, the fragmentation and rendering module 702, used to determine the size of the second fragment based on device performance, is specifically used for:
[0109] Obtain network parameters and CPU operating parameters; determine the size of the second slice based on the network parameters and CPU operating parameters.
[0110] In one possible implementation, the fragmentation and rendering module 702, used to concatenate the retrieved off-screen Canvas data with the second sub-off-screen Canvas data to obtain the fragmented off-screen Canvas data, is specifically used for:
[0111] The table style data in the retrieved off-screen Canvas data and the second sub-off-screen Canvas data are deconstructed to obtain the first content data in the retrieved off-screen Canvas data and the second content data in the second sub-off-screen Canvas data; the first content data and the second content data are concatenated to obtain the third content data; the merged area in the third content data is repaired and reorganized to obtain the off-screen Canvas data after this segmentation.
[0112] In one possible implementation, the segmentation and rendering module 702, used to determine the target off-screen Canvas data to be displayed from the off-screen Canvas data, is specifically used for:
[0113] Obtain the scroll offset direction and scroll offset value; determine the target area to be displayed in the target table based on the scroll offset direction and scroll offset value; use the portion of the off-screen Canvas data corresponding to the target area as the target off-screen Canvas data.
[0114] It should be noted that the detailed functions of each module in the embodiments of this application can be found in the corresponding disclosure section of the fragmentation and rendering method embodiments in the table above, and will not be repeated here.
[0115] This application also provides an electronic device in its embodiments. See also... Figure 8 , Figure 8 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. The electronic device in this embodiment may include, but is not limited to, fixed terminals such as mobile phones, laptops, PDAs (personal digital assistants), PADs (tablet computers), desktop computers, etc. Figure 8 The electronic device shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments of this application.
[0116] like Figure 8As shown, the electronic device may include a processing unit (e.g., a central processing unit, a graphics processing unit, etc.) 801, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 802 or a program loaded from a storage device 808 into a random access memory (RAM) 803. When the electronic device is powered on, the RAM 803 also stores various programs and data required for the operation of the electronic device. The processing unit 801, ROM 802, and RAM 803 are interconnected via a bus 804. An input / output (I / O) interface 805 is also connected to the bus 804.
[0117] Typically, the following devices can be connected to I / O interface 805: input devices 806 including, for example, touchscreens, touchpads, keyboards, mice, cameras, microphones, accelerometers, gyroscopes, etc.; output devices 807 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; storage devices 808 including, for example, memory cards, hard drives, etc.; and communication devices 809. Communication device 809 allows electronic devices to communicate wirelessly or wiredly with other devices to exchange data. Although Figure 8 Electronic devices with various devices are shown, but it should be understood that it is not required to implement or have all of the devices shown. More or fewer devices may be implemented or have alternatively.
[0118] This application also provides a computer program product including computer-readable instructions, which, when executed on an electronic device, cause the electronic device to implement any of the table segmentation and rendering methods provided in this application.
[0119] This application also provides a computer-readable storage medium that carries one or more computer programs. When the one or more computer programs are executed by an electronic device, the electronic device is able to implement any of the table segmentation and rendering methods provided in this application.
[0120] It should also be noted that the device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. In addition, in the device embodiment drawings provided in this application, the connection relationship between modules indicates that they have a communication connection, which can be implemented as one or more communication buses or signal lines.
[0121] Through the above description of the embodiments, those skilled in the art can clearly understand that this application can be implemented by means of software plus necessary general-purpose hardware, or it can be implemented by special-purpose hardware including application-specific integrated circuits, special-purpose CPUs, special-purpose memory, special-purpose components, etc. Generally, any function performed by a computer program can be easily implemented by corresponding hardware, and the specific hardware structure used to implement the same function can also be diverse, such as analog circuits, digital circuits, or special-purpose circuits. However, for this application, software program implementation is more often the preferred implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a readable storage medium, such as a computer floppy disk, USB flash drive, mobile hard disk, ROM, RAM, magnetic disk, or optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, training equipment, or network device, etc.) to execute the methods described in the various embodiments of this application.
[0122] In the above embodiments, implementation can be achieved, in whole or in part, through software, hardware, firmware, or any combination thereof. When implemented in software, it can be implemented, in whole or in part, as a computer program product.
[0123] The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of this application are generated. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions may be transmitted from one website, computer, training device, or data center to another website, computer, training device, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium may be any available medium that a computer can store or a data storage device such as a training device or data center that integrates one or more available media. The available media may be magnetic media (e.g., floppy disks, hard disks, magnetic tapes), optical media (e.g., DVDs), or semiconductor media (e.g., solid-state drives (SSDs)).
Claims
1. A method for processing and rendering table segments, characterized in that, The table's slicing and rendering methods include: Get the interactive operations for the target table; When the interactive operation is not a scroll offset operation, the source data of the target table is split, loaded, and merged to obtain off-screen Canvas data, including: if this split is not the first split, determining the size of the second split based on device performance; loading the second split data of this split from the source data according to the second split size, and converting the format of the second split data to obtain the second sub-off-screen Canvas data of this split; retrieving the off-screen Canvas data obtained after the last split, and concatenating the retrieved off-screen Canvas data with the second sub-off-screen Canvas data to obtain the off-screen Canvas data after this split; When the interactive operation is the scroll offset operation, the target off-screen Canvas data to be displayed is determined from the off-screen Canvas data, and the target off-screen Canvas data is drawn in the Canvas rendering engine.
2. The table segmentation and rendering method according to claim 1, characterized in that, The process of loading and merging the source data of the target table in segments to obtain off-screen Canvas data includes: If this is the first time this segmentation is performed, the size of the first segmentation is determined based on the size of the visible area. The first segment data of this segment is loaded from the source data according to the first segment size, and the format of the first segment data is converted to obtain the first sub-off-screen Canvas data of this segment; The first off-screen Canvas data is used as the off-screen Canvas data after this segmentation, and the off-screen Canvas data after this segmentation is drawn in the Canvas rendering engine.
3. The table segmentation and rendering method according to claim 1, characterized in that, The process of determining the size of the second fragment based on device performance includes: Obtain network parameters and CPU operating parameters; The size of the second slice is determined based on the network parameters and the CPU operating parameters.
4. The table segmentation and rendering method according to claim 1, characterized in that, The process of concatenating the retrieved off-screen Canvas data with the second sub-off-screen Canvas data to obtain the off-screen Canvas data after this segmentation includes: The table style data in the retrieved off-screen Canvas data and the second sub-off-screen Canvas data are deconstructed respectively to obtain the first content data in the retrieved off-screen Canvas data and the second content data in the second sub-off-screen Canvas data. The first content data and the second content data are concatenated to obtain the third content data; The merged area in the third content data is repaired and reorganized to obtain the off-screen Canvas data after this segmentation.
5. The table segmentation and rendering method according to claim 1, characterized in that, Determining the target off-screen Canvas data to be displayed from the off-screen Canvas data includes: Get the scroll offset direction and scroll offset value; The target area to be displayed in the target table is determined based on the scroll offset direction and the scroll offset value; The portion of the off-screen Canvas data corresponding to the target region is used as the target off-screen Canvas data.
6. A table segmentation and rendering apparatus, characterized in that, The table's slicing and rendering apparatus includes: The interaction module is used to obtain interactive operations for the target table; The slicing and rendering module is used to slice, load and merge the source data of the target table to obtain off-screen Canvas data when the interaction operation is not a scroll offset operation; when the interaction operation is the scroll offset operation, it determines the target off-screen Canvas data to be displayed from the off-screen Canvas data and draws the target off-screen Canvas data in the Canvas rendering engine. The segmentation and rendering module, which is used to load and merge the source data of the target table into off-screen Canvas data, specifically performs the following: when the current segmentation is not the first segmentation, it determines the size of the second segmentation based on device performance; loads the second segmentation data from the source data according to the second segmentation size, and performs format conversion on the second segmentation data to obtain the second sub-off-screen Canvas data of the current segmentation; retrieves the off-screen Canvas data obtained after the previous segmentation, and concatenates the retrieved off-screen Canvas data with the second sub-off-screen Canvas data to obtain the off-screen Canvas data after the current segmentation.
7. A computer program product, characterized in that, Includes computer-readable instructions that, when executed on an electronic device, cause the electronic device to implement the table slicing and rendering method as described in any one of claims 1 to 5.
8. An electronic device, characterized in that, It includes at least one processor and a memory connected to the processor, wherein: The memory is used to store computer programs; The processor is used to execute the computer program to enable the electronic device to implement the table slicing and rendering method as described in any one of claims 1 to 5.
9. A computer storage medium, characterized in that, The storage medium carries one or more computer programs that, when executed by an electronic device, enable the electronic device to implement the table slicing and rendering method as described in any one of claims 1 to 5.
Citation Information
Patent Citations
Topological graph off-screen rendering method and device, equipment and storage medium
CN118842711A
