CN114239530A - Method and device for generating chart - Google Patents

Method and device for generating chart Download PDF

Info

Publication number
CN114239530A
CN114239530A CN202111554789.1A CN202111554789A CN114239530A CN 114239530 A CN114239530 A CN 114239530A CN 202111554789 A CN202111554789 A CN 202111554789A CN 114239530 A CN114239530 A CN 114239530A
Authority
CN
China
Prior art keywords
chart
configuration information
file
style
data
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202111554789.1A
Other languages
Chinese (zh)
Inventor
陆耀
杨志勇
杨波
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
China Construction Bank Corp
Original Assignee
China Construction Bank Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by China Construction Bank Corp filed Critical China Construction Bank Corp
Priority to CN202111554789.1A priority Critical patent/CN114239530A/en
Publication of CN114239530A publication Critical patent/CN114239530A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/166Editing, e.g. inserting or deleting
    • G06F40/186Templates
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2455Query execution
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/25Integrating or interfacing systems involving database management systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/166Editing, e.g. inserting or deleting
    • G06F40/177Editing, e.g. inserting or deleting of tables; using ruled lines

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Physics & Mathematics (AREA)
  • Databases & Information Systems (AREA)
  • Computational Linguistics (AREA)
  • Data Mining & Analysis (AREA)
  • Health & Medical Sciences (AREA)
  • Artificial Intelligence (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • General Health & Medical Sciences (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention discloses a method and a device for generating a chart, and relates to the technical field of data visualization. One embodiment of the method comprises: responding to a chart generation request, analyzing a chart configuration file in a template file to obtain chart style configuration information and chart data configuration information, wherein the request comprises the chart style information and the chart data information of a chart to be generated; modifying the chart style configuration information according to the chart style information to obtain a chart style file of the chart to be generated; modifying the chart data configuration information according to the chart data information to obtain a chart data file of the chart to be generated; and generating a chart according to the chart style file and the chart data file. The implementation mode not only supports the adjustment of the chart style in a configuration mode, but also directly analyzes the chart configuration file, avoids the use of a third-party tool, enables the chart to be not limited by a JAVA environment, and facilitates better popularization and application.

Description

Method and device for generating chart
Technical Field
The invention relates to the technical field of data visualization, in particular to a method and a device for generating a chart.
Background
The chart can visually display the attribute of the statistical information, reflect the relationship among the data, is a means for visually and vividly visualizing the object data, can better understand the proportional relationship and the variation trend among the data by converting the data in the worksheet into the form of the chart, and reasonably deduces and predicts the researched object. At present, the chart is generated mainly by calling a third-party tool, and then the chart is inserted into a document so as to be used in practice.
In the process of implementing the invention, the inventor finds that the following problems exist in the prior art:
although the automatic generation of the chart can be realized by adopting a third-party tool, the requirements on the version of the JAVA environment are met, the low-version JAVA environment is not supported, and the popularization and the application of the low-version JAVA environment are not facilitated; the chart styles are not adjusted in a configuration mode, and the chart styles are not convenient to adjust flexibly.
Disclosure of Invention
In view of this, embodiments of the present invention provide a method and an apparatus for generating a chart, where the method includes obtaining chart style configuration information and chart data configuration information by parsing a chart configuration file, and modifying the chart style configuration information and the chart data configuration information according to request data to generate the chart, so that not only is adjustment of a chart style in a configuration manner supported, but also the chart configuration file is directly parsed, and a third-party tool is avoided, so that the method and the apparatus are not limited to a JAVA environment, and are convenient for better popularization and application.
To achieve the object, according to an aspect of an embodiment of the present invention, there is provided a method of chart generation, including:
responding to a chart generation request, analyzing a chart configuration file in a template file to obtain chart style configuration information and chart data configuration information, wherein the request comprises the chart style information and the chart data information of a chart to be generated;
modifying the chart style configuration information according to the chart style information to obtain a chart style file of the chart to be generated;
modifying the chart data configuration information according to the chart data information to obtain a chart data file of the chart to be generated;
and generating a chart according to the chart style file and the chart data file.
Optionally, the analyzing the chart configuration file in the template file to obtain the chart style configuration information and the chart data configuration information includes: and analyzing the chart configuration file in the template file by using a self-defined analysis interface and a JAVA program to obtain chart style configuration information and chart data configuration information.
Optionally, the graph configuration file is an extensible markup language file and is displayed in a tree structure, and each text region is a node of the tree structure; analyzing the chart configuration file in the template file to obtain chart style configuration information and chart data configuration information comprises the following steps: and searching child nodes layer by layer from the root node of the tree structure by using an extensible markup language file analysis tool so as to analyze the chart configuration file in the template file to obtain chart style configuration information and chart data configuration information.
Optionally, the chart style configuration information includes chart type configuration information, chart series configuration information, and chart structure configuration information; modifying the chart style configuration information according to the chart style information to obtain a chart style file of the chart to be generated, wherein the chart style file comprises: and modifying the chart type attribute value in the chart type configuration information, the chart series attribute value in the chart series configuration information and the chart structure attribute value in the chart structure configuration information respectively according to the chart type value, the chart series value and the chart structure value in the chart style information to obtain a chart style file of the chart to be generated.
Optionally, the chart style configuration information is stored in the database in an index form, and the chart type configuration information, the chart series configuration information and the chart structure configuration information included in the chart style configuration information are searched from the database through the index.
Optionally, modifying the chart data configuration information according to the chart data information to obtain a chart data file of the chart to be generated includes: and modifying the chart data attribute value in the chart data configuration information according to the chart data value in the chart data information to obtain a chart data file of the chart to be generated.
According to a second aspect of the embodiments of the present invention, there is provided an apparatus for chart generation, including:
the chart analysis module is used for responding to a chart generation request, analyzing a chart configuration file in the template file to obtain chart style configuration information and chart data configuration information, wherein the request comprises the chart style information and the chart data information of a chart to be generated;
the chart style acquisition module is used for modifying the chart style configuration information according to the chart style information to obtain a chart style file of the chart to be generated;
the chart data acquisition module is used for modifying the chart data configuration information according to the chart data information to obtain a chart data file of a chart to be generated;
and the chart generation module is used for generating a chart according to the chart style file and the chart data file.
Optionally, the chart parsing module is further configured to: and analyzing the chart configuration file in the template file by using a self-defined analysis interface and a JAVA program to obtain chart style configuration information and chart data configuration information.
Optionally, the graph configuration file is an extensible markup language file and is displayed in a tree structure, and each text region is a node of the tree structure; the parsing module is further configured to: and searching child nodes layer by layer from the root node of the tree structure by using an extensible markup language file analysis tool so as to analyze the chart configuration file in the template file to obtain chart style configuration information and chart data configuration information.
Optionally, the chart style configuration information includes chart type configuration information, chart series configuration information, and chart structure configuration information; the chart style acquisition module is further configured to: and modifying the chart type attribute value in the chart type configuration information, the chart series attribute value in the chart series configuration information and the chart structure attribute value in the chart structure configuration information respectively according to the chart type value, the chart series value and the chart structure value in the chart style information to obtain a chart style file of the chart to be generated.
Optionally, the chart style configuration information is stored in the database in an index form, and the chart type configuration information, the chart series configuration information and the chart structure configuration information included in the chart style configuration information are searched from the database through the index.
Optionally, the chart data obtaining module is further configured to: and modifying the chart data attribute value in the chart data configuration information according to the chart data value in the chart data information to obtain a chart data file of the chart to be generated.
According to a third aspect of the embodiments of the present invention, there is provided an electronic device for generating a chart, including:
one or more processors;
a storage device for storing one or more programs,
when the one or more programs are executed by the one or more processors, the one or more processors are caused to implement the method provided by the first aspect of the embodiments of the present invention.
According to a fourth aspect of embodiments of the present invention, there is provided a computer readable medium, on which a computer program is stored, which when executed by a processor, implements the method provided by the first aspect of embodiments of the present invention.
According to a fifth aspect of embodiments of the present invention, there is provided a computer program product comprising a computer program which, when executed by a processor, implements the method provided by the first aspect of embodiments of the present invention.
One embodiment of the invention has the following advantages or benefits: analyzing a chart configuration file in a template file to obtain chart style configuration information and chart data configuration information by responding to a chart generation request, wherein the request comprises the chart style information and the chart data information of a chart to be generated; modifying the chart style configuration information according to the chart style information to obtain a chart style file of the chart to be generated; modifying the chart data configuration information according to the chart data information to obtain a chart data file of the chart to be generated; according to the technical scheme of generating the chart according to the chart style file and the chart data file, the chart style configuration information and the chart data configuration information are obtained through analyzing the chart configuration file, the chart style configuration information and the chart data configuration information are modified respectively according to the request data, and the chart is generated.
Drawings
The drawings are included to provide a better understanding of the invention and are not to be construed as unduly limiting the invention. Wherein:
FIG. 1 is a schematic diagram of a main flow of a chart generation method according to an embodiment of the present invention;
FIG. 2 is a schematic diagram of a decompressed word template file according to an embodiment of the present invention;
FIG. 3 is a schematic diagram of a word graph template of an embodiment of the present invention;
FIG. 4 is a schematic diagram of a word graph generated in accordance with an embodiment of the present invention;
FIG. 5 is a schematic diagram of a word graph generated in accordance with another embodiment of the present invention;
FIG. 6 is a schematic diagram of the main blocks of a chart generation apparatus according to an embodiment of the present invention;
FIG. 7 is an exemplary system architecture diagram in which embodiments of the present invention may be employed;
fig. 8 is a schematic structural diagram of a computer system suitable for implementing a terminal device or a server according to an embodiment of the present invention.
Detailed Description
Exemplary embodiments of the present invention are described below with reference to the accompanying drawings, in which various details of embodiments of the invention are included to assist understanding, and which are to be considered as merely exemplary. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the invention. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
Although the automatic generation of the chart can be realized by adopting a third-party tool at present, the requirements on the version of the JAVA environment are met, the low-version JAVA environment is not supported, and the popularization and the application of the low-version JAVA environment are not facilitated; the method does not support the adjustment of the chart style in a configuration mode, is not convenient for flexibly adjusting the chart style, and cannot well meet the practical application.
In order to solve the problems in the prior art, the invention provides a chart generation method, which obtains chart style configuration information and chart data configuration information through analyzing a chart configuration file, modifies the chart style configuration information and the chart data configuration information according to request data, and generates a chart.
In the description of the embodiments of the present invention, the terms and their meanings are as follows:
XML file: extensible markup language, a subset of standard generalized markup language, is a markup language for marking electronic documents to be structured.
Fig. 1 is a schematic diagram of a main flow of a chart generation method according to an embodiment of the present invention, and as shown in fig. 1, the chart generation method according to the embodiment of the present invention includes steps S101 to S104 as follows.
Step S101, responding to a chart generation request, analyzing a chart configuration file in a template file to obtain chart style configuration information and chart data configuration information, wherein the request comprises the chart style information and the chart data information of a chart to be generated.
Specifically, before receiving a chart generation request, a configurable template file storing a chart template is created, and after receiving data, a client sends the chart generation request to a system, wherein the request comprises chart style information and chart data information of a chart to be generated.
According to an embodiment of the present invention, analyzing the chart configuration file in the template file to obtain the chart style configuration information and the chart data configuration information includes: and analyzing the chart configuration file in the template file by using a self-defined analysis interface and a JAVA program to obtain chart style configuration information and chart data configuration information.
Specifically, based on the created template file self-defined template analysis interface, according to the main attribute information of the chart object, a JAVA analysis program for a chart related configuration file in the template file is written, so as to obtain chart style configuration information and chart data configuration information of the template file.
According to one embodiment of the invention, the chart configuration file is an extensible markup language file and is displayed in a tree structure, and each text area is a node of the tree structure; analyzing the chart configuration file in the template file to obtain chart style configuration information and chart data configuration information comprises the following steps: and searching child nodes layer by layer from the root node of the tree structure by using an extensible markup language file analysis tool so as to analyze the chart configuration file in the template file to obtain chart style configuration information and chart data configuration information.
Exemplarily, taking a word template file as an example, the word file is a compressed package substantially composed of a plurality of configuration files, and the configuration files in XML (extensible markup language) format of different types (text, picture, diagram, etc.) in the document can be obtained by changing the extension name of the word template file into a zip file and then decompressing, or the XML configuration files can be extracted by other auxiliary software tools. Fig. 2 is a schematic diagram of a composition structure of a word template file after decompression in an embodiment of the present invention, a secondary directory word stores a main configuration file of a template document, where chart1.xml and chart2.xml under a chart directory are configuration files of two charts in the template document respectively, and describe types, structures, and data information of the charts, and Microsoft _ Excel __. xlsxsxsxx and Microsoft _ Excel __. xlsxx under an embedding directory are Excel table data corresponding to the two charts respectively. The XML configuration file is displayed in a tree structure, each character area is a node of the tree structure, the XML configuration file is gradually expanded to each branch and leaf node from a root node, and child nodes are searched layer by layer from the root nodes of the XML configuration file chart1.XML and chart2.XML by using an XML analysis tool, so that the chart style configuration information and the chart data configuration information in the word template file are obtained.
And S102, modifying the chart style configuration information according to the chart style information to obtain a chart style file of the chart to be generated.
Specifically, in order to flexibly generate different chart styles to meet practical use, the same chart template as that of the document system can be adopted, and the chart style configuration information obtained by analysis is modified according to the style information of the chart in the request to obtain the chart style file of the chart to be generated, so that the requirement of flexibly configuring the chart styles is met, the consistency with the document style is ensured, and the overall visual aesthetic feeling is improved.
According to an embodiment of the present invention, the chart style configuration information includes chart type configuration information, chart series configuration information, and chart structure configuration information; modifying the chart style configuration information according to the chart style information to obtain a chart style file of the chart to be generated, wherein the chart style file comprises: and modifying the chart type attribute value in the chart type configuration information, the chart series attribute value in the chart series configuration information and the chart structure attribute value in the chart structure configuration information respectively according to the chart type value, the chart series value and the chart structure value in the chart style information to obtain a chart style file of the chart to be generated.
Specifically, the attribute information of the chart style mainly comprises a chart type, a chart series and a chart structure, wherein the chart type comprises a column chart, a line chart, a pie chart and the like; chart series are used to characterize the specific meaning of a chart, such as chart series and categories in a word chart style; chart structures are used to characterize the composite structure of a chart type, such as clustered columns, stacked columns, percentage stacked columns, etc., for which the chart format may also be personalized by setting the alignment percentages. And modifying and storing the chart type configuration information obtained by analysis according to the chart type value, the chart series value and the chart structure value respectively according to the chart style information in the request to obtain a chart style file of the chart to be generated.
According to another embodiment of the present invention, the chart style configuration information is stored in the database in an index form, and the chart type configuration information, the chart series configuration information and the chart structure configuration information included in the chart style configuration information are searched from the database through the index.
Specifically, when the template file is created, configuration information of various types of chart styles needs to be stored, the configuration information of specific chart styles corresponding to the various types of chart styles can be searched from the database through a chart index in a database mode, and the configuration information of the chart styles can be known according to the attribute information of the chart styles, wherein the configuration information of the chart styles comprises the configuration information of the chart types, the configuration information of the chart series and the configuration information of the chart structure.
Through the analysis of the chart configuration file and the modification of the chart style configuration information, the generation of the dynamic chart style in a flexible and configurable manner is realized, so that the actual application scene is better met.
And S103, modifying the chart data configuration information according to the chart data information to obtain a chart data file of the chart to be generated.
According to an embodiment of the present invention, modifying the chart data configuration information according to the chart data information to obtain a chart data file of a chart to be generated includes: and modifying the chart data attribute value in the chart data configuration information according to the chart data value in the chart data information to obtain a chart data file of the chart to be generated.
Specifically, based on the chart data configuration information obtained by analyzing the chart configuration file, a chart data value is obtained according to the chart data information in the chart generation request, and the chart data attribute value in the chart data configuration information is modified and stored, so that a chart data file of the chart to be generated is obtained.
Additionally, for the excel table file corresponding to the graph, the field of the excel table corresponding to the graph is replaced and stored according to the graph data value and the graph format information, so that the stability and reliability of the subsequently generated graph are ensured.
Exemplarily, table 1 is excel table data corresponding to a graph in a word template file, which is specifically shown as follows:
TABLE 1
Series 1 Series 2 Series 3
Class 1 4.3 2.4 2
Class 2 2.5 4.4 2
According to the chart generation request, data charts respectively representing mobile types, communication types and telecommunication types of the mobile phone and the broadband need to be generated, and the specific data are 5.1, 2.4 and 2 of the mobile, communication and telecommunication data of the mobile phone and the broadband respectively; 2.5, 4.4 and 2, the columns in table 1 are replaced to obtain the following table 2.
TABLE 2
Move Are communicated Telecommunications
Mobile phone 5.1 2.4 2
Wide band 2.5 4.4 2
And step S104, generating a chart according to the chart style file and the chart data file.
By the method for analyzing the chart configuration file by the self-defined analysis interface and the JAVA program and generating the chart file according to the pattern information and the data information of the chart in the chart generation request, the chart pattern is adjusted in a configuration mode, the chart configuration file is directly analyzed, a third-party tool is avoided, the method is not limited by a JAVA environment, and the method is convenient for popularization and application.
FIG. 3 is a schematic diagram of a word chart template according to an embodiment of the present invention, which is a clustered column chart showing two categories of chart templates of three series of data, respectively.
Fig. 4 is a schematic diagram of a word graph generated according to an embodiment of the present invention, which is a graph generated by using the graph types and structures of the graph templates, and updates three series of graphs, i.e., mobile, unicom and telecom, and two types of graphs, i.e., mobile phone and broadband, and corresponding data.
Fig. 5 is a schematic diagram of a word graph generated according to another embodiment of the present invention, where the graph category is updated to be a stacked bar graph based on fig. 4, and a stacked configuration with hundred percent alignment is adopted to generate the graph.
FIG. 6 is a schematic diagram of the main blocks of a chart generation apparatus according to an embodiment of the present invention. As shown in fig. 6, the chart generating apparatus 600 mainly includes a chart parsing module 601, a chart style obtaining module 602, a chart data obtaining module 603, and a chart generating module 604.
The chart parsing module 601 is configured to parse a chart configuration file in a template file to obtain chart style configuration information and chart data configuration information in response to a chart generation request, where the request includes the chart style information and the chart data information of a chart to be generated.
And the chart style acquisition module 602 is configured to modify the chart style configuration information according to the chart style information to obtain a chart style file of the chart to be generated.
The chart data obtaining module 603 is configured to modify the chart data configuration information according to the chart data information, so as to obtain a chart data file of the chart to be generated.
The chart generating module 604 is configured to generate a chart according to the chart style file and the chart data file.
Specifically, the chart parsing module 601 may further be configured to: and analyzing the chart configuration file in the template file by using a self-defined analysis interface and a JAVA program to obtain chart style configuration information and chart data configuration information.
Specifically, the graph configuration file is an extensible markup language file and is displayed in a tree structure, and each text region is a node of the tree structure; the chart parsing module 601 may also be configured to: and searching child nodes layer by layer from the root node of the tree structure by using an extensible markup language file analysis tool so as to analyze the chart configuration file in the template file to obtain chart style configuration information and chart data configuration information.
Specifically, the chart style configuration information includes chart type configuration information, chart series configuration information, and chart structure configuration information; the chart style acquisition module 602 may also be configured to: and modifying the chart type attribute value in the chart type configuration information, the chart series attribute value in the chart series configuration information and the chart structure attribute value in the chart structure configuration information respectively according to the chart type value, the chart series value and the chart structure value in the chart style information to obtain a chart style file of the chart to be generated.
Specifically, the chart style configuration information is stored in the database in an index form, and chart type configuration information, chart series configuration information and chart structure configuration information included in the chart style configuration information are searched from the database through indexes.
Specifically, the chart data obtaining module 603 may be further configured to: and modifying the chart data attribute value in the chart data configuration information according to the chart data value in the chart data information to obtain a chart data file of the chart to be generated.
According to a further aspect of the invention, a computer program product of the invention, comprising a computer program which, when executed by a processor, carries out the method of graph generation in an embodiment of the invention.
Fig. 7 illustrates an exemplary system architecture 700 to which the method of chart generation or the apparatus of chart generation of an embodiment of the present invention may be applied.
As shown in fig. 7, the system architecture 700 may include terminal devices 701, 702, 703, a network 704, and a server 705. The network 704 serves to provide a medium for communication links between the terminal devices 701, 702, 703 and the server 705. Network 704 may include various connection types, such as wired, wireless communication links, or fiber optic cables, to name a few.
A user may use the terminal devices 701, 702, 703 to interact with a server 705 over a network 704, to receive or send messages or the like. Various communication client applications, such as a graph generation application, etc. (for example only), may be installed on the terminal devices 701, 702, 703.
The terminal devices 701, 702, 703 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop portable computers, desktop computers, and the like.
The server 705 may be a server providing various services, such as a background management server (for example only) providing support for the generation of charts by users with the terminal devices 701, 702, 703. The background management server can respond to a chart generation request, analyze a chart configuration file in the template file to obtain chart style configuration information and chart data configuration information, wherein the request comprises the chart style information and the chart data information of a chart to be generated; modifying the chart style configuration information according to the chart style information to obtain a chart style file of the chart to be generated; modifying the chart data configuration information according to the chart data information to obtain a chart data file of the chart to be generated; and generating a chart and other processing according to the chart style file and the chart data file, and feeding back a processing result (such as chart data and the like, for example only) to the terminal equipment.
It should be noted that the method for generating a graph provided by the embodiment of the present invention is generally executed by the server 705, and accordingly, the apparatus for generating a graph is generally disposed in the server 705.
It should be understood that the number of terminal devices, networks, and servers in fig. 7 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
Referring now to FIG. 8, shown is a block diagram of a computer system 800 suitable for use with a terminal device or server implementing an embodiment of the present invention. The terminal device or the server shown in fig. 8 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present invention.
As shown in fig. 8, the computer system 800 includes a Central Processing Unit (CPU)801 that can perform various appropriate actions and processes in accordance with a program stored in a Read Only Memory (ROM)802 or a program loaded from a storage section 808 into a Random Access Memory (RAM) 803. In the RAM 803, various programs and data necessary for the operation of the system 800 are also stored. The CPU 801, ROM 802, and RAM 803 are connected to each other via a bus 804. An input/output (I/O) interface 805 is also connected to bus 804.
The following components are connected to the I/O interface 805: an input portion 806 including a keyboard, a mouse, and the like; an output section 807 including a signal such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker; a storage portion 808 including a hard disk and the like; and a communication section 809 including a network interface card such as a LAN card, a modem, or the like. The communication section 809 performs communication processing via a network such as the internet. A drive 810 is also connected to the I/O interface 805 as necessary. A removable medium 811 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 810 as necessary, so that a computer program read out therefrom is mounted on the storage section 808 as necessary.
In particular, according to the embodiments of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method illustrated in the flow chart. In such an embodiment, the computer program can be downloaded and installed from a network through the communication section 809 and/or installed from the removable medium 811. The computer program executes the above-described functions defined in the system of the present invention when executed by the Central Processing Unit (CPU) 801.
It should be noted that the computer readable medium shown in the present invention can be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present invention, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In the present invention, however, a computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, fiber optic cable, RF, etc., or any suitable combination of the foregoing.
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units described in the embodiments of the present invention may be implemented by software or hardware. The described units may also be provided in a processor, and may be described as: a processor comprising: the device comprises a chart analyzing module, a chart style acquiring module, a chart data acquiring module and a chart generating module.
The names of these modules do not in some cases constitute a limitation on the module itself, and for example, the chart generation module may also be described as a "module for generating a chart from the chart style file and the chart data file".
In another aspect, the present invention also provides a computer-readable medium, which may be contained in the apparatus described in the embodiments; or may be separate and not incorporated into the device. The computer readable medium carries one or more programs which, when executed by an apparatus, cause the apparatus to comprise: responding to a chart generation request, analyzing a chart configuration file in a template file to obtain chart style configuration information and chart data configuration information, wherein the request comprises the chart style information and the chart data information of a chart to be generated; modifying the chart style configuration information according to the chart style information to obtain a chart style file of the chart to be generated; modifying the chart data configuration information according to the chart data information to obtain a chart data file of the chart to be generated; and generating a chart according to the chart style file and the chart data file.
According to the technical scheme of the embodiment of the invention, the method has the following advantages or beneficial effects: analyzing a chart configuration file in a template file to obtain chart style configuration information and chart data configuration information by responding to a chart generation request, wherein the request comprises the chart style information and the chart data information of a chart to be generated; modifying the chart style configuration information according to the chart style information to obtain a chart style file of the chart to be generated; modifying the chart data configuration information according to the chart data information to obtain a chart data file of the chart to be generated; according to the technical scheme of generating the chart according to the chart style file and the chart data file, the chart style configuration information and the chart data configuration information are obtained through analyzing the chart configuration file, the chart style configuration information and the chart data configuration information are modified respectively according to the request data, and the chart is generated.
The specific embodiments are not to be construed as limiting the scope of the invention. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions can occur, depending on design requirements and other factors. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims (15)

1. A method of chart generation, comprising:
responding to a chart generation request, analyzing a chart configuration file in a template file to obtain chart style configuration information and chart data configuration information, wherein the request comprises the chart style information and the chart data information of a chart to be generated;
modifying the chart style configuration information according to the chart style information to obtain a chart style file of the chart to be generated;
modifying the chart data configuration information according to the chart data information to obtain a chart data file of the chart to be generated;
and generating a chart according to the chart style file and the chart data file.
2. The method of claim 1, wherein parsing the chart configuration file in the template file to obtain chart style configuration information and chart data configuration information comprises:
and analyzing the chart configuration file in the template file by using a self-defined analysis interface and a JAVA program to obtain chart style configuration information and chart data configuration information.
3. The method of claim 2, wherein the graph configuration file is an xml file and is displayed in a tree structure, and each text region is a node of the tree structure;
analyzing the chart configuration file in the template file to obtain chart style configuration information and chart data configuration information comprises the following steps:
and searching child nodes layer by layer from the root node of the tree structure by using an extensible markup language file analysis tool so as to analyze the chart configuration file in the template file to obtain chart style configuration information and chart data configuration information.
4. The method of claim 1, wherein the chart style configuration information includes chart type configuration information, chart series configuration information, and chart structure configuration information;
modifying the chart style configuration information according to the chart style information to obtain a chart style file of the chart to be generated, wherein the chart style file comprises:
and modifying the chart type attribute value in the chart type configuration information, the chart series attribute value in the chart series configuration information and the chart structure attribute value in the chart structure configuration information respectively according to the chart type value, the chart series value and the chart structure value in the chart style information to obtain a chart style file of the chart to be generated.
5. The method according to claim 1 or 4, wherein the chart style configuration information is stored in the database in an index form, and the chart type configuration information, the chart series configuration information and the chart structure configuration information included in the chart style configuration information are searched from the database through the index.
6. The method of claim 1, wherein modifying the chart data configuration information according to the chart data information to obtain a chart data file of a chart to be generated comprises:
and modifying the chart data attribute value in the chart data configuration information according to the chart data value in the chart data information to obtain a chart data file of the chart to be generated.
7. An apparatus for chart generation, comprising:
the chart analysis module is used for responding to a chart generation request, analyzing a chart configuration file in the template file to obtain chart style configuration information and chart data configuration information, wherein the request comprises the chart style information and the chart data information of a chart to be generated;
the chart style acquisition module is used for modifying the chart style configuration information according to the chart style information to obtain a chart style file of the chart to be generated;
the chart data acquisition module is used for modifying the chart data configuration information according to the chart data information to obtain a chart data file of a chart to be generated;
and the chart generation module is used for generating a chart according to the chart style file and the chart data file.
8. The apparatus of claim 7, wherein the graph parsing module is further configured to:
and analyzing the chart configuration file in the template file by using a self-defined analysis interface and a JAVA program to obtain chart style configuration information and chart data configuration information.
9. The apparatus of claim 8, wherein the graph configuration file is an xml file and is displayed in a tree structure, and each text region is a node of the tree structure;
the parsing module is further configured to:
and searching child nodes layer by layer from the root node of the tree structure by using an extensible markup language file analysis tool so as to analyze the chart configuration file in the template file to obtain chart style configuration information and chart data configuration information.
10. The apparatus of claim 7, wherein the chart style configuration information comprises chart type configuration information, chart series configuration information, and chart structure configuration information;
the chart style acquisition module is further configured to:
and modifying the chart type attribute value in the chart type configuration information, the chart series attribute value in the chart series configuration information and the chart structure attribute value in the chart structure configuration information respectively according to the chart type value, the chart series value and the chart structure value in the chart style information to obtain a chart style file of the chart to be generated.
11. The apparatus according to claim 7 or 10, wherein the chart style configuration information is stored in the database in an index form, and the chart type configuration information, the chart series configuration information and the chart structure configuration information included in the chart style configuration information are searched from the database by the index.
12. The apparatus of claim 7, wherein the graph data acquisition module is further configured to:
and modifying the chart data attribute value in the chart data configuration information according to the chart data value in the chart data information to obtain a chart data file of the chart to be generated.
13. A mobile electronic device terminal, comprising:
one or more processors;
a storage device for storing one or more programs,
when executed by the one or more processors, cause the one or more processors to implement the method of any one of claims 1-6.
14. A computer-readable medium, on which a computer program is stored, which, when being executed by a processor, carries out the method according to any one of claims 1-6.
15. A computer program product comprising a computer program, characterized in that the computer program realizes the method according to any of claims 1-6 when executed by a processor.
CN202111554789.1A 2021-12-17 2021-12-17 Method and device for generating chart Pending CN114239530A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111554789.1A CN114239530A (en) 2021-12-17 2021-12-17 Method and device for generating chart

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111554789.1A CN114239530A (en) 2021-12-17 2021-12-17 Method and device for generating chart

Publications (1)

Publication Number Publication Date
CN114239530A true CN114239530A (en) 2022-03-25

Family

ID=80758459

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111554789.1A Pending CN114239530A (en) 2021-12-17 2021-12-17 Method and device for generating chart

Country Status (1)

Country Link
CN (1) CN114239530A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116048480A (en) * 2023-04-04 2023-05-02 青岛普瑞盛医药科技有限公司 Method and device for automatically generating chart based on code tool

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116048480A (en) * 2023-04-04 2023-05-02 青岛普瑞盛医药科技有限公司 Method and device for automatically generating chart based on code tool

Similar Documents

Publication Publication Date Title
CN107491488B (en) Page data acquisition method and device
CN107832045B (en) Method and apparatus for cross programming language interface conversion
CN107491382B (en) Log output method and device
CN112286513A (en) Visual design method and device based on component metadata
CN112633691A (en) Method and device for generating custom approval process
CN109683998A (en) Internationalize implementation method, device and system
CN108958826B (en) Method and device for dynamically configuring application installation package
CN110795147A (en) Interface protocol file management method and device
CN110705271B (en) System and method for providing natural language processing service
CN111666293A (en) Database access method and device
CN110134427A (en) A kind of method and apparatus generating code file
CN113626223A (en) Interface calling method and device
CN112199373A (en) Form development method and system
CN113031946A (en) Method and device for rendering page component
CN113467775A (en) Method and device for generating page
CN113641700A (en) Data processing method and device based on Spring boot frame
CN112486482A (en) Page display method and device
CN112926008B (en) Method, device, electronic equipment and storage medium for generating form page
CN114239530A (en) Method and device for generating chart
CN113536748A (en) Method and device for generating chart data
CN113312053A (en) Data processing method and device
CN110858240A (en) Front-end module loading method and device
CN118093070A (en) Page rendering display method and device
CN111177183B (en) Method and device for generating database access statement
CN113110873A (en) Method and apparatus for unifying system coding specifications

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination