Data processing method, computer equipment and storage medium
By splitting and sampling the initial buckets, the problem of high resource consumption when visualizing scatter plots with large amounts of data is solved, the drawing speed and visual effects are improved, and the amount of data is reduced and the user experience is improved.
Patent Information
- Application Number
- CN202410675002.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-28
- Publication Date
- 2024-09-10
AI Technical Summary
In the field of data analysis and processing, with the improvement of computer processing power, the amount of analyzed data is getting larger and larger, causing scatter plots to consume a lot of computer resources when visualizing, and the output scatter plot display effect is poor, especially in face-to-face situations. For large amounts of data, the transmission speed and rendering speed are slow, resulting in poor visual effects.
By determining the bucket splitting direction and its preset threshold based on the scatter data in the initial bucket based on the canvas size and maximum value, the initial bucket is split, and split buckets that meet the preset threshold are obtained, and these split buckets are sampled. Get the sampling bucket and finally draw a scatter plot on the canvas.
When faced with large amounts of data, through splitting and sampling processing, the details of medium-sparse parts are preserved and the data of high-density parts are thinned out, which improves the drawing speed of scatter plots, maintains the visualization effect, and improves the transmission and rendering speed. , which enhances the response speed of interactive operations.
Smart Images

Figure CN118626696A
Abstract
Description
Technical Field
[0001] The embodiments of the present disclosure relate to, but are not limited to, the field of data processing technology, and in particular, to a data processing method, a computer device, and a storage medium. Background Art
[0002] In the field of data analysis and processing, with the improvement of computer processing power, the amount of data analyzed is getting larger and larger. However, the amount of scattered data to be displayed is large, which will cause the scatter plot to consume a lot of computer resources when visualizing, and result in poor display effect of the output scatter plot. Summary of the invention
[0003] The following is a summary of the subject matter described in detail herein. This summary is not intended to limit the scope of the claims.
[0004] In a first aspect, an embodiment of the present disclosure provides a data processing method, the method comprising:
[0005] Get the initial buckets and canvas size including multiple scattered data points;
[0006] Determine a bucket splitting direction and a corresponding preset threshold value based on the size of the canvas and the maximum value of the initial bucket;
[0007] According to the bucket splitting direction and the corresponding preset threshold, the initial bucket is split to obtain a plurality of split buckets that meet the preset threshold, each split bucket includes part of the scattered data, and the difference between the maximum value and the minimum value of the part of the data in the bucket splitting direction is not greater than the preset threshold;
[0008] Performing sampling processing on the multiple split buckets respectively to obtain multiple sampling buckets;
[0009] On the canvas, a corresponding scatter plot is drawn based on the processed scatter data in the plurality of sampling buckets.
[0010] In some exemplary embodiments, the size of the canvas includes: a first direction size value and a second direction size value of the canvas, each scattered point data includes: a first direction value and a second direction value, and the maximum value of the initial bucket includes: a first direction maximum value and a second direction maximum value of the plurality of scattered point data in the initial bucket;
[0011] The method of determining the bucket splitting direction and its corresponding preset threshold based on the size of the canvas and the maximum value of the initial bucket includes: determining a first threshold corresponding to the first direction based on the maximum value of the first direction and the size value of the first direction; determining a second threshold corresponding to the second direction based on the maximum value of the second direction and the size value of the second direction; determining a ratio between the maximum value of the first direction and the maximum value of the second direction as a scaling ratio; comparing a first ratio between a first threshold corresponding to the first direction and the scaling ratio and a second ratio between a second threshold corresponding to the second direction and the scaling ratio; and determining, according to the comparison result, the first direction and its corresponding first threshold or the second direction and its corresponding second threshold as the bucket splitting direction and its corresponding preset threshold.
[0012] In some exemplary embodiments, determining the first threshold corresponding to the first direction based on the first direction maximum value and the first direction size value includes: multiplying a first ratio between the first direction maximum value and the first direction size value by a preset adjustment coefficient to obtain the first threshold corresponding to the first direction; determining the second threshold corresponding to the second direction based on the second direction maximum value and the second direction size value includes: multiplying a second ratio between the second direction maximum value and the second direction size value by the preset adjustment coefficient to obtain the second threshold corresponding to the second direction.
[0013] In some exemplary embodiments, the first direction and its corresponding first threshold or the second direction and its corresponding second threshold are determined as the barrel splitting direction and its corresponding preset threshold based on the comparison result, including: when the first ratio is greater than the second ratio, the first direction and its corresponding first threshold are determined as the barrel splitting direction and its corresponding preset threshold; or, when the first ratio is less than the second ratio, the second direction and its corresponding second threshold are determined as the barrel splitting direction and its corresponding preset threshold; or, when the first ratio is equal to the second ratio, any one of the first direction and its corresponding first threshold and the second direction and its corresponding second threshold is determined as the barrel splitting direction and its corresponding preset threshold.
[0014] In some exemplary embodiments, the splitting of the initial bucket according to the bucket splitting direction and its corresponding preset threshold to obtain multiple split buckets that meet the preset threshold includes: adding the initial bucket to a pending bucket queue, wherein the pending bucket queue is configured to store buckets for which it is not determined whether they meet the preset threshold or buckets that do not meet the preset threshold; when it is determined that the pending bucket queue is not empty, performing the following bucket splitting operations for each bucket in the pending bucket queue: determining whether each bucket in the pending bucket queue meets the preset bucket splitting condition; for the first bucket in the pending bucket queue that meets the preset bucket splitting condition, Sorting the scattered data of the first bucket in ascending order to obtain corresponding sorted buckets; determining a split point from the sorted scattered data by comparing the preset threshold corresponding to the bucket splitting direction with the sorted scattered data in the sorted bucket in turn; splitting the sorted bucket according to the splitting point to obtain two split buckets; adding the two split buckets to the pending bucket queue; for a second bucket in the pending bucket queue that does not meet the preset bucket splitting condition, adding the second bucket to the completion queue; until the pending bucket queue is empty, obtaining multiple split buckets that meet the preset threshold from the completion queue.
[0015] In some exemplary embodiments, determining whether each bucket in the bucket queue to be processed satisfies a preset bucket splitting condition includes: comparing the difference between the maximum value and the minimum value of each bucket in the bucket splitting direction with a preset threshold value corresponding to the bucket splitting direction; based on the comparison result, determining the bucket in the bucket queue to be processed whose difference is greater than the preset threshold value corresponding to the bucket splitting direction as the first bucket that satisfies the preset bucket splitting condition; or determining the bucket in the bucket queue to be processed whose difference is not greater than the preset threshold value corresponding to the bucket splitting direction as the second bucket that does not satisfy the preset bucket splitting condition.
[0016] In some exemplary embodiments, determining a splitting point from the sorted scattered data by comparing the preset threshold corresponding to the bucket splitting direction with the sorted scattered data in the sorted bucket in sequence includes: comparing the preset threshold corresponding to the bucket splitting direction with the bucket splitting direction value of the sorted scattered data in the sorted bucket in sequence; determining a target bucket splitting direction value from the bucket splitting direction values of the sorted scattered data in the sorted bucket according to the comparison result, the target bucket splitting direction value being the first bucket splitting direction value that is greater than the preset threshold corresponding to the bucket splitting direction; and determining the bucket splitting direction value preceding the target bucket splitting direction value as the splitting point.
[0017] In some exemplary embodiments, the sampling process is performed on the multiple split buckets respectively to obtain multiple sampling buckets, including: sampling process is performed on the multiple split buckets respectively according to a preset sampling method to obtain multiple sampling buckets, wherein the preset sampling method includes: any one of a logarithmic sampling method, a reservoir sampling method and a random sampling method.
[0018] In a second aspect, an embodiment of the present disclosure provides a computer device, comprising: a processor, and a memory storing a computer program that can be run on the processor, wherein the processor is configured to implement the steps of the data processing method described in any of the above embodiments when executing the program.
[0019] In a third aspect, an embodiment of the present disclosure provides a non-volatile computer-readable storage medium storing computer-executable instructions, wherein the computer-executable instructions are configured to execute the steps of the data processing method described in any one of the above embodiments.
[0020] The data processing method, computer device and storage medium provided by the exemplary embodiment of the present disclosure, after obtaining the initial bucket including multiple scattered data and the size of the canvas, determine the bucket splitting direction and the corresponding preset threshold value according to the size of the canvas and the maximum value of the initial bucket, then split the initial bucket according to the bucket splitting direction and the corresponding preset threshold value to obtain multiple split buckets that meet the preset threshold value; then, sample the multiple split buckets that meet the preset threshold value respectively to obtain multiple sampling buckets, and finally draw the corresponding scatter plot on the canvas based on the processed scattered data in the multiple sampling buckets. In this way, it can ensure the retention of details of the medium sparse part and the thinning of data in the high-density part. Therefore, when facing a large amount of data, the drawing speed of the scatter plot of the large amount of data can be improved, and the visualization effect of the scatter plot can be kept good, so as to achieve the effect of improving the transmission speed and rendering speed, and the response speed of interactive operations can be improved.
[0021] Other features and advantages of the present disclosure will be described in the following description, and partly become apparent from the description, or be understood by implementing the present disclosure. Other advantages of the present disclosure can be realized and obtained by the schemes described in the description and the drawings.
[0022] Other aspects will be apparent upon reading and understanding the drawings and detailed description. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] The accompanying drawings are used to provide an understanding of the technical solution of the present disclosure and constitute a part of the specification. Together with the embodiments of the present disclosure, they are used to explain the technical solution of the present disclosure and do not constitute a limitation on the technical solution of the present disclosure. The shapes and sizes of the components in the accompanying drawings do not reflect the actual proportions and are only intended to illustrate the contents of the present disclosure.
[0024] Figure 1 A schematic diagram of a system architecture involved in a data processing method in an exemplary embodiment of the present disclosure;
[0025] Figure 2 A first flow chart of a data processing method in an exemplary embodiment of the present disclosure;
[0026] Figure 3 is a second flow chart of a data processing method in an exemplary embodiment of the present disclosure;
[0027] Figure 4 is a third flow chart of the data processing method in the exemplary embodiment of the present disclosure;
[0028] Figure 5A The first schematic diagram of a scatter plot drawn to display all scattered data;
[0029] Figure 5B A first schematic diagram of a scatter plot drawn using the method provided by an exemplary embodiment of the present disclosure;
[0030] Fig. 6A A second schematic diagram of a scatter plot drawn to display all scattered data;
[0031] Figure 6B A second schematic diagram of a scatter plot drawn using the method provided by the exemplary embodiment of the present disclosure;
[0032] Fig. 7A A third schematic diagram of a scatter plot drawn to display all scattered data;
[0033] Figure 7B A third schematic diagram of a scatter plot drawn using the method provided by the exemplary embodiment of the present disclosure;
[0034] Figure 8 It is a schematic diagram of the structure of a computer device in an exemplary embodiment of the present disclosure. DETAILED DESCRIPTION
[0035] Multiple embodiments are described herein, but the description is exemplary rather than restrictive, and there may be more embodiments and implementations within the scope of the embodiments described herein. Although many possible feature combinations are shown in the drawings and discussed in the exemplary embodiments, many other combinations of the disclosed features are possible. Unless specifically limited, any feature or element of any embodiment may be used in combination with any other feature or element in any other embodiment, or may replace any other feature or element in any other embodiment.
[0036] When describing representative embodiments, the specification may have presented the method and / or process as a specific sequence of steps. However, to the extent that the method or process does not rely on the specific order of the steps described herein, the method or process should not be limited to the steps in the specific order described. As will be appreciated by those of ordinary skill in the art, other orders of steps are also possible. Therefore, the specific order of the steps set forth in the specification should not be interpreted as a limitation on the claims. In addition, the claims for the method and / or process should not be limited to the steps performed in the order written, and those skilled in the art can easily understand that these orders can be changed and still remain within the spirit and scope of the disclosed embodiments.
[0037] Unless otherwise defined, the technical terms or scientific terms used in the embodiments of the present disclosure should be understood by people with ordinary skills in the field to which the present disclosure belongs. The "first", "second" and similar words used in the embodiments of the present disclosure do not indicate any order, quantity or importance, but are only used to distinguish different components. "Including" or "comprising" and similar words mean that the elements or objects appearing before the word cover the elements or objects listed after the word and their equivalents, without excluding other elements or objects. "Connecting" or "connected" and similar words are not limited to physical or mechanical connections, but can include electrical connections, whether direct or indirect. "Exemplarily", "for example" or "for example" are used to indicate examples, illustrations or explanations. Any embodiment or design described as "exemplary", "for example" or "for example" in the embodiments of the present invention should not be interpreted as being more preferred or more advantageous than other embodiments or design.
[0038] It should be understood that the term "and / or" used in the embodiments of the present disclosure is only a description of 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. A and B can be singular or plural. In addition, unless otherwise specified, the character " / " generally indicates that the objects associated before and after are in an "or" relationship. For example, A / B can represent A or B.
[0039] In the embodiments of the present disclosure, descriptions such as "when...", "in the case of...", "if" and "if" all mean that the device will make corresponding processing under certain objective circumstances. It does not limit the time, nor does it require the device to have a judgment action when implemented, nor does it mean that there are other limitations. Depending on the context, the words "if" and "if" used herein can be interpreted as "when..." or "when..." or "in response to determination" or "in response to detection." Similarly, depending on the context, the phrases "if it is determined" or "if (stated condition or event) is detected" can be interpreted as "when determined" or "in response to determination" or "when detecting (stated condition or event)" or "in response to detecting (stated condition or event)".
[0040] For ease of understanding, the technical terms involved in the embodiments of the present disclosure are exemplarily explained below.
[0041] 1. Thinning algorithm: It is a technique used to reduce the number of data points (i.e. scattered data). It achieves the purpose of reducing the dimension or simplifying the data by deleting some data points in the data set. Thinning algorithms can be applied to various data types, including scattered points, curves, polygons, etc.
[0042] 2. A scatter plot, also known as a dot plot, is a graph that uses the size of dots and the number or density of dots of the same size to represent the changing trend of statistical data. A scatter plot displays data along the X-axis (horizontal direction) and the Y-axis (vertical direction), and it can show how the values along the two axes are related. When the data intersects on the two axes, a dot (i.e., a data point, a scattered data) will be displayed in the scatter plot. In practical applications, a high-density scatter plot is a data visualization technique that can be used to study the distribution patterns of data points, discover clustered areas, and analyze outliers in the data (i.e., data points far away from dense areas) by displaying a large number of data points (i.e., scattered data) on a two-dimensional plane.
[0043] 3. Bucket, also known as data bucket, can represent data partitioning, such as using range-based data intervals as the data partitioning standard. For example, taking the data partitioning standard using range-based data intervals as an example, discontinuous scattered data with a certain attribute value between the data interval [A, B] can be divided into a bucket, recorded as bucket [A, B], or, discontinuous scattered data with a certain attribute value between the data interval [A, B] and another attribute value between the data interval [C, D] can be divided into a bucket, recorded as bucket [AC, BD]. For another example, taking the data partitioning standard using range-based data intervals, and each scattered data includes a first attribute value (such as an x-coordinate value) and a second attribute value (such as a y-coordinate value) as an example, in different scenarios of the exemplary embodiments of the present disclosure, bucket [A, B] can represent multiple scattered data with x-coordinate values within the data interval [A, B], or it can represent multiple scattered data with y-coordinate values within the data interval [A, B]. Here, the embodiments of the present disclosure are not limited to this.
[0044] 4. Bucket splitting: For the data interval [A, B], it can be divided into k consecutive and non-intersecting sub-data intervals [a1, a2], (a2, a3], ..., (a k-1 , a k ],(a k , a k+1 ], so the sub-data interval [a1, a2], (a2, a3], ..., (a k-1 , a k ],(a k , a k+1 ], that is, the initial bucket [A, B] is split into k split buckets, each split bucket can include a part of the multiple scattered data in the initial bucket, and k is a positive integer greater than or equal to 2. Among them, [a1, a2]∪(a2, a3]∪…∪(a k-1 , a k ]∪(a k , a k+1 ]=[A,B],a2,a3,…,a k-1 , a k It can be called a split point, that is, in two adjacent buckets, the split point between one bucket and the other bucket can be the inclusive lower limit of the one bucket, and can also be the non-inclusive upper limit of the other bucket.
[0045] As computer processing power improves, the amount of data being analyzed is getting larger and larger. When visualizing data, scatter plots are widely selected and used by users as a common data visualization method. However, when performing visualization, because there are many details in the displayed data (for example, usually each selected data record will generate 1 data point), when performing visualization, especially the currently popular browser-based display method, in scenarios such as data transmission, graphics rendering, and graphics interaction, the computer performance will face great pressure.
[0046] At present, in the field of display panel production, display panels usually need to be manufactured through complex process flows. In the manufacturing process of display panels, due to problems in equipment, parameters, operation, environmental interference and other links, the output display panels will have bad phenomena, such as dust on the display panel, circuit breakage or short circuit, etc. For this reason, after each process in the manufacturing process of the display panel, an image containing the display panel is often collected by an automatic optical inspection (AOI) device, so that a large amount of image data will be generated. In order to obtain the location of the bad phenomenon in the display panel after each process, these images are usually identified. With the rise of artificial intelligence (AI) algorithms represented by deep learning, the (ADC) system that applies AI algorithms to the bad image recognition process for automatic bad image recognition has come into being. In the process of judging the bad image, the ADC system will identify the abnormal points in the bad image, and the abnormal points will be stored in the abnormal recognition information in the form of coordinate point data. When users of the ADC system analyze abnormal points, they will merge the abnormal points in multiple images into one coordinate system in order to analyze the areas where abnormal points frequently appear. However, the amount of scattered point data in the merged coordinate system is usually large, which results in a large amount of computer resources and time consumed in the transmission, rendering and other processes of drawing the scatter plot. In addition, too dense scattered point data will cause the graphics representing the scattered point data to be too crowded, making the visual effect of the scatter plot output by the system poor, which is not conducive to users observing and analyzing the laws of abnormal points.
[0047] Therefore, when faced with a large amount of scattered data, the scatter plot will consume a lot of computer resources when visualizing it, which is prone to problems with slow transmission and rendering speeds, and will cause the output scatter plot to be stacked and overlapped, resulting in poor display effects.
[0048] The following is an exemplary description of the system architecture involved in the exemplary embodiments of the present disclosure.
[0049] The exemplary embodiments of the present disclosure provide a display panel detection system. In practical applications, the display panel detection system can be used in the display product manufacturing field to perform defect detection on display panels, product defect detection management, and other scenarios.
[0050] Figure 1 FIG. 1 is a schematic diagram of a system architecture involved in a data processing method in an exemplary embodiment of the present disclosure. Figure 1 As shown, the display panel detection system may include: an image acquisition device 101 and a detection device 102, wherein the image acquisition device 101 is in communication connection with the detection device 102.
[0051] The image acquisition device 101 is configured to acquire an image of a display panel. Thus, during the manufacturing process of the display panel, the image acquisition device 101 can acquire images of the display panel after each process. For example, the image acquisition device 101 can send the acquired image containing the display panel to the detection device 102. In some exemplary embodiments, the image acquisition device 101 can be implemented using an automatic optical inspection (AOI) device.
[0052] The detection device 102 is configured to perform defect recognition on the collected image to obtain a defective image and abnormal points in the defective image, and the abnormal points are used to indicate the location of the defective phenomenon in the display panel after each process (for example, the location of dust on the display panel). For example, the abnormal points can be stored in the abnormal identification information in the form of coordinate point data. In this way, multiple abnormal point data to be processed can be obtained. In some exemplary embodiments, the detection device 102 can be a computer device, or a server, or a server cluster composed of several servers, or a cloud computing service center, etc.
[0053] In some exemplary embodiments, the display panel detection system may further include: a storage server. The storage server may be a single server, or a server cluster consisting of several servers, or a cloud computing service center, etc. The storage server is respectively connected to the image acquisition device 101 and the detection device 102 in communication. In this way, the image acquisition device 101 can be connected to the detection device 102 in communication through the storage server. After the image acquisition device 101 acquires an image containing a display panel, the image acquisition device 101 may send the acquired image to the storage server for storage. Subsequently, when it is necessary to detect an undesirable phenomenon existing in the display panel after a certain process, the detection device 102 may download the image to be processed from the storage server 103, and detect the defect existing in the display panel in the image.
[0054] In some exemplary embodiments, the communication connection may be a communication connection established through a wired network or a wireless network.
[0055] The system architecture and business scenarios described in the exemplary embodiments of the present disclosure are intended to more clearly illustrate the technical solutions of the embodiments of the present disclosure, and do not constitute a limitation on the technical solutions provided by the embodiments of the present disclosure. Those skilled in the art will appreciate that with the evolution of the system architecture and the emergence of new business scenarios, the technical solutions provided by the embodiments of the present disclosure are equally applicable to similar technical problems.
[0056] The exemplary embodiment of the present disclosure provides a data processing method, which regards multiple scattered data to be processed as a whole and stores them in an initial bucket, splits the initial bucket according to the bucket splitting direction and the corresponding preset threshold value, and obtains multiple split buckets that meet the preset threshold value; then, the multiple split buckets that meet the preset threshold value are sampled and processed respectively to obtain multiple sampling buckets, and then the corresponding scatter plot is drawn based on the processed scattered data in the multiple sampling buckets. In this way, it can be ensured that the details of the sparse part are retained and the data of the high-density part is thinned. Therefore, when facing a large amount of scattered data, the drawing speed of the large amount of scatter plot can be improved, and the visualization effect of the scatter plot can be kept good, so as to achieve the effect of improving the transmission speed and rendering speed, and the response speed of interactive operations can be improved.
[0057] An exemplary embodiment of the present disclosure provides a data processing method. Figure 2 FIG. 1 is a first flow chart of a data processing method in an exemplary embodiment of the present disclosure. Figure 2 As shown, the data processing method may include the following steps:
[0058] Step 21: Obtain the size of the initial bucket and canvas including the plurality of scattered point data;
[0059] Step 22: Based on the size of the canvas and the maximum value of the initial bucket, determine the bucket splitting direction and its corresponding preset threshold;
[0060] Step 23: Split the initial bucket according to the bucket splitting direction and the corresponding preset threshold value to obtain multiple split buckets that meet the preset threshold value, each split bucket includes part of the data in the multiple scattered data, and the difference between the maximum value and the minimum value of the part of the data in the bucket splitting direction is not greater than the preset threshold value;
[0061] Step 24: performing sampling processing on the multiple split buckets respectively to obtain multiple sampling buckets;
[0062] Step 25: On the canvas, draw a corresponding scatter plot based on the processed scatter data in the multiple sampling buckets.
[0063] Thus, the data processing method provided by the exemplary embodiment of the present disclosure, after obtaining the initial bucket including multiple scattered data and the size of the canvas, determines the bucket splitting direction and the corresponding preset threshold value according to the size of the canvas and the maximum value of the initial bucket, then, according to the bucket splitting direction and the corresponding preset threshold value, the initial bucket is split to obtain multiple split buckets that meet the preset threshold value; then, the multiple split buckets that meet the preset threshold value are sampled respectively to obtain multiple sampling buckets, and finally, on the canvas, based on the processed scattered data in the multiple sampling buckets, a corresponding scatter plot is drawn. In this way, when facing a large amount of scattered data, by iteratively dividing the initial bucket into a size that meets the preset threshold limit and then sampling, it can ensure that the details of the sparse part are retained and the data of the high-density part are rarefied, and the final scatter plot visualization effect can be ensured while achieving the effect of improving the transmission, rendering, and interactive response speed. Therefore, when facing a large amount of scattered data, the amount of scattered data can be greatly reduced under the premise of ensuring good visual effects and meeting the visualization and interaction needs of users. Furthermore, compared with some technologies that directly display all data or use a thinning method of deleting a given number of data points, it can improve the visualization effect of the scatter plot, increase the transmission speed, front-end rendering speed and interactive response speed, save time costs and computer resources, and provide a better user experience.
[0064] In some exemplary embodiments, the scattered point data may be abnormal point data. For example, the abnormal point data may characterize the bad information of the display panel (such as the location of dust), and / or the abnormal point data may be obtained by performing bad identification on an image containing the display panel. For example, the abnormal point data may be obtained by performing bad identification on a target image, and the target image may be an image containing the display panel acquired by an automatic optical inspection (AOI) device. In this way, it is easy to analyze the regularity of the abnormal points and determine the bad areas where the display panel is prone to appear.
[0065] In some exemplary embodiments, the first direction may be a horizontal direction of the display screen (eg, an X-axis direction), and the second direction may be a vertical direction of the display screen (eg, a Y-axis direction).
[0066] In some exemplary embodiments, each scattered point data may include: a first direction value (such as an x-coordinate value) and a second direction value (such as a y-coordinate value).
[0067] Here, the initial bucket may be a bucket containing all scattered point data to be displayed.
[0068] In some exemplary embodiments, the scatter plot may be drawn on a canvas, that is, the canvas is configured to display the scatter plot constructed based on the scatter data.
[0069] In some exemplary embodiments, the size of the canvas may include: a first dimension value of the canvas (such as a dimension value along the horizontal direction, ie, a width value) and a second dimension value of the canvas (such as a dimension value along the vertical direction, ie, a height value).
[0070] In some exemplary embodiments, step 21 may include: displaying an interface for creating a scatter plot, wherein the interface includes a canvas, and the canvas is configured to construct a scatter plot based on scatter data; obtaining a user operation for generating a scatter plot during a user operation on the interface; obtaining a plurality of scatter data to be processed and a size of the canvas in response to the user operation for generating the scatter plot; and dividing the plurality of scatter data into initial buckets. In this way, the initial buckets including the plurality of scatter data and the size of the canvas are obtained.
[0071] In some exemplary embodiments, the size of the canvas may include: a first direction size value and a second direction size value of the canvas, each scattered point data includes: a first direction value and a second direction value, and the maximum value of the initial bucket includes: a first direction maximum value and a second direction maximum value of multiple scattered point data in the initial bucket; then, step 22 may include the following steps 221 to 225:
[0072] Step 221: Determine a first threshold corresponding to the first direction based on the maximum value of the first direction of the plurality of scattered point data in the initial bucket and the first direction size value of the canvas.
[0073] Step 222: Determine a second threshold corresponding to the second direction based on the second direction maximum value of the plurality of scattered point data in the initial bucket and the second direction size value of the canvas.
[0074] For example, each scattered point data may include: a first direction value and a second direction value, the first direction value may be an x-coordinate value, and the second direction value may be a y-coordinate value, then, the multiple x-coordinate values corresponding to the multiple scattered point data in the initial bucket may be compared respectively, and the maximum x-coordinate value is determined from the multiple x-coordinate values. In this way, the maximum x-coordinate value of the multiple scattered point data in the initial bucket is obtained, that is, the first direction maximum value X of the multiple scattered point data in the initial bucket. max Similarly, the multiple y coordinate values corresponding to the multiple scattered point data in the initial bucket can be compared respectively, and the maximum y coordinate value can be determined from the multiple y coordinate values. In this way, the maximum y coordinate value of the multiple scattered point data in the initial bucket is obtained, that is, the second direction maximum value Y of the multiple scattered point data in the initial bucket max .
[0075] In some exemplary embodiments, step 221 may include: multiplying a first ratio between a first direction maximum value of a plurality of scattered point data in the initial bucket and a first direction size value of the canvas by a preset adjustment coefficient to obtain a first threshold corresponding to the first direction, as shown in the following formula (1):
[0076]
[0077] Among them, X max Indicates the maximum value of the first direction of multiple scattered data in the initial bucket, S x Indicates the first dimension of the canvas, K indicates the preset adjustment coefficient, σ x Indicates the first threshold corresponding to the first direction.
[0078] In some exemplary embodiments, step 221 may include: multiplying a second ratio between a second direction maximum value of a plurality of scattered point data in the initial bucket and a second direction size value of the canvas by a preset adjustment coefficient to obtain a second threshold corresponding to the second direction, as shown in the following formula (2).
[0079]
[0080] Among them, Y max Indicates the second direction maximum value of multiple scattered data in the initial bucket, S y Indicates the second dimension value of the canvas, K indicates the preset adjustment coefficient, σ y Indicates the second threshold corresponding to the second direction.
[0081] In some exemplary embodiments, the preset adjustment coefficient K may be 2 to 3. Exemplarily, the preset adjustment coefficient K may be 2 to 2.4, 2.4 to 2.8, 2.8 to 3, etc. For example, the preset adjustment coefficient K may be 2, 2.5, 3, etc. Of course, in practical applications, the preset adjustment coefficient K may also be set to other suitable values. Here, the embodiments of the present disclosure do not limit this.
[0082] Here, the bucket splitting direction and its corresponding preset threshold are important parameters for bucket splitting. The preset threshold is set to limit the size of the split bucket. Reasonable threshold design is the key to data thinning effect. In the above exemplary embodiment, the preset threshold is determined according to the size of the canvas and the maximum value of the scattered data in the bucket. In actual applications, the preset threshold can also be set to other appropriate values. Here, the embodiment of the present disclosure does not limit this.
[0083] Step 223: Determine the ratio between the maximum value in the first direction and the maximum value in the second direction as the scaling ratio, as shown in the following formula (3).
[0084] C xy =X max / Y max Formula (3);
[0085] Among them, X max Indicates the maximum value of the first direction of multiple scattered data in the initial bucket, Ymax Indicates the second direction maximum value of multiple scattered data in the initial bucket, C xy Indicates the zoom ratio.
[0086] Step 224: Compare a first ratio between a first threshold corresponding to the first direction and the scaling ratio with a second ratio between a second threshold corresponding to the second direction and the scaling ratio.
[0087] Step 225: According to the comparison result, the first direction and its corresponding first threshold or the second direction and its corresponding second threshold are determined as the bucket splitting direction and its corresponding preset threshold.
[0088] In some exemplary embodiments, step 225 may include: when a first ratio between a first threshold corresponding to the first direction and the scaling ratio is greater than a second ratio between a second threshold corresponding to the second direction and the scaling ratio, determining the first direction and its corresponding first threshold as the barrel splitting direction and its corresponding preset threshold; or, when a first ratio between a first threshold corresponding to the first direction and the scaling ratio is less than a second ratio between a second threshold corresponding to the second direction and the scaling ratio, determining the second direction and its corresponding second threshold as the barrel splitting direction and its corresponding preset threshold; or, when a first ratio between a first threshold corresponding to the first direction and the scaling ratio is equal to a second ratio between a second threshold corresponding to the second direction and the scaling ratio, determining any one of the first direction and its corresponding first threshold and the second direction and its corresponding second threshold as the barrel splitting direction and its corresponding preset threshold.
[0089] For example, the first direction data range of the scattered data in the initial bucket is [0, 1000], that is, X max =1000; the second direction data range of the scattered data in the initial bucket is [0, 100], that is, Y max =100; the canvas size is 100px*100px, that is, S x =100 and S y =100, and the preset adjustment coefficient K is set to 3 as an example, then, according to formula (1), it can be calculated that the first threshold σ corresponding to the first direction x = (1000 / 100)*3=30. According to formula (2), the second threshold σ corresponding to the second direction can be calculated. y = (100 / 100)*3=3. According to formula (3), the scaling ratio Cxy can be calculated to be 1000 / 100=10. Then, the first ratio f1 is σ x / Cxy=30 / 10=3, the second ratio f2 is σ y / Cxy=3 / 10=0.3, it can be seen that the first ratio f1 (i.e. 3) is much greater than the second ratio f2 (i.e. 0.3), so it can be determined that the first direction exceeds the limit more seriously. At this time, the bucket splitting can be selected along the first direction. In this way, the first direction is determined as the bucket splitting direction, and the first threshold σ corresponding to the first direction is set to x A preset threshold corresponding to the bucket splitting direction is determined.
[0090] For another example, the first direction data range of the scattered data in the initial bucket is [0, 10], that is, X max =10; the second direction data range of the scattered data in the initial bucket is [0, 1000], that is, Y max =1000; the canvas size is 5000px*500px, that is, S x =5000 and S y =500, and the preset adjustment coefficient K is set to 3 as an example, then, according to formula (1), it can be calculated that the first threshold σ corresponding to the first direction x = (10 / 5000)*3=0.006. According to formula (2), the second threshold σ corresponding to the second direction can be calculated. y = (1000 / 500)*3=6. According to formula (3), the scaling ratio Cxy can be calculated to be 10 / 1000=0.001. Then, the first ratio f1 is σ x / Cxy=0.006 / 0.001=6, the second ratio f2 is σ y / Cxy=6 / 0.001=6000, it can be seen that the first ratio f1 (i.e. 6) is much smaller than the second ratio f2 (i.e. 6000), so the second direction exceeds the limit more seriously. At this time, the barrel splitting can be selected along the second direction. In this way, the barrel splitting direction can be determined to be the second direction, and the preset threshold corresponding to the barrel splitting direction can be determined to be the second threshold σ corresponding to the second direction. y .
[0091] In some exemplary embodiments, step 23 may include:
[0092] Step 231: Add the initial bucket to the pending bucket queue, wherein the pending bucket queue is set to store buckets for which it is not determined whether they meet the preset threshold or buckets that do not meet the preset threshold. That is, when the pending bucket queue is not empty, the buckets in the pending bucket queue are buckets for which it is not determined whether they meet the preset threshold or buckets that do not meet the preset threshold.
[0093] Step 232: When it is determined that the queue of buckets to be processed is not empty, the following bucket splitting operations are performed for each bucket in the queue of buckets to be processed:
[0094] Step 233: Determine whether each bucket in the to-be-processed bucket queue satisfies a preset bucket splitting condition;
[0095] Step 234 may include: Step 2341: for the first bucket in the queue of buckets to be processed that meets the preset bucket splitting condition, sort the scattered data of the first bucket in the order of small to large according to the bucket splitting direction to obtain the corresponding sorted bucket; Step 2342: by comparing the preset threshold corresponding to the bucket splitting direction with the sorted scattered data in the sorted bucket in turn, determine the splitting point from the sorted scattered data; Step 2343: split the sorted bucket according to the splitting point to obtain two split buckets; Step 2344: add the two split buckets to the queue of buckets to be processed; wherein, Step 2342 may include: comparing the preset threshold corresponding to the bucket splitting direction with the bucket splitting direction value of the sorted scattered data in the sorted bucket in turn; according to the comparison result, determine the target bucket splitting direction value from the bucket splitting direction value of the sorted scattered data in the sorted bucket, the target bucket splitting direction value being the first bucket splitting direction value greater than the preset threshold corresponding to the bucket splitting direction; and determine the bucket splitting direction value before the target bucket splitting direction value as the splitting point.
[0096] Step 235: For the second bucket in the pending bucket queue that does not meet the preset bucket splitting condition, add the second bucket to the completion queue; wherein the completion queue is set to store buckets that meet the preset threshold;
[0097] Step 236: until the queue of buckets to be processed is empty, multiple split buckets that meet a preset threshold are obtained from the completion queue.
[0098] For example, taking the bucket splitting direction as the first direction as an example, the preset threshold corresponding to the bucket splitting direction may be the first threshold σ corresponding to the first direction. x , after arranging the multiple scattered data in the bucket in ascending order according to the first direction value, a sorted bucket can be obtained, and the sorted scattered data in the sorted bucket are recorded as: a1, a2, a3, ..., a k-1 , a k , a k+1 , where a1 <a2<a3<…<a k-1 k k+1 , the first threshold σ corresponding to the first direction can be x Sequentially with a1, a2, a3, ..., a k-1 , a k , a k+1 By comparison, when determining the first threshold σ corresponding to the first direction x Greater than a p , and the first threshold σ corresponding to the first direction x Less than ap+1 When , it indicates that the current point a p+1 has exceeded the limit, then we can determine that a p+1 The first bucket split direction value that is greater than the preset threshold corresponding to the bucket split direction is the target bucket split direction value. Then, the previous bucket split direction value of the target bucket split direction value is a p , determined as the split point. Thus, we can get the split point as a p . Then, the bucket can be split into the first split bucket (including a1, a2, a3, ..., a p ) and the second split bucket (including: a p+1 , …, a k-1 , a k , a k+1 ), that is, the split point a p can be (including a1, a2, a3, ..., a p ), and can be the non-inclusive upper limit of the first direction value in the second split bucket (including: ap+1, ..., ak-1, ak, ak+1), where p is any positive integer, p∈{2, ..., k+1}. Here, since the sorted scattered data is arranged in ascending order, the comparison can be stopped after the split point is determined.
[0099] In some other exemplary embodiments, step 23 may include:
[0100] Step 231: Add the initial bucket to a queue of buckets to be processed, wherein the queue of buckets to be processed is configured to store buckets for which it is not determined whether they meet a preset threshold or buckets that do not meet a preset threshold.
[0101] Step 232: When it is determined that the queue of buckets to be processed is not empty, the following bucket splitting operations are performed for each bucket in the queue of buckets to be processed:
[0102] Step 233: Determine whether each bucket in the to-be-processed bucket queue satisfies a preset bucket splitting condition;
[0103] Step 237 may include: Step 2371: for the first bucket in the queue of buckets to be processed that meets the preset bucket splitting condition, sort the scattered data of the first bucket in the order from large to small according to the bucket splitting direction to obtain the corresponding sorted bucket; Step 2372: by comparing the preset threshold corresponding to the bucket splitting direction with the sorted scattered data in the sorted bucket in turn, determine the splitting point from the sorted scattered data; Step 2373: according to the splitting point, split the sorted bucket to obtain two split buckets; Step 2374: add the two split buckets to the queue of buckets to be processed; wherein, Step 2372 may include: comparing the preset threshold corresponding to the bucket splitting direction with the bucket splitting direction value of the sorted scattered data in the sorted bucket in turn; according to the comparison result, determine the target bucket splitting direction value from the bucket splitting direction value of the sorted scattered data in the sorted bucket, the target bucket splitting direction value being the first bucket splitting direction value that is less than the preset threshold corresponding to the bucket splitting direction; and determine the bucket splitting direction value before the target bucket splitting direction value as the splitting point.
[0104] Step 235: For the second bucket in the pending bucket queue that does not meet the preset bucket splitting condition, add the second bucket to the completion queue; wherein the completion queue is set to store buckets that meet the preset threshold;
[0105] Step 236: until the queue of buckets to be processed is empty, multiple split buckets that meet a preset threshold are obtained from the completion queue.
[0106] For example, taking the bucket splitting direction as the first direction as an example, the preset threshold corresponding to the bucket splitting direction may be the first threshold σ corresponding to the first direction. x , after arranging the multiple scattered data in the bucket in descending order according to the first direction value, a sorted bucket can be obtained, and the sorted scattered data in the sorted bucket is recorded as: b1, b2, b3, ..., b k-1 , b k , b k+1 , where b1>b2>b3>…>b k-1 >b k >b k+1 , the first threshold σ corresponding to the first direction can be x Sequentially with b1, b2, b3, ..., b k-1 , b k , b k+1 Compare and determine b p Greater than the first threshold σ corresponding to the first direction x , and b p+1 Less than the first threshold σ corresponding to the first direction x When p+1 has exceeded the limit, then we can determine that b p+1The first bucket split direction value that is smaller than the preset threshold corresponding to the bucket split direction is the target bucket split direction value. Then, the previous bucket split direction value of the target bucket split direction value is b p , determined as the split point. Thus, the split point can be obtained as b p . Then, the bucket can be split into the first split bucket (including b1, b2, b3, ..., b p ) and the second split bucket (including: b p+1 , …, b k-1 , b k , b k+1 ), which is the split point b p can be (including b1, b2, b3, ..., b p ) in the first direction, and can be the second split bucket (including: b p+1 , …, b k-1 , b k , b k+1 ), where p is any positive integer, p∈{2,…,k+1}. Here, since the sorted scattered data are arranged in descending order, the comparison can be stopped after the split point is determined.
[0107] In some exemplary embodiments, step 233 may include:
[0108] Step 2331: Compare the difference between the maximum value and the minimum value of each bucket in the bucket splitting direction with a preset threshold corresponding to the bucket splitting direction;
[0109] Step 2332: Based on the comparison result, the bucket in the queue of buckets to be processed whose difference is greater than the preset threshold corresponding to the bucket splitting direction is determined as the first bucket that meets the preset bucket splitting condition; or, the bucket in the queue of buckets to be processed whose difference is not greater than the preset threshold corresponding to the bucket splitting direction is determined as the second bucket that does not meet the preset bucket splitting condition.
[0110] In some exemplary embodiments, step 24 may include: sampling the multiple split buckets separately according to a preset sampling method to obtain multiple sampling buckets, wherein the preset sampling method may include: any one of logarithmic sampling method, reservoir sampling method and random sampling method.
[0111] Among them, the basic idea of logarithmic sampling is to sample uniformly on a logarithmic scale rather than on a linear scale, which means that the intervals between smaller values and larger values are consistent on a logarithmic scale, making the data distribution in a larger range more balanced. The basic idea of reservoir sampling is to process the data one by one in the data stream and replace the data in the reservoir according to certain rules to keep the probability of each data being selected equal. The basic idea of random sampling is to extract data from some units of the population as samples according to the principle of randomness.
[0112] In some exemplary embodiments, the plurality of sampling buckets and the plurality of split buckets are in one-to-one correspondence. For example, the plurality of split buckets include: a first split bucket (eg, including a1, a2, a3, ..., a p ) and the second split bucket (such as including: a p+1 , …, a k-1 , a k , a k+1 ), for example, sampling the first split bucket can obtain the first sampling bucket, and sampling the second sampling bucket can obtain the second sampling bucket. Then, the multiple sampling buckets may include: the first sampling bucket and the second sampling bucket. The processed scattered data in the first sampling bucket include a1, a2, a3, ..., a p The processed scattered data in the second sampling bucket includes a p+1 , …, a k-1 , a k , a k+1 A portion of the data.
[0113] In some exemplary embodiments, taking logarithmic sampling as an example, step 24 may include: performing logarithmic sampling processing on multiple split buckets respectively with a preset sampling base to obtain multiple sampling buckets. Exemplarily, the sampling base in the logarithmic sampling process can use 2, e, 10, etc. For example, the sampling base in the logarithmic sampling method can use 2. Here, the embodiment of the present disclosure does not limit this.
[0114] For example, using the logarithmic sampling method, and the sampling base in the logarithmic sampling method can be 2. Assuming that the data in a split bucket is recorded as {a1, a2, a3, ..., a1024}, log2(1024) = 10 can be calculated. Then, a number can be taken for every 102 values of the data in the bucket. In this way, after logarithmic sampling, the data in the sampling bucket can be {b1, b2, ..., b10}. Of course, the sampling method is not limited to this method.
[0115] An exemplary embodiment of the present disclosure provides a data processing method. Figure 3FIG. 1 is a second flow chart of a data processing method in an exemplary embodiment of the present disclosure. Figure 3 As shown, the data processing method may include the following steps:
[0116] Step 30: Obtain an initial bucket including a plurality of scattered point data and a size of a canvas.
[0117] Step 31: Based on the size of the canvas and the maximum value of the initial bucket, determine the bucket splitting direction and its corresponding preset threshold.
[0118] Step 32: Add the initial bucket to the queue of buckets to be processed;
[0119] The pending bucket queue is configured to store buckets for which it is not determined whether to meet a preset threshold or buckets that do not meet a preset threshold.
[0120] Step 33: Determine whether the queue of buckets to be processed is empty;
[0121] When it is determined that the queue of buckets to be processed is not empty, the following bucket splitting operations are performed for each bucket in the queue of buckets to be processed, steps 34 to 36:
[0122] Step 34: for each bucket in the bucket queue to be processed, determine whether the bucket in the bucket queue to be processed meets the preset bucket splitting condition. If the bucket meets the preset bucket splitting condition, execute step 35. If the bucket does not meet the preset bucket splitting condition, execute step 36.
[0123] Step 35: Sort the scattered data of the first bucket that meets the preset bucket splitting condition in the bucket queue to be processed in ascending order according to the bucket splitting direction to obtain the corresponding sorted bucket; determine the splitting point from the sorted scattered data by comparing the preset threshold value corresponding to the bucket splitting direction with the sorted scattered data in the sorted bucket in turn; split the sorted bucket according to the splitting point to obtain two split buckets; and add the two split buckets to the bucket queue to be processed.
[0124] Step 36: Add the second bucket in the pending bucket queue that does not meet the preset bucket splitting condition to the completion queue.
[0125] Among them, the completion queue is set to store buckets that meet a preset threshold.
[0126] Step 37: until the queue of pending buckets is empty, multiple split buckets that meet a preset threshold are obtained from the completion queue.
[0127] Step 38: Sampling is performed on the plurality of split buckets respectively to obtain a plurality of sampling buckets. For example, sampling is performed on the plurality of split buckets respectively according to a logarithmic sampling method to obtain a plurality of sampling buckets.
[0128] Step 39: On the canvas, draw a corresponding scatter plot based on the processed scatter data in the multiple sampling buckets.
[0129] In this way, the data processing method provided by the exemplary embodiment of the present disclosure regards the multiple scattered data to be processed as a whole and stores them in the initial bucket, determines the bucket splitting direction and the corresponding preset threshold according to the size of the canvas and the maximum value of the initial bucket, and then, splits the initial bucket according to the bucket splitting direction and the corresponding preset threshold to obtain multiple split buckets that meet the preset threshold; then, the multiple split buckets that meet the preset threshold are sampled respectively to obtain multiple sampling buckets, and finally, on the canvas, based on the processed scattered data in the multiple sampling buckets, the corresponding scatter plot is drawn. In this way, when facing a large amount of scattered data, by iteratively dividing the initial bucket into a size that meets the preset threshold limit and then sampling, it can ensure that the details of the sparse part are retained and the data of the high-density part are rarefied, and the final scatter plot visualization effect can be ensured while achieving the effect of improving the transmission, rendering, and interactive response speed. Therefore, when facing a large amount of scattered data, the amount of scattered data can be greatly reduced under the premise of ensuring good visual effects and meeting the visualization and interaction needs of users. Furthermore, compared with some technologies that directly display all data or use a thinning method of deleting a given number of data points, it can improve the visualization effect of the scatter plot, increase the transmission speed, front-end rendering speed and interactive response speed, save time costs and computer resources, and provide a better user experience.
[0130] An exemplary embodiment of the present disclosure provides a data processing method. Figure 4 FIG. 1 is a third flow chart of a data processing method in an exemplary embodiment of the present disclosure. Figure 4 As shown, the data processing method may include the following steps:
[0131] Step 41: obtaining an initial bucket including a plurality of scattered point data and a size of a canvas; each scattered point data may include: a first direction value (such as an x-coordinate value) and a second direction value (such as a y-coordinate value); the size of the canvas may include: a first direction size value of the canvas (such as a size value along the horizontal direction, i.e., a width value) and a second direction size value (such as a size value along the vertical direction, i.e., a height value);
[0132] Step 42: determining the bucket splitting direction and its corresponding preset threshold based on the size of the canvas, the maximum value of the first direction and the maximum value of the second direction of the plurality of scattered point data in the initial bucket;
[0133] In some exemplary embodiments, step 42 may include: as shown in formulas (1) to (5), giving the first direction maximum value X of the plurality of scattered point data in the initial bucket max The first dimension of the canvas is S xThe first ratio between the first and second directions is multiplied by the preset adjustment coefficient K to obtain the first threshold σ corresponding to the first direction. x ; Give the second direction maximum value Y of multiple scattered data in the initial bucket max The second dimension value S of the canvas y The second ratio between the two is multiplied by the preset adjustment coefficient K to obtain the second threshold corresponding to the second direction; the maximum value X of the first direction of the plurality of scattered point data in the initial bucket is max The second direction maximum value Y of multiple scattered data in the initial bucket max The ratio between them is determined as the scaling ratio C xy ; Set the first threshold σ corresponding to the first direction x With scaling C xy The first ratio f1 between the first and second directions corresponds to the second threshold σ y With scaling C xy and comparing the first direction and the first threshold corresponding thereto or the second direction and the second threshold corresponding thereto as the bucket splitting direction and the preset threshold corresponding thereto according to the comparison result.
[0134] Exemplarily, when the first ratio f1 is greater than the second ratio f2, the first direction and its corresponding first threshold can be determined as the barrel splitting direction and its corresponding preset threshold; or, when the first ratio f1 is less than the second ratio f2, the second direction and its corresponding second threshold can be determined as the barrel splitting direction and its corresponding preset threshold; or, when the first ratio f1 is equal to the second ratio f2, any one of the first direction and its corresponding first threshold and the second direction and its corresponding second threshold can be determined as the barrel splitting direction and its corresponding preset threshold.
[0135]
[0136]
[0137] C xy =X max / Y max Formula (3);
[0138] f1=σ x / Cxy formula (4);
[0139] f2=σ y / Cxy formula (5);
[0140] Among them, X max Indicates the maximum value of the first direction of multiple scattered data in the initial bucket, Y max Indicates the second direction maximum value of multiple scattered data in the initial bucket, C xy Indicates the scaling ratio, Sx Indicates the first dimension of the canvas, S y Indicates the second dimension value of the canvas, K indicates the preset adjustment coefficient, σ x represents the first threshold corresponding to the first direction, σ y represents the second threshold corresponding to the second direction, f1 represents the first ratio between the first threshold corresponding to the first direction and the scaling ratio, and f2 represents the second ratio between the second threshold corresponding to the second direction and the scaling ratio.
[0141] Step 43: splitting the initial bucket according to the bucket splitting direction and the corresponding preset threshold value to obtain multiple split buckets that meet the preset threshold value, each split bucket includes part of the data in the multiple scattered data, and the difference between the maximum value and the minimum value of the part of the data in the bucket splitting direction is not greater than the preset threshold value;
[0142] In some exemplary embodiments, step 43 may include:
[0143] Step 431: Add the initial bucket to a queue of buckets to be processed, wherein the queue of buckets to be processed is configured to store buckets for which it is not determined whether they meet a preset threshold or buckets that do not meet a preset threshold.
[0144] Step 432: Determine whether the queue of buckets to be processed is empty.
[0145] When it is determined that the queue of buckets to be processed is not empty, the following bucket splitting operations are performed for each bucket in the queue of buckets to be processed, that is, steps 433 to 43:
[0146] Step 433: for each bucket in the bucket queue to be processed, determine whether the bucket satisfies a preset bucket splitting condition;
[0147] In some exemplary embodiments, step 433 includes: for each bucket in the bucket queue to be processed, comparing the difference between the maximum value and the minimum value of the bucket in the bucket splitting direction with a preset threshold corresponding to the bucket splitting direction; when the difference between the maximum value and the minimum value of the bucket in the bucket splitting direction is greater than the preset threshold corresponding to the bucket splitting direction, the bucket is determined to be the first bucket that meets the preset bucket splitting condition. At this time, when it is determined that the bucket meets the preset bucket splitting condition, steps 434 to 436 can be subsequently executed; or, when the difference between the maximum value and the minimum value of the bucket in the bucket splitting direction is not greater than the preset threshold corresponding to the bucket splitting direction, the bucket is determined to be the second bucket that does not meet the preset bucket splitting condition, and step 437 can be subsequently executed.
[0148] For each bucket in the to-be-processed bucket queue, when it is determined that the bucket meets the preset bucket splitting condition, steps 434 to 436 may be subsequently performed. When it is determined that the bucket does not meet the preset bucket splitting condition, step 437 is performed.
[0149] Step 434: for the first bucket in the to-be-processed bucket queue that meets the preset bucket splitting condition, sort the scattered point data of the first bucket in the bucket splitting direction in ascending order to obtain the corresponding sorted bucket;
[0150] Step 435: Determine a split point from the sorted scattered point data by comparing the preset threshold corresponding to the bucket splitting direction with the sorted scattered point data in the sorted bucket in sequence;
[0151] Step 436: Split the sorted buckets according to the split point to obtain two split buckets, and add the two split buckets to the queue of buckets to be processed;
[0152] Exemplarily, step 435 may include: comparing the preset threshold corresponding to the bucket splitting direction with the bucket splitting direction value of the sorted scattered data in the sorted bucket in turn; determining a target bucket splitting direction value from the bucket splitting direction value of the sorted scattered data in the sorted bucket according to the comparison result, the target bucket splitting direction value being the first bucket splitting direction value that is greater than the preset threshold corresponding to the bucket splitting direction; and determining the bucket splitting direction value before the target bucket splitting direction value as the splitting point.
[0153] Step 437: For the second bucket in the pending bucket queue that does not meet the preset bucket splitting condition, add the second bucket to the completion queue;
[0154] Among them, the completion queue is set to store buckets that meet a preset threshold.
[0155] Step 438: until the queue of buckets to be processed is empty, multiple split buckets that meet a preset threshold are obtained from the completion queue.
[0156] Step 44: performing sampling processing on the multiple split buckets respectively to obtain multiple sampling buckets;
[0157] Step 45: On the canvas, draw a corresponding scatter plot based on the processed scatter data in the multiple sampling buckets.
[0158] In this way, the data processing method provided by the exemplary embodiment of the present disclosure, when faced with a large amount of scattered data, can ensure the retention of details in the sparse part and the thinning of data in the high-density part by iteratively dividing the initial bucket into a size that meets the preset threshold limit and then sampling, which can ensure the visualization effect of the final scatter plot while achieving the effect of improving the transmission, rendering, and interactive response speed. Therefore, when faced with a large amount of scattered data, the amount of scattered data can be greatly reduced while ensuring good visual effects and meeting the visualization and interaction needs of users. Furthermore, compared to some technologies that directly display all data or use a given number of data points to delete the thinning method, the visualization effect of the scatter plot can be improved, the transmission speed, the front-end rendering speed, and the interactive response speed can be improved, and time costs and computer resources can be saved, so that the user experience is better.
[0159] The inventors of the present disclosure selected 10,000, 100,000, and 1 million data sets for testing and obtained the following results:
[0160] Experiment 1: Taking 10,000 scattered data as an example, we can get Figure 5A The first schematic diagram of a scatter plot drawn to show all scattered data, Figure 5B This is a first schematic diagram of a scatter plot drawn using the method provided by an exemplary embodiment of the present disclosure.
[0161] Experiment 2: Taking 100,000 scattered data as an example, we can get Fig. 6A A second schematic diagram of a scatter plot drawn to display all scattered data. Figure 6B This is a second schematic diagram of a scatter plot drawn using the method provided by an exemplary embodiment of the present disclosure.
[0162] Experiment 3: Taking 1 million scattered data as an example, we can get Fig. 7A A third schematic diagram of a scatter plot drawn to display all scattered data. Figure 7B This is a third schematic diagram of a scatter plot drawn using the method provided by an exemplary embodiment of the present disclosure.
[0163] Comprehensively comparing the visualization effects, when faced with a large amount of data, it can have a better sampling ratio and display effect, showing superior performance. Through experiments, it can be seen that the data processing method provided by the exemplary embodiment of the present disclosure, when faced with a large amount of scattered data, can significantly reduce the amount of scattered data while ensuring good visual effects and meeting user visualization and interaction needs, compared to displaying all data, thereby solving the problem that the front-end interface of the software needs to consume a long time and computer resources when loading a large amount of overlapping scattered data for image drawing, saving time costs and computer resources, and improving transmission speed, front-end rendering speed, and interactive response speed, so that the user experience is better.
[0164] It should be understood that in the various embodiments of the present disclosure, the size of the serial numbers of the above-mentioned processes does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present disclosure.
[0165] The description of the above application scenario embodiment is similar to the description of the above data processing method embodiment, and has similar beneficial effects as the method embodiment. For technical details not disclosed in the application scenario embodiment of the present disclosure, those skilled in the art should refer to the description in the method embodiment of the present disclosure for understanding, and no further description is given here.
[0166] Based on the same inventive concept, an embodiment of the present disclosure also provides a computer device, including: a processor, and a memory storing a computer program that can be run on the processor, wherein the processor is configured to implement the steps of the data processing method in any of the above embodiments when executing the program.
[0167] In an exemplary embodiment, Figure 8 FIG. 1 is a schematic diagram of the structure of a computer device in an exemplary embodiment of the present disclosure. Figure 8 As shown, the computer device 80 may include: at least one processor 81; and at least one memory 82 and a bus 83 connected to the processor 81; wherein the processor 81 and the memory 82 communicate with each other through the bus 83; the processor 81 is configured to call the program instructions in the memory 82 to execute the steps of the data processing method in one or more of the above exemplary embodiments. It can be understood that Figure 8 The structure of the computer device 80 shown in the figure does not constitute a limitation on the computer device. The actual computer device may include more or less components than those shown in the figure, or combine certain components, or arrange the components differently.
[0168] In an exemplary embodiment, the processor may be, for example, a central processing unit (CPU), other general-purpose processors, a digital signal processor (DSP), a field programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, application-specific integrated circuits, and other chips with computing functions. A general-purpose processor may be a microprocessor (MPU) or the processor may be any conventional processor, etc. Here, the embodiments of the present disclosure do not limit this.
[0169] In an exemplary embodiment, the memory may include a non-permanent memory and / or a non-volatile memory in a computer-readable storage medium, for example, the memory may be a random access memory (RAM) a read-only memory (ROM) or a flash memory (Flash RAM), or any combination thereof, which is configured to store a program executed by a processor, and the memory may include at least one memory chip. Here, the embodiments of the present disclosure do not limit this.
[0170] In an exemplary embodiment, the bus may include a power bus, a control bus, a status signal bus, etc. in addition to the data bus. Figure 8 In the figure, the various buses are all labeled as bus 83. Here, the embodiment of the present disclosure does not limit this.
[0171] In the implementation process, the processing performed by the computer device can be completed by the hardware integrated logic circuit in the processor or the instructions in the form of software. That is, the method steps of the embodiment of the present disclosure can be embodied as being executed by a hardware processor, or being executed by a combination of hardware and software modules in the processor. The software module can be located in a storage medium such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory, and the processor reads the information in the memory and completes the steps of the above method in combination with its hardware. To avoid repetition, it will not be described in detail here.
[0172] Based on the same inventive concept, an embodiment of the present disclosure further provides a non-transitory computer-readable storage medium storing computer-executable instructions, wherein the computer-executable instructions are set as steps of the data processing method in one or more of the above exemplary embodiments.
[0173] In an exemplary embodiment, the computer-readable storage medium may include, but is not limited to, ROM / RAM, a magnetic disk or an optical disk, etc. Here, the embodiment of the present disclosure does not limit this.
[0174] The description of the above computer device or computer-readable storage medium embodiment is similar to the description of the above method embodiment, and has similar beneficial effects as the method embodiment. For technical details not disclosed in the computer device or computer-readable storage medium embodiment of the present disclosure, those skilled in the art refer to the description of the method embodiment of the present disclosure for understanding. No further details will be given here.
[0175] It will be appreciated by those skilled in the art that all or some of the steps, systems, and functional modules / modules in the methods disclosed above may be implemented as software, firmware, hardware, and appropriate combinations thereof. In hardware implementations, the division between the functional modules / modules mentioned in the above description does not necessarily correspond to the division of physical components; for example, a physical component may have multiple functions, or a function or step may be performed by several physical components in cooperation. Some or all components may be implemented as software executed by a processor, such as a digital signal processor or a microprocessor, or implemented as hardware, or implemented as an integrated circuit, such as an application-specific integrated circuit. Such software may be distributed on a computer-readable medium, which may include a computer storage medium (or non-transitory medium) and a communication medium (or temporary medium). As known to those skilled in the art, the term computer storage medium includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information (such as computer-readable instructions, data structures, program modules, or other data). Computer storage media include, but are not limited to, RAM, ROM, EEPROM, flash memory or other memory technology, CD-ROM, digital versatile disks (DVD) or other optical disk storage, magnetic cassettes, magnetic tapes, magnetic disk storage or other magnetic storage devices, or any other medium that can be used to store the desired information and can be accessed by a computer. In addition, it is well known to those of ordinary skill in the art that communication media typically contain computer-readable instructions, data structures, program modules, or other data in a modulated data signal such as a carrier wave or other transport mechanism, and may include any information delivery media.
[0176] Although the embodiments disclosed in the present disclosure are as above, the above contents are only embodiments adopted for facilitating the understanding of the present disclosure and are not intended to limit the present disclosure. Any technician in the field to which the present disclosure belongs can make any modifications and changes in the form and details of implementation without departing from the spirit and scope disclosed in the present disclosure, but the scope of patent protection of the present disclosure shall still be subject to the scope defined in the attached claims.
Claims
1. A data processing method, It is characterized in that The method comprises: Get the initial buckets and canvas size including multiple scattered data points; Determine a bucket splitting direction and a corresponding preset threshold value based on the size of the canvas and the maximum value of the initial bucket; According to the bucket splitting direction and the corresponding preset threshold, the initial bucket is split to obtain a plurality of split buckets that meet the preset threshold, each split bucket includes part of the scattered data, and the difference between the maximum value and the minimum value of the part of the data in the bucket splitting direction is not greater than the preset threshold; Performing sampling processing on the multiple split buckets respectively to obtain multiple sampling buckets; On the canvas, a corresponding scatter plot is drawn based on the processed scatter data in the plurality of sampling buckets.
2. The data processing method according to claim 1, It is characterized in that The size of the canvas includes: a first direction size value and a second direction size value of the canvas, each scattered point data includes: a first direction value and a second direction value, and the maximum value of the initial bucket includes: a first direction maximum value and a second direction maximum value of the plurality of scattered point data in the initial bucket; The determining of the bucket splitting direction and its corresponding preset threshold based on the size of the canvas and the maximum value of the initial bucket includes: Determine a first threshold corresponding to the first direction based on the first direction maximum value and the first direction size value; Determine a second threshold corresponding to the second direction based on the second direction maximum value and the second direction size value; Determine a ratio between the maximum value in the first direction and the maximum value in the second direction as a scaling ratio; comparing a first ratio between a first threshold corresponding to the first direction and the scaling ratio and a second ratio between a second threshold corresponding to the second direction and the scaling ratio; According to the comparison result, the first direction and its corresponding first threshold or the second direction and its corresponding second threshold are determined as the bucket splitting direction and its corresponding preset threshold.
3. The data processing method according to claim 2, It is characterized in that The determining the first threshold corresponding to the first direction based on the first direction maximum value and the first direction size value comprises: multiplying a first ratio between the first direction maximum value and the first direction size value by a preset adjustment coefficient to obtain the first threshold corresponding to the first direction; Determining the second threshold corresponding to the second direction based on the second direction maximum value and the second direction size value includes: multiplying a second ratio between the second direction maximum value and the second direction size value by the preset adjustment coefficient to obtain the second threshold corresponding to the second direction.
4. The data processing method according to claim 2, It is characterized in that The step of determining, according to the comparison result, the first direction and its corresponding first threshold or the second direction and its corresponding second threshold as the bucket splitting direction and its corresponding preset threshold includes: When the first ratio is greater than the second ratio, determining the first direction and the first threshold corresponding thereto as the bucket splitting direction and the preset threshold corresponding thereto; Alternatively, when the first ratio is less than the second ratio, the second direction and its corresponding second threshold are determined as the bucket splitting direction and its corresponding preset threshold; Alternatively, when the first ratio is equal to the second ratio, any one of the first direction and its corresponding first threshold and the second direction and its corresponding second threshold is determined as the bucket splitting direction and its corresponding preset threshold.
5. The data processing method according to any one of claims 1 to 4, It is characterized in that The step of splitting the initial bucket according to the bucket splitting direction and the corresponding preset threshold value to obtain a plurality of split buckets meeting the preset threshold value includes: Adding the initial bucket to a queue of pending buckets, wherein the queue of pending buckets is configured to store buckets for which it is not determined whether they meet the preset threshold or buckets that do not meet the preset threshold; When it is determined that the to-be-processed bucket queue is not empty, the following bucket splitting operations are performed for each bucket in the to-be-processed bucket queue: Determine whether each bucket in the to-be-processed bucket queue satisfies a preset bucket splitting condition; For a first bucket in the queue of buckets to be processed that meets a preset bucket splitting condition, the scattered point data of the first bucket is sorted in ascending order according to the bucket splitting direction to obtain a corresponding sorted bucket; a splitting point is determined from the sorted scattered point data by sequentially comparing a preset threshold corresponding to the bucket splitting direction with the sorted scattered point data in the sorted bucket; the sorted bucket is split according to the splitting point to obtain two split buckets; and the two split buckets are added to the queue of buckets to be processed; For a second bucket in the pending bucket queue that does not meet the preset bucket splitting condition, adding the second bucket to the completion queue; When the to-be-processed bucket queue is empty, a plurality of split buckets meeting the preset threshold are obtained from the completion queue.
6. The data processing method according to claim 5, It is characterized in that The determining whether each bucket in the to-be-processed bucket queue satisfies a preset bucket splitting condition includes: Compare the difference between the maximum value and the minimum value of each bucket in the bucket splitting direction with a preset threshold corresponding to the bucket splitting direction; According to the comparison result, the bucket in the to-be-processed bucket queue whose difference is greater than the preset threshold corresponding to the bucket splitting direction is determined as the first bucket that meets the preset bucket splitting condition; or, the bucket in the to-be-processed bucket queue whose difference is not greater than the preset threshold corresponding to the bucket splitting direction is determined as the second bucket that does not meet the preset bucket splitting condition.
7. The data processing method according to claim 5, It is characterized in that The step of comparing the preset threshold corresponding to the bucket splitting direction with the sorted scattered point data in the sorted buckets in sequence to determine the splitting point from the sorted scattered point data includes: Comparing the preset threshold corresponding to the bucket splitting direction with the bucket splitting direction value of the sorted scattered point data in the sorted bucket in sequence; According to the comparison result, a target bucket splitting direction value is determined from the bucket splitting direction values of the sorted scattered data in the sorted buckets, wherein the target bucket splitting direction value is the first bucket splitting direction value greater than a preset threshold value corresponding to the bucket splitting direction; The previous bucket splitting direction value of the target bucket splitting direction value is determined as the splitting point.
8. The data processing method according to claim 1, It is characterized in that The sampling process is performed on the multiple split buckets respectively to obtain multiple sampling buckets, including: According to a preset sampling method, the multiple split buckets are sampled respectively to obtain multiple sampling buckets, wherein the preset sampling method includes: any one of a logarithmic sampling method, a reservoir sampling method and a random sampling method.
9. A computer device, It is characterized in that The computer device comprises: a processor, and a memory storing a computer program that can be run on the processor, wherein: The processor is configured to execute the steps of the data processing method according to any one of claims 1 to 8.
10. A non-transitory computer-readable storage medium storing computer-executable instructions, It is characterized in that The computer executable instructions are configured to execute the steps of the data processing method according to any one of claims 1 to 8.
