A chart layout mode generation method, device and electronic equipment

By automatically generating the initial size and layout of charts, the problem of unreasonable chart layout in data visualization tools is solved, and more reasonable and diverse layouts are achieved.

CN114625941BActive Publication Date: 2025-12-30ALIBABA GROUP HOLDING LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202011438715.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-12-10
Publication Date
2025-12-30
Estimated Expiration
2040-12-10

AI Technical Summary

Technical Problem

Existing data visualization tools struggle to properly arrange multiple charts on a canvas, resulting in illogical layouts and a lack of diversity.

Method used

By obtaining the features of the target chart and the size of the canvas, the initial size of the chart is automatically generated using the feature matrix and mapping function. Based on the preset layout rules, an integer programming problem is constructed to solve the layout of the chart on the canvas.

Benefits of technology

It achieves a reasonable layout of charts on the canvas, reduces manual intervention, and ensures the diversity and rationality of the layout.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114625941B_ABST
    Figure CN114625941B_ABST
Patent Text Reader

Abstract

The present disclosure provides a chart layout generation method and device and electronic equipment, the method comprising: obtaining a feature of a target chart to be displayed in a canvas and a size of the canvas; obtaining an initial size of the target chart according to the feature of the target chart; and determining a layout of the target chart in the canvas based on a preset layout rule, the initial size and the size of the canvas.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of data processing technology, and more specifically, to a method for generating a chart layout, a device for generating a chart layout, an electronic device, and a computer-readable storage medium. Background Technology

[0002] Data visualization refers to the process of representing data in large datasets in graphical form and using data analysis and development tools to discover unknown information. Its main purpose is to clearly and effectively convey and communicate information through graphical means.

[0003] Existing data visualization tools first acquire raw data and process it before displaying it through appropriate charts. They typically support over thirty different chart types, such as pie charts, bar charts, and line charts. Since users may provide multiple sets of data, each offering insights from multiple dimensions, data visualization applications often display multiple charts on a single canvas, sometimes even dozens.

[0004] However, since the size of the canvas is limited by the screen size, it is very important to arrange the multiple charts displayed on the canvas in a reasonable way. Summary of the Invention

[0005] One object of this disclosure is to provide a new technical solution for determining how a chart is laid out on a canvas.

[0006] According to a first aspect of this disclosure, a method for generating a chart layout is provided, comprising:

[0007] Obtain the features of the target chart to be displayed on the canvas, and the size of the canvas;

[0008] Based on the characteristics of the target chart, the initial size of the target chart is obtained;

[0009] Based on preset layout rules, the layout of the target chart on the canvas is determined according to the initial size and the canvas size.

[0010] Optionally, obtaining the initial size of the target chart based on the characteristics possessed by the target chart includes:

[0011] Based on preset features, a feature matrix is ​​constructed to indicate whether the target chart has the features, serving as the target feature matrix; wherein, the preset features include at least the target features;

[0012] The initial size of the target chart is obtained based on the target feature matrix.

[0013] Optionally, obtaining the initial size of the target chart based on the target feature matrix includes:

[0014] Obtain the mapping function between the feature matrix and the size matrix; wherein the size matrix is ​​a matrix reflecting the initial size of the corresponding chart;

[0015] The size matrix of the target chart is determined based on the target feature matrix and the mapping function;

[0016] The initial size of the target chart is obtained based on the size matrix of the target chart.

[0017] Optionally, the step of constructing a feature matrix based on preset features to indicate whether the target chart possesses the features, wherein the target feature matrix includes:

[0018] Based on the preset features, the features of the target chart are one-hot encoded to generate the target feature matrix.

[0019] Optionally, the characteristics of the target chart to be displayed on the canvas include:

[0020] Obtain JSON data provided by the data visualization tool;

[0021] Parse the JSON data to obtain the characteristics of the target chart.

[0022] Optionally, determining the layout of the target chart on the canvas based on preset layout rules, according to the initial size and the canvas size, includes:

[0023] Using the scaling factor of the target chart and the coordinates of the preset marker points of the target chart in the canvas as variables, an integer programming problem is constructed based on the initial size, the layout rules, and the size of the canvas.

[0024] Solve the integer programming problem to obtain the layout of the target chart on the canvas.

[0025] Optionally, the step of constructing an integer programming problem based on the initial size, the layout rules, and the canvas size, using the scaling factor of the target chart and the coordinates of the preset marker point of the target chart as variables, includes:

[0026] Using the scaling factor of the target chart and the coordinates of the preset marker point of the target chart in the canvas as variables, the coordinates of the vertex of the target chart in the canvas are determined according to the scaling factor, the initial size and the coordinates of the preset marker point in the canvas;

[0027] The integer programming problem is constructed based on the coordinates of the vertices of the target graph in the canvas, the layout rules, and the size of the canvas.

[0028] Optionally, the layout rules include at least one of the following:

[0029] The target charts do not overlap;

[0030] The target charts are neatly arranged in the canvas;

[0031] The target chart occupies a proportion within the canvas within a set range.

[0032] Optional, also includes:

[0033] Output the layout of the target chart on the canvas; or,

[0034] The target chart is displayed on the canvas according to the layout described.

[0035] According to a second aspect of this disclosure, a method for generating a layout of a display object is provided, comprising:

[0036] Obtain the characteristics of the target display object to be displayed on the canvas, and the size of the canvas;

[0037] Based on the characteristics of the target display object, the initial size of the target display object is obtained;

[0038] Based on preset layout rules, the layout of the target display object in the canvas is determined according to the initial size and the size of the canvas.

[0039] Optionally, obtaining the initial size of the target display object based on the characteristics possessed by the target display object includes:

[0040] Based on preset features, a feature matrix is ​​constructed to indicate whether the target display object has the features, serving as the target feature matrix; wherein, the preset features include at least the target features;

[0041] The initial size of the target display object is obtained based on the target feature matrix.

[0042] Optionally, obtaining the initial size of the target display object based on the target feature matrix includes:

[0043] Obtain the mapping function between the feature matrix and the size matrix; wherein the size matrix is ​​a matrix reflecting the initial size of the corresponding display object;

[0044] The size matrix of the target display object is determined based on the target feature matrix and the mapping function;

[0045] The initial size of the target display object is obtained based on the size matrix of the target display object.

[0046] Optionally, determining the layout of the target display object on the canvas based on preset layout rules, according to the initial size and the canvas size, includes:

[0047] Using the scaling factor of the target display object and the coordinates of the preset marker point of the target display object in the canvas as variables, an integer programming problem is constructed based on the initial size, the layout rules, and the size of the canvas;

[0048] Solve the integer programming problem to obtain the layout of the target display object in the canvas.

[0049] Optionally, when the canvas is a video playback interface, the target display object includes at least one of a video, an image, an animated image, and a text box; or, when the canvas is an e-commerce platform display interface, the target display object includes at least one of a product image, a product grid, and a product list; or, when the canvas is an information flow display interface, the target display object includes at least one of an image, a video, an animated image, and an information flow card; or, when the canvas is a chart display interface, the target display object includes a chart.

[0050] According to a third aspect of this disclosure, an apparatus for generating chart layouts is provided, comprising:

[0051] The feature size acquisition module is used to acquire the features of the target chart to be displayed on the canvas and the size of the canvas;

[0052] An initial size determination module is used to obtain the initial size of the target chart based on the characteristics possessed by the target chart;

[0053] The layout method determination module is used to determine the layout method of the target chart in the canvas based on preset layout rules, the initial size, and the size of the canvas.

[0054] According to a third aspect of this disclosure, an electronic device is provided, comprising:

[0055] A processor and a memory, the memory being used to store instructions for controlling the processor to perform the method according to the first aspect of this disclosure.

[0056] According to a fourth aspect of this disclosure, a computer-readable storage medium is provided having a computer program stored thereon that, when executed by a processor, implements the method described in the first aspect of this disclosure.

[0057] In the embodiments of this disclosure, the initial size of the target chart can be automatically generated based on its characteristics, without manual setting. Furthermore, there is no need to manually set layout templates; the layout of the target chart on the canvas can be determined based on preset layout rules, the initial size, and the preset canvas size. This allows for a more rational layout of the chart on the canvas, reduces manual intervention, and ensures layout diversity.

[0058] Other features and advantages of this disclosure will become clear from the following detailed description of exemplary embodiments with reference to the accompanying drawings. Attached Figure Description

[0059] The accompanying drawings, which are incorporated in and form a part of this specification, illustrate embodiments of the present disclosure and, together with their description, serve to explain the principles of the present disclosure.

[0060] Figure 1a This is a schematic diagram of the hardware structure of an electronic device according to the first embodiment of the present disclosure.

[0061] Figure 1b This is a schematic diagram of the hardware structure of an electronic device according to a second embodiment of the present disclosure.

[0062] Figure 2 A schematic diagram illustrating an application scenario of one embodiment of this disclosure is shown.

[0063] Figure 3 A flowchart illustrating a method for generating a chart layout according to a first embodiment of this disclosure is shown.

[0064] Figure 4 A flowchart illustrating a method for generating a chart layout according to a second embodiment of this disclosure is shown.

[0065] Figure 5 A schematic block diagram of a diagram layout generation apparatus according to an embodiment of the present disclosure is shown.

[0066] Figure 6 A schematic block diagram of an electronic device according to a third embodiment of the present disclosure is shown. Detailed Implementation

[0067] Various exemplary embodiments of the present disclosure will now be described in detail with reference to the accompanying drawings. It should be noted that, unless otherwise specifically stated, the relative arrangement, numerical expressions, and values ​​of the components and steps set forth in these embodiments do not limit the scope of the present disclosure.

[0068] The following description of at least one exemplary embodiment is merely illustrative and is in no way intended to limit this disclosure or its application or use.

[0069] Techniques, methods, and equipment known to those skilled in the art may not be discussed in detail, but where appropriate, such techniques, methods, and equipment should be considered part of the specification.

[0070] In all the examples shown and discussed herein, any specific values ​​should be interpreted as merely exemplary and not as limitations. Therefore, other examples of exemplary embodiments may have different values.

[0071] It should be noted that similar labels and letters in the following figures indicate similar items; therefore, once an item is defined in one figure, it does not need to be discussed further in subsequent figures.

[0072] <Hardware Configuration>

[0073] Figure 1a and Figure 1b This is a block diagram of the hardware configuration of an electronic device 1000 that can be used to implement the methods of any embodiment of this disclosure.

[0074] In one embodiment, such as Figure 1a As shown, electronic device 1000 can be server 1100.

[0075] Server 1100 is a computer that provides processing, database, and communication facilities. Server 1100 can be a monolithic server or a distributed server spanning multiple computers or a computer data center. Servers can be of various types, such as, but not limited to, web servers, news servers, mail servers, messaging servers, advertising servers, file servers, application servers, interactive servers, database servers, or proxy servers. In some embodiments, each server may include hardware, software, or embedded logical components for performing suitable functions supported or implemented by the server, or combinations of two or more such components. For example, servers may be blade servers, cloud servers, etc., or may be a server group consisting of multiple servers, which may include one or more of the types of servers described above, etc.

[0076] In this embodiment, server 1100 can be as follows: Figure 1a As shown, it includes a processor 1110, a memory 1120, an interface device 1130, a communication device 1140, a display device 1150, and an input device 1160.

[0077] In this embodiment, the server 1100 may also include speakers, microphones, etc., which are not limited here.

[0078] Processor 1110 can be a dedicated server processor, or a desktop processor, mobile processor, etc., that meets performance requirements; no limitation is made here. Memory 1120 includes, for example, ROM (Read-Only Memory), RAM (Random Access Memory), and non-volatile memory such as a hard disk. Interface device 1130 includes, for example, various bus interfaces, such as serial bus interfaces (including USB interfaces), parallel bus interfaces, etc. Communication device 1140 is capable of wired or wireless communication. Display device 1150 is, for example, an LCD screen, an LED screen, a touch screen, etc. Input device 1160 may include, for example, a touch screen, a keyboard, etc.

[0079] In this embodiment, the memory 1120 of the server 1100 is used to store instructions for controlling the processor 1110 to operate in order to at least perform the method according to any embodiment of this disclosure. Those skilled in the art can design instructions based on the schemes disclosed herein. How the instructions control the processor to operate is well known in the art and will not be described in detail here.

[0080] Despite Figure 1a The disclosure shows multiple devices of server 1100, but this disclosure may refer to only some of these devices; for example, server 1100 may refer only to memory 1120 and processor 1110.

[0081] In one embodiment, the electronic device 1000 may be a terminal device 1200 such as a PC or laptop used by the operator, and no limitation is made herein.

[0082] In this embodiment, refer to Figure 1b As shown, the terminal device 1200 may include a processor 1210, a memory 1220, an interface device 1230, a communication device 1240, a display device 1250, an input device 1260, a speaker 1270, a microphone 1280, etc.

[0083] Processor 1210 may be a mobile processor. Memory 1220 includes, for example, ROM (Read-Only Memory), RAM (Random Access Memory), and non-volatile memory such as a hard disk. Interface device 1230 includes, for example, a USB interface and a headphone jack. Communication device 1240 may be capable of wired or wireless communication. Communication device 1240 may include short-range communication devices, such as any device that performs short-range wireless communication based on short-range wireless communication protocols such as Hilink, WiFi (IEEE 802.11), Mesh, Bluetooth, ZigBee, Thread, Z-Wave, NFC, UWB, and LiFi. Communication device 1240 may also include long-range communication devices, such as any device that performs WLAN, GPRS, or 2G / 3G / 4G / 5G long-range communication. Display device 1250 is, for example, an LCD screen or a touch screen. Input device 1260 may include, for example, a touch screen or a keyboard. Users can input / output voice information through speaker 1270 and microphone 1280.

[0084] In this embodiment, the memory 1220 of the terminal device 1200 is used to store instructions for controlling the processor 1210 to operate to at least execute the method according to any embodiment of this disclosure. Those skilled in the art can design instructions based on the schemes disclosed herein. How the instructions control the processor to operate is well known in the art and will not be described in detail here.

[0085] Despite Figure 1b The present disclosure illustrates a number of devices of the terminal device 1200; however, the present disclosure may refer only to some of these devices. For example, the terminal device 1200 may refer only to the memory 1220, the processor 1210, and the display device 1250.

[0086] <Application Scenarios>

[0087] Figure 2 A schematic diagram illustrating an application scenario of one embodiment of this disclosure is shown.

[0088] like Figure 2 As shown, the user can provide raw data to the data visualization tool 2000. This raw data can be a data table, such as an Excel file. The data visualization tool 2000 analyzes and processes the raw data provided by the user and, according to the user's needs, obtains multiple target charts and the characteristics of each target chart. The characteristics of the target charts can include numerical values, trends, details, ratios, etc., and can be selected by the user from preset characteristics according to their own needs. The data visualization tool 2000 can generate JSON data representing the characteristics of each target chart and provide the JSON data to the electronic device 1000 in this embodiment.

[0089] The electronic device 1000 in this embodiment can parse the JSON data to obtain the features of each target chart to be displayed on the canvas, and perform one-hot encoding on the features of each target chart based on preset features to generate a corresponding target feature matrix. Each element in the target feature matrix can represent whether the corresponding target chart has the corresponding feature. For example, the value of the element in the corresponding target chart that has the corresponding feature can be set to a first preset value, and the value of the element in the corresponding target chart that does not have the corresponding feature can be set to a second preset value. The first preset value can be, for example, but is not limited to, 1, and the second preset value can be, for example, but is not limited to, 0.

[0090] When the number of target charts is N and the number of preset features is M, the target feature matrix can be an N*M matrix. Each row of the target feature matrix can correspond to the same target chart, and each column can correspond to the same feature.

[0091] Based on a pre-trained mapping function between the feature matrix and the size matrix, the size matrix of the target chart can be obtained from the target feature matrix. This size matrix can be an N*2 matrix. Each row of the size matrix can correspond to the same target chart, the first column can correspond to the length, and the second column can correspond to the width.

[0092] Based on the size matrix of the target charts, the initial size of each target chart can be obtained. Then, based on layout rules ensuring the target charts are neatly arranged on the canvas, do not overlap, and occupy a proportion within a set range, the layout of the target charts on the canvas can be determined according to their initial size and the preset canvas size. This layout includes the display size and position of each target chart on the canvas.

[0093] The electronic device 1000 may provide this layout to the data visualization tool 2000, which then displays the target chart on the canvas according to this layout.

[0094] In one example, the data visualization tool may be set on an electronic device performing the method of this embodiment, or it may be set on other electronic devices, without limitation.

[0095] The method described in this embodiment can automatically generate the initial size of the target chart based on its characteristics, without manual setting. Furthermore, it eliminates the need for manual layout template settings; it can determine the chart's layout on the canvas based on preset layout rules, the initial size, and the preset canvas size. This results in a more rational chart layout, reduces manual intervention, and ensures layout diversity.

[0096] <First Method Implementation>

[0097] This embodiment provides a method for generating a chart layout. This method can be implemented by an electronic device. The electronic device can be, for example,... Figure 1a The server shown is 1100, or as shown below. Figure 1b The terminal device shown is 1200.

[0098] according to Figure 3 As shown, the method for generating the chart layout in this embodiment may include the following steps S3100 to S3300:

[0099] Step S3100: Obtain the features of the target chart to be displayed on the canvas and the size of the canvas.

[0100] Specifically, data visualization tools can pre-provide multiple features, from which users select at least a portion based on the data corresponding to each target chart as the features of that target chart. These pre-defined features can include, for example, numerical values, trends, details, ratios, etc.

[0101] In one example, the data visualization tool could provide JSON data representing the characteristics of a target chart to an electronic device executing this embodiment. The electronic device receives the JSON data, parses it, and obtains the characteristics of the target chart.

[0102] In one embodiment of this disclosure, the size of the canvas can be determined by the size and / or resolution of the screen displaying the content on the canvas, or it can be preset by the user according to the application scenario or specific needs. For example, only the content of the canvas may be displayed on the screen, in which case the size of the canvas can be the same as the size of the screen. Alternatively, a portion of the screen may display the content of the canvas, in which case the size of the canvas can be smaller than the size of the screen, and can be set by the user according to the application scenario or specific needs.

[0103] Step S3200: Obtain the initial size of the target chart based on its characteristics.

[0104] In one embodiment of this disclosure, obtaining the initial size of the target chart based on its characteristics may include the following steps S3210 to S3220:

[0105] Step S3210: Based on preset features, construct a feature matrix to indicate whether the target chart has preset features, as the target feature matrix.

[0106] In one embodiment of this disclosure, a feature matrix is ​​constructed based on preset features to indicate whether a target chart has preset features. Specifically, the target feature matrix can be generated by performing one-hot encoding on the features of the target chart based on preset features.

[0107] One-hot encoding is a process of converting categorical variables into a form that is easy for machine learning algorithms to use.

[0108] Specifically, it can be done by using each target chart as a row and each feature as a column, and generating a target feature matrix based on whether each target chart has a corresponding preset feature.

[0109] For example, in an embodiment where target chart 1 has the characteristics of trend and value, target chart 2 has the characteristics of detail, and target chart 3 has the characteristics of ratio, all characteristics can include trend, value, detail, and ratio. The first row of elements in the target feature matrix can be set to correspond to target chart 1, the second row to correspond to target chart 2, and the third row to correspond to target chart 3. The first column of elements in the target feature matrix can be set to correspond to the feature "trend", the second column to correspond to the feature "value", the third column to correspond to the feature "detail", and the fourth column to correspond to the feature "ratio". For the value of each element, it can be set to a first set value when the corresponding target chart has the corresponding feature, and a second set value when the corresponding target chart does not have the corresponding feature.

[0110] With the first setting value being 1 and the second setting value being 0, the resulting target feature matrix can be represented as follows:

[0111] Step S3220: Obtain the initial size of the target chart based on the target feature matrix.

[0112] The initial dimensions in this embodiment can at least reflect the aspect ratio of the target chart.

[0113] In one embodiment of this disclosure, obtaining the initial size of the target chart based on the target feature matrix may include the following steps S3221 to S3223:

[0114] Step S3221: Obtain the mapping function between the feature matrix and the size matrix.

[0115] Specifically, the mapping function can be pre-trained. The independent variable of the mapping function F(x) is the feature matrix X, and the dependent variable F(x) is the size matrix determined by the feature matrix X.

[0116] Based on this embodiment, training samples can be obtained in advance, wherein the training samples include feature matrices of multiple charts and actual size matrices representing the initial size of the features of each chart corresponding to the feature matrices as manually labeled; a mapping function is trained based on the feature matrices of the training samples and the actual size matrices corresponding to the training samples.

[0117] In one embodiment, the training mapping function can be executed according to a preset training period. This training period can be set according to specific application scenarios or requirements; for example, it can be set to one day.

[0118] In this embodiment, based on the feature matrix of the training samples and the actual size matrix corresponding to the training samples, the mapping function F(x) can be obtained through various fitting methods. For example, any machine learning model can be used to obtain the mapping function F(x), which is not limited here.

[0119] In one example, the machine learning model can be a simple polynomial function that reflects the mapping function F(x), where the coefficients of each order of the polynomial function are unknown. By substituting the feature matrix of the training sample and the actual size matrix corresponding to the training sample into the polynomial function, the coefficients of each order of the polynomial function can be determined, and thus the mapping function F(x) can be obtained.

[0120] In another example, various machine learning models can be used to train multiple rounds of training using the feature matrix of the training sample and the actual size matrix corresponding to the training sample as accurate samples. In each round, the residuals after fitting in the previous round are learned. After T rounds of iteration, the residuals can be controlled to a very low value, so that the final mapping function F(x) has very high accuracy.

[0121] Step S3222: Determine the size matrix of the target chart based on the target feature matrix and the mapping function.

[0122] In this embodiment, the mapping function between the feature matrix and the size matrix is ​​obtained according to step S3221. The target feature matrix can then be substituted into the mapping function F(x) to obtain the size matrix of the target chart that reflects the initial size of the target chart.

[0123] When the number of target charts is N and the number of preset features is M, the target feature matrix can be an N*M matrix. Each row of the target feature matrix can correspond to the same target chart, and each column can correspond to the same feature. The size matrix of the target charts obtained from this target feature matrix can be an N*2 matrix. Each row of the size matrix can correspond to the same target chart, the first column can correspond to the length (or width), and the second column can correspond to the width (or length).

[0124] Step S3223: Obtain the initial size of the target chart based on the size matrix of the target chart.

[0125] The initial size of the target chart can include its length and width. In a size matrix where each row corresponds to the same target chart, the first column corresponds to the length, and the second column corresponds to the width, the value corresponding to the first column can be used as the initial length of the target chart for each element in the row, and the value corresponding to the second column can be used as the initial width of the target chart.

[0126] Step S3300: Based on preset layout rules, determine the layout of the target chart on the canvas according to the initial size of the target chart and the size of the canvas.

[0127] The layout of the target chart on the canvas includes at least its display size and position. The display position of the target chart on the canvas can be the display position of a preset marker point on the target chart, where the preset marker point can be the center of the target chart or any vertex.

[0128] In this embodiment, the display size of the target chart on the canvas can be scaled according to the initial size of the target chart and the scaling factor. When the display size is larger than the initial size, the scaling factor can be greater than 1; when the display size is smaller than the initial size, the scaling factor can be a positive number greater than 0 and less than 1; when the display size is equal to the initial size, the scaling factor can be 1.

[0129] In one embodiment of this disclosure, the initial size can be a normalized size. If the canvas size is in pixels (e.g., 640 pixels * 480 pixels), then the display size must be larger than the initial size, and the scaling factor must be greater than 1. To facilitate determining the layout of the target chart on the canvas, the scaling factor can be an integer.

[0130] In one embodiment of this disclosure, determining the layout of the target chart on the canvas based on preset layout rules, according to the initial size of the target chart and the size of the canvas, may include the following steps S3310 to S3320:

[0131] Step S3310: Using the scaling factor of the target chart and the coordinates of the preset marker points in the canvas as variables, construct an integer programming problem based on the initial size, layout rules, and canvas size.

[0132] In one embodiment of this disclosure, constructing an integer programming problem based on the initial size, layout rules, and canvas size, using the scaling factor of the target chart and the coordinates of preset marker points on the canvas as variables, may include the following steps S3311 to S3312:

[0133] Step S3311: Using the scaling factor of the target chart and the coordinates of the preset marker points in the canvas as variables, determine the coordinates of each vertex of the target chart in the canvas based on the scaling factor, the initial size, and the coordinates of the preset marker points in the canvas.

[0134] Specifically, based on the coordinates of the preset marker points in the canvas, the scaling factor, and the initial size, the coordinates of any point in the target chart in the canvas can be obtained.

[0135] Step S3312: Construct an integer programming problem based on the coordinates of each vertex of the target graph in the canvas, the layout rules, and the size of the canvas.

[0136] The layout rules in this embodiment may include at least one of the following:

[0137] The first requirement is that the target charts do not overlap;

[0138] The second point is that the target charts are neatly arranged on the canvas;

[0139] The third item is that the proportion of the target chart in the canvas is within the set range.

[0140] In this embodiment, the number of target graphs can be at least one. When there is only one target graph, the first and second layout rules described above are not involved; the integer programming problem can be constructed solely based on the third layout rule. When there are at least two target graphs, the integer programming problem can be constructed based on at least one of the rules described above.

[0141] For the first layout rule, it can be determined by the coordinates of each vertex of the target chart in the canvas, the area occupied by each target chart individually in the canvas, and the total area occupied by any two target charts in the canvas. An inequality can be constructed in which the total area occupied by any two target charts in the canvas is greater than or equal to the sum of the areas occupied by the two target charts individually in the canvas, so that the target charts in the canvas conform to the first layout rule.

[0142] For the second layout rule, the adjacent target charts can be determined based on the coordinates of each vertex of the target chart in the canvas. Then, for each vertex of each target chart, the boundary points adjacent to each vertex in the adjacent target charts can be determined. For each vertex of each target chart, an inequality can be constructed based on the difference between its horizontal axis coordinates and / or the difference between its vertical axis coordinates and the differences between its horizontal axis coordinates and the adjacent boundary points. This inequality ensures that the target chart conforms to the second layout rule in the canvas.

[0143] For the third layout rule, the total area occupied by the target chart on the canvas can be determined based on the coordinates of each vertex of the target chart on the canvas; the area of ​​the canvas can be determined based on the size of the canvas; and then the ratio of the total area occupied by the target chart on the canvas to the area of ​​the canvas can be determined. An inequality can be constructed where this ratio is less than or equal to a third set value and greater than or equal to a fourth set value to ensure that the target chart conforms to the third layout rule on the canvas.

[0144] Step S3320: Solve the integer programming problem to obtain the layout of the target chart on the canvas.

[0145] The method described in this embodiment can automatically generate the initial size of the target chart based on its characteristics, without manual setting. Furthermore, it eliminates the need for manual layout template settings; it can determine the chart's layout on the canvas based on preset layout rules, the initial size, and the preset canvas size. This results in a more rational chart layout, reduces manual intervention, and ensures layout diversity.

[0146] In one embodiment of this disclosure, when the layout of the target chart in the canvas is obtained, the layout of the target chart in the canvas can be provided to the data visualization tool so that the data visualization tool can display the target chart in the canvas of the corresponding display screen according to the layout.

[0147] In one embodiment of this disclosure, the method may further include: outputting the layout of the target chart in the canvas.

[0148] In the absence of a data visualization tool in the electronic device of this embodiment, the method may include: outputting the layout of the target chart on a canvas. For example, the layout of the target chart on the canvas may be output to another electronic device equipped with a data visualization tool, so that the other electronic device can display the target chart on the canvas of its display screen according to the layout.

[0149] In the case where the electronic device in this embodiment is equipped with a data visualization tool, the method may include: displaying the target chart on the canvas of the display screen according to the layout.

[0150] <Second Method Implementation>

[0151] This embodiment provides a method for generating a layout of a display object. This method can be implemented by an electronic device. The electronic device can be, for example,... Figure 1a The server shown is 1100, or as shown below. Figure 1b The terminal device shown is 1200.

[0152] according to Figure 4As shown, the method for generating the layout of the display object in this embodiment may include the following steps S4100 to S4300:

[0153] Step S4100: Obtain the characteristics of the target display object to be displayed on the canvas and the size of the canvas.

[0154] In one embodiment of this disclosure, the canvas may be a video playback interface, an e-commerce platform display interface, an information flow display interface, or a chart display interface.

[0155] When the canvas is a video playback interface, the target display object includes at least one of a video, an image, an animated image, and a text box; or, when the canvas is an e-commerce platform display interface, the target display object includes at least one of a product image, a product grid, and a product list; or, when the canvas is an information feed display interface, the target display object includes at least one of an image, a video, an animated image, and an information feed card; or, when the canvas is a chart display interface, the target display object includes a chart.

[0156] Step S4200: Obtain the initial size of the target display object based on the characteristics of the target display object.

[0157] In one embodiment of this disclosure, obtaining the initial size of the target display object based on its characteristics may include the following steps S4210 to S4120:

[0158] Step S4210: Based on preset features, construct a feature matrix to represent whether the target display object has features, as the target feature matrix.

[0159] Among them, the preset features include at least the target features.

[0160] In one embodiment of this disclosure, a feature matrix is ​​constructed based on preset features to indicate whether a target display object has features. The target feature matrix may include:

[0161] Based on the preset features, the features of the target display object are one-hot encoded to generate a target feature matrix.

[0162] Step S4220: Obtain the initial size of the target display object based on the target feature matrix.

[0163] In one embodiment of this disclosure, obtaining the initial size of the target display object based on the target feature matrix may include the following steps S4221 to S4223:

[0164] Step S4221: Obtain the mapping function between the feature matrix and the size matrix.

[0165] The size matrix is ​​a matrix that reflects the initial size of the corresponding display object.

[0166] Step S4222: Determine the size matrix of the target display object based on the target feature matrix and the mapping function.

[0167] Step S4223: Obtain the initial size of the target display object based on the size matrix of the target display object.

[0168] Step S4300: Based on preset layout rules, determine the layout of the target display object on the canvas according to the initial size and the canvas size.

[0169] In one embodiment of this disclosure, determining the layout of the target display object on the canvas based on preset layout rules, initial size, and canvas size includes the following steps S4310 to S4320:

[0170] Step S4310: Using the scaling factor of the target display object and the coordinates of the preset marker point of the target display object in the canvas as variables, construct an integer programming problem based on the initial size, layout rules and canvas size.

[0171] In one embodiment of this disclosure, constructing an integer programming problem based on the initial size, layout rules, and canvas size, using the scaling factor of the target display object and the coordinates of the preset marker point of the target display object in the canvas as variables, may include the following steps S4311-4312:

[0172] Step S4311: Using the scaling factor of the target display object and the coordinates of the preset marker point of the target display object in the canvas as variables, determine the coordinates of the vertex of the target display object in the canvas based on the scaling factor, the initial size, and the coordinates of the preset marker point in the canvas.

[0173] Step S4312: Construct an integer programming problem based on the coordinates of the vertices of the target display object in the canvas, the layout rules, and the size of the canvas.

[0174] In one embodiment of this disclosure, the layout rule may include at least one of the following:

[0175] The target display objects do not overlap;

[0176] The target objects are neatly arranged in the canvas;

[0177] The proportion of the target display object in the canvas is within the set range.

[0178] Step S4320: Solve the integer programming problem to obtain the layout of the target display object on the canvas.

[0179] In the embodiments of this disclosure, the initial size of the target display object can be automatically generated based on its characteristics, without manual setting. Furthermore, there is no need to manually set layout templates; the layout of the target display object on the canvas can be determined based on preset layout rules, the initial size, and the preset canvas size. This allows for a more rational layout of the target display object on the canvas, reduces manual intervention, and ensures layout diversity.

[0180] <Device Embodiment>

[0181] In this embodiment, a chart layout generation device 4000 is provided, such as... Figure 5 As shown, the system includes a feature size acquisition module 4100, an initial size determination module 4200, and a layout method determination module 4300. The feature size acquisition module 4100 is used to acquire the features of the target chart to be displayed on the canvas and the size of the canvas. The initial size determination module 4200 is used to obtain the initial size of the target chart based on the features of the target chart. The layout method determination module 4300 is used to determine the layout method of the target chart on the canvas based on preset layout rules, the initial size, and the size of the canvas.

[0182] In one embodiment of this disclosure, the initial size determination module 4200 may also be used for:

[0183] Based on preset features, a feature matrix is ​​constructed to indicate whether the target chart has features, which serves as the target feature matrix; wherein, the preset features include at least the target features;

[0184] The initial size of the target chart is obtained based on the target feature matrix.

[0185] In one embodiment of this disclosure, obtaining the initial size of the target chart based on the target feature matrix includes:

[0186] Obtain the mapping function between the feature matrix and the size matrix; where the size matrix is ​​a matrix reflecting the initial size of the corresponding chart;

[0187] Determine the size matrix of the target chart based on the target feature matrix and the mapping function;

[0188] The initial dimensions of the target chart are obtained based on the size matrix of the target chart.

[0189] In one embodiment of this disclosure, a feature matrix is ​​constructed based on preset features to indicate whether a target chart possesses the features. The target feature matrix includes:

[0190] Based on preset features, the features of the target chart are one-hot encoded to generate a target feature matrix.

[0191] In one embodiment of this disclosure, obtaining the features of the target chart to be displayed on the canvas includes:

[0192] Obtain JSON data provided by the data visualization tool;

[0193] Parse the JSON data to obtain the characteristics of the target chart.

[0194] In one embodiment of this disclosure, the layout determination module 4300 can also be used for:

[0195] Using the scaling factor of the target chart and the coordinates of the target chart's preset marker points on the canvas as variables, construct an integer programming problem based on the initial size, layout rules, and canvas size;

[0196] Solve the integer programming problem to obtain the layout of the target chart on the canvas.

[0197] In one embodiment of this disclosure, using the scaling factor of the target chart and the coordinates of the preset marker points of the target chart in the canvas as variables, the integer programming problem is constructed based on the initial size, layout rules, and canvas size, including:

[0198] Using the scaling factor of the target chart and the coordinates of the preset marker points of the target chart in the canvas as variables, determine the coordinates of the vertices of the target chart in the canvas based on the scaling factor, the initial size, and the coordinates of the preset marker points in the canvas.

[0199] Construct an integer programming problem based on the coordinates of the vertices of the target graph in the canvas, the layout rules, and the size of the canvas.

[0200] In one embodiment of this disclosure, the layout rules include at least one of the following:

[0201] The target charts do not overlap;

[0202] The target charts are neatly arranged on the canvas;

[0203] The target chart occupies a proportion of the canvas within the set range.

[0204] In one embodiment of this disclosure, it further includes:

[0205] Output the layout of the target chart on the canvas; or...

[0206] Display the target chart on the canvas according to the layout.

[0207] Those skilled in the art will understand that the chart layout generation apparatus 4000 can be implemented in various ways. For example, the chart layout generation apparatus 4000 can be implemented by configuring a processor with instructions. For example, instructions can be stored in a ROM, and when the device is started, the instructions can be read from the ROM into a programmable device to implement the chart layout generation apparatus 4000. For example, the chart layout generation apparatus 4000 can be embedded in a special-purpose device (e.g., an ASIC). The chart layout generation apparatus 4000 can be divided into independent units, or they can be combined together. The chart layout generation apparatus 4000 can be implemented by one of the various implementation methods described above, or by a combination of two or more of the various implementation methods described above.

[0208] In this embodiment, the chart layout generation device 4000 can have various implementation forms. For example, the chart layout generation device 4000 can be a functional module running in any software product or application that provides chart layout generation services, or a peripheral embedding, plug-in, patch, etc. of these software products or applications, or it can be the software products or applications themselves.

[0209] Through the embodiments of this disclosure, the initial size of the target chart can be automatically generated based on its characteristics, without manual setting. Furthermore, there is no need to manually set layout templates; the layout of the target chart on the canvas can be determined based on preset layout rules, the initial size, and the preset canvas size. This allows for a more rational layout of the chart on the canvas, reduces manual intervention, and ensures layout diversity.

[0210] <Electronic Devices>

[0211] In this embodiment, an electronic device 1000 is also provided. The electronic device 1000 may be the server 1100 shown in FIG1 or, for example... Figure 1b The terminal device shown is 1200.

[0212] like Figure 6 As shown, the electronic device 1000 may further include a processor 1300 and a memory 1400, the memory 1400 being used to store executable instructions; the processor 1300 being used to control the electronic device 1000 to execute a method for generating a chart layout according to any embodiment of the present disclosure, or a method for generating a layout of display objects, according to the instructions.

[0213] For example, electronic device 1000 could be a computer cluster capable of providing layout services.

[0214] Through the embodiments of this disclosure, the initial size of the target chart can be automatically generated based on its characteristics, without manual setting. Furthermore, there is no need to manually set layout templates; the layout of the target chart on the canvas can be determined based on preset layout rules, the initial size, and the preset canvas size. This allows for a more rational layout of the chart on the canvas, reduces manual intervention, and ensures layout diversity.

[0215] Computer-readable storage media

[0216] In this embodiment, a computer-readable storage medium is also provided, on which a computer program is stored. When the computer program is executed by a processor, it implements a method for generating a chart layout as in any embodiment of this disclosure, or a method for generating a layout of display objects.

[0217] This disclosure can be a system, method, and / or computer program product. A computer program product may include a computer-readable storage medium having computer-readable program instructions loaded thereon for causing a processor to implement various aspects of this disclosure.

[0218] Computer-readable storage media can be tangible devices capable of holding and storing instructions for use by an instruction execution device. Computer-readable storage media can be, for example—but not limited to—electrical storage devices, magnetic storage devices, optical storage devices, electromagnetic storage devices, semiconductor storage devices, or any suitable combination of the foregoing. More specific examples (a non-exhaustive list) of computer-readable storage media include: portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), static random access memory (SRAM), portable compact disc read-only memory (CD-ROM), digital multifunction disc (DVD), memory sticks, floppy disks, mechanical encoding devices, such as punch cards or recessed protrusions storing instructions thereon, and any suitable combination of the foregoing. The computer-readable storage media used herein are not to be construed as transient signals themselves, such as radio waves or other freely propagating electromagnetic waves, electromagnetic waves propagating through waveguides or other transmission media (e.g., light pulses through fiber optic cables), or electrical signals transmitted through wires.

[0219] The computer-readable program instructions described herein can be downloaded from computer-readable storage media to various computing / processing devices, or downloaded via a network, such as the Internet, local area network, wide area network, and / or wireless network, to an external computer or external storage device. The network may include copper transmission cables, fiber optic transmission, wireless transmission, routers, firewalls, switches, gateway computers, and / or edge servers. A network adapter card or network interface in each computing / processing device receives the computer-readable program instructions from the network and forwards them to the computer-readable storage media in the respective computing / processing device.

[0220] Computer program instructions used to perform the operations of this disclosure may be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine-dependent instructions, microcode, firmware instructions, status setting data, or source code or object code written in any combination of one or more programming languages, including object-oriented programming languages ​​such as Smalltalk, C++, etc., and conventional procedural programming languages ​​such as the "C" language or similar programming languages. The computer-readable program instructions may execute entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or may be connected to an external computer (e.g., via the Internet using an Internet service provider). In some embodiments, electronic circuitry, such as programmable logic circuitry, field-programmable gate arrays (FPGAs), or programmable logic arrays (PLAs), is personalized by utilizing the status information of the computer-readable program instructions to implement various aspects of this disclosure.

[0221] Various aspects of this disclosure are described herein with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this disclosure. It should be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer-readable program instructions.

[0222] These computer-readable program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing apparatus to produce a machine such that, when executed by the processor of the computer or other programmable data processing apparatus, they create means for implementing the functions / actions specified in one or more blocks of the flowchart and / or block diagram. These computer-readable program instructions can also be stored in a computer-readable storage medium that causes a computer, programmable data processing apparatus, and / or other device to operate in a particular manner; thus, the computer-readable medium storing the instructions comprises an article of manufacture that includes instructions for implementing aspects of the functions / actions specified in one or more blocks of the flowchart and / or block diagram.

[0223] Computer-readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other device to cause a series of operational steps to be performed on the computer, other programmable data processing apparatus, or other device to produce a computer-implemented process, thereby causing the instructions executed on the computer, other programmable data processing apparatus, or other device to perform the functions / actions specified in one or more boxes of a flowchart and / or block diagram.

[0224] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of an instruction containing one or more executable instructions for implementing a specified logical function. In some alternative implementations, the functions marked in the blocks may occur in a different order than those marked in the drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or action, or using a combination of dedicated hardware and computer instructions. It will be known to those skilled in the art that implementation in hardware, implementation in software, and implementation in a combination of software and hardware are equivalent.

[0225] The various embodiments of this disclosure have been described above. These descriptions are exemplary and not exhaustive, and are not limited to the disclosed embodiments. Many modifications and variations will be apparent to those skilled in the art without departing from the scope and spirit of the described embodiments. The terminology used herein is chosen to best explain the principles, practical application, or technical improvements to the embodiments in the market, or to enable others skilled in the art to understand the embodiments disclosed herein. The scope of this disclosure is defined by the appended claims.

Claims

1. A method for generating a chart layout, comprising: obtaining features of a target chart to be displayed in a canvas and a size of the canvas; obtaining an initial size of the target chart according to the features of the target chart; determining a layout of the target chart in the canvas according to the initial size and the size of the canvas based on a preset layout rule; wherein the method further comprises: encoding the features of the target chart with one-hot encoding with the target chart as rows and the preset features as columns to generate a target feature matrix, wherein the target feature matrix is used to indicate whether the target chart has the preset features; and wherein the method further comprises: determining a size matrix of the target chart according to the target feature matrix and a mapping function, wherein the mapping function is determined according to training samples, the training samples comprising feature matrices of a plurality of charts and actual size matrices of initial sizes of features of each of the charts, the size matrix being a matrix reflecting the initial size of the corresponding chart, each row of the size matrix corresponding to the target chart, and two columns of the size matrix corresponding to a length and a width of the target chart, respectively.

2. The method of claim 1, wherein the obtaining the initial size of the target chart according to the features of the target chart comprises: obtaining the initial size of the target chart according to the target feature matrix.

3. The method of claim 2, wherein the obtaining the initial size of the target chart according to the target feature matrix comprises: obtaining the initial size of the target chart according to a size matrix of the target chart.

4. The method of claim 2, wherein the constructing a feature matrix used to indicate whether the target chart has the features as a target feature matrix based on the preset features comprises: generating the target feature matrix by one-hot encoding the features of the target chart based on the preset features.

5. The method of claim 1, wherein the obtaining the features of the target chart to be displayed in the canvas comprises: obtaining json data provided by a data visualization tool; and parsing the json data to obtain the features of the target chart.

6. The method of claim 1, wherein the determining the layout of the target chart in the canvas according to the initial size and the size of the canvas based on the preset layout rule comprises: constructing an integer programming problem according to the initial size, the layout rule and the size of the canvas with a scaling factor of the target chart and coordinates of preset marker points of the target chart in the canvas as variables; and solving the integer programming problem to obtain the layout of the target chart in the canvas. ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ 7. The method of claim 6, wherein constructing an integer programming problem according to the initial dimensions, the layout rules and the size of the canvas, with the scaling factor of the target chart and the coordinates of preset marker points of the target chart in the canvas as variables comprises: determining coordinates of vertices of the target chart in the canvas according to the scaling factor, the initial dimensions and the coordinates of the preset marker points of the target chart in the canvas, with the scaling factor of the target chart and the coordinates of preset marker points of the target chart in the canvas as variables; and constructing the integer programming problem according to the coordinates of the vertices of the target chart in the canvas, the layout rules and the size of the canvas.

8. The method of claim 7, wherein the layout rules comprise at least one of the following: the target charts do not overlap; the target charts are arranged neatly in the canvas; and proportions of the target charts in the canvas are within a set range.

9. The method of claim 1, further comprising: outputting the layout of the target charts in the canvas; or displaying the target charts in the canvas according to the layout.

10. A method for generating a layout of display objects, comprising: obtaining features of a target display object to be displayed in a canvas and a size of the canvas; obtaining initial dimensions of the target display object according to the features of the target display object; and determining a layout of the target display object in the canvas according to the initial dimensions and the size of the canvas based on preset layout rules.

11. The method of claim 10, wherein obtaining the initial dimensions of the target display object according to the features of the target display object comprises: the preset features comprise at least the target features; and obtaining the initial dimensions of the target display object according to the target feature matrix.

12. The method of claim 11, wherein obtaining the initial dimensions of the target display object according to the target feature matrix comprises: obtaining the initial dimensions of the target display object according to the size matrix of the target display object. ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ 13. The method of claim 10, wherein determining, based on the preset layout rule, the layout manner of the target display object in the canvas according to the initial size and the size of the canvas comprises: taking the scaling factor of the target display object and the coordinates of preset marker points of the target display object in the canvas as variables, constructing an integer programming problem according to the initial size, the layout rule and the size of the canvas; and solving the integer programming problem to obtain the layout manner of the target display object in the canvas.

14. The method of claim 10, wherein the target display object comprises at least one of a video, a picture, a dynamic picture and a text box when the canvas is a video playing interface; or the target display object comprises at least one of a product picture, a product grid and a product list when the canvas is an e-commerce platform display interface; or the target display object comprises at least one of a picture, a video, a dynamic picture and an information flow card when the canvas is an information flow display interface; or the target display object comprises a chart when the canvas is a chart display interface.

15. An apparatus for generating a chart layout manner, comprising: a feature size obtaining module configured to obtain features of a target chart to be displayed in a canvas and a size of the canvas; an initial size determining module configured to obtain an initial size of the target chart according to the features of the target chart; and a layout manner determining module configured to determine a layout manner of the target chart in the canvas based on a preset layout rule and according to the initial size and the size of the canvas.

16. An electronic device, comprising: a processor and a memory configured to store instructions for controlling the processor to perform the method of any one of claims 1 to 14.

17. A computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements the method of any one of claims 1 to 14. ​ ​ ​ ​ ​ ​ ​ ​

Citation Information

Patent Citations

  • Data processing method and device as well as screen designer

    CN105867951A