Data drawing method and device, electronic equipment and storage medium
By determining the coordinate range based on the width, height and offset of the canvas in Internet products and drawing data in loops, the rendering performance pressure problem caused by the complexity of data display in Internet products is solved, and a stable data display is achieved.
Patent Information
- Application Number
- CN202411047561.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-31
- Publication Date
- 2024-11-15
AI Technical Summary
Due to excessive data display and complex user operations in Internet products, the front-end rendering performance pressure is too high, resulting in data display errors.
Reduce front-end rendering pressure by determining the coordinate range of content to be displayed based on the width, height and offset of the canvas, and looping the content data and table header data on the canvas.
It effectively avoids data display errors, improves front-end rendering performance, and reduces the pressure on servers and networks.
Smart Images

Figure CN118967873A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of front-end technology, and in particular to a data rendering method, device, electronic device and storage medium. Background Art
[0002] With the continuous development of Internet technology, in order to facilitate user use, many Internet products are displayed in the form of tables. However, due to the large amount of displayed data and complex user operations, it sometimes causes excessive pressure on the front-end rendering performance, resulting in problems such as data display errors. Summary of the invention
[0003] In order to overcome the problems existing in the related art, the present disclosure provides a data rendering method, device, electronic device and storage medium.
[0004] According to a first aspect of an embodiment of the present disclosure, a data drawing method is provided, the method comprising: Determine, according to the canvas width and canvas height of the canvas and the current offset of the canvas, a coordinate range of the content to be displayed in the canvas; wherein the coordinate range of the content to be displayed includes a coordinate range of at least one content data and a coordinate range of at least one header data; According to the coordinate range of each content data, loop the horizontal coordinate and the vertical coordinate of the canvas to draw each content data on the canvas; According to the coordinate range of each of the header data, the horizontal coordinate and the vertical coordinate of the canvas are looped to draw each of the header data on the canvas.
[0005] Optionally, determining the coordinate range of the content to be displayed on the canvas according to the canvas width and canvas height of the canvas and the current offset of the canvas includes: Set the canvas width and canvas height of the canvas; Setting any vertex of the canvas as the origin, and determining the horizontal axis and the vertical axis of the canvas to obtain the coordinate system of the canvas; In the coordinate system of the canvas, the coordinate range of the to-be-displayed content is determined according to the canvas width, the canvas height, and the offset, where the offset is an offset generated by page scrolling.
[0006] Optionally, the looping of the horizontal coordinate and the vertical coordinate of the canvas according to the coordinate range of each content data to draw each content data on the canvas includes: According to the coordinate range of each content data, looping the horizontal coordinate and the vertical coordinate of the canvas to determine whether the looped coordinate point is within the coordinate range of any content data; When the loop reaches a first coordinate point in the canvas, and the first coordinate point is within the coordinate range of the first content data, the first content data is drawn on the canvas.
[0007] Optionally, the content to be displayed is a table, and the content data is the content of one or more grids in the table, and when the loop reaches a first coordinate point in the canvas, and the first coordinate point is within a coordinate range of the first content data, drawing the first content data on the canvas includes: When the loop reaches a first coordinate point in the canvas, and the first coordinate point is a vertex at a specified position in one or more grids included in the first content data, the content data in the one or more grids are drawn on the canvas.
[0008] Optionally, when any of the content data includes a plurality of course data, drawing each of the content data on the canvas includes: When drawing each of the content data, for the multiple course data in any of the content data, the multiple course data are drawn in sequence according to the preset weight of each course data in the multiple course data from high to low.
[0009] Optionally, the method further comprises: In response to a long-press operation of the mouse by the user, obtaining a first coordinate position of the mouse cursor on the canvas; The content data or header data corresponding to the first coordinate position is acquired according to the first coordinate position.
[0010] Optionally, the method further comprises: When the cursor is long pressed and dragged from the first coordinate position to the second coordinate position, the content data or header data corresponding to the first coordinate position is drawn to the second coordinate position.
[0011] Optionally, the method further comprises: When it is detected that the user edits the content data and / or the header data, obtaining a comparison file from a cloud server; According to the comparison file, confirm whether there is a conflict in the content data and / or the header data; When the content data and / or the header data conflict with the comparison file, a prompt message indicating the data conflict is output to the user.
[0012] Optionally, the method further comprises: When drawing each of the content data and / or the header data on the canvas, each of the content data and / or the header data is first drawn on the buffer canvas, and then the content on the buffer canvas is copied to the canvas.
[0013] According to a second aspect of an embodiment of the present disclosure, a data drawing device is provided, the device comprising: A coordinate determination module, used to determine the coordinate range of the content to be displayed in the canvas according to the canvas width and canvas height of the canvas and the current offset of the canvas; wherein the coordinate range of the content to be displayed includes the coordinate range of at least one content data and the coordinate range of at least one header data; A first drawing module, used for looping the horizontal coordinate and the vertical coordinate of the canvas according to the coordinate range of each content data, so as to draw each content data on the canvas; The second drawing module is used to cycle the horizontal coordinates and the vertical coordinates of the canvas according to the coordinate range of each of the header data, so as to draw each of the header data on the canvas.
[0014] According to a third aspect of an embodiment of the present disclosure, there is provided a data drawing device, comprising: a processor; a memory for storing instructions executable by the processor; The processor is configured to: execute the executable instructions to implement the steps of the data drawing method described in any implementation of the first aspect above.
[0015] According to a fourth aspect of an embodiment of the present disclosure, a computer-readable storage medium is provided, on which computer program instructions are stored. When the program instructions are executed by a processor, the steps of the data drawing method described in the first aspect of the present disclosure are implemented.
[0016] The technical solution provided by the embodiments of the present disclosure may have the following beneficial effects: In the above technical solution, the coordinate range of the content to be displayed in the canvas is determined according to the canvas width and canvas height of the canvas, and the current offset of the canvas; wherein the coordinate range of the content to be displayed includes the coordinate range of at least one content data and the coordinate range of at least one header data, and according to the coordinate range of each content data, the horizontal coordinate and vertical coordinate of the canvas are cycled to draw each content data on the canvas, and according to the coordinate range of each header data, the horizontal coordinate and vertical coordinate of the canvas are cycled to draw each header data on the canvas. Through the above technical solution, the content data and header data are drawn according to the offset using the canvas, and since the data drawing operations are all implemented inside the canvas, the rendering pressure of the front end can be reduced, thereby avoiding problems such as data display errors.
[0017] Other features and advantages of the present disclosure will be described in detail in the following detailed description. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] The accompanying drawings are used to provide a further understanding of the present disclosure and constitute a part of the specification. Together with the following specific embodiments, they are used to explain the present disclosure but do not constitute a limitation of the present disclosure. In the accompanying drawings: Figure 1 The figure is a flow chart of a data drawing method according to an exemplary embodiment.
[0019] Figure 2 The figure is a flow chart of another data drawing method according to an exemplary embodiment.
[0020] Figure 3 The figure is a flow chart of another data drawing method according to an exemplary embodiment.
[0021] Figure 4 The figure is a flow chart of another data drawing method according to an exemplary embodiment.
[0022] Figure 5 is a flow chart of yet another data drawing method according to an exemplary embodiment.
[0023] Figure 6 It is a block diagram of a data drawing device according to an exemplary embodiment.
[0024] Figure 7 It is a block diagram of an electronic device according to an exemplary embodiment.
[0025] Figure 8 is a block diagram of yet another electronic device according to an exemplary embodiment. DETAILED DESCRIPTION
[0026] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.
[0027] It is to be understood that in the present disclosure, "plurality" refers to two or more than two, and other quantifiers are similar. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the associated objects before and after are in an "or" relationship. The singular forms "a", "the" and "the" are also intended to include plural forms, unless the context clearly indicates other meanings.
[0028] It is further understood that the terms "first", "second", etc. are used to describe various information, but such information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other, and do not indicate a specific order or importance. In fact, the expressions "first", "second", etc. can be used interchangeably.
[0029] It is further understood that, although the operations are described in a specific order in the drawings in the embodiments of the present disclosure, it should not be understood as requiring the operations to be performed in the specific order shown or in a serial order, or requiring the execution of all the operations shown to obtain the desired results. In certain environments, multitasking and parallel processing may be advantageous.
[0030] It should be noted that all actions of acquiring signals, information or data in this application are carried out in compliance with the relevant data protection laws and policies of the country where they are located, and with the authorization given by the owner of the corresponding device.
[0031] With the continuous development of the Internet, Internet products have also begun to get involved in the field of education, such as online teaching systems, online courses, electronic timetables, etc. Among them, electronic timetables usually display a lot of information, and different timetables need to be generated for students and teachers respectively. Due to the large time span of electronic timetables, and the fact that there may be functions such as scheduling, adjusting classes, and timetable queries in electronic timetables, there are also many complex operations, which may cause excessive pressure on front-end rendering. And because different operations correspond to different amounts of calculation, if the electronic timetable synchronizes the timetable to the server in real time, it may cause excessive pressure on the server and the network. Therefore, the present disclosure proposes a data drawing method to solve this problem.
[0032] Figure 1 is a flow chart of a data drawing method according to an exemplary embodiment. Figure 1 As shown, the method includes the following steps.
[0033] In step S101, the coordinate range of the content to be displayed in the canvas is determined according to the canvas width and canvas height, and the current offset of the canvas; wherein the coordinate range of the content to be displayed includes the coordinate range of at least one content data and the coordinate range of at least one header data.
[0034] It is understandable that Canvas is a new tag added in HTML5, which is used to generate images in real time on web pages and can operate image content. The current offset of the canvas is the difference between the current position of the canvas and the position of the canvas before the offset. Among them, the content to be displayed can be a table, and the table can include content data and header data. Since the table usually cannot be fully displayed on the canvas, and the content of the table displayed in the canvas may also change after the offset occurs. Therefore, according to the canvas width and canvas height of the canvas, as well as the current offset of the canvas, the coordinate range of the content to be displayed in the canvas can be determined; wherein, since the content to be displayed includes at least one content data and at least one header data, the coordinate range of the content to be displayed includes the coordinate range of at least one content data and the coordinate range of at least one header data.
[0035] In step S102, the horizontal coordinates and vertical coordinates of the canvas are cycled according to the coordinate range of each content data to draw each content data on the canvas.
[0036] It can be understood that since the coordinate range of each content data is composed of corresponding horizontal coordinates and vertical coordinates respectively, when looping through the horizontal coordinates and vertical coordinates of the canvas and traversing to the coordinate range of each content data, the content data corresponding to the coordinate range can be drawn on the canvas.
[0037] In step S103, the horizontal coordinates and vertical coordinates of the canvas are cycled according to the coordinate range of each header data to draw each header data on the canvas.
[0038] It can be understood that, as described in step S102, since the coordinate range of each header data is composed of corresponding horizontal coordinates and vertical coordinates, when looping through the horizontal coordinates and vertical coordinates of the canvas and traversing to the coordinate range of each header data, the header data corresponding to the coordinate range can be drawn on the canvas. It is worth mentioning that the content data is drawn first and then the header data is drawn due to the characteristic of the canvas that it comes later. Therefore, in order to ensure that the header data is located above the content data and is not blocked by the content data, it is necessary to draw the content data first and then the header data.
[0039] In the above technical solution, the coordinate range of the content to be displayed in the canvas is determined according to the canvas width and canvas height of the canvas, and the current offset of the canvas; wherein the coordinate range of the content to be displayed includes the coordinate range of at least one content data and the coordinate range of at least one header data, and according to the coordinate range of each content data, the horizontal coordinate and vertical coordinate of the canvas are cycled to draw each content data on the canvas, and according to the coordinate range of each header data, the horizontal coordinate and vertical coordinate of the canvas are cycled to draw each header data on the canvas. Through the above technical solution, the content data and header data are drawn according to the offset using the canvas, and since the data drawing operations are all implemented inside the canvas, the rendering pressure of the front end can be reduced, thereby avoiding problems such as data display errors.
[0040] Optionally, Figure 2 is a flow chart of another data drawing method according to an exemplary embodiment. Figure 2 As shown, step S101 may include the following steps.
[0041] In step S1011 , the canvas width and canvas height of the canvas are set.
[0042] In step S1012, any vertex of the canvas is set as the origin, and the horizontal axis and the vertical axis of the canvas are determined to obtain the coordinate system of the canvas.
[0043] In step S1013, in the coordinate system of the canvas, the coordinate range of the content to be displayed is determined according to the canvas width and canvas height, and an offset, where the offset is an offset generated by scrolling the page.
[0044] It is understandable that the origin of the canvas is usually the vertex in the upper left corner of the canvas. After determining the origin, the horizontal axis is the horizontal axis and the vertical axis is the vertical axis, and the coordinate system of the canvas can be obtained. The width and height of the canvas can be obtained by <canvas>The width and height attributes of the tag set the width and height of the canvas, which can also be set via JavaScript <canvas>The width and height attributes of the tag. After the content data and header data are formatted into the required form, the coordinate range of the content data and header data can be obtained according to the coordinate system of the canvas. The coordinate range of the content to be displayed can be calculated according to the canvas width, canvas height and offset. Among them, the offset is obtained by monitoring the browser API.
[0045] Optionally, Figure 3 is a flow chart of another data drawing method according to an exemplary embodiment. Figure 3 As shown, step S102 may include the following steps.
[0046] In step S1021, the horizontal coordinates and vertical coordinates of the canvas are looped according to the coordinate ranges of the respective content data to determine whether the looped coordinate point is within the coordinate range of any content data.
[0047] In step S1022, when the loop reaches the first coordinate point in the canvas, and the first coordinate point is within the coordinate range of the first content data, the first content data is drawn on the canvas.
[0048] Optionally, the content to be displayed is a table, and a content data is the content of one or more grids in the table. Step S1022 includes: When the loop reaches the first coordinate point in the canvas, and the first coordinate point is a vertex at a specified position in one or more grids contained in the first content data, the content data in the one or more grids is drawn on the canvas. The first coordinate point is any coordinate point in the canvas.
[0049] It is understandable that the coordinate range of each content data can be determined by the vertex coordinates of the upper left corner vertex of the cell in the table occupied by the content data, the cell height occupied, and the cell width occupied, or it can be confirmed according to the vertex coordinates of the four vertices of the cell in the table occupied by the content data. Among them, one content data may occupy multiple cells. For example, the vertex coordinates of content data A are (2, 3), the cell height occupied is 10px, and the cell width occupied is 20px. Therefore, when looping the coordinate points in the horizontal coordinates and vertical coordinates of the canvas, when looping to the vertex coordinates in the coordinate range of the content data, the content data is drawn on the canvas. Taking content data A as an example, when looping to the coordinate point (2, 3), the content data A will be drawn at the corresponding position in the table with (2, 3) as the vertex, 10px as the height, and 20px as the width.
[0050] It is worth mentioning that steps S1021 to S1022 are for content data. Similarly, for header data, step S103 may include: (1) According to the coordinate range of each header data, loop through the horizontal and vertical coordinates of the canvas to determine whether the coordinate point looped to is within the coordinate range of any header data.
[0051] (2) When the loop reaches the second coordinate point in the canvas, and the second coordinate point is within the coordinate range of the first header data, the first header data is drawn on the canvas.
[0052] The step (2) may include: when looping to a second coordinate point in the canvas, and the second coordinate point is a vertex at a specified position in one or more grids included in the first header data, drawing the header data in the one or more grids on the canvas. The second coordinate point is any coordinate point in the canvas.
[0053] For example, the coordinate range of each header data consists of the vertex coordinates of the upper left corner vertex of the cell in the table occupied by the header data, the cell height occupied, and the cell width occupied, where one header data may occupy multiple cells. For example, the vertex coordinates of header data B are (1, 1), the cell height occupied is 5px, and the cell width occupied is 10px. Therefore, when looping through the coordinate points in the horizontal and vertical coordinates of the canvas, when looping through the vertex coordinates in the coordinate range of the header data, the header data is drawn on the canvas. Taking header data B as an example, when looping through the coordinate point (1, 1), the header data B will be drawn at the corresponding position in the table with (1, 1) as the vertex, 5px as the height, and 10px as the width.
[0054] Optionally, when any content data includes multiple course data, step S102 may include: When drawing each content data, for a plurality of course data in any content data, the plurality of course data are drawn in sequence according to the preset weight of each course data in the plurality of course data from high to low.
[0055] It is understandable that the course data may include course-related data such as course time, course content, teacher, number of absentees, etc. For example, the preset weight of the number of absentees is 1, the preset weight of the teacher is 0.9, the preset weight of the course time is 0.8, and the preset weight of the course content is 0.7. Therefore, according to the preset weight from high to low, the order of drawing each course data in the content data is the number of absentees, teacher, course time, and course content, and the display order in the table is also the number of absentees at the top of the cell, followed by the teacher, course time, and course content.
[0056] Optionally, Figure 4 is a flow chart of another data drawing method according to an exemplary embodiment. Figure 4 As shown, the method may further include the following steps.
[0057] In step S401, in response to a long-press operation of the mouse by the user, a first coordinate position of the mouse cursor on the canvas is acquired.
[0058] In step S402, content data or header data corresponding to the first coordinate position is acquired according to the first coordinate position.
[0059] Optionally, the method may further include the following steps.
[0060] When the cursor is long pressed and dragged from the first coordinate position to the second coordinate position, the content data or header data corresponding to the first coordinate position is drawn to the second coordinate position.
[0061] It can be understood that on the canvas, if the position of certain content data or header data needs to be changed, you can long press the left mouse button at the data at the first coordinate position, then drag the cursor to the second coordinate position, and then draw the data at the original first coordinate position to the second coordinate position, thereby realizing the interaction effect between the user and the table.
[0062] Optionally, Figure 5 is a flow chart of another data drawing method according to an exemplary embodiment. Figure 5 As shown, the method may further include the following steps.
[0063] In step S501, when it is detected that the user edits the content data and / or the header data, a comparison file is obtained from the cloud server.
[0064] In step S502, it is confirmed whether there is a conflict in the content data and / or the header data based on the comparison file.
[0065] In step S503, when the content data and / or the header data conflict with the comparison file, a prompt message indicating the data conflict is output to the user.
[0066] It is understandable that when the user edits the content data and / or header data on the canvas, these data are saved in the user's local device. When the user edits the data in the canvas, the comparison file can be obtained from the cloud server, and the comparison file can be used to compare the data in the canvas being edited by the user. When the content data and / or header data conflict with the comparison file, a prompt message indicating the data conflict is output to the user. After the user saves or submits the data, the user data is uploaded to the cloud server, which can alleviate the storage pressure of the server to a certain extent.
[0067] Optionally, the method may further include: When drawing each content data and / or header data on the canvas, each content data and / or header data is first drawn on the buffer canvas, and then the content on the buffer canvas is copied on the canvas.
[0068] It is understandable that in order to avoid data errors, table flickering and other problems caused by complex drawing operations, all operations are performed on the buffer canvas when drawing data. When the drawing is completed, the buffer canvas copies the data directly on the canvas, which is equivalent to performing only a few operations on the canvas.
[0069] Through the above technical solution, the content data and header data in the table are drawn by obtaining the vertex coordinates, and the course data in the same grid are drawn in order according to the weight to show the different importance of the course data. And the table data can be dragged by long pressing and dragging the mouse to achieve the interaction effect between the user and the table; through the comparison file in the cloud server, when there is a conflict in the data being edited by the user, the user is reminded in time; and the buffered canvas can be used to copy the data directly on the canvas, avoiding data errors and table flickering caused by complex drawing operations.
[0070] Figure 6 is a block diagram of a data drawing device according to an exemplary embodiment. Figure 6 As shown, the data drawing device 600 may include.
[0071] The coordinate determination module 601 is used to determine the coordinate range of the content to be displayed in the canvas according to the canvas width and canvas height of the canvas and the current offset of the canvas; wherein the coordinate range of the content to be displayed includes the coordinate range of at least one content data and the coordinate range of at least one header data.
[0072] The first drawing module 602 is used to cycle the horizontal coordinates and the vertical coordinates of the canvas according to the coordinate range of each content data, so as to draw each content data on the canvas.
[0073] The second drawing module 603 is used to cycle the horizontal coordinates and the vertical coordinates of the canvas according to the coordinate range of each header data, so as to draw each header data on the canvas.
[0074] Optionally, the coordinate determination module 601 is used to: Set the canvas width and canvas height of the canvas.
[0075] Set any vertex of the canvas as the origin, and determine the horizontal axis and vertical axis of the canvas to obtain the coordinate system of the canvas.
[0076] In the coordinate system of the canvas, the coordinate range of the content to be displayed is determined according to the canvas width, canvas height, and offset, where the offset is the offset generated by page scrolling.
[0077] Optionally, the first drawing module 602 is used to: According to the coordinate range of each content data, the horizontal coordinate and the vertical coordinate of the canvas are looped to determine whether the looped coordinate point is within the coordinate range of any content data.
[0078] When the loop reaches the first coordinate point in the canvas, and the first coordinate point is within the coordinate range of the first content data, the first content data is drawn on the canvas.
[0079] Optionally, the first drawing module 602 is used to: When the loop reaches the first coordinate point in the canvas, and the first coordinate point is a vertex at a specified position in one or more grids contained in the first content data, the content data in the one or more grids are drawn on the canvas.
[0080] Optionally, when any content data includes a plurality of course data, the first drawing module 602 is used to: When drawing each content data, for a plurality of course data in any content data, the plurality of course data are drawn in sequence according to the preset weight of each course data in the plurality of course data from high to low.
[0081] Optionally, the data drawing device 600 further includes: The coordinate acquisition module is used to acquire the first coordinate position of the mouse cursor on the canvas in response to a long-press operation of the mouse by the user.
[0082] The data acquisition module is used to acquire content data or header data corresponding to the first coordinate position according to the first coordinate position.
[0083] Optionally, the data drawing device 600 further includes: The data dragging module is used to draw the content data or header data corresponding to the first coordinate position to the second coordinate position when the cursor is long pressed and dragged from the first coordinate position to the second coordinate position.
[0084] Optionally, the data drawing device 600 further includes: The file acquisition module is used to acquire the comparison file from the cloud server when it is detected that the user edits the content data and / or the header data.
[0085] The confirmation module is used to confirm whether there is a conflict in the content data and / or the header data based on the comparison file.
[0086] The prompt output module is used to output a prompt message of data conflict to the user when there is a conflict between the content data and / or the header data and the comparison file.
[0087] Optionally, the data drawing device 600 further includes: The data copy module is used to draw various content data and / or header data on the canvas, first draw various content data and / or header data on the buffer canvas, and then copy the content on the buffer canvas on the canvas.
[0088] In the above technical solution, the coordinate range of the content to be displayed in the canvas is determined according to the canvas width and canvas height of the canvas, and the current offset of the canvas; wherein the coordinate range of the content to be displayed includes the coordinate range of at least one content data and the coordinate range of at least one header data, and according to the coordinate range of each content data, the horizontal coordinate and vertical coordinate of the canvas are cycled to draw each content data on the canvas, and according to the coordinate range of each header data, the horizontal coordinate and vertical coordinate of the canvas are cycled to draw each header data on the canvas. Through the above technical solution, the content data and header data are drawn according to the offset using the canvas, and since the data drawing operations are all implemented inside the canvas, the rendering pressure of the front end can be reduced, thereby avoiding problems such as data display errors.
[0089] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.
[0090] Figure 7 FIG. 7 is a block diagram of an electronic device 700 according to an exemplary embodiment. Figure 7 As shown, the electronic device 700 may include: a processor 701 , a memory 702 . The electronic device 700 may also include one or more of a multimedia component 703 , an input / output (I / O) interface 704 , and a communication component 705 .
[0091] The processor 701 is used to control the overall operation of the electronic device 700 to complete all or part of the steps in the above-mentioned data drawing method. The memory 702 is used to store various types of data to support the operation of the electronic device 700. For example, these data may include instructions for any application or method used to operate on the electronic device 700, and application-related data, such as contact data, sent and received messages, pictures, audio, video, etc. The memory 702 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (Static Random Access Memory, referred to as SRAM), electrically erasable programmable read-only memory (Electrically Erasable Programmable Read-Only Memory, referred to as EEPROM), erasable programmable read-only memory (Erasable Programmable Read-Only Memory, referred to as EPROM), programmable read-only memory (Programmable Read-Only Memory, referred to as PROM), read-only memory (Read-Only Memory, referred to as ROM), magnetic memory, flash memory, magnetic disk or optical disk. The multimedia component 703 may include a screen and an audio component. The screen may be, for example, a touch screen, and the audio component is used to output and / or input audio signals. For example, the audio component may include a microphone for receiving external audio signals. The received audio signal may be further stored in the memory 702 or sent through the communication component 705. The audio component also includes at least one speaker for outputting audio signals. The I / O interface 704 provides an interface between the processor 701 and other interface modules, and the other interface modules may be keyboards, mice, buttons, etc. These buttons may be virtual buttons or physical buttons. The communication component 705 is used for wired or wireless communication between the electronic device 700 and other devices. Wireless communication, such as Wi-Fi, Bluetooth, Near Field Communication (NFC), 2G, 3G, 4G, NB-IOT, eMTC, or other 5G, etc., or a combination of one or more of them, is not limited here. Therefore, the corresponding communication component 705 may include: Wi-Fi module, Bluetooth module, NFC module, etc.
[0092] In an exemplary embodiment, the electronic device 700 may be implemented by one or more application specific integrated circuits (ASIC), digital signal processors (DSP), digital signal processing devices (DSPD), programmable logic devices (PLD), field programmable gate arrays (FPGA), controllers, microcontrollers, microprocessors or other electronic components to execute the above-mentioned data drawing method.
[0093] In another exemplary embodiment, a computer-readable storage medium including program instructions is also provided, and when the program instructions are executed by a processor, the steps of the above-mentioned data drawing method are implemented. For example, the computer-readable storage medium can be the above-mentioned memory 702 including program instructions, and the above-mentioned program instructions can be executed by the processor 701 of the electronic device 700 to complete the above-mentioned data drawing method.
[0094] Figure 8 8 is a block diagram of another electronic device 800 according to an exemplary embodiment. For example, the electronic device 800 may be provided as a server. Figure 8 The electronic device 800 includes a processor 822, which may be one or more, and a memory 832 for storing a computer program executable by the processor 822. The computer program stored in the memory 832 may include one or more modules each corresponding to a set of instructions. In addition, the processor 822 may be configured to execute the computer program to perform the above-mentioned data drawing method.
[0095] In addition, the electronic device 800 may further include a power supply component 826 and a communication component 850, wherein the power supply component 826 may be configured to perform power management of the electronic device 800, and the communication component 850 may be configured to implement communication of the electronic device 800, for example, wired or wireless communication. In addition, the electronic device 800 may further include an input / output (I / O) interface 858. The electronic device 800 may operate based on an operating system stored in the memory 832.
[0096] In another exemplary embodiment, a computer-readable storage medium including program instructions is also provided, and when the program instructions are executed by a processor, the steps of the above-mentioned data drawing method are implemented. For example, the non-transitory computer-readable storage medium can be the above-mentioned memory 832 including program instructions, and the above-mentioned program instructions can be executed by the processor 822 of the electronic device 800 to complete the above-mentioned data drawing method.
[0097] In another exemplary embodiment, a computer program product is also provided. The computer program product includes a computer program executable by a programmable device. The computer program has a code portion for executing the above data drawing method when executed by the programmable device.
[0098] The preferred embodiments of the present disclosure are described in detail above in conjunction with the accompanying drawings; however, the present disclosure is not limited to the specific details in the above embodiments. Within the technical concept of the present disclosure, a variety of simple modifications can be made to the technical solution of the present disclosure, and these simple modifications all fall within the protection scope of the present disclosure.
[0099] It should also be noted that the various specific technical features described in the above specific embodiments can be combined in any suitable manner without contradiction. In order to avoid unnecessary repetition, the present disclosure will not further describe various possible combinations.
[0100] In addition, various embodiments of the present disclosure may be arbitrarily combined, and as long as they do not violate the concept of the present disclosure, they should also be regarded as the contents disclosed by the present disclosure.< / canvas> < / canvas>
Claims
1. A data drawing method, characterized in that: The method comprises: Determine, according to the canvas width and canvas height of the canvas and the current offset of the canvas, a coordinate range of the content to be displayed in the canvas; wherein the coordinate range of the content to be displayed includes a coordinate range of at least one content data and a coordinate range of at least one header data; According to the coordinate range of each content data, loop the horizontal coordinate and the vertical coordinate of the canvas to draw each content data on the canvas; According to the coordinate range of each of the header data, the horizontal coordinate and the vertical coordinate of the canvas are looped to draw each of the header data on the canvas.
2. The method according to claim 1, characterized in that Determining the coordinate range of the content to be displayed on the canvas according to the canvas width and canvas height of the canvas and the current offset of the canvas includes: Set the canvas width and canvas height of the canvas; Setting any vertex of the canvas as the origin, and determining the horizontal axis and the vertical axis of the canvas to obtain the coordinate system of the canvas; In the coordinate system of the canvas, the coordinate range of the to-be-displayed content is determined according to the canvas width, the canvas height, and the offset, where the offset is an offset generated by page scrolling.
3. The method according to claim 2, characterized in that The step of looping the horizontal coordinate and the vertical coordinate of the canvas according to the coordinate range of each content data to draw each content data on the canvas includes: According to the coordinate range of each content data, looping the horizontal coordinate and the vertical coordinate of the canvas to determine whether the looped coordinate point is within the coordinate range of any content data; When the loop reaches a first coordinate point in the canvas, and the first coordinate point is within the coordinate range of the first content data, the first content data is drawn on the canvas.
4. The method according to claim 3, characterized in that: The content to be displayed is a table, the content data is the content of one or more grids in the table, and when the loop reaches a first coordinate point in the canvas and the first coordinate point is within a coordinate range of the first content data, drawing the first content data on the canvas includes: When the loop reaches a first coordinate point in the canvas, and the first coordinate point is a vertex at a specified position in one or more grids included in the first content data, the content data in the one or more grids are drawn on the canvas.
5. The method according to claim 1, characterized in that: In the case where any of the content data includes a plurality of course data, drawing each of the content data on the canvas comprises: When drawing each of the content data, for the multiple course data in any of the content data, the multiple course data are drawn in sequence according to the preset weight of each course data in the multiple course data from high to low.
6. The method according to claim 1, characterized in that The method further comprises: In response to a long-press operation of the mouse by the user, obtaining a first coordinate position of the mouse cursor on the canvas; The content data or header data corresponding to the first coordinate position is acquired according to the first coordinate position.
7. The method according to claim 6, characterized in that The method further comprises: When the cursor is long pressed and dragged from the first coordinate position to the second coordinate position, the content data or header data corresponding to the first coordinate position is drawn to the second coordinate position.
8. The method according to claim 1, characterized in that The method further comprises: When it is detected that the user edits the content data and / or the header data, obtaining a comparison file from a cloud server; According to the comparison file, confirm whether there is a conflict in the content data and / or the header data; When the content data and / or the header data conflict with the comparison file, a prompt message indicating the data conflict is output to the user.
9. The method according to claim 1, characterized in that: The method further comprises: When drawing each of the content data and / or the header data on the canvas, each of the content data and / or the header data is first drawn on the buffer canvas, and then the content on the buffer canvas is copied to the canvas.
10. A data drawing device, characterized in that: The device comprises: A coordinate determination module, used to determine the coordinate range of the content to be displayed in the canvas according to the canvas width and canvas height of the canvas and the current offset of the canvas; wherein the coordinate range of the content to be displayed includes the coordinate range of at least one content data and the coordinate range of at least one header data; A first drawing module, used for looping the horizontal coordinate and the vertical coordinate of the canvas according to the coordinate range of each content data, so as to draw each content data on the canvas; The second drawing module is used to cycle the horizontal coordinates and the vertical coordinates of the canvas according to the coordinate range of each of the header data, so as to draw each of the header data on the canvas.
11. An electronic device, characterized in that: include: a memory having a computer program stored thereon; A processor is used to execute the computer program in the memory to implement the steps of the data drawing method according to any one of claims 1 to 9.
12. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the steps of the data drawing method according to any one of claims 1 to 9 are implemented.
Citation Information
Cited By
Method for realizing gesture screen sliding based on embedded linux
CN119576203A
