Chart generation method and device, computer device and storage medium
By using a professionally designed chart template library and data processing technology, the problems of flexibility and high labor costs in chart generation have been solved, achieving efficient and aesthetically pleasing chart generation.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- HANGZHOU DBAPPSECURITY CO LTD
- Filing Date
- 2022-12-12
- Publication Date
- 2026-06-09
AI Technical Summary
Existing technologies for generating charts are inflexible and have high labor costs. Traditional methods, such as taking screenshots or exporting pure code, result in a large workload and inflexibility in chart generation.
By acquiring the target database and chart template library, and utilizing the chart template library pre-designed by professional designers, the target template is selected according to the chart instructions, data deletion is performed, a specified style result is generated, and the target database is imported into the specified style result to generate the final chart.
It improves the flexibility and efficiency of chart generation, reduces labor costs, and ensures that the generated charts are aesthetically pleasing and meet expected requirements, thereby reducing the workload of relevant personnel.
Smart Images

Figure CN116151205B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of electronic digital data processing technology, and in particular to a chart generation method, apparatus, computer device, and storage medium. Background Technology
[0002] Charts play an indispensable role in a report. They can transform dry data into vivid and easy-to-understand graphs or tables. However, many problems arise when generating charts. For example, most projects only support web page display for data processing. When users want to export charts, they can usually only do so by taking a screenshot or exporting the chart using pure code. Using a screenshot directly results in poor flexibility, while exporting the chart using pure code requires designing the size, style, position, and color of the chart line by line, which greatly increases the workload of chart generation.
[0003] There is currently no effective solution to the problems of poor flexibility and high labor costs in generating charts using existing technologies. Summary of the Invention
[0004] Therefore, it is necessary to provide a chart generation method, apparatus, computer device, and storage medium to address the aforementioned technical problems.
[0005] Firstly, this application provides a method for generating charts. The method includes:
[0006] The process involves: acquiring a target database, chart commands, and a chart template library; the chart template library includes at least one initial template; retrieving the chart template library based on the chart commands and acquiring the target template corresponding to the chart commands from the initial templates; deleting data from the target template and generating a specified style result corresponding to the target template; and generating the final chart based on the target database and the specified style result.
[0007] In one embodiment, the application is on a server-side connection to a web page, and obtaining the target database includes:
[0008] Obtain data instructions and target data format; extract target data from the web page based on the data instructions, and convert the target data according to the target data format to obtain data in the specified format; obtain the target database based on the data in the specified format.
[0009] In one embodiment, data deletion is performed on the target template, and a specified style result corresponding to the target template is generated, including:
[0010] Detect style instructions; in response to style instructions, extract initial charts from the target template; perform data deletion on the initial charts to obtain the specified style result.
[0011] In one embodiment, extracting an initial chart from a target template includes:
[0012] Obtain the target chart format and detect the preset extraction instruction corresponding to the target chart format; in response to the preset extraction instruction, extract the initial chart that matches the target chart format from the target template.
[0013] In one embodiment, the target chart format includes multiple chart formats, and the multiple chart formats can be converted to each other.
[0014] In one embodiment, after generating the final chart, the method further includes:
[0015] Obtain queue information and target export format;
[0016] The final charts are sorted according to the queue information to obtain a final chart group, wherein the final chart group includes at least one final chart;
[0017] The final chart group is formatted according to the target export format to obtain the target export chart group.
[0018] Secondly, this application also provides a chart generation apparatus. The apparatus includes:
[0019] The acquisition module is used to acquire the target database, chart commands, and chart template library;
[0020] The calculation module is used to obtain a target template from the chart template library according to the chart instructions, wherein the chart template library includes at least one template;
[0021] The generation module is used to convert the target template into the target chart, import the target database into the target chart, and generate the final chart.
[0022] Thirdly, this application also provides a computer device. The computer device includes a memory and a processor, the memory storing a computer program, and the processor executing the computer program to perform the following steps:
[0023] Obtain the target database, chart commands, and chart template library; the chart template library includes at least one initial template.
[0024] The system retrieves the chart template library based on the chart instructions and obtains the target template corresponding to the chart instructions from the initial template; it then deletes data from the target template and generates a specified style result corresponding to the target template.
[0025] Generate the final chart based on the target database and the specified style results.
[0026] Fourthly, this application also provides a computer-readable storage medium. The computer-readable storage medium stores a computer program thereon, which, when executed by a processor, performs the following steps:
[0027] Obtain the target database, chart commands, and chart template library; the chart template library includes at least one initial template.
[0028] The system retrieves the chart template library based on the chart instructions and obtains the target template corresponding to the chart instructions from the initial template; it then deletes data from the target template and generates a specified style result corresponding to the target template.
[0029] Generate the final chart based on the target database and the specified style results.
[0030] Fifthly, this application also provides a computer program product. The computer program product includes a computer program that, when executed by a processor, performs the following steps:
[0031] Obtain the target database, chart commands, and chart template library; the chart template library includes at least one initial template.
[0032] The system retrieves the chart template library based on the chart instructions and obtains the target template corresponding to the chart instructions from the initial template; it then deletes data from the target template and generates a specified style result corresponding to the target template.
[0033] Generate the final chart based on the target database and the specified style results.
[0034] The aforementioned chart generation method, apparatus, computer equipment, and storage medium select a corresponding target template from multiple initial templates in a preset chart template library according to chart instructions, delete the default data inherent in the target template to obtain a specified style result, and then import a preset target database into the specified style result to generate the final chart. This application solves the problems of poor flexibility and high manual costs in traditional chart generation techniques. By importing the target database into the target template selected from the chart template library to obtain the required final chart, the efficiency of chart generation is greatly improved. Furthermore, since the chart template library is designed by professionals, it also enhances the aesthetics of the final chart. Attached Figure Description
[0035] Figure 1 This is a flowchart illustrating a chart generation method in one embodiment;
[0036] Figure 2 This is a flowchart illustrating the chart generation method in another embodiment;
[0037] Figure 3 This is a flowchart illustrating a preferred embodiment of the chart generation method;
[0038] Figure 4 This is a structural block diagram of the chart generation device in another embodiment;
[0039] Figure 5 This is a structural block diagram of the internal structure of a computer device used to generate a diagram, as shown in one embodiment. Detailed Implementation
[0040] To make the objectives, technical solutions, and advantages of this application clearer, the application is described and illustrated below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the application. All other embodiments obtained by those skilled in the art based on the embodiments provided in this application without inventive effort are within the scope of protection of this application. Furthermore, it is understood that although the efforts made in such a development process may be complex and lengthy, for those skilled in the art related to the content disclosed in this application, modifications to design, manufacturing, or production based on the technical content disclosed in this application are merely conventional technical means and should not be construed as insufficient disclosure of the content of this application.
[0041] In this application, the reference to "embodiment" means that a specific feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of this application. The appearance of this phrase in various places in the specification does not necessarily refer to the same embodiment, nor is it a separate or alternative embodiment that is mutually exclusive with other embodiments. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described in this application may be combined with other embodiments without conflict.
[0042] In one embodiment, such as Figure 1 As shown, a chart generation method is provided. Figure 1 This is a flowchart of a chart generation method according to an embodiment of this application, including the following steps:
[0043] Step S110: Obtain the target database, chart instructions, and chart template library; wherein the chart template library includes at least one initial template.
[0044] The initial templates in this chart template library are all designed by specialized designers. Multiple types of initial templates are designed within the application software, including but not limited to line charts, bar charts, pie charts, column charts, radar charts, etc. During the design phase, the style and type of the initial templates can be modified according to user needs. After designing one type of initial template, other types are designed following the same process. Furthermore, if more refined templates are required, different forms of the same type of initial template can also be designed as initial templates, thus enriching the supported chart styles. Specifically, the application software can be Word. Chart commands can be entered by the user to extract the corresponding target template from the chart template library based on the actual situation. When obtaining the target database, it can be generated based on existing data or extracted from a web page to obtain the target database.
[0045] Step S120: Search the chart template library according to the chart instructions and obtain the target template corresponding to the chart instructions in the initial template; perform data deletion on the target template and generate the specified style result corresponding to the target template;
[0046] In the initial template of the chart template library, the designer can choose to exclude data or include random data during the design process. When random default data is selected, the target template is obtained from the chart template library according to the chart instructions. The target template includes charts, titles, annotations, images, headers, footers, and text. The chart is extracted from the target template to obtain the initial chart, which includes randomly generated default data. In this application, the designer can choose to generate random data or not. The default selection in this application is to generate random data. Generating data means that the corresponding graphic can be generated in the chart, which makes it convenient for relevant personnel to clearly and directly observe the charts in the chart template library and then select the required target template according to the actual situation. After the target template is selected, the randomly generated data in the target template is deleted to obtain the specified style result corresponding to the target template.
[0047] Step S130: Generate the final chart based on the target database and the specified style result.
[0048] As can be seen from steps S110 to S130 above, when obtaining the target database and retrieving the target template from the chart template library according to the chart instructions, the chart template library includes multiple initial templates. These initial templates are completed by professional designers using the required application, such as Word. The target template includes charts, images, text, headers, footers, and annotations. The charts in the target template are extracted to obtain the initial chart. The initial chart includes preset default data in the template. This default data is deleted to obtain the specified style result. The target database is then imported into the specified style result to obtain the required final chart. It can be seen that the present application processes the chart template and the required data separately, which can greatly improve the flexibility of the final chart generation. By having multiple initial templates in the chart template library designed by professional designers, it is more aesthetically pleasing than directly taking screenshots or generating templates with pure code in traditional technologies, and it also greatly reduces the workload required to generate the final chart. Furthermore, by importing the target database into the initial chart extracted from the target template, and directly replacing all the preset default data in the initial chart, the efficiency of generating the final chart is improved. Since a chart only produces a graph with data, pre-setting random default data in the initial chart allows for a more intuitive and clear observation of the initial chart. Moreover, the exported charts still allow users to redesign and modify them, ultimately creating charts that better meet their expectations, reducing the workload and development difficulty for relevant technical personnel.
[0049] In one embodiment, the above chart generation method further includes:
[0050] Data acquisition instructions and target data format;
[0051] Extract target data from the webpage based on data instructions, and convert the target data according to the target data format to obtain data in the specified format;
[0052] The target database is obtained based on the specified data format.
[0053] Specifically, target data can be obtained through data commands based on the actual application scenario requirements, and the target data can be converted into a target database. Relevant personnel input the aforementioned data commands to obtain the required target data. When the above method is applied to the server side, the server connects to the web page to extract data from the web page and convert it into the data format required for the chart. It can be seen that users can choose a preset target database based on the actual situation, or they can extract data from the backend database on the web page based on the data selected by the user. This design makes the chart generation method of this application more adaptable and more flexible in terms of data acquisition.
[0054] In one embodiment, the above chart generation method further includes:
[0055] Detect style instructions; in response to style instructions, extract initial charts from the target template; perform data deletion on the initial charts to obtain the specified style result.
[0056] Specifically, taking Apache POI as an example, the target template is obtained based on style directives. These directives can be user-inputted. Since the target template includes not only initial charts but also images, text, headers, footers, and annotations, the initial charts are extracted from the target template after obtaining the style directives. After obtaining the target template, it is read into Java memory. Apache POI is an open-source library from the Apache Software Foundation. POI (Poor Obfuscation Implementation) provides interface functions for programmers to read and write Microsoft Office format files. Using the interfaces provided by POI, the target template is read into an XWPFDocument object, and the POIXMLDocumentPart or XWPFChart object is extracted from the XWPFDocument object. Both the POIXMLDocumentPart and XWPFChart objects represent charts in the target template. The data portion of the POIXMLDocumentPart or XWPFChart object is cleared to obtain the specified style result. Furthermore, POI provides the following objects: XWPFRun (representing a piece of text); XWPFTable (representing a table); XWPFTableRow (representing a row in a table); XWPFTableCell (representing a cell in a table); XWPFHyperlink (representing a hyperlink); XWPFFooter (representing a footer); and XWPFHeader (representing a header). This demonstrates that different targets within the template can be flexibly extracted and processed based on different extraction objects. Furthermore, since the target template contains preset random default data, corresponding charts are generated based on this random default data, making the target template's style more intuitive and clear.
[0057] In one embodiment, the above chart generation method further includes:
[0058] Obtain the target chart format and detect the preset extraction instructions corresponding to the target chart format;
[0059] In response to a preset extraction command, extract an initial chart from the target template that matches the target chart format.
[0060] Specifically, taking Apache POI as an example, after obtaining the target template, it is read into Java memory. Using the interfaces provided by POI, the target template is transformed into an XWPFDocument object, and then either a POIXMLDocumentPart object or an XWPFChart object is extracted from it. Both the POIXMLDocumentPart and XWPFChart objects represent charts in the target template. In Word, users can select the target chart format according to their needs and choose the corresponding preset extraction command. For example, in Word, the target chart format includes doc or docx versions. When the doc version is selected, the preset extraction command is the command to extract the POIXMLDocumentPart object; when the docx version is selected, the preset extraction command is the command to extract the XWPFChart object. Furthermore, this application can not only extract charts but also extract and replace parts of the initial template other than charts. For example, when extracting and replacing text, an XWPFRun object can be used, meaning the preset extraction command can also be the command to extract the XWPFRun object. First, obtain the collection of all text in the initial template. Then, loop through the text in each paragraph to get the text in each XWPFRun object. For example, you can get the first paragraph's text using `runs.get(0).getText(run.getTextPosition())`. The initial template contains some built-in questions that need to be replaced according to the actual situation. For example: "Today is ${time}, weather ${weather}". This text can be replaced by replacing "${time}" with "Month X Day" and "${weather}" with "Sunny". After the replacement, the paragraph in the initial template becomes: "Today is Month X Day, weather sunny". It should be noted that only the text content is replaced during the replacement; the paragraph format, font, and font size settings remain unchanged. Therefore, it can be seen that the extraction and replacement of charts and non-chart parts in this application is very flexible and efficient. Compared to traditional technologies where chart creation relies solely on screenshots or pure code, the chart creation in this application can not only generate beautifully designed charts by professional designers, but also flexibly add necessary annotations and text to the charts according to the actual situation, greatly improving work efficiency.
[0061] In one embodiment, the chart generation method further includes: the target chart format includes multiple chart formats, and the multiple chart formats can be converted to each other.
[0062] Specifically, taking Word as an example, the target chart format includes either a .doc or .docx version. A POIXMLDocumentPart object represents the .doc version chart, and an XWPFChart object represents the .docx version chart. The appropriate extraction method can be selected based on the required version. The POIXMLDocumentPart and XWPFChart objects can be converted between each other. This method allows for more flexible and efficient chart extraction and design.
[0063] In one embodiment, such as Figure 2 The above-mentioned chart generation method provides another method, which further includes:
[0064] Step S240: Obtain queue information and target export format; sort the final charts according to the queue information to obtain a final chart group, wherein the final chart group includes at least one of the final charts; convert the format of the final chart group according to the target export format to obtain a target export chart group.
[0065] Specifically, in practical applications, users often need to generate not just a single chart, but a collection of multiple charts. These multiple final charts can be merged according to the specific application scenario. First, a template can be created to arrange the charts in the desired order. Then, a new XWPFDocument object is created, and either a POIXMLDocumentPart object or an XWPFChart object is added to this new XWPFDocument object in the aforementioned order. Finally, the charts are exported using POI to the desired file. This demonstrates that this method can efficiently and conveniently generate multiple charts needed by the user, and merging multiple charts into a single file also improves work efficiency.
[0066] This embodiment also provides a specific implementation of a method for generating charts, such as... Figure 3 As shown, Figure 3 This is a flowchart of a preferred embodiment of a method for generating a chart.
[0067] First, acquire the target database, chart commands, and chart template library. The target database can be generated from the user's existing database or extracted from the web-based backend database, and then formatted into the required formats for each chart. When generating the chart template library, the main idea is to create a separate template for each chart, including pre-designing all design style information such as chart type, size, position, and elements, reserving only for data filling. Taking Word as an example, Word's built-in chart tools can generate corresponding charts. For example, for line charts, various types can be generated, such as standard line charts, stacked line charts, percentage stacked line charts, and line charts with data markers. Then, these can be beautified and designed. During the beautification and design process, no data processing is required; randomly generated default data is used. After completing one type of template, the remaining types are designed in the same way, and so on, until all types of charts are designed. For greater refinement, different forms of the same chart can also be designed as templates, thus enriching the supported chart styles for export. This demonstrates that the design of the chart template library in this application is highly flexible, allowing for the design of different initial templates to meet user needs based on actual circumstances.
[0068] Secondly, the user selects a target template from multiple pre-designed initial templates in the chart template library according to actual needs. This template is read into Java memory, and the POI interface is used to create an XWPFDocument object. The POIXMLDocumentPart or XWPFChart object is then extracted from the XWPFDocument object; this POIXMLDocumentPart or XWPFChart object represents the chart in the template. Random default data in the chart is deleted to obtain a specified style result. Data from the target database is then rendered into this specified style result to obtain the final chart. Furthermore, this application can extract not only the required charts but also the text. The text in the initial template has pre-embedded parts to be replaced, allowing the program to automatically locate the replacement position when replacing text, using a List... <xwpfrun>`runs = paragraph.getRuns();` retrieves a collection of all text in the initial Word template. It then iterates through the `XWPFRun` objects to find the positions in each paragraph that need to be replaced and performs the replacements. Finally, it generates a `runs` object with all the replacements. The `runs` object, along with the `XWPFChart` or `POIXMLDocumentPart` representing the chart, is added to a newly created `XWPFDocumet` object in the appropriate order.
[0069] Finally, since the report generated by the user is not just a single final chart, but a collection of multiple final charts, it is necessary to merge the multiple POIXMLDocumentPart objects or XWPFChart objects generated in the above process. First, arrange the charts according to the order selected by the user, then create a new XWPFDocument object, and add the POIXMLDocumentPart objects or XWPFChart objects to the newly created XWPFDocument object in a preset order. Finally, export the XWPFDocument object as a Word file required by the user through POI. Furthermore, when the user needs to select charts and data on the web page, the layout can be completely based on the user's selection. For example, if the user selects the first, third, and fifth charts out of 10 charts on the web page, the data corresponding to these three charts will be extracted, and three corresponding target templates will be selected from the chart template library. The three target templates will be merged with the corresponding data to obtain three independent final charts. These three independent final charts will be merged according to the order selected by the user to form the final Word document and exported.
[0070] It should be understood that although the steps in the flowcharts of the embodiments described above are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the embodiments described above may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.
[0071] Based on the same inventive concept, this application also provides a chart generation apparatus for implementing the chart generation method designed above. The solution provided by this apparatus is similar to the solution described in the above method. Therefore, the specific limitations of one or more chart generation apparatus embodiments provided below can be found in the limitations of the chart generation method above, and will not be repeated here.
[0072] In one embodiment, such as Figure 4 As shown, a chart generation device is provided, including: an acquisition module 41, a calculation module 42, and a generation module 43, wherein:
[0073] The acquisition module 41 is used to acquire the target database, chart instructions, and chart template library; wherein the chart template library includes at least one initial template.
[0074] The calculation module 42 is used to perform retrieval processing on the chart template library according to the chart instruction, and obtain the target template corresponding to the chart instruction in the initial template; perform data deletion processing on the target template, and generate a specified style result corresponding to the target template;
[0075] The generation module 43 is used to generate the final chart based on the target database and the specified style result.
[0076] Specifically, the acquisition module 41 is connected to the calculation module 42. The acquisition module 41 is used to acquire the target database, chart instructions, and chart template library. When generating the chart template library, the main idea is to create a separate template for each chart, including pre-designing all design style information such as chart type, size, position, and elements, reserving only for data filling. During the beautification and design process, the data does not need to be processed; randomly generated default data is used. After completing a template of one type, the remaining templates are designed according to this process, and so on, until the chart template library is complete. The target database, chart instructions, and chart template library are transmitted to the calculation module 42. The calculation module 42 performs retrieval processing in the chart template library according to the chart instructions and obtains the corresponding target template from multiple initial modules. The target template is read as an XWPFDocument object, and the POIXMLDocumentPart object or XWPFChart object is extracted from the XWPFDocument object. This object represents the chart in the target template. The data portion of the POIXMLDocumentPart object or XWPFChart object is cleared to obtain the specified style result. The calculation module 42 transmits the specified style result to the generation module 43, and the generation module 43 renders the data in the target database into the specified style result to obtain the final chart.
[0077] Compared to existing technologies, the final charts generated by the aforementioned chart generation device allow for independent development of the target chart's style, freeing it from code. Professional designers can create these charts within applications like Word, resulting in an aesthetically pleasing outcome that cannot be achieved through pure code creation. Furthermore, the exported charts still allow users to modify and redesign them, ultimately creating charts that better suit their reporting needs. This not only meets user requirements but also reduces the workload and difficulty for developers.
[0078] Each module in the aforementioned chart generation device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device, or stored in the memory of a computer device as software, so that the processor can call and execute the operations corresponding to each module.
[0079] In one embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be as follows: Figure 5 As shown, the computer device includes a processor, memory, communication interface, display screen, and input device connected via a system bus. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The communication interface or network interface of the computer device is used for wired or wireless communication with external terminals; wireless communication can be achieved through Wi-Fi, mobile cellular networks, NFC (Near Field Communication), or other technologies. When the computer program is executed by the processor, it implements a chart generation method, and the database of the computer device stores the chart generation data.
[0080] Those skilled in the art will understand that Figure 5 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the segmented data statistics device to which the present application is applied. A specific segmented data statistics device may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0081] Those skilled in the art should understand that the technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments have been described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0082] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the invention patent. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this patent application should be determined by the appended claims.< / xwpfrun>
Claims
1. A chart generation method, characterized in that, The method includes: Obtain the target database, chart instructions, and chart template library; wherein the chart template library includes at least one initial template; The chart template library is searched according to the chart instruction, and a target template corresponding to the chart instruction is obtained from the initial template. The target template is a document template, including charts, titles, annotations, images, headers and footers, and text. Data deletion is performed on the target template, and a specified style result corresponding to the target template is generated, including: Detect style instructions; in response to the style instructions, extract an initial chart from the target template, including: using the interface provided by POI to read the document template and form it into an XWPFDocument object, and extracting the POIXMLDocumentPart object or the XWPFChart object from the XWPFDocument object, and using the POIXMLDocumentPart object or the XWPFChart object as the initial chart; The initial chart is processed by data deletion to obtain the specified style result; Based on the target database and the specified style results, a final chart is generated, including: Import the target database into the specified style result to obtain the desired final chart; After generating the final chart, the method further includes: Obtain queue information and target export format; The final charts are sorted according to the queue information to obtain a final chart group, wherein the final chart group includes at least one of the final charts; The final chart group is format-converted according to the target export format to obtain the target export chart group.
2. The method according to claim 1, characterized in that, Applied to the server side, the server side connects to the web page side, and the acquisition of the target database includes: Data acquisition instructions and target data format; Based on the data instructions, target data is extracted from the web page, and the target data is converted according to the target data format to obtain data in the specified format; The target database is obtained based on the specified format data.
3. The method according to claim 1, characterized in that, The step of extracting the initial chart from the target template includes: Obtain the target chart format and detect the preset extraction command corresponding to the target chart format; In response to the preset extraction instruction, the initial chart that matches the target chart format is extracted from the target template.
4. The method according to claim 3, characterized in that, The target chart format includes multiple chart formats, and the multiple chart formats can be converted to each other.
5. A chart generation device, characterized in that, The device includes: The acquisition module is used to acquire the target database, chart instructions, and chart template library; wherein the chart template library includes at least one initial template; it is also used to acquire queue information and target export format after generating the final chart; The calculation module is used to retrieve and process the chart template library according to the chart instruction, and obtain the target template corresponding to the chart instruction from the initial template; the target template is a document template, including charts, titles, annotations, images, headers and footers, and text; perform data deletion processing on the target template and generate a specified style result corresponding to the target template, including: detecting style instructions; in response to the style instructions, extracting the initial chart from the target template, including: using the interface provided by POI to read the document template and form it into an XWPFDocument object, and extracting the POIXMLDocumentPart object or XWPFChart object from the XWPFDocument object, and using the POIXMLDocumentPart object or the XWPFChart object as the initial chart; perform data deletion processing on the initial chart to obtain the specified style result; The generation module is configured to generate a final chart based on the target database and the specified style result, including: importing the target database into the specified style result to obtain the required final chart; sorting the final chart according to the queue information to obtain a final chart group, wherein the final chart group includes at least one final chart; and performing format conversion on the final chart group corresponding to the target export format to obtain a target export chart group.
6. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 4.
7. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 4.
8. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 4.