A method and system for automatically generating charts using large models
Through the method of automatically generating charts from large models, the problem of low degree of automation in chart generation is solved, and efficient and accurate chart generation and optimization is achieved, which is suitable for the field of data visualization.
Patent Information
- Application Number
- CN202411701149.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-25
- Publication Date
- 2025-08-01
- Estimated Expiration
- 2044-11-25
AI Technical Summary
In the prior art, the chart generation process has a low degree of automation, which requires manual design and adjustment by users. The operation is complex and time-consuming, and the lack of effective data format inspection and preprocessing mechanisms, resulting in poor generation results and incomplete chart optimization and quality evaluation.
The method of automatically generating charts using a large model is used to obtain the data information input by users, and the initial structure and basic element layout of the chart are generated using a pre-trained neural network model, the coordinates and sizes of the chart elements are optimized, and the quality evaluation is carried out to ensure clarity, rationality of element layout and accuracy of data expression.
Improves the efficiency and accuracy of chart generation, reduces user operation complexity, ensures the quality of generated charts, and optimizes file size through compression processing, improving loading speed and transfer efficiency.
Smart Images

Figure CN119887996B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of data visualization. More specifically, the present invention relates to a method and system for automatically generating charts using a large model. Background Art
[0002] With the advent of the big data era, data visualization technology plays an increasingly important role in various fields. Data visualization technology intuitively displays complex data in the form of graphs, charts, etc., helping users understand and analyze data more quickly and accurately. In the traditional data visualization process, professional data analysts or designers usually need to manually design and adjust charts, which is not only time-consuming and laborious, but also has a high threshold for non-professionals. In addition, with the continuous growth of the data volume, the difficulty of manually processing and analyzing data is also increasing. Therefore, how to improve the automation degree of the data visualization process, reduce the user operation difficulty, and improve the efficiency and accuracy of chart generation has become an urgent problem to be solved in the current data visualization technology field.
[0003] In the process of implementing the embodiments of the present invention, the inventors found that there are at least the following problems or defects in the prior art: the automation degree of the chart generation process in the prior art is relatively low, and users need to manually design and adjust charts, with complex operations and time-consuming; there is a lack of an effective data format checking and preprocessing mechanism, resulting in poor chart generation effects when data input errors or format inconsistencies occur; the chart optimization and quality evaluation mechanism is imperfect, and it is impossible to ensure that the generated charts achieve the optimal effects in terms of clarity, layout rationality, and data expression accuracy. Summary of the Invention
[0004] The present invention provides a method and system for automatically generating charts using a large model.
[0005] In the first aspect of the present invention, a method for automatically generating charts using a large model is provided, including:
[0006] Step 1: Obtain the data information input by the user, where the data information includes data type, data volume, data content characteristics, and target chart type;
[0007] Step 2: Input the obtained user input data information into the large model, where the large model is a pre-trained neural network model capable of processing chart generation tasks;
[0008] Step 3: The large model generates the initial structure and basic element layout of the chart according to the input data information, specifically:
[0009] The large model determines the basic architecture of the chart according to the data type and target chart type, and determines the basic element layout according to the data volume and data content characteristics;
[0010] Step 4: Optimize the initial structure of the generated chart and the layout of basic elements according to the characteristics of the data content;
[0011] Step 5: Calculate the coordinates and sizes of the chart elements according to the optimized architecture and layout. When calculating the coordinates, assume the width of the chart is W, and the relative position ratio of the element in the horizontal direction is p x , then the x coordinate of the element. Assume the height of the chart is H, and the relative position ratio of the element in the vertical direction is p y , then the y coordinate of the element. Assume the total layout width is TW, and the space occupancy ratio of the element in the horizontal direction is s w , then the width of the element. Assume the total layout height is TH, and the space occupancy ratio of the element in the vertical direction is s h , then the height of the element;
[0012] Step 6: Draw the chart elements according to the calculated coordinates and sizes;
[0013] Step 7: Evaluate the quality of the generated chart. Evaluate from three aspects: the clarity C of the chart, the rationality LR of the element layout, and the accuracy DA of data expression. The quality score, then return to Step 3 to regenerate; where T is a preset threshold;
[0014] Step 8: Output the final chart.
[0015] The above embodiments of the present invention have at least the following beneficial effects: By using the method of automatically generating charts with a large model, the present invention can improve the efficiency and accuracy of chart generation. Users only need to provide the required data information and the target chart type, and the large model can automatically process the data, generate the initial structure of the chart and the layout of basic elements, and optimize them, and finally output high-quality charts. This process can not only reduce the workload of users in chart design and adjustment, but also reduce the dependence on professional skills, enabling non-professionals to easily achieve the visual expression of data.
[0016] In addition, a quality evaluation mechanism is introduced in the chart generation process of this method, which can ensure that the generated charts meet high standards in terms of clarity, rationality of element layout, and accuracy of data expression. By calculating the coordinates and sizes of chart elements, optimizing the axis scales, and evaluating the quality of the chart, this method can effectively improve the visual effect of the chart and the accuracy of information transmission. At the same time, through compression processing, the size of the chart file can also be reduced, improving the loading speed and transmission efficiency of the chart, thereby optimizing the user experience while ensuring the quality of the chart. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] By reading the following detailed description with reference to the accompanying drawings, the above and other objects, features, and advantages of the exemplary embodiments of the present invention will become readily understandable. In the drawings, several embodiments of the present invention are shown by way of example and not limitation, wherein:
[0018] Figure 1 It is a schematic flowchart of a method for automatically generating a chart using a large model provided by an embodiment of the present invention;
[0019] Figure 2 It is a schematic structural diagram of a system for automatically generating a chart using a large model provided by an embodiment of the present invention;
[0020] Figure 3 Schematically shows a schematic structural diagram of an electronic device according to an embodiment of the present invention. Detailed Embodiments
[0021] The principles and spirit of the present invention will be described below with reference to several exemplary embodiments. It should be understood that these embodiments are given only to enable those skilled in the art to better understand and thus implement the present invention, and not to limit the scope of the present invention in any way. On the contrary, these embodiments are provided to make the present invention more thorough and complete, and to be able to fully convey the scope of the present invention to those skilled in the art.
[0022] Those skilled in the art know that the embodiments of the present invention can be implemented as a system, apparatus, device, method, or computer program product. Therefore, the present invention can be specifically implemented in the following forms, namely: completely hardware, completely software (including firmware, resident software, microcode, etc.), or a combination of hardware and software.
[0023] It should be noted that any number of elements in the drawings is for illustration rather than limitation, and any naming is only for distinction and does not have any limiting meaning.
[0024] Below with reference to Figure 1 , Figure 1 It is a schematic flowchart of a method for automatically generating a chart using a large model provided by an embodiment of the present invention. As Figure 1 shown, a method 100 for automatically generating a chart using a large model includes:
[0025] Step 1: Obtain the data information input by the user, where the data information includes data type, data volume, data content characteristics, and target chart type;
[0026] Step 2: Input the obtained user input data information into a large model, where the large model is a pre-trained neural network model capable of processing chart generation tasks;
[0027] Step 3: The large model generates the initial structure and basic element layout of the chart based on the input data information, specifically as follows:
[0028] The large model determines the basic architecture of the chart according to the data type and the target chart type, and determines the basic element layout according to the data volume and the characteristics of the data content;
[0029] Step 4: Optimize the generated initial structure and basic element layout of the chart according to the characteristics of the data content;
[0030] Step 5: Calculate the coordinates and sizes of the chart elements according to the optimized architecture and layout. When calculating the coordinates, assume the width of the chart is W and the relative horizontal position ratio of the element is p x , then the x coordinate of the element x = W × p x , assume the height of the chart is H and the relative vertical position ratio of the element is p y , then the y coordinate of the element y = H × p y , assume the total layout width is TW and the horizontal space occupancy ratio of the element is s w , then the width of the element w = TW × s w , assume the total layout height is TH and the vertical space occupancy ratio of the element is s h , then the height of the element h = TH × s h ;
[0031] Step 6: Draw the chart elements according to the calculated coordinates and sizes;
[0032] Step 7: Evaluate the quality of the generated chart. Evaluate from three aspects: the clarity C of the chart, the rationality LR of the element layout, and the accuracy DA of the data expression. The quality score S = 0.3×C + 0.4×LR + 0.3×DA. If S < T (T is a preset threshold), then return to Step 3 to regenerate;
[0033] Step 8: Output the final chart.
[0034] It should be noted that this method first involves obtaining the data information input by the user, which includes the data type, data volume, characteristics of the data content, and the target chart type that the user hopes to generate. The data type can be time series data, categorical data, etc. The data volume refers to the number of records in the dataset. The characteristics of the data content may include the distribution, extreme values, etc. of the data, and the target chart type is the chart form that the user hopes to obtain, such as line chart, bar chart, etc. The large model refers to a pre-trained neural network model that can handle chart generation tasks, that is, generate charts according to the input data information.
[0035] Specifically, the data type parameter can be time series or categorical data, and the target chart type parameter can be a line chart or a bar chart. The data volume and data content characteristics can be used to determine the basic structure and element layout of the chart. For example, if the data type is time series and the target chart type is a line chart, the basic structure will include a time axis and a data value axis. The data volume and data content characteristics can be used to determine the spatial proportion of each element in the chart, such as the width of each bar in a bar chart. In addition, the number of different data categories and the data volume of each category in the data content characteristics can be used to calculate the spatial proportion of the layout of each category element.
[0036] Preferably, for the case where the data value range is large, the readability of the chart can be improved by optimizing the axis scale. Specifically, the minimum and maximum values of the data values and the number of scales can be set, and then the scale interval can be calculated. For example, if the minimum value of the data value is 10, the maximum value is 100, and the number of scales is 5, the scale interval can be set to (100 - 10) / 5 = 18.
[0037] Furthermore, for the drawing of chart elements, different drawing sub-functions can be called according to the element type. For example, if the element is a line, the starting point coordinates and the ending point coordinates can be used to draw the line; if the element is a rectangle, the upper left corner coordinates, width, and height can be used to draw the rectangle. The specific settings of these parameters can be determined according to the actual data and chart requirements.
[0038] In some embodiments, in the step of obtaining the data information input by the user in step one, the data input by the user is subjected to format check and preprocessing. If the data format does not meet the requirements, it is converted according to the preset format conversion rules. Let the original data format parameters be F1, F2, …, F n , and the preset format parameters be P1, P2, …, P n , if F i ≠P i (i = 1, 2, …, n), then F i is converted to P i .
[0039] It should be noted that when this method obtains the data information input by the user, it will perform format check and preprocessing on the data provided by the user. This is to ensure that the data information meets the requirements of the large model processing. If the data format does not meet the requirements, it needs to be converted according to the preset format conversion rules. Here, the data format refers to the organization method and structure of the data, such as CSV, JSON, etc., and the preset format conversion rules are a set of predefined rules for converting the data format that does not meet the requirements into a format acceptable to the model.
[0040] Specifically, when performing data format checks, the system will identify the original format parameters of the data, such as the field separator and record separator of the data, and compare them with the preset format parameters. If a mismatch is found, for example, the original format uses commas to separate fields while the preset format uses tab characters, the system will adjust the data format according to the preset conversion rules, such as replacing commas with tab characters. This process may involve data cleaning, conversion, and standardization to ensure data consistency and accuracy.
[0041] Preferably, during the data format conversion process, various strategies can be adopted to handle different types of format problems. For example, if the data contains extra spaces or special characters, regular expressions can be used for cleaning. For missing values or outliers, methods such as filling, deleting, or replacing can be adopted for processing.
[0042] Furthermore, different data encoding methods can be selected according to the characteristics and requirements of the data, such as encoding categorical data as numerical data for easier model processing. These conversion steps can be adjusted according to the actual data characteristics and model requirements to achieve the best data preprocessing effect.
[0043] In some embodiments, in the step where the large model generates the initial structure and basic element layout of the chart based on the input data information, if the data type is time series data and the target chart type is a line chart, the basic architecture includes a time axis and a data value axis. If the data type is categorical data and the target chart type is a bar chart, the basic architecture includes a category axis and a numerical axis. Let the data type parameter be D t , and the target chart type parameter be T t , when D t is time series and T t is a line chart, the architecture parameter A = 1 (representing the architecture with a time axis and a data value axis). When D t is categorical data and T t is a bar chart, the architecture parameter A = 2 (representing the architecture with a category axis and a numerical axis).
[0044] It should be noted that when this method generates the initial structure and basic element layout of the chart, it will determine the basic architecture of the chart according to the data type and the target chart type. Here, the data type refers to the nature of the data, such as time series data or categorical data, while the target chart type is the form of the chart that the user hopes to generate, such as a line chart or a bar chart. The basic architecture refers to the framework of the chart, including the layout and design of elements such as coordinate axes, legends, and titles.
[0045] Specifically, when determining the basic structure of the chart, if the data type is time series data and the user wishes to generate a line chart, the basic structure will include a time axis and a data value axis. The time axis is used to represent the passage of time, while the data value axis is used to represent the changes in the data. For categorical data and bar charts, the basic structure will include a category axis and a numerical axis. The category axis is used to display different categories, and the numerical axis is used to display the data values for each category. Architecture parameters are used to define these axes. For example, the architecture parameter can be 1 or 2, representing the architecture with a time axis and a data value axis, or the architecture with a category axis and a numerical axis, respectively.
[0046] Preferably, after determining the basic structure, the element layout can be further refined according to the data volume and data content characteristics. For example, if the data volume is large, it can be considered to increase the size of the chart or use a scroll bar to display all the data. If the data content characteristics include multiple data categories, different colors or patterns can be assigned to each category for the user to distinguish.
[0047] Furthermore, the scale of the coordinate axes can also be adjusted according to the distribution of the data, making the chart clearer and easier to read. These refinement steps can be adjusted according to the actual data characteristics and user requirements to achieve the best chart display effect.
[0048] In some embodiments, in the step of determining the basic element layout according to the data volume and data content characteristics in step three, let the number of different data categories in the data content characteristics be n, the data volume be V, and the data volume of the i-th data category be V i , then the layout space occupancy ratio of the i-th data category element
[0049] It should be noted that when this method determines the basic element layout of the chart, it will consider the number of different data categories in the data content characteristics and the data volume of each category. Here, the data content characteristics refer to specific attributes in the data set, such as the distribution, extreme values, categories, etc. of the data, while the data category refers to different groupings or classifications in the data set. The basic element layout refers to the positions and sizes of the various components in the chart, such as each bar in a bar chart or each line in a line chart.
[0050] Specifically, when determining the basic element layout, the data volume and data content characteristics can be used to calculate the layout space occupancy ratio of each data category element. For example, if the data set contains three categories, and the data volumes of each category are 100, 200, and 300 respectively, then the total data volume is 600. According to the formula, the layout space occupancy ratio of the first category is 100 / 600, the second category is 200 / 600, and the third category is 300 / 600. These ratios can be used to determine the relative sizes and positions of each category in the chart.
[0051] More specifically, the layout can also be adjusted according to the distribution of the data. For example, if the amount of data in a certain category is much larger than that of other categories, its proportion in the chart can be appropriately increased to better display the data distribution.
[0052] Preferably, when determining the basic element layout, the aesthetics and readability of the chart can also be considered. For example, different colors or patterns can be assigned to different data categories for users to distinguish. In addition, the scale of the coordinate axes can be adjusted according to the data distribution to make the chart clearer and easier to read.
[0053] Furthermore, in actual operation, the layout of the elements can also be adjusted according to the display area of the chart and the user's visual habits. For example, the most important data category can be placed in the center or the most prominent position of the chart. These refinement steps can be adjusted according to the actual data characteristics and user needs to achieve the best chart display effect.
[0054] In some embodiments, in the step of optimizing the initial structure of the generated chart and the basic element layout according to the data content characteristics in step four, if the data content characteristics include a large data value range, the scale of the coordinate axes is optimized. Let the minimum data value be min, the maximum value be max, and the number of scales be m, then the scale interval
[0055] It should be noted that after generating the initial structure of the chart and the basic element layout, this method will optimize the chart according to the data content characteristics. Here, the data content characteristics refer to specific attributes in the data set, such as the distribution, extreme values, categories, etc. of the data, and optimization means adjusting certain parameters of the chart to improve the readability of the chart and the accuracy of expressing the data. Optimizing the scale of the coordinate axes is a key step, which involves adjusting the scale interval on the coordinate axes to better display the range and changes of the data.
[0056] Specifically, when optimizing the scale of the coordinate axes, the minimum and maximum values of the data values, as well as the number of scales that the user hopes to display on the coordinate axes, need to be considered. For example, if the minimum data value is 10, the maximum value is 100, and the user hopes to have 5 scales, then the scale interval can be set to (100 - 10) / 5 = 18. Such a setting can ensure that the scales on the coordinate axes are evenly distributed, making the readings of the chart more intuitive. In addition, the appropriate number of scales can also be selected according to the data distribution to avoid the scales being too dense or sparse, which affects the readability of the chart.
[0057] Preferably, when optimizing the axis scale, an adaptive scale setting method can be adopted. For example, if the range of data values is very large, logarithmic scales can be used to display the data, which can better show the relative changes in the data. Additionally, if there are outliers or extreme points in the data, additional markers or annotations can be considered to be added on the axes to alert users to these special data points.
[0058] Furthermore, the labels and formats of the scales can also be adjusted according to the purpose of the chart and the target audience to make them more in line with the reading habits of users. These optimization steps can be adjusted according to the actual data characteristics and user requirements to achieve the best chart display effect.
[0059] In some embodiments, in the step of drawing chart elements according to the calculated coordinates and sizes in step six, the drawing function calls different drawing sub-functions according to the element type. If the element is a line, let the starting coordinate of the line be (x1, y1) and the ending coordinate be (x2, y2), then the formula for drawing the line is
[0060]
[0061] If the element is a rectangle, let the upper left corner coordinate be (x, y), the width be w, and the height be h, then the formula for drawing the rectangle is x ≤ X ≤ x + w and y ≤ Y ≤ y + h ((X, Y) is the coordinate of a point inside the rectangle).
[0062] It should be noted that when this method draws chart elements according to the calculated coordinates and sizes, different drawing sub-functions will be called according to the type of the element. Here, the drawing sub-function refers to a function specifically used to draw a specific type of chart element, such as a line, a rectangle, etc. These functions can accurately draw the corresponding elements in the chart according to the provided coordinate and size parameters. The type of the element determines the drawing method and the required parameters. For example, a line requires the starting and ending coordinates, while a rectangle requires the upper left corner coordinate, width, and height.
[0063] Specifically, when drawing a line, the starting coordinate and the ending coordinate of the line need to be set, and these two coordinates define the position and direction of the line in the chart. The formula for drawing the line can be calculated according to the starting coordinate (x1, y1) and the ending coordinate (x2, y2) to ensure that the line can accurately extend from one point to another point.
[0064] More specifically, for the drawing of a rectangle, in addition to the upper left corner coordinate (x, y), the width and height of the rectangle also need to be determined. These parameters together determine the size and position of the rectangle in the chart. The formula for drawing the rectangle can ensure that each point (x', y') of the rectangle satisfies the condition of (x ≤ x' ≤ x + width) and (y ≤ y' ≤ y + height).
[0065] Preferably, when drawing chart elements, the drawing process can be further refined. For example, the visual effect can be enhanced by setting the thickness, color, or style of the lines. For rectangles, in addition to basic drawing, borders, shadows, or fill colors can be added to improve the readability and aesthetics of the chart.
[0066] Furthermore, the drawing order of the elements can be adjusted according to the purpose of the chart and the target audience to ensure that important elements are prominently displayed. In some cases, animations or interactive elements can also be used to enhance the dynamic effect of the chart, enabling users to more intuitively understand and analyze the data. These refinement steps can be adjusted according to the actual data characteristics and user needs to achieve the best chart display effect.
[0067] In some embodiments, in the step of quality assessment of the generated chart in step seven, the clarity C is measured by calculating the sharpness E of the edges of the elements in the chart. Let the edge pixel change rate be r, then E = ∑r. The rationality of element layout LR is measured by calculating the compliance degree of the average distance D between elements and the preset reasonable distance range [d min , d max . If d min ≤D≤d max , then the LR score is high. The accuracy of data expression DA is measured by calculating the error rate e between the data value and the chart display value. Let the true data value be v and the chart display value be v ′ . Then
[0068] It should be noted that after the chart is generated by this method, quality assessment will be carried out to ensure the clarity of the chart, the rationality of element layout, and the accuracy of data expression. The quality assessment here refers to the process of comprehensively evaluating three key aspects of the generated chart. Clarity refers to the sharpness of the edges of the elements in the chart. The rationality of element layout involves the spatial distribution between various elements in the chart, and the accuracy of data expression refers to the consistency between the data shown in the chart and the actual data. Through this assessment, it can be ensured that the finally output chart is both beautiful and accurate.
[0069] Specifically, when conducting quality assessment, clarity can be measured by calculating the sharpness of the edges of the elements in the chart, which involves the calculation of pixel change rate. The rationality of element layout is measured by calculating the compliance degree of the average distance between elements and the preset reasonable distance range. If the average distance falls within the preset reasonable range, the layout rationality score is higher. The accuracy of data expression is measured by calculating the error rate between the data value and the chart display value. The lower the error rate, the higher the accuracy of data expression. The settings of these assessment parameters can be adjusted according to the specific type of the chart and the user's needs to ensure the accuracy and applicability of the assessment results.
[0070] Preferably, during the quality assessment process, a more refined algorithm can be adopted to calculate the clarity of the chart. For example, an edge detection algorithm can be used to identify and enhance the edges of the elements in the chart. For the rationality of the element layout, a machine learning model can be introduced to predict and adjust the optimal distance between elements to achieve a better visual effect. In terms of the accuracy of data expression, more complex statistical methods can be adopted to analyze the relationship between the data values and the chart display values to ensure the accurate transmission of data.
[0071] Furthermore, a user feedback mechanism can be introduced to involve users in the quality assessment process and further optimize the chart generation process according to the users' feedback. These refined steps can be adjusted according to the actual data characteristics and user requirements to achieve the best chart display effect.
[0072] In some embodiments, before step eight, the chart is compressed. Let the original data size of the chart be S1 and the compressed data size be S2, and the compression ratio Adopt a compression algorithm to make Z meet the preset range.
[0073] It should be noted that before outputting the final chart, this method will compress the chart. The compression process here refers to using a specific algorithm to reduce the size of the chart file for easy storage and transmission. The compression ratio is an important parameter to measure the compression effect, which represents the ratio of the compressed file size to the original file size. Through the compression process, the volume of the chart file can be reduced without significantly reducing the chart quality, improving the loading speed and transmission efficiency of the chart.
[0074] Specifically, when compressing the chart, multiple compression algorithms can be selected, such as JPEG, PNG, GIF, etc. These algorithms remove redundant information in the file in different ways to achieve the purpose of compression. For example, the JPEG algorithm is suitable for compressing continuous-tone images, while the PNG algorithm is more suitable for compressing images containing a large amount of text and lines. When setting the compression parameters, it is necessary to balance the compression ratio and the chart quality to ensure that the compressed chart is still clearly readable. The setting of the compression ratio can be determined according to the use of the chart and the transmission environment. For example, for web charts that need to be loaded quickly, a higher compression ratio can be set; while for printed charts that require high precision, a lower compression ratio can be set to maintain the details of the chart.
[0075] Preferably, when compressing chart files, adaptive compression technology can be adopted to automatically select the most suitable compression algorithm and parameters according to the content and characteristics of the chart. For example, for charts containing a large amount of text and symbols, the PNG format can be selected to maintain the clarity of the text; while for charts mainly containing images and gradient colors, the JPEG format can be selected to obtain a higher compression ratio.
[0076] Furthermore, lossless compression and lossy compression technologies can be combined to perform differential compression processing on different parts of the chart to achieve the best compression effect. In practical applications, different compression options can also be provided according to the needs and preferences of users, allowing users to choose the compression ratio and compression algorithm themselves to meet different usage scenarios. These optimization measures can ensure that while maintaining the quality of the chart, the file size is minimized to the greatest extent, improving the practicality and convenience of the chart.
[0077] In some embodiments, in step seven, when the quality score S does not meet the requirements and returns to step three for regeneration, the number of times N of each regeneration is recorded. If N > N max (N max is the preset maximum number of regenerations), the user is prompted to check the input data.
[0078] It should be noted that in the quality assessment stage of this method, if the quality score of the generated chart does not meet the preset threshold, that is, the clarity, rationality of element layout, and accuracy of data expression of the chart do not reach the expected standard, the system will record the number of times of each regeneration and prompt the user to check the input data after reaching the preset maximum number of regenerations. Here, the quality score is a comprehensive score that reflects the overall quality of the chart, and the preset threshold and the preset maximum number of regenerations are parameters preset in the system to control the quality and efficiency of the chart generation process.
[0079] Specifically, the calculation of the quality score involves the scoring of three aspects: the clarity of the chart, the rationality of element layout, and the accuracy of data expression. Clarity can be measured by calculating the sharpness of the edges of the elements in the chart. The rationality of element layout is measured by calculating the degree of compliance between the average distance between elements and the preset reasonable distance range. The accuracy of data expression is measured by calculating the error rate between the data value and the displayed value of the chart.
[0080] More specifically, the preset threshold can be a value between 0 and 1, such as 0.8, indicating that the quality score of the chart needs to reach more than 80% to be qualified. The preset maximum number of regenerations is an integer, such as 5, indicating that the system will try to regenerate the chart up to 5 times. If the preset threshold cannot be reached after 5 times, the user is prompted to check the input data.
[0081] Preferably, during the process of regenerating the chart, the system can adopt different strategies to improve the quality score of the chart. For example, it can adjust the layout parameters of the chart, such as the spacing between elements, the size of the chart, etc., to improve the rationality of the element layout. It can also optimize the visual effect of the chart, such as adjusting the color contrast, adding legends and labels, etc., to improve the clarity of the chart. For the accuracy of data expression, it can re-check the steps of data processing and conversion to ensure the accuracy and integrity of the data.
[0082] Furthermore, the system can also introduce a user feedback mechanism to allow users to participate in the process of chart quality evaluation and further optimize the chart generation process according to the users' feedback. These strategies can be adjusted according to the actual data characteristics and user needs to achieve the best chart display effect. If the expected quality still cannot be achieved after multiple attempts, the system can prompt the user to check the accuracy of the input data or provide professional data cleaning and preprocessing services to help the user improve the data quality.
[0083] The above-mentioned various embodiments of the present invention have the following beneficial effects: The method for automatically generating charts using a large model according to the present invention can improve the automation degree of chart generation, reduce manual intervention, and thus improve the efficiency of generating charts. Users only need to provide data information and the target chart type, and the large model can automatically process the data and generate the initial structure and basic element layout of the chart, which can not only save users' time but also reduce the dependence on professional skills, enabling non-professionals to easily achieve the visual expression of data. By implementing the various steps of the method described herein, the axis scale can be optimized to ensure the precise drawing of chart elements, and the chart can be comprehensively evaluated through a quality assessment mechanism to ensure the quality of the chart. In addition, the compression process can reduce the size of the chart file, improve the loading speed and transmission efficiency of the chart, and optimize the user experience. The handling of these details makes the entire chart generation process more precise and efficient, meeting the high requirements of different users for chart quality.
[0084] As Figure 2 shown, a system 200 for automatically generating charts using a large model according to some embodiments, the system 200 includes:
[0085] A data acquisition module 201, configured to execute step one in claim 1;
[0086] A large model processing module 202, configured to execute step three and step four in claim 1;
[0087] A chart calculation module 203, configured to execute step five in claim 1;
[0088] A chart drawing module 204, configured to execute step six in claim 1;
[0089] A quality assessment module 205 for performing step seven in claim 1;
[0090] An output module 206 for performing step eight in claim 1.
[0091] It can be understood that the various modules described in the system 200 for automatically generating charts using a large model correspond to the respective steps in the method for automatically generating charts using a large model described in the reference. Figure 1 Therefore, the operations, features, and beneficial effects described above for the method for automatically generating charts using a large model also apply to the system 200 for automatically generating charts using a large model and the modules included therein, and will not be elaborated here.
[0092] Next, refer to Figure 3 , which shows a schematic structural diagram of the structure 300 of an electronic device suitable for implementing some embodiments of the present invention. The electronic device in some embodiments of the present invention may include, but is not limited to, mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Tablet Computers), PMPs (Portable Multimedia Players), in-vehicle terminals (such as in-vehicle navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 3 The terminal device shown is merely an example and should not impose any limitations on the functions and usage scope of the embodiments of the present invention.
[0093] As Figure 3 shown, the electronic device 300 may include a processing device (such as a central processing unit, a graphics processing unit, etc.) 301, which may perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 302 or a program loaded from a storage device 308 into a random access memory (RAM) 303. In the RAM 303, various programs and data required for the operation of the electronic device 300 are also stored. The processing device 301, the ROM 302, and the RAM 303 are connected to each other through a bus 304. An input / output (I / O) interface 305 is also connected to the bus 304.
[0094] Generally, the following devices may be connected to the I / O interface 305: an input device 306 including, for example, a touch screen, a touchpad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 307 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 308 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 309. The communication device 309 may allow the electronic device 300 to communicate with other devices wirelessly or wiredly to exchange data. Although Figure 3An electronic device 300 with various devices is shown, but it should be understood that it is not required to implement or have all the shown devices. Instead, more or fewer devices may be implemented or had. Figure 3 Each block shown in Figure 3 may represent a device or, as needed, multiple devices.
[0095] Furthermore, the storage medium of the embodiments of the present application stores program instructions capable of implementing all the above methods. Among them, the program instructions may be stored in the above storage medium in the form of a software product, including several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) or a processor to execute all or part of the steps of the methods described in the various embodiments of the present application. The foregoing storage medium includes: various media capable of storing program codes such as a USB flash drive, a mobile hard disk, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), a magnetic disk, or an optical disc, or a terminal device such as a computer, a server, a mobile phone, or a tablet.
[0096] The above description is only some preferred embodiments of the present invention and an explanation of the applied technical principles. Those skilled in the art should understand that the scope of the invention involved in the embodiments of the present invention is not limited to the technical solutions formed by the specific combination of the above technical features, and should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above inventive concept. For example, the technical solutions formed by mutually replacing the above features with the (but not limited to) technical features having similar functions disclosed in the embodiments of the present invention.
Claims
1. A method for automatically generating charts using large models, characterized in that, It includes the following steps: Step 1: Obtain the data information input by the user, where the data information includes data type, data volume, data content characteristics, and target chart type; Step 2: Input the obtained user input data information into a large model, where the large model is a pre-trained neural network model capable of processing chart generation tasks; Step 3: The large model generates the initial structure and basic element layout of the chart based on the input data information, specifically: The large model determines the basic architecture of the chart according to the data type and target chart type, and determines the basic element layout according to the data volume and data content characteristics; Step 4: Optimize the generated initial structure and basic element layout of the chart according to the data content characteristics; Step 5: Calculate the coordinates and dimensions of the chart elements based on the optimized architecture and layout. When calculating the coordinates, assume the width of the chart is W and the relative position ratio of the element in the horizontal direction is p x , then the x-coordinate of the element. Assume the height of the chart is H and the relative position ratio of the element in the vertical direction is p y , then the y-coordinate of the element. Assume the total layout width is TW and the space occupancy ratio of the element in the horizontal direction is s w , then the width of the element. Assume the total layout height is TH and the space occupancy ratio of the element in the vertical direction is s h , then the height of the element; Step 6: Draw chart elements according to the calculated coordinates and sizes; Step 7: Perform quality assessment on the generated chart, and evaluate it from three aspects: chart clarity C, element layout rationality LR, and data expression accuracy DA. If the quality score S < T, then return to Step 3 for regeneration; where T is a preset threshold; Step 8: Output the final chart.
2. The method for automatically generating a chart using a large model according to claim 1, wherein In the step of obtaining the data information input by the user in Step 1, the data input by the user is subjected to format check and preprocessing. If the data format does not meet the requirements, it is converted according to the preset format conversion rules. Let the original data format parameters be F1, F2, …, F n , and the preset format parameters be P1, P2, …, P n . If F i ≠P i , where i = 1, 2, …, n, then F i is converted to P i .
3. The method for automatically generating a chart using a large model according to claim 1, characterized in that, In the step of generating the initial structure and basic element layout of the chart by the large model according to the input data information in Step 3, if the data type is time series data and the target chart type is a line chart, the basic architecture includes a time axis and a data value axis; if the data type is categorical data and the target chart type is a bar chart, the basic architecture includes a category axis and a numerical axis. Let the data type parameter be D t , and the target chart type parameter be T t . When D t is time series and T t is a line chart, the architecture parameter A = 1, representing the architecture with a time axis and a data value axis. When D t is categorical data and T t is a bar chart, the architecture parameter A = 2, representing the architecture with a category axis and a numerical axis.
4. The method for automatically generating charts using a large model according to claim 1, wherein In the step of determining the basic element layout according to the data volume and data content characteristics in step three, assume that the number of different data categories in the data content characteristics is n, the data volume is V, and the data volume of the i-th data category is V i , then the proportion of the layout space of the elements of the i-th data category.
5. The method for automatically generating a chart using a large model according to claim 1, characterized in that, In the step of optimizing the generated initial structure and basic element layout of the chart according to the data content characteristics in Step 4, if the data content characteristics include a large data value range, then optimize the axis scale. Let the minimum data value be min, the maximum value be max, and the number of scales be m, then the scale interval.
6. The method for automatically generating a chart using a large model according to claim 1, characterized in that, In the step of drawing chart elements according to the calculated coordinates and sizes in Step 6, the drawing function calls different drawing sub-functions according to the element type. If the element is a line, let the starting coordinate of the line be (x₁, y₁) and the ending coordinate be (x₂, y₂).
7. The method for automatically generating a chart using a large model according to claim 1, wherein In the step of quality assessment of the generated chart in Step 7, the clarity C is measured by calculating the sharpness E of the edges of the elements in the chart. Let the edge pixel change rate be r. The rationality of element layout LR is measured by calculating the degree of compliance of the average distance D between elements with the preset reasonable distance range [d min , d max . If d min ≤D≤d max , then the LR score is high. The accuracy of data expression DA is measured by calculating the error rate e between the data value and the chart display value. Let the true data value be v and the chart display value be v ′ .
8. The method for automatically generating charts using a large model according to claim 1, wherein Before Step 8, perform compression processing on the chart. Let the original data size of the chart be S₁ and the compressed data size be S₂, and use a compression algorithm to make Z satisfy a preset range.
9. The method for automatically generating a chart using a large model according to claim 1, wherein In step seven, if the quality score S does not meet the requirements and returns to step three for regeneration, record the number of times N of each regeneration. If N > N max , then prompt the user to check the input data; where N max is the preset maximum number of regenerations.
10. The system for automatically generating charts using a large model according to claim 9, wherein The data acquisition module transmits the data information input by the user to the large model processing module for generating the initial structure and layout of the chart; after optimizing the generated initial structure and layout, the large model processing module transmits it to the chart calculation module for calculating the coordinates and sizes of chart elements; after the chart calculation module completes the calculation of the coordinates and sizes of the elements, it transmits the results to the chart drawing module for drawing chart elements; after the chart drawing module generates a preliminary chart, it hands it over to the quality assessment module to evaluate the clarity, layout rationality, and data expression accuracy of the chart; the quality assessment module determines whether to output the final chart according to the assessment results, and transmits the chart that passes the assessment to the output module for display; if it fails, it feeds back to the large model processing module for regeneration.
Citation Information
Patent Citations
Chart layout mode generation method and device and electronic equipment
CN114625941A
ECharts-based data visualization chart customizing method
CN116501316A