Chart generation method and device based on natural language, equipment and storage medium

By obtaining the data query text input in natural language, and using the domain knowledge graph to generate expanded dimensions and derivative indicators, the problem of limitations of users' professional capabilities is solved, and accurate in-depth analysis of the chart and efficient data query are realized.

CN120523933AActive Publication Date: 2025-08-22HANGZHOU FEIZHIYUN INFORMATION TECH CO LTD

Patent Information

Application Number
CN202511028231.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-07-25
Publication Date
2025-08-22
Estimated Expiration
2045-07-25

AI Technical Summary

Technical Problem

In the prior art, the limitations of user professional capabilities make it difficult for natural language generated charts to meet the needs of in-depth analysis.

Method used

By obtaining the data query text input in natural language, using the domain knowledge graph to extract and expand dimensions and generate derivative indicators, generating database query statements and rendering charts, the charts are achieved to accurately meet users' deep analysis needs.

Benefits of technology

Build a complete dimension and indicator system that meets user data query and analysis, and the generated charts accurately meet the needs of in-depth analysis, reduce user operation thresholds, and improve analysis efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120523933A_ABST
    Figure CN120523933A_ABST
Patent Text Reader

Abstract

The invention provides a natural language-based chart generation method and device, equipment and a storage medium, and the method comprises the steps: obtaining a data query text input in a natural language manner, and analyzing the data query text to obtain a basic dimension and a basic index corresponding to the data query text; extracting an expansion dimension associated with the basic dimension through a pre-constructed domain knowledge graph, and generating a corresponding derivative index for the expansion dimension; generating a database query statement based on the basic dimension, the basic index, the expansion dimension and the derivative index, and performing data query based on the database query statement to obtain target data; and based on the target data, rendering a data chart corresponding to the data query text. According to the method and the device, the domain knowledge graph is utilized to carry out analysis dimension expansion and derivative index generation, so that a complete dimension and index system meeting user data query analysis is constructed, and the generated data graph can accurately meet deep analysis requirements of a user.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of artificial intelligence technology, and in particular to a natural language-based chart generation method, apparatus, device, and storage medium. Background Art

[0002] In the field of data analysis, automatically generating visual charts through natural language interaction can significantly lower the user barrier to entry and improve analysis efficiency. Therefore, building an intelligent natural language-to-chart system has become a core research direction in the industry. However, existing technologies face fundamental constraints: limited user expertise prevents them from fully defining the dimensional system required for problem analysis within natural language queries, rendering the generated charts inadequate for in-depth analysis. Therefore, ensuring that natural language-generated charts accurately meet users' in-depth analysis needs has become a technical bottleneck that technicians in this field urgently need to overcome. Summary of the Invention

[0003] In view of this, the present disclosure proposes a natural language-based chart generation method, apparatus, device, and storage medium, which can enable the generated data charts to accurately meet the user's in-depth analysis needs.

[0004] According to a first aspect of the present disclosure, a method for generating a chart based on natural language is provided, comprising: Obtaining a data query text input in natural language, and parsing the data query text to obtain basic dimensions and basic indicators corresponding to the data query text; Extracting extended dimensions associated with the basic dimensions from a pre-built domain knowledge graph, and generating corresponding derivative indicators for the extended dimensions; Generate a database query statement based on the basic dimension, the basic indicator, the extended dimension, and the derived indicator, and perform a data query based on the database query statement to obtain target data; Based on the target data, a data chart corresponding to the data query text is rendered.

[0005] In a possible implementation, when rendering a data chart corresponding to the data query text based on the target data, the method includes: Analyzing the characteristics of the target data, and determining a chart type that matches the target data based on the characteristic analysis results; Based on the target data and the chart type, a data chart corresponding to the data query text is rendered.

[0006] In a possible implementation, when rendering a data chart corresponding to the data query text based on the target data and the chart type, the method includes: Create independent canvas layers for each pre-divided chart element; Rendering corresponding chart elements on each of the canvas layers in sequence according to the target data and the chart type; The rendered canvas layers are sequentially superimposed to obtain the chart data corresponding to the data query text.

[0007] In a possible implementation, the pre-divided chart elements include at least one of a background element, a grid element, a data element, and a label element.

[0008] In a possible implementation, when rendering a data chart corresponding to the data query text based on the target data and the chart type, the method includes: generating a chart visualization semantic specification based on the target data and the chart type; Generate executable chart rendering code based on the chart visualization semantic specification; The chart rendering code is executed to render a data chart corresponding to the data query text.

[0009] In a possible implementation, when rendering a data chart corresponding to the data query text based on the target data, the target data is dynamically rendered in batches through a virtual DOM.

[0010] In a possible implementation, after performing a data query based on the database query statement to obtain target data, the method further includes: Preprocessing the target data; After completing the preprocessing of the target data, an operation of rendering a data chart corresponding to the data query text based on the target data is performed.

[0011] According to a second aspect of the present disclosure, there is provided a natural language-based chart generation apparatus, comprising: A natural language processing module is used to obtain a data query text input in natural language, and parse the data query text to obtain basic dimensions and basic indicators corresponding to the data query text; An expansion module is used to extract the expansion dimensions associated with the basic dimensions from the pre-built domain knowledge graph, and generate corresponding derivative indicators for the expansion dimensions; A data query module, configured to generate a database query statement based on the basic dimension, the basic indicator, the extended dimension, and the derived indicator, and perform data query based on the database query statement to obtain target data; A chart generation module is used to render a data chart corresponding to the data query text based on the target data.

[0012] According to a third aspect of the present disclosure, a natural language-based chart generation device is provided, comprising: a processor; and a memory for storing processor-executable instructions; wherein the processor is configured to execute the method described in the first aspect of the present disclosure.

[0013] According to a fourth aspect of the present disclosure, a non-volatile computer-readable storage medium is provided, on which computer program instructions are stored, wherein the computer program instructions, when executed by a processor, implement the method described in the first aspect of the present disclosure.

[0014] The present disclosure provides a method, apparatus, device and storage medium for generating a chart based on natural language, the method comprising: obtaining a data query text input in natural language, and parsing the data query text to obtain basic dimensions and basic indicators corresponding to the data query text; extracting extended dimensions associated with the basic dimensions from a pre-constructed domain knowledge graph, and generating corresponding derivative indicators for the extended dimensions; generating a database query statement based on the basic dimensions, basic indicators, extended dimensions and derivative indicators, and performing a data query based on the database query statement to obtain target data; and rendering a data chart corresponding to the data query text based on the target data. In the present disclosure, the domain knowledge graph can be used to automatically expand the analysis dimensions and generate derivative indicators, thereby constructing a complete dimension and indicator system that meets the user's data query analysis, and thereby enabling the generated data chart to accurately meet the user's in-depth analysis needs.

[0015] Further features and aspects of the present disclosure will become apparent from the following detailed description of exemplary embodiments with reference to the attached drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] The accompanying drawings, which are incorporated in and constitute a part of the specification, illustrate exemplary embodiments, features, and aspects of the disclosure and, together with the description, serve to explain the principles of the disclosure.

[0017] Figure 1 A flowchart of a method for generating a chart based on natural language according to an embodiment of the present disclosure is shown; Figure 2 A schematic block diagram of a natural language-based chart generation apparatus according to an embodiment of the present disclosure is shown; Figure 3 A schematic block diagram of a natural language-based chart generation device according to an embodiment of the present disclosure is shown. DETAILED DESCRIPTION

[0018] Various exemplary embodiments, features, and aspects of the present disclosure will be described in detail below with reference to the accompanying drawings. The same reference numerals in the accompanying drawings represent elements with the same or similar functions. Although various aspects of the embodiments are shown in the accompanying drawings, the drawings are not necessarily drawn to scale unless otherwise indicated.

[0019] The word “exemplary” is used exclusively herein to mean “serving as an example, example, or illustration.” Any embodiment described herein as “exemplary” is not necessarily to be construed as preferred or advantageous over other embodiments.

[0020] In addition, numerous specific details are provided in the following detailed description to better illustrate the present disclosure. Those skilled in the art will appreciate that the present disclosure can be practiced without certain specific details. In some instances, methods, means, components, and circuits well known to those skilled in the art are not described in detail in order to highlight the main points of the present disclosure.

[0021] <Method Example> Figure 1 FIG. 1 is a flow chart showing a method for generating a chart based on natural language according to an embodiment of the present disclosure. Figure 1 As shown, the method includes steps S1100-S1400.

[0022] S1100: Obtain a data query text input in natural language, and parse the data query text to obtain basic dimensions and basic indicators corresponding to the data query text.

[0023] It should be noted that the system implementing the disclosed method can provide a natural language interface through which users can enter data query text in various modalities, such as voice and text. After completing the data query text input, they click "Send" to allow the system to retrieve the data query text entered by the user in natural language. This data query text can reflect the user's data analysis needs, such as "Please analyze the changing trends in down jacket sales this year."

[0024] After obtaining the data query text input in natural language, the data query text will be parsed to obtain the basic dimensions and basic indicators corresponding to the data query text. Specifically, a prompt template for extracting basic dimensions and basic indicators is prepared, and the data query text is filled into the prompt word template to obtain prompt words for extracting basic dimensions and basic indicators. The prompt words are input into the large language model, and the large language model can automatically perform semantic parsing and extract the basic dimensions and basic indicators contained in the data query text based on the semantic parsing results. For example, when the user enters the data query text "Please analyze the changing trend of down jacket sales this year", the basic indicator corresponding to the data query text is sales, and the corresponding basic dimensions and corresponding values ​​are as follows: In one possible implementation, after obtaining the data query text, the query intent corresponding to the data query text is first identified to determine whether the query intent is relevant to data analysis: If it is not related to data analysis, prompt the user to send a data query text related to data analysis. For example, after determining whether the query intention is not related to data analysis, automatically reply "I am a data analysis intelligent assistant. I am sorry that I cannot answer your question. You can ask questions related to data analysis."

[0025] If it is not related to data analysis, continue to determine whether the query intent is clear: If the query intent is clear, then perform the analysis of the data query text to obtain the basic dimensions and basic indicators corresponding to the data query text. If the query intent is unclear, initiate multiple rounds of interactive confirmation in combination with contextual memory, and clarify the query intent through guided questions. For example, when a user enters the data query text "Please analyze the changing trend of down jacket sales this year", the user may be querying the changing trend of sales volume or the changing trend of sales revenue. At this time, a new round of dialogue will be initiated, and the automatic reply "Do you want to query the changing trend of sales volume? Or do you want to query the changing trend of sales revenue?" In this way, the user can be guided to further clarify the query intent through a new round of dialogue.

[0026] After parsing the basic dimensions and basic indicators corresponding to the data query text, step S1200 can be executed to extract the extended dimensions associated with the basic dimensions from the pre-built domain knowledge graph, and generate corresponding derived indicators for the extended dimensions. Among them, the domain knowledge graph is a structured semantic knowledge base that represents the entities, attributes and relationships of a specific domain in the form of a graph. It consists of nodes (representing entities, such as dimensions or indicators) and edges (representing relationships, such as "belongs to", "depends on" or "influences"). For example, in the retail field, the knowledge graph may contain the nodes "product" (dimension), "sales" (indicator), and the edge "product-belongs->category" (relationship).

[0027] Extracting extended dimensions associated with base dimensions from a pre-built domain knowledge graph can include the following steps: First, identify core dimensions from the base dimensions. Second, traverse the edge relationships in the domain knowledge graph to extract dimensions that are directly associated with the core dimensions and have a causal path with the base indicators as extended dimensions. This causal path is the shortest path that affects the base indicators.

[0028] For example, in an example where the user inputs the data query text "Please analyze the changing trends in down jacket sales this year," the basic dimensions of the data query text are first determined to include "this year" (the time dimension) and "down jackets" (the category dimension), with sales as the basic indicator. Down jackets are then identified as the core dimension. Next, the edge relationships in the domain knowledge graph are traversed to extract the expanded dimensions of temperature (the environmental dimension), duck down (the raw material dimension), and graphene thermal clothing (the competitive product dimension), which are directly associated with the core dimension of down jackets and have causal paths with the basic indicator of down jacket sales. The shortest causal paths between each expanded dimension and the basic indicator of down jacket sales are shown in the table below.

[0029] After the extended dimension is determined, the derived indicators that can explain the changes in the basic indicators will be generated for each extended dimension. The generation process of the derived indicators corresponding to each extended dimension is as follows: First, taking the extended dimension as the starting point, the entity attributes or relationship attributes that have an impact on the basic indicators and can be quantified along the shortest causal path between the extended dimension and the basic indicator are extracted on the causal path; secondly, according to the extracted entity attributes and / or relationship attributes, the derived indicators corresponding to the extended dimension and the calculation formula of the derived indicators are configured. Specifically, the extracted entity attributes and / or relationship attributes can be recommended to the user for the user to configure the derived indicators and the calculation formula of the derived indicators. The extended dimension, the shortest causal path where the extended dimension is located, and the entity attributes and / or relationship attributes extracted on the shortest causal path can also be input into a pre-trained neural network model to automatically generate the derived indicators corresponding to the extended dimension and the calculation formula of the derived indicators through the neural network model.

[0030] For example, for the extended dimension "temperature", the temperature entity on its shortest causal path has the attribute of temperature difference, the climate sensitivity relationship has the attribute of climate sensitivity coefficient, and the down jacket entity has the attribute of sales volume. First, the temperature difference attribute, climate sensitivity coefficient and sales volume attribute are extracted, and then the extracted temperature difference attribute, climate sensitivity coefficient and sales volume attribute are recommended to the user. Based on the temperature difference attribute, climate sensitivity coefficient and sales volume attribute, the user configures the derivative indicator warm winter impact value corresponding to the extended dimension of temperature, which is the warm winter impact value = sales volume × climate sensitivity coefficient × temperature difference.

[0031] In another example, for the extended dimension "temperature", the temperature entity on its shortest causal path has the attribute of temperature difference, the climate sensitivity relationship has the attribute of climate sensitivity coefficient, and the down jacket entity has the attribute of sales volume. The temperature difference attribute, climate sensitivity coefficient and sales volume attribute are first extracted, and then the extended dimension temperature, the shortest causal path where the temperature is located, and the temperature difference attribute, climate sensitivity coefficient and sales volume attribute extracted on the path are input into the pre-trained neural network model to automatically generate the derivative indicator warm winter impact value corresponding to the extended dimension of temperature through the neural network model. The warm winter impact value = sales volume × climate sensitivity coefficient × temperature difference.

[0032] After extracting the extended dimensions associated with the base dimensions and generating corresponding derived indicators for the extended dimensions, step S1300 can be executed to generate a database query statement based on the base dimensions, base indicators, extended dimensions, and derived indicators. Data queries are then performed based on the database query statement to obtain the target data. Specifically, a prompt for generating the database query statement is constructed based on the base dimensions, base indicators, extended dimensions, and derived indicators. The prompt for generating the database query statement is input into a pre-trained large language model. The large language model then automatically generates a database query statement (e.g., an SQL query statement), performs a data query based on the database query statement, and returns the corresponding target data.

[0033] After obtaining the target data returned after the data query, step S1400 can be executed to render a data chart corresponding to the data query text based on the target data. Specifically, the following steps may be included: First, analyze the characteristics of the target data and determine the chart type that matches the target data based on the characteristic analysis results.

[0034] First, analyze the target data for at least one of the following characteristics: 1. Dimensional analysis: Identify basic dimensions (such as time), extended dimensions (such as temperature), and their types; 2. Indicator analysis: Identify basic indicators (e.g., sales), derived indicators (e.g., warm winter impact value), and their types; 3. Distribution analysis: Count the number of data points, time series characteristics, discreteness / continuity, and significance of comparative relationships; 4. Correlation Pattern Analysis: a. Analyze the relationship between basic dimensions and basic indicators (e.g., time vs. sales trends); b. Analyze the correlation between extended dimensions and basic indicators (e.g., temperature vs. sales); c. Analyze the extent to which derived indicators explain changes in basic indicators (e.g., the impact of a warm winter explains sales fluctuations); d. Combine scenario analysis with the domain knowledge graph (e.g., the causal path "temperature → ... → sales" in the domain knowledge graph is climate attribution analysis) and label the business scenario type (trend / correlation / attribution analysis). Secondly, based on the characteristic analysis results of the target data and combined with the pre-set chart type mapping rules, the chart type that matches the target data is determined. The pre-set chart type mapping rules are shown in the following table: It should be noted here that the following principles should be followed when matching chart types: priority should be given to charts that can reveal the correlation patterns between extended dimensions, derivative indicators and basic indicators to meet the intention of deep analysis.

[0035] When the feature analysis results match multiple feasible chart types, you can choose according to the preset priority strategy. The priority strategies are ranked from high to low as follows: a. Select the chart type that can display the relationship between the most dimensional indicators; b. Select the recommended chart for this type of analysis scenario in the domain knowledge graph; c. Consider generating a combination chart; d. Initiate multiple rounds of interaction to confirm the user's chart preference.

[0036] Second, based on the target data and chart type, a data chart corresponding to the data query text is rendered. Specifically, the following steps may be included: First, a separate canvas layer is created for each pre-defined chart element. Each pre-defined chart element includes at least one of a background element, a grid element, a data element, and a label element. The background element defines the overall style of the chart, the grid element assists in data positioning, the data element visually displays the target data, and the label element annotates key information. Second, the corresponding chart elements are sequentially rendered on each canvas layer based on the target data and chart type. In embodiments where each chart element includes a background element, a grid element, a data element, and a label element, static elements such as the chart's background color and border are drawn on the canvas layer corresponding to the background element. Auxiliary lines such as coordinate axes and grid lines are drawn on the canvas layer corresponding to the grid element. Core data visualization elements such as line charts, bar charts, and pie charts are drawn on the canvas layer corresponding to the data element. Dynamic text such as data labels, legends, and tooltips are drawn on the canvas layer corresponding to the label element. Finally, the rendered canvas layers are sequentially overlaid to obtain the chart data corresponding to the data query text.

[0037] In one possible implementation, when the target data changes, a difference comparison algorithm is used to identify the specific chart elements that have changed, and only the canvas layers corresponding to the changed chart elements are incrementally updated. This setup can significantly reduce rendering computation, achieve millisecond-level response speeds, and avoid page flickering.

[0038] In one possible implementation, when rendering a data chart corresponding to a data query text based on target data and chart type, it is achieved by executing the constructed chart rendering code. The specific chart rendering process is as follows: First, based on the target data and chart type, a chart visualization semantic specification is generated. Specifically, the definition of the visualization semantic specification, the target data, and the chart type are first obtained, and prompt words for generating chart semantic specifications are constructed according to the definition of the visualization semantic specification, the target data, and the chart type. Then, the prompt words for generating chart semantic specifications are input into the large language model, and the large language model can automatically generate chart visualization semantic specifications, wherein the visualization semantic specification is in the JSON format specified by the system. Secondly, based on the chart visualization semantic specification, an executable chart rendering code is generated. Specifically, based on the chart visualization semantic specification, prompt words for generating chart rendering code are constructed, and the prompt words for generating chart rendering code are input into the large language model, and the large language model can automatically generate executable chart rendering code corresponding to the chart visualization semantic specification. Finally, the chart rendering code is executed to render the data chart corresponding to the data query text.

[0039] When rendering data charts corresponding to data query text based on target data, especially when the target data volume is large, the target data can be dynamically rendered in batches using virtual DOM (Document Object Model) technology to optimize performance and ensure smooth interaction. Specifically, the following steps may be involved: First, the visualization window is initialized and data is loaded in batches. Specifically, the pre-set visualization window size is obtained, and based on this size, the maximum number of data points that can be displayed in real time within the window is determined (for example, 100 data points). During the first rendering, only the following two parts of data are loaded: 1. First-screen visualization window data: data points that need to be displayed directly within the window range (for example, 100); 2. Preload buffer data: data points in the adjacent area of ​​the window to be rendered (for example, 100 points in front of and behind the window, for a total of 200). By keeping the total amount of initially loaded data within a reasonable range (for example, 300 data points), the computational load of the initial rendering is significantly reduced.

[0040] Secondly, interactions trigger dynamic updates and batch construction of virtual DOM. Specifically, when the user performs an interactive operation (such as scrolling or zooming a chart), the data range of the new visualization window is dynamically calculated. Check whether the preload buffer contains the data required for the new window: if so, update and render these data points directly on the data element layer canvas. At the same time, asynchronously trigger the background to load the next batch of data to be rendered in the adjacent area (for example, 200) to maintain the continuity of data supply. For data points that need to be updated in batches (for example, scrolling across 20 points), a lightweight virtual DOM is built in memory, and the changes in the data points to be updated (such as the displacement of the broken line path) are uniformly spliced ​​into the virtual DOM to avoid triggering rendering operations point by point.

[0041] Finally, efficient synchronization and asynchrony are decoupled. Specifically, after the virtual DOM is constructed, only one physical rendering operation (such as updating state via setState or directly accessing the Canvas API) is performed, synchronizing accumulated changes to the data element layer canvas at once. This mechanism avoids the performance overhead and page flickering caused by frequent partial redraws.

[0042] In one possible implementation, user interaction behavior characteristics, including swipe speed, swipe direction, and dwell time, are monitored in real time. The amount of preloaded data is dynamically adjusted based on swipe speed: when a user swipes quickly (speed threshold > 50 pixels per second), the preload buffer is expanded to 300 data points before and after the window; when the user browses slowly (speed threshold < 10 pixels per second), the preload buffer is reduced to 50 data points before and after. A swipe direction prediction model is also constructed. If three consecutive swipes are in the same direction (e.g., all to the right), an additional data area for the next direction is preloaded (increasing the buffer by 30%), significantly reducing loading delays caused by swipe inertia.

[0043] In this embodiment, user interaction operations are decoupled from the data loading / rendering process through an asynchronous mechanism, so that user operations can obtain immediate responses and ensure smooth interaction.

[0044] In one possible implementation, after performing a data query based on a database query statement and obtaining target data, the method further includes preprocessing the target data, wherein the preprocessing includes at least one of outlier processing and format conversion. Outlier processing is used to detect and automatically correct outliers in the target data. Format conversion is used to convert the target data into a standard and reasonable format. After completing the preprocessing of the target data, an operation is performed to render a data chart corresponding to the data query text based on the target data.

[0045] The present disclosure provides a method for generating charts based on natural language, including: obtaining a data query text input in natural language, and parsing the data query text to obtain basic dimensions and basic indicators corresponding to the data query text; extracting extended dimensions associated with the basic dimensions from a pre-constructed domain knowledge graph, and generating corresponding derivative indicators for the extended dimensions; generating database query statements based on the basic dimensions, basic indicators, extended dimensions, and derivative indicators, and performing data queries based on the database query statements to obtain target data; rendering a data chart corresponding to the data query text based on the target data. In the present disclosure, the domain knowledge graph can be used to automatically expand the analysis dimensions and generate derivative indicators, thereby constructing a complete dimension and indicator system that meets the user's data query analysis, and thereby enabling the generated data chart to accurately meet the user's in-depth analysis needs.

[0046] <Device Example> Figure 2 FIG. 1 is a schematic block diagram of a natural language-based chart generation apparatus according to an embodiment of the present disclosure. Figure 2 As shown, the device 100 includes: The natural language processing module 110 is used to obtain a data query text input in a natural language manner, and parse the data query text to obtain basic dimensions and basic indicators corresponding to the data query text; An expansion module 120 is configured to extract an expansion dimension associated with the basic dimension from a pre-built domain knowledge graph, and generate corresponding derivative indicators for the expansion dimension; The data query module 130 is configured to generate a database query statement based on the basic dimension, the basic indicator, the extended dimension, and the derived indicator, and perform a data query based on the database query statement to obtain target data; The chart generating module 140 is configured to render a data chart corresponding to the data query text based on the target data.

[0047] <Equipment Example> Figure 3 FIG. 1 is a schematic block diagram of a natural language-based chart generation device according to an embodiment of the present disclosure. Figure 3 As shown, the natural language-based chart generation device 200 includes a processor 210 and a memory 220 for storing executable instructions of the processor 210. The processor 210 is configured to implement any of the above-mentioned natural language-based chart generation methods when executing the executable instructions.

[0048] It should be noted that there may be one or more processors 210. Furthermore, the natural language-based chart generation device 200 according to the embodiment of the present disclosure may further include an input device 230 and an output device 240. The processor 210, memory 220, input device 230, and output device 240 may be connected via a bus or other means, which are not specifically limited herein.

[0049] Memory 220, as a computer-readable storage medium, can be used to store software programs, computer-executable programs, and various modules, such as the programs or modules corresponding to the natural language-based chart generation method of the present disclosure. Processor 210 executes the software programs or modules stored in memory 220 to perform various functional applications and data processing of natural language-based chart generation device 200.

[0050] The input device 230 may be used to receive input numbers or signals. The signals may be key signals related to user settings and function control of the device / terminal / server. The output device 240 may include a display device such as a display screen.

[0051] <Storage Medium Embodiment> According to a fourth aspect of the present disclosure, a non-volatile computer-readable storage medium is further provided, on which computer program instructions are stored. When the computer program instructions are executed by the processor 210, any of the above-mentioned natural language-based chart generation methods is implemented.

[0052] While various embodiments of the present disclosure have been described above, the foregoing description is intended to be illustrative, non-exhaustive, and not limited to the disclosed embodiments. Many modifications and variations will be apparent to those skilled in the art without departing from the scope and spirit of the described embodiments. The terminology used herein is selected to best explain the principles of the embodiments, their practical applications, or technical improvements to existing technologies, or to enable others skilled in the art to understand the embodiments disclosed herein.

Claims

1. A method for generating a chart based on natural language, characterized in that: include: Obtaining a data query text input in natural language, and parsing the data query text to obtain basic dimensions and basic indicators corresponding to the data query text; Extracting extended dimensions associated with the basic dimensions from a pre-built domain knowledge graph, and generating corresponding derivative indicators for the extended dimensions; Generate a database query statement based on the basic dimension, the basic indicator, the extended dimension, and the derived indicator, and perform a data query based on the database query statement to obtain target data; Based on the target data, a data chart corresponding to the data query text is rendered.

2. The method according to claim 1, characterized in that When rendering a data chart corresponding to the data query text based on the target data, the method includes: Analyzing the characteristics of the target data, and determining a chart type that matches the target data based on the characteristic analysis results; Based on the target data and the chart type, a data chart corresponding to the data query text is rendered.

3. The method according to claim 2, characterized in that When rendering a data chart corresponding to the data query text based on the target data and the chart type, the method includes: Create independent canvas layers for each pre-divided chart element; Rendering corresponding chart elements on each of the canvas layers in sequence according to the target data and the chart type; The rendered canvas layers are sequentially superimposed to obtain the chart data corresponding to the data query text.

4. The method according to claim 3, characterized in that The pre-divided chart elements include at least one of background elements, grid elements, data elements, and label elements.

5. The method according to claim 2, characterized in that When rendering a data chart corresponding to the data query text based on the target data and the chart type, the method includes: generating a chart visualization semantic specification based on the target data and the chart type; Generate executable chart rendering code based on the chart visualization semantic specification; The chart rendering code is executed to render a data chart corresponding to the data query text.

6. The method according to claim 1, characterized in that When rendering a data chart corresponding to the data query text based on the target data, the target data is dynamically rendered in batches through a virtual DOM.

7. The method according to claim 1, characterized in that After performing data query based on the database query statement and obtaining target data, the method further includes: Preprocessing the target data; After completing the preprocessing of the target data, an operation of rendering a data chart corresponding to the data query text based on the target data is performed.

8. A diagram generating device based on natural language, characterized in that: include: A natural language processing module is used to obtain a data query text input in natural language, and parse the data query text to obtain basic dimensions and basic indicators corresponding to the data query text; An expansion module is used to extract the expansion dimensions associated with the basic dimensions from the pre-built domain knowledge graph, and generate corresponding derivative indicators for the expansion dimensions; A data query module, configured to generate a database query statement based on the basic dimension, the basic indicator, the extended dimension, and the derived indicator, and perform data query based on the database query statement to obtain target data; A chart generation module is used to render a data chart corresponding to the data query text based on the target data.

9. A natural language-based chart generation device, characterized in that: include: processor; a memory for storing processor-executable instructions; The processor is configured to implement the method according to any one of claims 1 to 7 when executing the executable instructions.

10. A non-volatile computer-readable storage medium having computer program instructions stored thereon, characterized in that: When the computer program instructions are executed by a processor, the method according to any one of claims 1 to 7 is implemented.

Citation Information

Patent Citations

  • Index data analysis method and system based on knowledge graph and natural language

    CN116244410A

  • Data analysis method based on atlas and large model and ChatBI system

    CN119622055A

  • Interactive intelligent analysis method and device based on knowledge graph and medium

    CN120045686A

  • System and method for operation of realistic learning content platform for elderly

    KR1020230173831A

  • Natural language visualizations

    US10846318B1

Cited By

  • Data chart generation method and device, computer equipment and readable storage medium

    CN121350141A

  • Battery test data processing method, device, equipment, medium and program product

    CN121578151A