Method and apparatus for generating chart, device, and storage medium
By using machine learning to identify the target function block from multiple drawing function blocks and generating chart drawing instructions, the problem of high usage threshold in existing chart generation applications is solved, and a user-friendly experience for diverse chart generation and editing is achieved.
Patent Information
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- BEIJING ZITIAO NETWORK TECH CO LTD
- Filing Date
- 2024-10-30
- Publication Date
- 2026-05-07
AI Technical Summary
Existing chart generation applications require users to write code manually, resulting in a high barrier to entry and an inability to support different types and styles of charts and different types of data sources, thus failing to meet the diverse needs of users.
By using machine learning-based methods, the target drawing function block is determined from multiple drawing function blocks, chart drawing instructions are generated, multiple types of chart generation are supported, and multi-level headers are used to process the data source to generate the target chart.
It enables the generation of diverse and complex charts using natural language without requiring programming skills, lowering the barrier to chart creation. It supports the generation of various chart types to meet users' diverse data visualization needs, and also supports real-time chart rendering and editing.
Smart Images

Figure CN2024128668_07052026_PF_FP_ABST
Abstract
Description
Methods, apparatus, devices, and storage media for chart generation Technical Field
[0001] The exemplary embodiments disclosed herein relate generally to the field of computers, and in particular to methods, apparatus, devices, and computer-readable storage media for generating charts. Background Technology
[0002] With the development of information technology, various terminal devices can provide people with a variety of services in work and life. Applications providing these services can be deployed on these terminal devices. The terminal devices present relevant content and interact with users through the application's user interface, meeting various user needs. For example, in a chart generation scenario, the terminal device or application can generate corresponding charts based on user requirements to provide data support for the user.
[0003] Summary of the Invention
[0004] In a first aspect of this disclosure, a chart generation method is provided. The method includes: determining a target drawing function block from a plurality of drawing function blocks based on a first user input instructing a chart drawing task, the drawing function blocks being configured to generate a chart of a predetermined type; generating chart drawing instructions executable by the target drawing function block based on the first user input and target data related to the first user input, the target data being determined based on a data source indicated by the first user input, the data source including multi-level headers; and obtaining a target chart using the target drawing function block based on the target data and the chart drawing instructions.
[0005] In a second aspect of this disclosure, an apparatus for chart generation is provided. The apparatus includes: a determining module configured to determine a target drawing function block from a plurality of drawing function blocks based on a first user input instructing a chart drawing task, the drawing function blocks being configured to generate a chart of a predetermined type; a generating module configured to generate chart drawing instructions executable by the target drawing function block based on the first user input and target data related to the first user input, the target data being determined based on a data source indicated by the first user input, the data source including a multi-level header; and an obtaining module configured to obtain a target chart using the target drawing function block based on the target data and the chart drawing instructions.
[0006] In a third aspect of this disclosure, an electronic device is provided. The device includes at least one processing unit; and at least one memory coupled to the at least one processing unit and storing instructions for execution by the at least one processing unit. When executed by the at least one processing unit, the instructions cause the device to perform the method of the first aspect.
[0007] In a fourth aspect of this disclosure, a computer-readable storage medium is provided. The computer-readable storage medium stores a computer program that can be executed by a processor to implement the method of the first aspect.
[0008] It should be understood that the content described in this content section is not intended to limit the key or essential features of the embodiments of this disclosure, nor is it intended to restrict the scope of this disclosure. Other features of this disclosure will become readily apparent from the following description. Attached Figure Description
[0009] The above and other features, advantages, and aspects of the embodiments of this disclosure will become more apparent from the accompanying drawings and the following detailed description. In the drawings, the same or similar reference numerals denote the same or similar elements, wherein:
[0010] Figure 1 shows a schematic diagram of an example environment in which embodiments of the present disclosure may be implemented;
[0011] Figure 2 illustrates a schematic diagram of an example architecture for graph generation according to some embodiments of the present disclosure;
[0012] Figure 3 shows a schematic block diagram of an example process for generating a target chart according to some embodiments of the present disclosure;
[0013] Figure 4 shows a schematic diagram of an example architecture for selecting drawing function blocks according to some embodiments of the present disclosure;
[0014] Figure 5 illustrates a schematic diagram of an example architecture for generating and updating graphs according to some embodiments of the present disclosure;
[0015] Figure 6 illustrates a schematic diagram of an example architecture for rendering a chart according to some embodiments of the present disclosure;
[0016] Figure 7 shows a schematic diagram of an example interface for presenting a target chart according to some embodiments of the present disclosure;
[0017] Figure 8 shows a schematic diagram of an example interface for updating a chart according to some embodiments of the present disclosure;
[0018] Figure 9 illustrates a flowchart of an example process for generating diagrams according to some embodiments of the present disclosure;
[0019] Figure 10 shows a schematic structural block diagram of an example apparatus for graph generation according to some embodiments of the present disclosure; and
[0020] Figure 11 shows a block diagram of an electronic device capable of implementing several embodiments of the present disclosure. Detailed Implementation
[0021] Embodiments of this disclosure will now be described in more detail with reference to the accompanying drawings. While some embodiments of this disclosure are shown in the drawings, it should be understood that this disclosure can be implemented in various forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided to provide a more thorough and complete understanding of this disclosure. It should be understood that the accompanying drawings and embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of protection of this disclosure.
[0022] It should be noted that the headings of any section / subsection provided herein are not limiting. Various embodiments are described throughout this document, and embodiments of any type may be included under any section / subsection. Furthermore, embodiments described in any section / subsection may be combined in any way with any other embodiments described in the same section / subsection and / or different sections / subsections.
[0023] In the description of embodiments of this disclosure, the term "comprising" and similar terms should be understood as open-ended inclusion, i.e., "including but not limited to". The term "based on" should be understood as "at least partially based on". The term "one embodiment" or "the embodiment" should be understood as "at least one embodiment". The term "some embodiments" should be understood as "at least some embodiments". Other explicit and implicit definitions may also be included below. The terms "first", "second", etc., may refer to different or the same objects. Other explicit and implicit definitions may also be included below.
[0024] The embodiments of this disclosure may involve user data, data acquisition, and / or use. All of these aspects comply with applicable laws, regulations, and relevant provisions. In the embodiments of this disclosure, all data collection, acquisition, processing, manipulation, forwarding, and use are conducted with the user's knowledge and confirmation. Accordingly, in implementing the embodiments of this disclosure, the type, scope of use, and usage scenarios of any data or information that may be involved should be communicated to the user and their authorization obtained in accordance with relevant laws and regulations through appropriate means. The specific methods of notification and / or authorization may vary depending on the actual situation and application scenario, and the scope of this disclosure is not limited in this respect.
[0025] In this specification and the embodiments, any processing of personal information will be carried out only under the premise of legality (such as obtaining the consent of the personal information subject, or being necessary for the performance of a contract), and will only be carried out within the scope stipulated or agreed upon. A user's refusal to process personal information other than that necessary for basic functions will not affect the user's use of basic functions.
[0026] Example Environment
[0027] Figure 1 illustrates a schematic diagram of an example environment 100 in which embodiments of the present disclosure can be implemented. As shown in Figure 1, the example environment 100 may include an electronic device 110 and a server 120.
[0028] In this example environment 100, electronic device 110 may run an application 120 that supports chart generation. Application 120 may be any suitable type of application with chart generation capabilities. User 140 may interact with application 120 via electronic device 110 and / or its attached devices. In some embodiments, application 120 may provide or be configured with a digital assistant to interact with user 140.
[0029] In environment 100 of Figure 1, if application 120 is active, electronic device 110 can present interface 150 for supporting chart generation through application 120. Interface 150 may include, for example, a conversational interface between user 140 and a digital assistant. User 140 can issue chart drawing instructions to the digital assistant through the conversational interface, etc. Interface 150 can be used to present charts.
[0030] In some embodiments, electronic device 110 communicates with server 130 to provide services to application 120. Electronic device 110 can be any type of mobile terminal, fixed terminal, or portable terminal, including mobile phones, desktop computers, laptop computers, notebook computers, netbook computers, tablet computers, media computers, multimedia tablets, handheld computers, portable gaming terminals, VR / AR devices, personal communication system (PCS) devices, personal navigation devices, personal digital assistants (PDAs), audio / video players, digital cameras / camcorders, positioning devices, television receivers, radio receivers, e-book devices, gaming devices, or any combination thereof, including accessories and peripherals of these devices or any combination thereof. In some embodiments, electronic device 110 can also support any type of user-facing interface (such as "wearable" circuitry).
[0031] Server 130 can be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks, and big data and artificial intelligence platforms. Server 130 may include, for example, computing systems / servers such as mainframes, edge computing nodes, computing devices in a cloud environment, etc. Server 130 can provide backend services for application 120 in electronic device 110 that supports chart generation.
[0032] A communication connection can be established between server 130 and electronic device 110. This communication connection can be established via wired or wireless means. The communication connection may include, but is not limited to, Bluetooth, mobile network, Universal Serial Bus (USB), and Wireless Fidelity (WiFi) connections; the embodiments of this disclosure are not limited in this respect. In the embodiments of this disclosure, server 130 and electronic device 110 can achieve signaling interaction through the communication connection between them.
[0033] It should be understood that the structure and function of the various elements in environment 100 are described for illustrative purposes only and do not imply any limitation on the scope of this disclosure.
[0034] As mentioned above, chart generation applications can provide users with corresponding charts based on user-input chart generation commands (e.g., generating bar charts, generating flowcharts, etc.) and the data corresponding to those commands. One type of chart generation application can generate charts based on chart drawing code. However, this type of application requires users to manually write code, demanding a high level of programming ability and understanding of the application's API, resulting in a high barrier to entry and learning curve for users.
[0035] With the development of machine learning technology, machine learning-based chart generation applications have emerged. These applications can be implemented using Natural Language Processing (NLP) models and code generation techniques. They understand the user's chart generation instructions input in natural language through NLP models and generate chart generation code corresponding to the user's needs, thus creating the chart. However, currently, such chart generation applications can only draw specific types of charts and lack broad support for different types and styles of charts and different data sources, failing to meet the diverse needs of users.
[0036] Embodiments of this disclosure propose a scheme for chart generation. In this scheme, based on a first user input instructing a chart drawing task, a target drawing function block is determined from a plurality of drawing function blocks, which are configured to generate a chart of a predetermined type. Based on the first user input and target data related to the first user input, chart drawing instructions executable by the target drawing function block are generated. The target data is determined based on a data source indicated by the first user input, and the data source includes multi-level headers. Based on the target data and the chart drawing instructions, a target chart is obtained using the target drawing function block.
[0037] According to embodiments of this disclosure, multiple drawing function blocks are provided to the user, capable of drawing different types of charts. When the user specifies their chart drawing requirements, they can select a target drawing function block that matches their needs. Then, chart drawing instructions suitable for that target function block are generated, thereby generating the target chart. In this way, embodiments of this disclosure can generate different types of target charts based on user input, thus meeting diverse user needs. This provides better data support for users.
[0038] The following section provides a detailed description of various example implementations of this scheme, with reference to the accompanying drawings.
[0039] Example Architecture
[0040] Figure 2 illustrates a schematic diagram of an example architecture 200 for chart generation according to some embodiments of the present disclosure. As shown in Figure 2, architecture 200 can be implemented or included in the server 130 shown in Figure 1, or implemented across terminal devices and server 130. Architecture 200 includes a data preprocessing stage 230, a scheme generation stage 240, a chart drawing stage 250, and a chart modification stage 270.
[0041] In some embodiments, a target drawing function block 242 that meets the user's needs (i.e., corresponds to the first user input 210) can be determined from a plurality of drawing function blocks used for drawing charts based on a first user input 210 instructing the chart drawing task. The drawing function block is used to draw different types of charts (such as bar charts, flowcharts, line charts, pie charts, dynamic charts, interactive charts, etc.) according to provided chart drawing code. Different drawing function blocks can be used to draw different types of charts. The drawing function block can include a chart drawing tool and a program or script for calling the chart drawing tool. The chart drawing tool in the drawing function block can be a chart drawing tool pre-implemented in the server, or a chart drawing tool implemented in other servers or electronic devices. The server 130 can call the drawing function block by accessing other servers or electronic devices. If the drawing function block is implemented in the server 130, a runtime environment needs to be configured in the server 130 to enable the different drawing function blocks to function correctly. For example, the chart drawing tool can be various drawing tools implemented based on programming language libraries, such as matplotlib, graphviz, pyecharts, etc., which are based on Python libraries.
[0042] The first user input 210 can instruct a chart drawing task or chart drawing requirement. Additionally, instructions for the data source 211 can be received in association with the first user input 210. The first user input 210 can include voice input, text input, etc. User input can be natural language received at the interface. For example, the first user input 210 could be "Generate a bar chart based on the sales figures of product A in the last quarter," or "Generate a flowchart of a user's use of application B," etc. Optionally or additionally, the first user input 210 can instruct the user on the desired chart style (such as color, lines, etc.). For example, the first user input 210 could be "Draw a red bar chart." In some embodiments, the user can interact with the application through interface 150 to provide user input to the server. The user can also provide user input to the server through user input interface 220.
[0043] Due to limitations in users' expressive abilities, the content entered by users on the interface may be inaccurate or overly complex, making it impossible to accurately and quickly determine the drawing function block corresponding to the first user input 210. Therefore, in some embodiments, machine learning models (e.g., language models) can be used to process the first user input 210 (e.g., summarize and paraphrase) to accurately identify the user's needs.
[0044] In some embodiments, the server may utilize a first machine learning model 241 to determine the target drawing function block 242 corresponding to the first user input 210. The first machine learning model 241 is a model that is supervisedly fine-tuned using information related to the drawing function block. The server may generate prompt information based on the first user input 210 and provide the prompt information to the first machine learning model 241 to obtain the output of the first machine learning model 241. Subsequently, based on the output of the first machine learning model 241, the target drawing function block 242 corresponding to the first user input 210 is determined from a plurality of drawing function blocks.
[0045] Figure 3 illustrates a schematic block diagram of an example flow 300 for generating a target chart according to some embodiments of the present disclosure. As shown in Figure 3, the chart type 310 includes at least a first chart type 310-1, a second chart type 310-2, and a third chart type 310-3, which can be individually or collectively referred to as chart type 310. The drawing function block 320 corresponding to different chart types 310 includes at least a first drawing function block 320-1, a second drawing function block 320-2, and a third drawing function block 320-3, which can be individually or collectively referred to as drawing function block 320. As shown in Figure 3, the server can determine the target chart type 252 from the multiple chart types 310 based on the first user input 210 and information about the multiple chart types 310 using a first machine learning model 241. Subsequently, based on the correspondence between the multiple chart types 310 and the multiple drawing function blocks 320, the target drawing function block 242 corresponding to the target chart type 252 is determined. For example, if the first user input 210 is "generate bar chart", the first chart type 310 indicates "bar chart", and the first machine learning model 241 determines the first chart type 310 based on the first user input 210. Subsequently, based on the correspondence between chart type 310 and drawing function block 320, the first drawing function block 320-1 corresponding to the first chart type 310-1 is determined as the target drawing function block 242.
[0046] The number of chart types 310 and drawing function blocks 320 shown in Figure 3 are merely exemplary and are not intended to be any limitation. The correspondence between different chart types 310 and different drawing function blocks 320 can be pre-specified by the user or maintenance personnel, or can be learned by the first machine learning model 241 through historical chart drawing tasks, and is not limited here.
[0047] Figure 4 illustrates a schematic diagram of an example architecture 400 for selecting drawing function blocks according to some embodiments of the present disclosure. As shown in Figure 4, to improve the accuracy of the target drawing function blocks determined by the first machine learning model, supervised fine-tuning can be performed on the first machine learning model using first training data 410. Exemplarily, the first training data 410 may include one or more reference user inputs respectively indicating a graph drawing task, and reference responses corresponding to each reference user input (i.e., drawing function blocks 320 for processing the corresponding reference user input). Supervised fine-tuning is performed on the first machine learning model 241 by using one or more reference responses as ground truth values. Exemplarily, during the model training phase, the first machine learning model 241 can be used to determine the training response corresponding to each reference user input (i.e., the drawing function blocks 320 determined by the first machine learning model 241 for processing the corresponding reference user input). Subsequently, the response difference between the reference response and the training response corresponding to each reference user input is determined. Based on the response differences corresponding to each reference user input, the first machine learning model 241 is fine-tuned. During the model application phase, the finely tuned first machine learning model 241 is used to generate a target drawing function block 242 corresponding to the first user input 210 and the data source 211.
[0048] Referring again to Figure 2. In some embodiments, the server can generate a chart drawing instruction 251 executable by the target drawing function block 242 based on the first user input 210 and target data 232 related to the first user input 210. That is, the chart drawing instruction 251 is applicable to the target drawing function block 242.
[0049] In some embodiments, the target data 232 can be determined based on the data source 211 indicated by the user. For example, if the first user input 210 is "Generate a bar chart based on data table C", then the target data 232 corresponding to the first user input 210 is determined based on the data source 211 "data table C". Alternatively or additionally, the user can upload or specify the data source 211 before or after providing the first user input 210. Alternatively or additionally, the target data 232 can be determined based on the first user input 210. The first user input 210 specifies the data source 211 used to determine the target data 232 by specifying a data storage area or data range, and the server can use a machine learning model or database to determine the data source 211. Subsequently, the target data 232 is determined based on the determined data source 211. For example, if the first user input 210 is "Generate a bar chart based on the operating data in document D", then "the operating data in document D" is the data source 211 corresponding to the first user input 210. The first user input 210 can be "Draw a character relationship diagram based on the content of book E", then "the content of book E" is the data source 211 corresponding to the first user input 210.
[0050] The server can determine the target data by reading data from the data source. Since different data sources contain different data types, it is necessary to select a data reading method corresponding to the data source to ensure correct data reading. Therefore, in some embodiments, upon receiving an instruction from the data source 211 corresponding to the first user input 210, the data reading mode for reading the data source 211 can be determined based on the type of the data source 211. Subsequently, based on the data reading mode, the initial data 231 in the data source 211 is read. For example, the type of the data source 211 can be determined based on whether several (e.g., the first five) data items in the data source 211 are standard data, thereby determining the data reading mode.
[0051] In some embodiments, the server can generate corresponding data reading instructions (e.g., data reading code or script) based on a defined data reading pattern. The data reading instructions are then used to read initial data 231 from data source 211. For example, the data reading instructions may be pre-saved or generated by the server using a machine learning model. The read initial data may contain some invalid data (e.g., incomplete or duplicate data), affecting the quality of the generated chart. Therefore, in some embodiments, the read initial data 231 may be preprocessed (e.g., deleting invalid data from the initial data 231, performing grouping aggregation on the initial data 231, etc.) to determine the target data 232.
[0052] In some embodiments, the data source can be a data table. The data table may include a header and data items. The header indicates the top row of the data table (e.g., column names or headings) and can be used to describe the content of each column of data. During the process of reading data from the data table, to improve the accuracy of data extraction, the server can generate corresponding data read instructions based on the header data. The data read instructions are executable to determine the corresponding initial data based on the position of the data to be read in the data table and the data format. For example, the data read instruction instructs the reading of numeric data from the second row and third column of the data table. The server first determines the position and type of the data to be read in the data table based on the header. Subsequently, it generates data read instructions based on the position and type of the data to be read. In some embodiments, the server can utilize a machine learning model to generate data read instructions. It should be noted that this application uses a data table where the header is at the top of the data table (i.e., the first row of the data table is the header) as an example for illustration. If the header of the data table is located on the side of the data table (i.e., the first column of the data table is the header), a transpose operation can be performed on the data table to obtain a standard data table (the first row of the standard data table is column names, and the other rows are data). Subsequently, the initial data is read based on the data read command.
[0053] In some embodiments, a data table may contain multi-level headers. To accurately obtain header information, a machine learning model can be used to convert multiple data units corresponding to the multi-level headers into single-level header formats based on the multi-level header structure. For a specific target data unit, the server, based on the multi-level header structure, determines the field names of the lowest-level header corresponding to the target data unit and the corresponding field names of the higher-level headers above the lowest-level header. Subsequently, based on the field names of the lowest-level header and the corresponding field names of the higher-level headers, the converted field names of the target data unit are determined. For example, the converted field names of the target data unit can be determined by concatenation. For instance, a data table is used to represent sales data of different companies at different times. The first-level header represents the company name, Company A. The second-level header represents the time, including January, February, and March. Accordingly, the converted field names of the target data unit are Company A-January, Company A-February, and Company A-March. In some embodiments, the transformed field names of the target data units can be generated based on the semantic information indicated by the field names of the lowest-level header and the corresponding semantic information indicated by the field names of higher-level headers. In this way, when retrieving the data corresponding to the target data unit, the transformed field names can be used to accurately determine the contextual information of the target data. This further improves the accuracy of the generated target chart.
[0054] In some embodiments, there may be situations where the header of a target data unit in a data table cannot be determined (e.g., header information is missing, header information is distributed across multiple rows, etc.). To ensure the accuracy of the target data for a given target data unit, after reading the initial data, a machine learning model can be used to determine the transformed field names of the target data unit. For example, based on other header information in the data table, the data type in the target data unit, and the description information of the data table, a machine learning model can be used to generate the transformed field names of the target data unit.
[0055] In some embodiments, the data table may contain empty rows and columns (or useless data). To accurately obtain the initial data in the data table, the positions of the non-empty cells can be determined first. The initial data is then read based on the positions of the non-empty cells.
[0056] In some embodiments, in order for the initial data to be usable by the server, after reading the initial data corresponding to the target data unit, it is also necessary to update the index information of the initial data to generate the target data. In this way, the server can generate a target chart corresponding to the initial data.
[0057] In some embodiments, a machine learning model can be used to determine target data from a data source. The machine learning model can determine the data type of the data source (e.g., whether it includes multi-level headers, whether it includes blank rows, etc.) and generate corresponding data reading instructions (such as data reading code) to provide target data for the target drawing function block. To utilize such a machine learning model, an appropriate dataset can be constructed first to train the model. For example, a dataset can be constructed using different types of complex tables and corresponding processing code. The machine learning model can then be trained using such a dataset.
[0058] Chart drawing instruction 251 is an instruction for drawing function block 320 to generate target chart 252. The type of chart drawing instruction 251 corresponds to the type of drawing function block 320 to ensure that chart drawing instruction 251 can be executed by drawing function block 320. For example, if drawing function block 320 is a chart drawing tool implemented in Python, then chart drawing instruction 251 is the corresponding Python drawing code. The server can call the corresponding chart drawing tool to generate target chart 252 by executing the Python drawing code. For example, chart drawing instruction 251 can be an instruction generated using a second machine learning model. The first machine learning model 241 and the second machine learning model can be the same model (e.g., the first machine learning model 241 and the second machine learning model can be the same language model) or different models; this is not limited here.
[0059] Chart drawing instructions directly affect the quality of the target chart. To improve the quality of the target chart, the correctness of the chart drawing instructions must be ensured. Therefore, in some embodiments, a second machine learning model can be supervisedly fine-tuned using second training data including reference user inputs and reference drawing instructions. Figure 5 illustrates a schematic diagram of an example architecture 500 for generating and updating charts according to some embodiments of this disclosure. As shown in Figure 5, during the training phase, the server first determines second training data 510. The second training data 510 includes at least a plurality of reference user inputs respectively instructing the chart drawing task and a reference chart corresponding to each reference user input, and a reference drawing instruction corresponding to each reference user input. Subsequently, the second machine learning model 520 is fine-tuned using the second training data 510.
[0060] Continuing with Figure 2. In some embodiments, the server obtains a target chart 252 using a target drawing function block 242 based on target data 232 and chart drawing instructions 251. The server provides the chart drawing instructions 251 to the target drawing function block 242, causing the target drawing function block 242 to execute the chart drawing instructions 251, and then obtains the target image based on the output of the target drawing function block 242. To ensure the normal operation of the target drawing function block 242, an execution environment required for the chart drawing tool to run can be created. For example, the execution environment can be a code executor configured with multiple drawing function blocks 320 (e.g., in a sandbox). The server can provide the chart drawing instructions 251 and target data 232 to the code executor to execute the chart drawing instructions 251, thereby generating the target chart 252 in the execution environment. Subsequently, the server obtains the target chart 252 from the execution environment.
[0061] The target chart 252 needs to be rendered before being presented to the user. As shown in Figure 3, during the chart rendering stage 340, different rendering styles 341 can be used to render the target chart 252. For example, at least a first rendering style 341-1, a second rendering style 341-2, and a third rendering style 341-3 are included, which can be individually or collectively referred to as rendering styles 341. The number of rendering styles 341 shown in Figure 3 is merely exemplary and is not intended to be a limitation. The server can determine the rendering style 341 used to render the target chart 252 based on the type of the target chart 252 (such as a static chart, a dynamic chart, and an interactive chart) according to a predetermined correspondence.
[0062] Figure 6 illustrates a schematic diagram of an example architecture 600 for rendering a chart according to some embodiments of the present disclosure. As shown in Figure 6, a rendering model 630 can be fine-tuned using third training data 610. Subsequently, the target chart 252 is rendered using the supervised fine-tuned rendering model 630 to present the target chart to the user. In some embodiments, the target chart 252 generated by the target drawing function block 242 can be stored as a file in a database (e.g., an object storage cloud service), and access information 620 of the stored file can be sent to the rendering model 630. The rendering model 630 obtains the access information 620 for accessing the stored file of the target chart 252. Subsequently, based on the access information 620 and the type of the target chart 252, a target rendering style 650 represented in a markup language (e.g., markdown) for the target chart 252 is generated.
[0063] For example, if the target chart 252 is a static chart, the static chart file (e.g., a PNG file) generated by the execution environment will be stored in the cloud. Simultaneously, access information 620 (e.g., a URL link) for this static chart file will be provided to the rendering model 630. The rendering model 630 will then generate a target rendering style 650 in Markdown format based on the access information 620. If the target chart 252 is a dynamic chart, the dynamic chart file (e.g., an HTML file) generated by the execution environment will be stored in the cloud. Simultaneously, access information 620 (e.g., a URL link) for this dynamic chart file will be provided to the rendering model 630. The rendering model 630 will then generate a target rendering style 650 in Markdown format based on the access information 620.
[0064] The server renders the target chart 252 according to the target rendering style 650 as at least part of the response 530 to the first user input. The response 530 to the first user input may include the target chart 252 and the first user input 210, the data source 211 corresponding to the first user input 210, the chart drawing instruction 251, and / or a reply message to the first user input 210 (e.g., "Chart generated" or an analysis summary 271 for the target chart 252), etc.
[0065] In some embodiments, the target chart 252 generated by the server may not meet the user's needs, or the user's needs may change. Therefore, the generated target chart 252 needs to be modified. As shown in Figures 2 and / or 5, the second machine learning model 520 generates a chart drawing instruction 251 based on the provided first user input 210 and target data 232. Subsequently, the chart drawing instruction 251 is executed through the target drawing function block 242 to generate the target chart 252. The target chart 252 is presented to the user as at least part of the response 530 to the first user input, and a second user input 261 is obtained from the user regarding the target chart 252. For example, the second user input 261 may indicate the user's evaluation of the target chart 252, or indicate an adjustment instruction for the target chart 252. If the second user output indicates adjustment of the target chart 252, the chart drawing instruction 251 is updated based on the second user input 261 and the chart drawing instruction 251. The target chart 252 is modified according to the updated chart drawing instruction 262 to generate an updated chart 270 for the target chart 252. If there are multiple rounds of modification, the chart drawing instruction 251 corresponding to the current round is updated based on all the preceding information in each round.
[0066] In some embodiments, a target chart and an entry point for natural language input can be presented in different areas of the user interface. For example, the user can present the target chart, user instructions, application feedback information, etc., in different areas of the user interface to facilitate the user's viewing of the target chart. Figure 7 illustrates a schematic diagram of an example interface 700 for presenting a target chart according to some embodiments of the present disclosure. As shown in Figure 7, the interface 700 includes a dialogue area 710 and a chart presentation area 720. The dialogue area 710 is for the user to interact with an application (e.g., a provided digital assistant). The chart presentation area 720 is used to present the target chart 721.
[0067] In some embodiments, the target can be adjusted based on information received from interactive elements and / or entry points in the target chart 721. Figure 8 illustrates a schematic diagram of an example interface 800 for updating a chart according to some embodiments of the present disclosure. As shown in Figure 8, the dialogue area 710 includes an entry point 810 for natural language input. The chart presentation area 720 includes a chart update entry point 820. Adjustment instructions for the target chart 721 can be received through interactive elements (e.g., chart update entry point 820) or entry point 810 included in the target chart 721. Subsequently, the presented target chart 721 can be updated based on the adjustment instructions.
[0068] As shown in Figure 8, in response to the icon update instruction provided by the user through the icon update entry 820, the target icon 721 is adjusted. Subsequently, the response to the user's operation is presented in text form in the dialog area 710. Simultaneously, the updated target icon 830 is presented in the icon presentation area 720. The server can also update the target icon based on the user command 811 entered by the user through entry 810. Subsequently, the response to the user's operation is presented in text form in the dialog area 710, and the updated target icon 840 is presented in the icon presentation area 720.
[0069] The above description, with reference to Figures 2 to 8, illustrates an example implementation of a chart generation scenario. As can be seen, in the embodiments of this disclosure, chart drawing instructions are generated through a target drawing function block corresponding to the user input among multiple drawing function blocks, thereby generating a target chart based on the first user input and target data. In this way, on the one hand, for natural language input instructing the chart drawing task, the user's intent can be accurately identified and the corresponding drawing function block determined, and chart drawing instructions generated and executed to generate the chart, thus meeting diverse user needs. On the other hand, the target chart can be adjusted based on the second user input, supporting complex chart modifications. Fine-grained style adjustments can be made to the generated chart through natural language. Furthermore, the chart can be rendered in real time, and different rendering styles can be determined according to the type of target chart, improving user experience and operational efficiency.
[0070] In this way, the embodiments of this disclosure enable users to generate diverse and complex charts using simple natural language descriptions without requiring programming skills, significantly lowering the barrier to chart creation. Furthermore, the embodiments of this disclosure support the generation of various chart types, simultaneously meeting diverse data visualization needs and are widely applicable to scenarios such as data analysis and report generation. In addition, the generated charts can be edited again using natural language, reducing modification costs.
[0071] Example process
[0072] Figure 9 illustrates a flowchart of an example process 900 generated from diagrams according to some embodiments of the present disclosure. Process 900 may be implemented at terminal device 110 and / or server 130. Process 900 is described below with reference to Figure 1. Process 900 is described below with respect to a server only as an example.
[0073] As shown in Figure 9, in box 910, the server determines the target drawing function block from multiple drawing function blocks based on the first user input indicating the chart drawing task. The drawing function blocks in the multiple drawing function blocks are configured to generate a chart of a predetermined type.
[0074] In some embodiments, determining a target drawing function block from a plurality of drawing function blocks includes: generating prompt information provided to a first machine learning model based on a first user input; and determining the target drawing function block corresponding to the first user input, wherein the first machine learning model is fine-tuned using information related to the plurality of drawing function blocks.
[0075] In some embodiments, the first machine learning model is fine-tuned by: acquiring first training data, the first training data including one or more reference user inputs respectively indicating a graph drawing task and one or more reference responses respectively corresponding to the one or more reference user inputs, the reference responses indicating drawing function blocks among a plurality of drawing function blocks for processing the corresponding reference user inputs; and performing supervised fine-tuning on the first machine learning model by taking the one or more reference responses as truth values.
[0076] In some embodiments, determining a target drawing function block from a plurality of drawing function blocks includes: determining a target chart style from a plurality of chart styles using a first machine learning model based on a first user input and information about a plurality of chart styles; and determining the target drawing function block based on the target chart style and according to the correspondence between the plurality of chart styles and the plurality of drawing function blocks.
[0077] In box 920, the server generates chart drawing instructions executable by the target drawing function block based on the first user input and the target data related to the first user input. The target data is determined based on the data source indicated by the first user input, and the data source includes multi-level headers.
[0078] In some embodiments, the target data is determined by: determining initial data related to the first user input from the data source based on the data source indicated by the first user input; in response to the initial data having a multi-level header, converting the multiple data units corresponding to the multi-level header into a single-level header format based on the structure of the multi-level header to process the initial data; and determining the target data based on the processed initial data.
[0079] In some embodiments, converting multiple data units corresponding to a multi-level header into a single-level header format includes: for a target data unit among the multiple data units, based on the structure of the multi-level header, determining the field names of the lowest-level header corresponding to the target data unit and the corresponding field names of one or more higher-level headers above the lowest-level header; and determining the converted field names of the target data unit based on the field names of the lowest-level header and the corresponding field names of one or more higher-level headers.
[0080] In some embodiments, generating a chart drawing instruction executable by the target drawing function block includes: generating a chart drawing instruction based on a first user input and target data using a second machine learning model, wherein the second machine learning model is fine-tuned by: determining second training data, the second training data including one or more reference user inputs respectively indicating the chart drawing task, one or more reference charts respectively corresponding to the one or more reference user inputs, and reference drawing instructions respectively corresponding to the one or more reference charts; and fine-tuning the second machine learning model using the second training data.
[0081] In box 930, the server obtains the target chart using the target drawing function block based on the target data and chart drawing instructions.
[0082] In some embodiments, obtaining a target chart using a target drawing function block includes: providing chart drawing instructions and target data to an execution environment configured with a target drawing function block to execute chart drawing instructions for the target data; and obtaining the target chart from the execution environment.
[0083] In some embodiments, process 900 further includes obtaining access information for accessing a storage file of a target chart; generating a target rendering style for the target chart in a markup language based on the access information and the type of the target chart; and presenting the target chart according to the target rendering style as at least part of a response to a first user input.
[0084] In some embodiments, process 900 further includes: presenting a target chart and an entry point for natural language input in different areas of the user interface; receiving an adjustment instruction for the target chart via at least one of the following: interactive elements or entry points included in the target chart; and updating the presented target chart based on the adjustment instruction.
[0085] In some embodiments, process 900 further includes receiving a second user input for a target chart, the second user input indicating adjustments to the target chart; updating the chart drawing instructions based on the second user input and the chart drawing instructions; and generating an updated chart for the target chart by executing the updated chart generation instructions.
[0086] Example devices and equipment
[0087] Embodiments of this disclosure also provide corresponding apparatus for implementing the methods or processes described above. FIG10 shows a schematic structural block diagram of an example apparatus 1000 for graph generation according to certain embodiments of this disclosure. Apparatus 1000 may be implemented as or included in server 130 or terminal device 110. The various modules / components in apparatus 1000 may be implemented by hardware, software, firmware, or any combination thereof.
[0088] As shown in Figure 10, the device 1000 includes a determining module 1010, configured to determine a target drawing function block from a plurality of drawing function blocks based on a first user input indicating a chart drawing task. The drawing function block among the plurality of drawing function blocks is configured to generate a chart of a predetermined type. The device 1000 also includes a generating module 1020, configured to generate chart drawing instructions executable by the target drawing function block based on the first user input and target data related to the first user input. The target data is determined based on a data source indicated by the first user input, and the data source includes multi-level headers. The device 1000 further includes an obtaining module 1030, configured to obtain a target chart using the target drawing function block based on the target data and the chart drawing instructions.
[0089] In some embodiments, the determining module 1010 is further configured to generate prompt information for the first machine learning model based on the first user input; and to determine the target drawing function block corresponding to the first user input, wherein the first machine learning model is fine-tuned using information related to multiple drawing function blocks.
[0090] In some embodiments, the determining module 1010 is further configured to acquire first training data, the first training data including one or more reference user inputs respectively indicating a chart drawing task and one or more reference responses respectively corresponding to the one or more reference user inputs, the reference responses indicating a drawing function block among a plurality of drawing function blocks for processing the corresponding reference user input; and to perform supervised fine-tuning on a first machine learning model by taking the one or more reference responses as truth values.
[0091] In some embodiments, the determining module 1010 is further configured to determine a target chart style from the multiple chart styles using a first machine learning model based on a first user input and information about multiple chart styles; and to determine a target drawing function block based on the target chart style and according to the correspondence between the multiple chart styles and multiple drawing function blocks.
[0092] In some embodiments, the generation module 1020 is further configured to generate chart drawing instructions based on the first user input and target data, using a second machine learning model, wherein the second machine learning model is fine-tuned by: determining second training data, the second training data including one or more reference user inputs respectively instructing the chart drawing task, one or more reference charts respectively corresponding to the one or more reference user inputs, and reference drawing instructions respectively corresponding to the one or more reference charts; and fine-tuning the second machine learning model using the second training data.
[0093] In some embodiments, the generation module 1020 is further configured to: determine initial data related to the first user input from the data source based on the data source indicated by the first user input; in response to the initial data having a multi-level header, convert the multiple data units corresponding to the multi-level header into a single-level header format based on the structure of the multi-level header to process the initial data; and determine target data based on the processed initial data.
[0094] In some embodiments, the generation module 1020 is further configured to, for a target data unit among a plurality of data units, determine, based on the structure of the multi-level header, the field name of the lowest-level header corresponding to the target data unit and the corresponding field name of one or more higher-level headers above the lowest-level header; and determine the transformed field name of the target data unit based on the field name of the lowest-level header and the corresponding field name of one or more higher-level headers.
[0095] In some embodiments, the obtaining module 1030 is further configured to provide chart drawing instructions and target data to an execution environment configured with a target drawing function block, so as to execute chart drawing instructions for the target data; and to obtain the target chart from the execution environment.
[0096] In some embodiments, the apparatus 1000 further includes a rendering module configured to obtain access information for accessing a storage file of a target chart; generate a target rendering style for the target chart in a markup language based on the access information and the type of the target chart; and render the target chart according to the target rendering style as at least part of a response to a first user input.
[0097] In some embodiments, the apparatus 1000 further includes an adjustment module configured to receive a second user input for a target chart, the second user input indicating an adjustment to the target chart; update a chart drawing instruction based on the second user input and a chart drawing instruction; and generate an updated chart for the target chart by executing the updated chart generation instruction.
[0098] In some embodiments, the device 1000 further includes a presentation module configured to present a target chart and an entry point for natural language input in different areas of a user interface; receive adjustment instructions for the target chart via at least one of the following: interactive elements or entry points included in the target chart; and update the presented target chart based on the adjustment instructions.
[0099] As shown in Figure 11, electronic device 1100 is in the form of a general-purpose electronic device. Components of electronic device 1100 may include, but are not limited to, one or more processors or processing units 1110, memory 1120, storage device 1130, one or more communication units 1140, one or more input devices 1190, and one or more output devices 1160. Processing unit 1110 may be a physical or virtual processor and is capable of performing various processes according to programs stored in memory 1120. In a multiprocessor system, multiple processing units execute computer-executable instructions in parallel to improve the parallel processing capability of electronic device 1100.
[0100] Electronic device 1100 typically includes multiple computer storage media. Such media can be any accessible media that is accessible to electronic device 1100, including but not limited to volatile and non-volatile media, removable and non-removable media. Memory 1120 can be volatile memory (e.g., registers, cache, random access memory (RAM)), non-volatile memory (e.g., read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory), or some combination thereof. Storage device 1130 can be removable or non-removable media and can include machine-readable media, such as flash drives, disks, or any other media that can be used to store information and / or data and can be accessed within electronic device 1100.
[0101] Electronic device 1100 may further include additional removable / non-removable, volatile / non-volatile storage media. Although not shown in FIG11, disk drives for reading or writing from removable, non-volatile disks (e.g., "floppy disks") and optical disk drives for reading or writing from removable, non-volatile optical disks may be provided. In these cases, each drive may be connected to a bus (not shown) via one or more data media interfaces. Memory 1120 may include computer program product 1125 having one or more program modules configured to perform various methods or actions of various embodiments of the present disclosure.
[0102] Communication unit 1140 enables communication with other electronic devices via a communication medium. Additionally, the functionality of components of electronic device 1100 can be implemented using a single computing cluster or multiple computing machines capable of communicating via communication connections. Therefore, electronic device 1100 can operate in a networked environment using logical connections to one or more other servers, network personal computers (PCs), or another network node.
[0103] Input device 1150 can be one or more input devices, such as a mouse, keyboard, trackball, etc. Output device 1160 can be one or more output devices, such as a monitor, speaker, printer, etc. Electronic device 1100 can also communicate with one or more external devices (not shown) via communication unit 1140 as needed. These external devices include storage devices, display devices, etc., and can communicate with one or more devices that enable user interaction with electronic device 1100, or with any device that enables electronic device 1100 to communicate with one or more other electronic devices (e.g., network card, modem, etc.). Such communication can be performed via input / output (I / O) interface (not shown).
[0104] According to an exemplary implementation of this disclosure, a computer-readable storage medium is provided that stores computer-executable instructions thereon, wherein the computer-executable instructions are executed by a processor to implement the methods described above. According to an exemplary implementation of this disclosure, a computer program product is also provided, which is tangibly stored on a non-transitory computer-readable medium and includes computer-executable instructions, which are executed by a processor to implement the methods described above.
[0105] Various aspects of this disclosure are described herein with reference to flowchart illustrations and / or block diagrams of methods, apparatuses, devices, and computer program products implemented according to 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.
[0106] These computer-readable program instructions can be provided to a processing unit 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 processing unit 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.
[0107] Computer-readable program instructions can 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 that execute 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.
[0108] 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 this disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of an instruction, which contains one or more executable instructions for implementing the specified logical function. In some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated 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, may 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.
[0109] Various implementations of this disclosure have been described above. These descriptions are exemplary and not exhaustive, nor are they limited to the disclosed implementations. Many modifications and variations will be apparent to those skilled in the art without departing from the scope and spirit of the described implementations. The terminology used herein is chosen to best explain the principles, practical applications, or improvements to technology in the market, or to enable others skilled in the art to understand the various implementations disclosed herein.
Claims
1. A chart generation method, comprising: Based on a first user input indicating a chart drawing task, a target drawing function block is determined from a plurality of drawing function blocks, the drawing function blocks being configured to generate a chart of a predetermined type; Based on the first user input and target data related to the first user input, an executable chart drawing instruction for the target drawing function block is generated. The target data is determined based on a data source indicated by the first user input, and the data source includes multi-level table headers; and Based on the target data and the chart drawing instructions, the target chart is obtained using the target drawing function block.
2. The method according to claim 1, wherein the target data is determined by: Based on the data source indicated by the first user input, determine the initial data related to the first user input from the data source; In response to the initial data having a multi-level header, based on the structure of the multi-level header, the multiple data units corresponding to the multi-level header are respectively converted into a single-level header format to process the initial data; and The target data is determined based on the processed initial data.
3. The method according to claim 2, wherein converting the plurality of data units corresponding to the multi-level header into the format of a single-level header comprises: For a target data unit among the plurality of data units, based on the structure of the multi-level header, the field names of the lowest-level header corresponding to the target data unit and the corresponding field names of one or more higher-level headers above the lowest-level header are determined from the multi-level header; and Based on the field names of the lowest-level header and the corresponding field names of the one or more higher-level headers, the transformed field names of the target data unit are determined.
4. The method of claim 1, wherein determining the target drawing function block from a plurality of drawing function blocks comprises: Based on the first user input, generate prompt information for the first machine learning model; as well as The target drawing function block corresponding to the first user input is determined, and the first machine learning model is fine-tuned using information related to the plurality of drawing function blocks.
5. The method of claim 4, wherein the first machine learning model is fine-tuned in the following manner: Acquire first training data, the first training data including one or more reference user inputs respectively indicating the chart drawing task and one or more reference responses respectively corresponding to the one or more reference user inputs, the reference responses indicating the drawing function blocks among the plurality of drawing function blocks used to process the corresponding reference user inputs; and Supervised fine-tuning is performed on the first machine learning model by using the one or more reference responses as truth values.
6. The method of claim 1, wherein determining the target drawing function block from a plurality of drawing function blocks comprises: Based on the first user input and information about multiple chart types, a first machine learning model is used to determine the target chart type from the multiple chart types; as well as Based on the target chart type, the target drawing function block is determined according to the correspondence between the multiple chart types and the multiple drawing function blocks.
7. The method according to claim 1, wherein obtaining the target chart using the target drawing function block comprises: The chart drawing instructions and the target data are provided to an execution environment configured with the target drawing function block, so as to execute the chart drawing instructions for the target data; as well as The target graph is obtained from the execution environment.
8. The method according to claim 1, wherein generating the chart drawing instructions executable by the target drawing function block comprises: Based on the first user input and the target data, the chart drawing instructions are generated using a second machine learning model, and The second machine learning model was fine-tuned in the following way: Determine the second training data, which includes one or more reference user inputs that respectively instruct the chart drawing task, one or more reference charts respectively corresponding to the one or more reference user inputs, and reference drawing instructions respectively corresponding to the one or more reference charts; as well as The second machine learning model is fine-tuned using the second training data.
9. The method according to claim 1, further comprising: Obtain access information for accessing the storage file of the target chart; Based on the access information and the type of the target chart, a target rendering style represented in markup language is generated for the target chart; as well as The target chart is rendered according to the target rendering style as at least part of the response to the first user input.
10. The method according to claim 1, further comprising: The target chart and the entry point for natural language input are presented in different areas of the user interface; The adjustment instruction for the target chart is received via at least one of the following: interactive elements or entry points included in the target chart; and Based on the adjustment instructions, update the presented target chart.
11. The method according to claim 1, further comprising: Receive a second user input for the target chart, the second user input indicating the target chart. Adjustments; Update the chart drawing instruction based on the second user input and the chart drawing instruction; as well as An updated chart for the target chart is generated by executing the updated chart generation instructions.
12. An apparatus for generating charts, comprising: The determination module is configured to determine a target drawing function block from a plurality of drawing function blocks based on a first user input indicating a chart drawing task, wherein the drawing function block among the plurality of drawing function blocks is configured to generate a chart of a predetermined type. The generation module is configured to generate chart drawing instructions executable by the target drawing function block based on the first user input and target data related to the first user input. The target data is determined based on the data source indicated by the first user input, and the data source includes multi-level table headers. as well as The acquisition module is configured to obtain a target chart based on the target data and the chart drawing instructions, using the target drawing function block.
13. An electronic device, comprising: At least one processing unit; as well as At least one memory, coupled to the at least one processing unit and storing instructions for execution by the at least one processing unit, which, when executed by the at least one processing unit, cause the electronic device to perform the method according to any one of claims 1 to 11.
14. A computer-readable storage medium having a computer program stored thereon, the computer program being executable by a processor to implement the method according to any one of claims 1 to 11.
Citation Information
Patent Citations
Excel-based method for data graph drawing and related device
CN106155988A
Report generation method and device, electronic equipment and medium
CN117033540A
Intelligent question and answer method and device, equipment and medium
CN117787415A
Chart generation method and system, terminal and readable storage medium
CN117892704A
Task processing method, device and equipment and computer readable storage medium
CN118839769A