CN112015418A - Chart generation method and device, computer equipment and storage medium - Google Patents

Chart generation method and device, computer equipment and storage medium Download PDF

Info

Publication number
CN112015418A
CN112015418A CN202010918902.9A CN202010918902A CN112015418A CN 112015418 A CN112015418 A CN 112015418A CN 202010918902 A CN202010918902 A CN 202010918902A CN 112015418 A CN112015418 A CN 112015418A
Authority
CN
China
Prior art keywords
chart
information
graph
target
type
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
CN202010918902.9A
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.)
Ping An Technology Shenzhen Co Ltd
Original Assignee
Ping An Technology Shenzhen Co Ltd
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 Ping An Technology Shenzhen Co Ltd filed Critical Ping An Technology Shenzhen Co Ltd
Priority to CN202010918902.9A priority Critical patent/CN112015418A/en
Publication of CN112015418A publication Critical patent/CN112015418A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/38Creation or generation of source code for implementing user interfaces

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Human Computer Interaction (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • User Interface Of Digital Computer (AREA)

Abstract

The invention relates to the technical field of data processing, relates to a block chain technology, and provides a chart generation method, a chart generation device, computer equipment and a storage medium, wherein the method comprises the following steps: when a chart generation instruction is received, determining to-be-processed information corresponding to the chart generation instruction; extracting diagram data and diagram types from the information to be processed, and generating a configuration file according to the diagram data; searching a target chart generator corresponding to the chart type; inputting the configuration file into a target chart generator so that the target chart generator generates a chart to be selected based on the configuration file; and carrying out graph verification on the graph to be selected, and taking the graph to be selected as a target graph when the graph passes the verification. Wherein the information to be processed may be stored in a block chain. And searching a target chart generator corresponding to the chart type, generating a configuration file according to the chart data, and inputting the configuration file into the target chart generator to further obtain the target chart, so that the chart generation difficulty is reduced, and the chart generation efficiency is improved.

Description

Chart generation method and device, computer equipment and storage medium
Technical Field
The present invention relates to the field of data processing technologies, and in particular, to a method and an apparatus for generating a graph, a computer device, and a storage medium.
Background
There are many ways to generate visual charts in the market, but these ways not only need various complex APIs and attributes, but also have a relatively high learning cost, developers often need to do much work of looking up and using documents before development, which is not only time-consuming, but also many APIs that need to be used are difficult to find at the first time, and in the development process, there are many similarities and commonalities between charts and charts, but many times, because of being limited by the limitation of the framework, they cannot be used universally, so that codes and logic are copied continuously in the development process, and thus many redundant codes are generated, and the efficiency of developers is wasted.
For example, in a visualization project, there are various charts such as a bar chart, a line chart, and a pie chart, but developers usually put the same code in different pages, which results in that the code required by a plurality of charts is the same, and this repeated labor not only wastes the time of the developers, but also reduces the quality of the code, which results in a problem of difficult maintenance in the later requirement.
The above is only for the purpose of assisting understanding of the technical aspects of the present invention, and does not represent an admission that the above is prior art.
Disclosure of Invention
The invention mainly aims to provide a chart generation method, a chart generation device, computer equipment and a storage medium, and aims to solve the technical problems of complex chart generation mode and low efficiency in the prior art.
In order to achieve the above object, the present invention provides a chart generating method, including the steps of:
when a chart generation instruction is received, determining to-be-processed information corresponding to the chart generation instruction, wherein the to-be-processed information is stored in a block chain;
extracting chart data and chart types from the information to be processed, and generating a configuration file according to the chart data;
searching a target chart generator corresponding to the chart type;
inputting the configuration file into the target chart generator so that the target chart generator generates a chart to be selected based on the configuration file and feeds back the chart to be selected;
and carrying out graph verification on the graph to be selected, and taking the graph to be selected as a target graph when the graph passes the verification.
Optionally, the step of searching for the target chart generator corresponding to the chart type includes:
matching the chart type with a chart type to be selected in a mapping list, wherein the mapping list records the corresponding relation between the chart type to be selected and the chart generator;
taking the chart type to be selected matched with the chart type as a target chart type, and taking a chart generator corresponding to the target chart type as a target chart generator;
before the step of matching the chart type with the chart type to be selected in the mapping list, the method further comprises the following steps:
acquiring a graph type to be selected and graph type information corresponding to the graph type to be selected;
generating a chart container according to the chart type information, and taking the chart container as a chart generator;
and establishing a mapping list according to the type of the chart to be selected and the chart generator.
Optionally, the step of generating a chart container according to the chart type information includes:
determining chart requirement information according to the chart type information;
extracting personalized requirement information from the chart requirement information, and searching general requirement information corresponding to the chart type;
and generating a chart container according to the general requirement information and the personalized requirement information.
Optionally, the step of generating a chart container according to the general requirement information and the personalized requirement information includes:
extracting diagram abscissa axis information, diagram ordinate axis information and diagram field information from the general requirement information;
generating first chart configuration information according to the chart abscissa axis information, the chart ordinate axis information and the chart field information;
extracting chart title information, chart element color information, chart axis display information and chart element distance information from the personalized requirement information;
generating second chart configuration information according to the chart title information, the chart element color information, the chart axis display information and the chart element distance information;
and generating a chart container according to the first chart configuration information and the second chart configuration information.
Optionally, the step of performing graph verification on the graph to be selected, and when the graph to be selected passes the verification, taking the graph to be selected as a target graph includes:
performing graph detection on the graph to be selected to judge whether the graph to be selected is a blank graph or not;
when the graph to be selected is not the blank graph, performing data structure analysis on the graph to be selected to obtain a data structure to be selected corresponding to the graph to be selected;
searching a reference data structure corresponding to the chart type, and comparing the data structure to be selected with the reference data structure;
and when the data structure to be selected is consistent with the reference data structure, taking the chart to be selected as a target chart.
Optionally, the chart verification of the graph to be selected, and when the graph to be selected passes the verification, after the step of taking the graph to be selected as the target graph, the method further includes:
when a chart modification instruction is received, determining chart modification information corresponding to the chart modification instruction;
extracting modification data from the chart modification information;
and inputting the modification data into the target chart generator, and modifying the target chart through the target chart generator based on the modification data to obtain a modified target chart.
Optionally, after the step of performing chart verification on the chart to be selected, the method further includes:
when the verification fails, judging that the graph is abnormal, and searching corresponding graph abnormal information;
generating a chart abnormity prompting interface based on the chart abnormity information;
and displaying the chart abnormity prompting interface to prompt the user that the chart is abnormal.
In order to achieve the above object, the present invention also provides a chart generating apparatus including:
the information acquisition module is used for determining to-be-processed information corresponding to a chart generation instruction when the chart generation instruction is received, wherein the to-be-processed information is stored in a block chain;
the information processing module is used for extracting chart data and chart types from the information to be processed and generating a configuration file according to the chart data;
the target searching module is used for searching the target chart generator corresponding to the chart type;
the chart generation module is used for inputting the configuration file into the target chart generator so as to enable the target chart generator to generate a chart to be selected based on the configuration file and feed back the chart to be selected;
and the target chart module is used for carrying out chart verification on the chart to be selected, and taking the chart to be selected as the target chart when the verification is passed.
In addition, to achieve the above object, the present invention also provides a computer device, including: a memory, a processor, and a chart generation program stored on the memory and executable on the processor, the chart generation program configured with steps to implement the chart generation method as described above.
In order to achieve the above object, the present invention further provides a storage medium having a chart generation program stored thereon, wherein the chart generation program, when executed by a processor, implements the steps of the chart generation method as described above.
The chart generation method provided by the invention comprises the steps of determining to-be-processed information corresponding to a chart generation instruction when the chart generation instruction is received; extracting chart data and chart types from the information to be processed, and generating a configuration file according to the chart data; searching a target chart generator corresponding to the chart type; inputting the configuration file into the target chart generator so that the target chart generator generates a chart to be selected based on the configuration file and feeds back the chart to be selected; and carrying out graph verification on the graph to be selected, and taking the graph to be selected as a target graph when the graph passes the verification. Wherein the information to be processed may be stored in a block chain. Therefore, the target chart generator corresponding to the chart type is searched, the configuration file is generated according to the chart data, the configuration file is input into the target chart generator, the target chart is obtained, the chart generation difficulty is reduced, and the chart generation efficiency is improved.
Drawings
FIG. 1 is a schematic diagram of a computer device architecture of a hardware operating environment according to an embodiment of the present invention;
FIG. 2 is a schematic flow chart diagram illustrating a first embodiment of a chart generation method according to the present invention;
FIG. 3 is a schematic flow chart diagram illustrating a chart generation method according to a second embodiment of the present invention;
FIG. 4 is a schematic flow chart diagram illustrating a third exemplary method for generating a graph according to the present invention;
FIG. 5 is a functional block diagram of a chart generating apparatus according to a first embodiment of the present invention.
The implementation, functional features and advantages of the objects of the present invention will be further explained with reference to the accompanying drawings.
Detailed Description
It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
Referring to fig. 1, fig. 1 is a schematic structural diagram of a computer device in a hardware operating environment according to an embodiment of the present invention.
As shown in fig. 1, the computer apparatus may include: a processor 1001, such as a Central Processing Unit (CPU), a communication bus 1002, a user interface 1003, a network interface 1004, and a memory 1005. Wherein a communication bus 1002 is used to enable connective communication between these components. The user interface 1003 may comprise a Display screen (Display), an input unit such as keys, and the optional user interface 1003 may also comprise a standard wired interface, a wireless interface. The network interface 1004 may optionally include a standard wired interface, a wireless interface (e.g., WI-FI interface). The Memory 1005 may be a Random Access Memory (RAM) Memory or a non-volatile Memory (e.g., a magnetic disk Memory). The memory 1005 may alternatively be a storage device separate from the processor 1001.
Those skilled in the art will appreciate that the device architecture shown in fig. 1 is not intended to be limiting of computer devices and may include more or fewer components than those shown, or some components may be combined, or a different arrangement of components.
As shown in fig. 1, a memory 1005, which is a storage medium, may include therein an operating system, a network communication module, a user interface module, and a chart generation program.
In the computer device shown in fig. 1, the network interface 1004 is mainly used for connecting an external network and performing data communication with other network devices; the user interface 1003 is mainly used for connecting to a user equipment and performing data communication with the user equipment; the apparatus of the present invention calls the chart generation program stored in the memory 1005 through the processor 1001 and executes the chart generation method provided by the embodiment of the present invention.
Based on the above hardware structure, an embodiment of the graph generation method of the present invention is provided.
Referring to fig. 2, fig. 2 is a flowchart illustrating a chart generating method according to a first embodiment of the present invention.
In a first embodiment, the chart generating method includes the steps of:
step S10, when receiving the chart generation instruction, determining information to be processed corresponding to the chart generation instruction, where the information to be processed is stored in the blockchain.
It should be noted that, the execution subject in this embodiment may be a computer device, and may also be other devices that can achieve the same or similar functions.
It should be noted that the computer device may be a terminal device such as a desktop computer, a notebook computer, a tablet computer, a mobile phone, or other devices, which is not limited in this embodiment.
It should be understood that, when the chart generation instruction is received, it is described that the user needs to perform the chart generation operation at this time, and the to-be-processed information corresponding to the chart generation instruction can be acquired. The information to be processed may be input by a user while inputting a chart generation instruction, may also be input in advance and stored in a local database, and the operation of acquiring the information to be processed is triggered when the user inputs the chart generation instruction.
It is emphasized that, in order to further ensure the privacy and security of the information to be processed, the information to be processed may also be stored in a node of a block chain.
It should be understood that the information to be processed includes information such as chart data and chart type, and may also include other information, which is not limited in this embodiment.
And step S20, extracting chart data and chart types from the information to be processed, and generating a configuration file according to the chart data.
It should be noted that the chart types may include a bar chart, a line chart, a pie chart, and the like, and may also be other types of charts, which is not limited by the embodiment. The chart data is data of a chart to be generated, and a target chart is generated according to the chart data.
It should be understood that a plurality of configuration items may be generated from the chart data, and a configuration file may be generated from the configuration items.
In a specific implementation, for example, the chart data may include data such as name data, age data, occupational data, and the like, and therefore, the data may be extracted from the chart data, and corresponding configuration items may be generated according to the data, for example, a corresponding name configuration item may be generated according to the name data, a corresponding age configuration item may be generated according to the age data, a corresponding occupational configuration item may be generated according to the occupational data, and a configuration file may be generated according to the name configuration item, the age configuration item, and the occupational configuration item.
And step S30, searching the target chart generator corresponding to the chart type.
It should be appreciated that after determining the chart type, the target chart generator to which the chart type corresponds may be looked up. The method for searching for the target chart generator corresponding to the chart type may be to search from a database, or may also be to search from a mapping list, which is not limited in this embodiment.
It can be understood that, the database and the mapping list may record a corresponding relationship between the chart type and the chart generator, and the target chart generator corresponding to the chart type may be searched according to the corresponding relationship. The target chart generator has the function that the chart can be automatically generated according to the configuration file without the operation of a user.
Step S40, inputting the configuration file into the target chart generator, so that the target chart generator generates a chart to be selected based on the configuration file, and feeds back the chart to be selected.
It should be appreciated that after generating the configuration file and determining the target chart generator, the configuration file may be input into the target chart generator, and the target chart generator may generate the candidate chart based on the configuration file.
In a specific implementation, the target graph generator may be wrapped based on the exact component to obtain a Search component; inputting the configuration file into the target chart generator through the Search component, so that the target chart generator generates a chart to be selected based on the configuration file, and feeding back the chart to be selected. For example, when the target graph generator needs to be used, an Import Search from 'Search' may be introduced as follows, so that in a DOM (Document Object Model) structure to be exposed, < Search config ═ config }/>, the target graph generator is called, and the configuration file is input into the target graph generator, so as to obtain a graph to be selected. The configuration file may also be input into the target chart generator by other ways, which is not limited in this embodiment.
And step S50, performing graph verification on the graph to be selected, and taking the graph to be selected as a target graph when the graph passes the verification.
It should be understood that, in the process of generating the diagram, a problem of a back-end input error may occur, where the back-end input error mainly refers to that, due to a problem occurring in logic in a back-end code, data transmitted to the front end is empty, and a data structure corresponding to the diagram is inconsistent, so that a back-end error is reported to cause an exception to be displayed on the diagram of the front end, which may seriously crash a front-end page and block user operations.
In this embodiment, chart verification may be performed on the chart to be selected, the chart to be selected is used as the target chart only when the verification passes, if the data in the chart to be selected is found to be empty during verification, evacuation processing is directly performed, a page shows an empty state, if the data structure is wrong, compatible processing is performed, if the data structure is correct, normal display is performed, otherwise, the wrong type of the user is automatically prompted, and the page display is not affected and does not block any operation of the user.
In this embodiment, when a chart generation instruction is received, to-be-processed information corresponding to the chart generation instruction is determined; extracting chart data and chart types from the information to be processed, and generating a configuration file according to the chart data; searching a target chart generator corresponding to the chart type; inputting the configuration file into the target chart generator so that the target chart generator generates a chart to be selected based on the configuration file and feeds back the chart to be selected; and carrying out graph verification on the graph to be selected, and taking the graph to be selected as a target graph when the graph passes the verification. Wherein the information to be processed may be stored in a block chain. Therefore, the target chart generator corresponding to the chart type is searched, the configuration file is generated according to the chart data, the configuration file is input into the target chart generator, the target chart is obtained, the chart generation difficulty is reduced, and the chart generation efficiency is improved.
In an embodiment, as shown in fig. 3, a second embodiment of the chart generating method according to the present invention is proposed based on the first embodiment, and the step S30 includes:
step S301, matching the chart type with a chart type to be selected in a mapping list, wherein the mapping list records a corresponding relation between the chart type to be selected and the chart generator.
It should be appreciated that the target chart generator corresponding to the chart type can be looked up from the mapping list. Wherein, the mapping list comprises: and the graph type to be selected and the graph generator record the corresponding relation between the graph type to be selected and the graph generator.
It can be understood that the chart generator to be selected corresponding to the chart type can be matched in the mapping list, and then the target chart generator is determined according to the corresponding relation between the chart generator to be selected and the chart generator.
Step S302, the graph type to be selected which is matched with the graph type is used as a target graph type, and a graph generator which corresponds to the target graph type is used as a target graph generator.
It is understood that the candidate chart type matching the chart type can be used as the target chart type, and then the chart generator corresponding to the target chart type is searched, and the on-icon generator corresponding to the target chart type is used as the target chart generator.
In a specific implementation, for example, the mapping list may include a to-be-selected chart type a, a to-be-selected chart type B, a to-be-selected chart type C, a chart generator a, a chart generator B, and a chart generator C, where the to-be-selected chart type a corresponds to the chart generator a, the to-be-selected chart type B corresponds to the chart generator B, and the to-be-selected chart type C corresponds to the chart generator C. And (3) the chart type extracted from the information to be processed is consistent with the chart type C to be selected, namely the chart type is matched with the chart type C to be selected, the chart type C to be selected is used as a target chart type, and a chart generator C corresponding to the target chart type is used as a target chart generator.
Before the step S30, the method further includes:
and S001, acquiring the type of the chart to be selected and the chart type information corresponding to the type of the chart to be selected.
It should be understood that the types of charts to be selected may be obtained in advance, the chart type information corresponding to each type of chart to be selected is obtained, and the corresponding chart generator is generated for each type of chart to be selected according to the chart type information.
In a specific implementation, the types of charts to be selected may be a histogram, a line graph, a pie graph, and the like, and a corresponding histogram generator, a line graph generator, a pie graph generator, and the like may be generated. In the process of generating the chart, after the chart type is determined, the corresponding chart generator of the chart type can be called, for example, when the chart type is a pie chart, the pie chart generator corresponding to the pie chart is called.
And step S002, generating a chart container according to the chart type information, and taking the chart container as a chart generator.
It should be noted that the chart generator is for different charts, for example: the method comprises the steps of generating one or more chart containers filled with charts by using a pie chart, a bar chart, a line chart, a bar chart, a percentage stack chart and the like, using the generated chart containers as chart generators, using a developer to invoke corresponding target chart generators according to actual requirements only through provided readme files, using the developer to create a configuration file, configuring chart data in the configuration file, inputting the configuration file into the target chart generators, and generating the charts by the target chart generators based on the configuration file.
In a specific implementation, the specific implementation code may be as follows:
Figure BDA0002664874070000091
wherein createConfig refers to a chart generator, and chart generators corresponding to different chart types are different.
chartsType refers to a chart type, such as a series of charts, e.g., pie charts, line charts, bar charts, etc.
xField refers to a field of the chart abscissa axis that requires corresponding background data.
yField refers to the field of the chart ordinate axis that requires the corresponding background data.
Options refer to personalized information such as the color of the chart, the degree of curvature of the lines, the width of the posts, etc.
In one embodiment, the step of generating a chart container according to the chart type information includes:
determining chart requirement information according to the chart type information; extracting personalized requirement information from the chart requirement information, and searching general requirement information corresponding to the chart type; and generating a chart container according to the general requirement information and the personalized requirement information.
It should be understood that the chart requirement information may be determined according to the chart type information, and the personalization requirement information, in which the personalization setting information the user wants to make, may be extracted from the chart requirement information.
Meanwhile, each chart type has corresponding necessary configuration, and the necessary configuration can be described through general requirement information. Therefore, the general requirement information corresponding to the chart type can be searched at the same time, and the chart container is generated according to the general requirement information and the personalized requirement information.
In one embodiment, the step of generating a chart container according to the general requirement information and the personalized requirement information includes:
extracting diagram abscissa axis information, diagram ordinate axis information and diagram field information from the general requirement information; generating first chart configuration information according to the chart abscissa axis information, the chart ordinate axis information and the chart field information; extracting chart title information, chart element color information, chart axis display information and chart element distance information from the personalized requirement information; generating second chart configuration information according to the chart title information, the chart element color information, the chart axis display information and the chart element distance information; and generating a chart container according to the first chart configuration information and the second chart configuration information.
It should be understood that the general requirement information includes necessary configurations, and the personalized configuration information includes personalized configurations, and the chart abscissa axis information, the chart ordinate axis information, and the chart field information may be extracted from the general requirement information, and the first chart configuration information may be generated based on these information. In addition to the above information, other information may be included, which is not limited in this embodiment.
It should be understood that chart title information, chart element color information, chart axis display information, and chart element spacing information may be extracted from the personalization requirement information, from which second chart configuration information is generated. In addition to the above information, other information may be included, which is not limited in this embodiment.
It should be understood that after the first chart configuration information and the second chart configuration information are determined, the chart container can be generated according to the first chart configuration information and the second chart configuration information, so that the chart container can be generated according to the actual requirements of the user and by combining with the necessary configuration of the chart type, the stability is guaranteed, and the personalization degree of the chart container is improved.
And S003, establishing a mapping list according to the type of the graph to be selected and the graph generator.
It can be understood that a mapping list is established according to the type of the graph to be selected and the graph generator, and the target graph generator corresponding to the graph type extracted from the information to be processed can be determined through the corresponding relation between the type of the graph to be selected in the mapping list and the graph generator.
In the embodiment, the type of the chart to be selected and the chart type information corresponding to the type of the chart to be selected are obtained; generating a chart container according to the chart type information, and taking the chart container as a chart generator; establishing a mapping list according to the type of the chart to be selected and the chart generator; matching the chart type with a chart type to be selected in a mapping list; and taking the chart type to be selected matched with the chart type as a target chart type, and taking a chart generator corresponding to the target chart type as a target chart generator. Therefore, the target generator corresponding to the chart type extracted from the information to be processed can be accurately determined to be used for generating the chart, and the chart generation efficiency is further improved.
In an embodiment, as shown in fig. 4, a third embodiment of the graph generating method according to the present invention is proposed based on the first embodiment or the second embodiment, and in this embodiment, the step S50 includes:
step S501, performing graph detection on the graph to be selected to judge whether the graph to be selected is a blank graph.
The blank chart is a chart in which data in the chart is empty, that is, the blank chart has no content.
It should be understood that, in the process of generating a graph, a situation of data abnormality may occur, and the graph is not normally generated, so that the graph is abnormal, in order to determine whether the graph to be selected is an abnormal graph, the graph to be selected may be detected to determine whether the graph to be selected is a blank graph, and if the graph to be selected is a blank graph, the graph to be selected is an abnormal graph; and if the graph to be selected is not a blank graph, further detecting the graph to be selected.
Step S502, when the graph to be selected is not the blank graph, performing data structure analysis on the graph to be selected to obtain a data structure to be selected corresponding to the graph to be selected.
It should be understood that, when the graph to be selected is not a blank graph, data structure analysis may be performed on the graph to be selected, so as to obtain a data structure to be selected corresponding to the graph to be selected, and whether the graph to be selected is abnormal is determined through the data structure to be selected.
Step S503, searching for a reference data structure corresponding to the graph type, and comparing the data structure to be selected with the reference data structure.
It will be appreciated that each chart type has a corresponding reference data structure, and the candidate data structure may be compared with the reference data structure to determine whether the candidate chart is abnormal. If the data structure to be selected is consistent with the reference data structure, judging that the chart to be selected is abnormal; and if the data structure to be selected is not consistent with the reference data structure, judging that the chart to be selected is normal.
It should be noted that the data structure may be a set, a linear structure, a tree structure, a graph structure, and the like, and may also be other structures, which is not limited in this embodiment.
Step S504, when the data structure to be selected is consistent with the reference data structure, the chart to be selected is taken as a target chart.
It can be understood that when the data structure to be selected is consistent with the reference data structure, the graph to be selected is judged to be normal, at this time, the graph to be selected passes verification, and the graph to be selected is taken as the target graph.
In particular implementations, for example, the chart types can include a bar chart, a line chart, and a pie chart, the bar chart can be set to correspond to a first data structure, the line chart can be set to correspond to a second data structure, and the pie chart can be set to correspond to a third data structure. And if the generated candidate data structure corresponding to the candidate chart is the third data structure, the reference data structure is consistent with the candidate data structure, the candidate chart is judged to be normal, and the candidate chart is taken as the target chart. And if the generated candidate data structure corresponding to the candidate chart is not the third data structure, indicating that the reference data structure is inconsistent with the candidate data structure, and judging that the candidate chart is abnormal.
In an embodiment, after the step of performing chart verification on the chart to be selected, the method further includes:
when the verification fails, judging that the graph is abnormal, and searching corresponding graph abnormal information; generating a chart abnormity prompting interface based on the chart abnormity information; and displaying the chart abnormity prompting interface to prompt the user that the chart is abnormal.
It should be understood that graph verification is performed on the graph to be selected, and when the verification fails, the graph is judged to be abnormal. In the verification process, the graph to be selected is a blank graph, or a data structure to be selected corresponding to the graph to be selected is inconsistent with the reference data structure to be selected, and when one of the conditions occurs, the graph is judged to be abnormal.
It can be understood that the graph exception information may be preset to remind the user when the graph is abnormal, and the graph exception information may be stored in the database, may also be stored in a node of a block chain, and may also be stored in other places, which is not limited in this embodiment.
It can be understood that when the graph is abnormal, corresponding graph abnormal information is searched, a graph abnormal prompting interface is generated based on the graph abnormal information, the graph abnormal prompting interface is displayed in a page, a user can know that the graph is abnormal according to the displayed graph abnormal prompting interface, and then other operations are taken, so that the time waste of the user is avoided.
In an embodiment, after the step S50, the method further includes:
when a chart modification instruction is received, determining chart modification information corresponding to the chart modification instruction; extracting modification data from the chart modification information; and inputting the modification data into the target chart generator, and modifying the target chart through the target chart generator based on the modification data to obtain a modified target chart.
It should be understood that, after the chart is generated, the user may also need to modify the data in the chart, and therefore, when the chart modification instruction is received, the chart modification information corresponding to the chart modification instruction may be determined. The chart modification information may be input by a user while inputting a chart modification instruction, may also be input in advance and stored in a local database, and the operation of obtaining the chart modification information is triggered when the user inputs the chart modification instruction, and may also be in other manners, which is not limited in this embodiment.
It should be understood that the modification data may be extracted from the chart modification information, the modification data may be input into the target chart generator, and the target chart generator may directly modify the target chart based on the modification data to obtain the modified target chart, and feed back the modified target chart to the computer device, thereby achieving the effect of automatic chart update.
In the embodiment, chart detection is performed on the chart to be selected to judge whether the chart to be selected is a blank chart; when the graph to be selected is not the blank graph, performing data structure analysis on the graph to be selected to obtain a data structure to be selected corresponding to the graph to be selected; searching a reference data structure corresponding to the chart type, and comparing the data structure to be selected with the reference data structure; and when the data structure to be selected is consistent with the reference data structure, taking the chart to be selected as a target chart. And detecting whether the graph to be selected is a blank graph or not, judging whether a data structure to be selected corresponding to the graph to be selected is consistent with a reference data structure corresponding to the graph type or not, taking the graph to be selected as a target graph when the graph to be selected is not the blank graph and the data structure to be selected is inconsistent with the reference data structure, and verifying the generated graph to ensure the quality of the generated graph.
Furthermore, an embodiment of the present invention further provides a storage medium, on which a chart generation program is stored, and the chart generation program, when executed by a processor, implements the steps of the chart generation method as described above.
Since the storage medium adopts all technical solutions of all the embodiments, at least all the beneficial effects brought by the technical solutions of the embodiments are achieved, and no further description is given here.
Further, referring to fig. 5, an embodiment of the present invention further provides a chart generating apparatus, including:
the information obtaining module 10 is configured to determine to-be-processed information corresponding to a chart generation instruction when the chart generation instruction is received, where the to-be-processed information is stored in a block chain.
It should be understood that, when the chart generation instruction is received, it is described that the user needs to perform the chart generation operation at this time, and the to-be-processed information corresponding to the chart generation instruction can be acquired. The information to be processed may be input by a user while inputting a chart generation instruction, may also be input in advance and stored in a local database, and the operation of acquiring the information to be processed is triggered when the user inputs the chart generation instruction.
It is emphasized that, in order to further ensure the privacy and security of the information to be processed, the information to be processed may also be stored in a node of a block chain.
It should be understood that the information to be processed includes information such as chart data and chart type, and may also include other information, which is not limited in this embodiment.
And the information processing module 20 is configured to extract chart data and chart types from the information to be processed, and generate a configuration file according to the chart data.
It should be noted that the chart types may include a bar chart, a line chart, a pie chart, and the like, and may also be other types of charts, which is not limited by the embodiment. The chart data is data of a chart to be generated, and a target chart is generated according to the chart data.
It should be understood that a plurality of configuration items may be generated from the chart data, and a configuration file may be generated from the configuration items.
In a specific implementation, for example, the chart data may include data such as name data, age data, occupational data, and the like, and therefore, the data may be extracted from the chart data, and corresponding configuration items may be generated according to the data, for example, a corresponding name configuration item may be generated according to the name data, a corresponding age configuration item may be generated according to the age data, a corresponding occupational configuration item may be generated according to the occupational data, and a configuration file may be generated according to the name configuration item, the age configuration item, and the occupational configuration item.
And the target searching module 30 is used for searching the target chart generator corresponding to the chart type.
It should be appreciated that after determining the chart type, the target chart generator to which the chart type corresponds may be looked up. The method for searching for the target chart generator corresponding to the chart type may be to search from a database, or may also be to search from a mapping list, which is not limited in this embodiment.
It can be understood that, the database and the mapping list may record a corresponding relationship between the chart type and the chart generator, and the target chart generator corresponding to the chart type may be searched according to the corresponding relationship. The target chart generator has the function that the chart can be automatically generated according to the configuration file without the operation of a user.
And the chart generating module 40 is configured to input the configuration file into the target chart generator, so that the target chart generator generates a chart to be selected based on the configuration file, and feeds back the chart to be selected.
It should be appreciated that after generating the configuration file and determining the target chart generator, the configuration file may be input into the target chart generator, and the target chart generator may generate the candidate chart based on the configuration file.
In a specific implementation, the target graph generator may be wrapped based on the exact component to obtain a Search component; inputting the configuration file into the target chart generator through the Search component, so that the target chart generator generates a chart to be selected based on the configuration file, and feeding back the chart to be selected. The configuration file may be input into the target graph generator through the Search component, for example, when the target graph generator needs to be used, an Import Search from 'Search' may be introduced as follows, in the DOM structure to be exposed, a < Search config ═ config }/>, so as to call the target graph generator, and the configuration file is input into the target graph generator, resulting in the graph to be selected. The configuration file may also be input into the target chart generator by other ways, which is not limited in this embodiment.
And the target chart module 50 is used for performing chart verification on the chart to be selected, and when the chart to be selected passes the verification, the chart to be selected is taken as the target chart.
It should be understood that, in the process of generating the diagram, a problem of a back-end input error may occur, where the back-end input error mainly refers to that, due to a problem occurring in logic in a back-end code, data transmitted to the front end is empty, and a data structure corresponding to the diagram is inconsistent, so that a back-end error is reported to cause an exception to be displayed on the diagram of the front end, which may seriously crash a front-end page and block user operations.
In this embodiment, chart verification may be performed on the chart to be selected, the chart to be selected is used as the target chart only when the verification passes, if the data in the chart to be selected is found to be empty during verification, evacuation processing is directly performed, a page shows an empty state, if the data structure is wrong, compatible processing is performed, if the data structure is correct, normal display is performed, otherwise, the wrong type of the user is automatically prompted, and the page display is not affected and does not block any operation of the user.
In this embodiment, when a chart generation instruction is received, to-be-processed information corresponding to the chart generation instruction is determined; extracting chart data and chart types from the information to be processed, and generating a configuration file according to the chart data; searching a target chart generator corresponding to the chart type; inputting the configuration file into the target chart generator so that the target chart generator generates a chart to be selected based on the configuration file and feeds back the chart to be selected; and carrying out graph verification on the graph to be selected, and taking the graph to be selected as a target graph when the graph passes the verification. Wherein the information to be processed may be stored in a block chain. Therefore, the target chart generator corresponding to the chart type is searched, the configuration file is generated according to the chart data, the configuration file is input into the target chart generator, the target chart is obtained, the chart generation difficulty is reduced, and the chart generation efficiency is improved.
In an embodiment, the target searching module 30 is further configured to match the chart type with a to-be-selected chart type in a mapping list, where a correspondence between the to-be-selected chart type and the chart generator is recorded in the mapping list; taking the chart type to be selected matched with the chart type as a target chart type, and taking a chart generator corresponding to the target chart type as a target chart generator;
in an embodiment, the chart generating device further includes a chart generator generating module, configured to obtain a type of a chart to be selected and chart type information corresponding to the type of the chart to be selected; generating a chart container according to the chart type information, and taking the chart container as a chart generator; and establishing a mapping list according to the type of the chart to be selected and the chart generator.
In an embodiment, the chart generator generating module is further configured to determine chart requirement information according to the chart type information; extracting personalized requirement information from the chart requirement information, and searching general requirement information corresponding to the chart type; generating a chart container according to the general requirement information and the personalized requirement information; and taking the chart container as a chart generator.
In an embodiment, the chart generator generating module is further configured to extract chart abscissa axis information, chart ordinate axis information, and chart field information from the general requirement information; generating first chart configuration information according to the chart abscissa axis information, the chart ordinate axis information and the chart field information; extracting chart title information, chart element color information, chart axis display information and chart element distance information from the personalized requirement information; generating second chart configuration information according to the chart title information, the chart element color information, the chart axis display information and the chart element distance information; and generating a chart container according to the first chart configuration information and the second chart configuration information.
In an embodiment, the target graph module 50 is further configured to perform graph detection on the graph to be selected, so as to determine whether the graph to be selected is a blank graph; when the graph to be selected is not the blank graph, performing data structure analysis on the graph to be selected to obtain a data structure to be selected corresponding to the graph to be selected; searching a reference data structure corresponding to the chart type, and comparing the data structure to be selected with the reference data structure; and when the data structure to be selected is consistent with the reference data structure, taking the chart to be selected as a target chart.
In an embodiment, the chart generating apparatus further includes a chart modification module, configured to determine, when a chart modification instruction is received, chart modification information corresponding to the chart modification instruction; extracting modification data from the chart modification information; and modifying the target diagram based on the modification data through the target diagram generator to obtain a modified target diagram.
In an embodiment, the graph generating device further includes a graph exception module, configured to perform graph verification on the graph to be selected, determine that the graph is abnormal when the graph is not verified, and search for corresponding graph exception information; generating a chart abnormity prompting interface based on the chart abnormity information; and displaying the chart abnormity prompting interface to prompt the user that the chart is abnormal.
Other embodiments or specific implementation methods of the graph generating apparatus according to the present invention may refer to the above method embodiments, and are not described herein again.
The block chain is a novel application mode of computer technologies such as distributed data storage, point-to-point transmission, a consensus mechanism, an encryption algorithm and the like. A block chain (Blockchain), which is essentially a decentralized database, is a series of data blocks associated by using a cryptographic method, and each data block contains information of a batch of network transactions, so as to verify the validity (anti-counterfeiting) of the information and generate a next block. The blockchain may include a blockchain underlying platform, a platform product service layer, an application service layer, and the like.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
The above-mentioned serial numbers of the embodiments of the present invention are merely for description and do not represent the merits of the embodiments.
Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better implementation manner. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a computer-readable storage medium (such as ROM/RAM, magnetic disk, optical disk) as described above, and includes instructions for enabling a smart device (such as a mobile phone, an estimator, a computer device, an air conditioner, or a network computer device) to execute the method according to the embodiments of the present invention.
The above description is only a preferred embodiment of the present invention, and not intended to limit the scope of the present invention, and all modifications of equivalent structures and equivalent processes, which are made by using the contents of the present specification and the accompanying drawings, or directly or indirectly applied to other related technical fields, are included in the scope of the present invention.

Claims (10)

1. A chart generating method, characterized by comprising the steps of:
when a chart generation instruction is received, determining to-be-processed information corresponding to the chart generation instruction, wherein the to-be-processed information is stored in a block chain;
extracting chart data and chart types from the information to be processed, and generating a configuration file according to the chart data;
searching a target chart generator corresponding to the chart type;
inputting the configuration file into the target chart generator so that the target chart generator generates a chart to be selected based on the configuration file and feeds back the chart to be selected;
and carrying out graph verification on the graph to be selected, and taking the graph to be selected as a target graph when the graph passes the verification.
2. The chart generation method of claim 1, wherein said step of finding a target chart generator corresponding to said chart type comprises:
matching the chart type with a chart type to be selected in a mapping list, wherein the mapping list records the corresponding relation between the chart type to be selected and the chart generator;
taking the chart type to be selected matched with the chart type as a target chart type, and taking a chart generator corresponding to the target chart type as a target chart generator;
before the step of matching the chart type with the chart type to be selected in the mapping list, the method further comprises the following steps:
acquiring a graph type to be selected and graph type information corresponding to the graph type to be selected;
generating a chart container according to the chart type information, and taking the chart container as a chart generator;
and establishing a mapping list according to the type of the chart to be selected and the chart generator.
3. The chart generating method according to claim 2, wherein the step of generating a chart container based on the chart type information comprises:
determining chart requirement information according to the chart type information;
extracting personalized requirement information from the chart requirement information, and searching general requirement information corresponding to the chart type;
and generating a chart container according to the general requirement information and the personalized requirement information.
4. The chart generating method according to claim 3, wherein the step of generating a chart container based on the general requirement information and the personalized requirement information comprises:
extracting diagram abscissa axis information, diagram ordinate axis information and diagram field information from the general requirement information;
generating first chart configuration information according to the chart abscissa axis information, the chart ordinate axis information and the chart field information;
extracting chart title information, chart element color information, chart axis display information and chart element distance information from the personalized requirement information;
generating second chart configuration information according to the chart title information, the chart element color information, the chart axis display information and the chart element distance information;
and generating a chart container according to the first chart configuration information and the second chart configuration information.
5. The chart generation method according to any one of claims 1 to 4, wherein the step of performing chart verification on the chart to be selected and regarding the chart to be selected as a target chart when the verification is passed includes:
performing graph detection on the graph to be selected to judge whether the graph to be selected is a blank graph or not;
when the graph to be selected is not the blank graph, performing data structure analysis on the graph to be selected to obtain a data structure to be selected corresponding to the graph to be selected;
searching a reference data structure corresponding to the chart type, and comparing the data structure to be selected with the reference data structure;
and when the data structure to be selected is consistent with the reference data structure, taking the chart to be selected as a target chart.
6. The chart generation method according to any one of claims 1 to 4, wherein the step of performing chart verification on the chart to be selected and taking the chart to be selected as a target chart when the verification is passed further comprises:
when a chart modification instruction is received, determining chart modification information corresponding to the chart modification instruction;
extracting modification data from the chart modification information;
and inputting the modification data into the target chart generator, and modifying the target chart through the target chart generator based on the modification data to obtain a modified target chart.
7. A chart generation method according to any one of claims 1 to 4, wherein after said step of performing chart verification on said chart to be selected, further comprising:
when the verification fails, judging that the graph is abnormal, and searching corresponding graph abnormal information;
generating a chart abnormity prompting interface based on the chart abnormity information;
and displaying the chart abnormity prompting interface to prompt the user that the chart is abnormal.
8. A chart generating apparatus, characterized in that the chart generating apparatus comprises:
the information acquisition module is used for determining to-be-processed information corresponding to a chart generation instruction when the chart generation instruction is received, wherein the to-be-processed information is stored in a block chain;
the information processing module is used for extracting chart data and chart types from the information to be processed and generating a configuration file according to the chart data;
the target searching module is used for searching the target chart generator corresponding to the chart type;
the chart generation module is used for inputting the configuration file into the target chart generator so as to enable the target chart generator to generate a chart to be selected based on the configuration file and feed back the chart to be selected;
and the target chart module is used for carrying out chart verification on the chart to be selected, and taking the chart to be selected as the target chart when the verification is passed.
9. A computer device, characterized in that the computer device comprises: a memory, a processor, and a chart generation program stored on the memory and executable on the processor, the chart generation program configured to implement the steps of the chart generation method of any of claims 1 to 7.
10. A storage medium, characterized in that the storage medium has stored thereon a chart generation program which, when executed by a processor, implements the steps of the chart generation method according to any one of claims 1 to 7.
CN202010918902.9A 2020-09-03 2020-09-03 Chart generation method and device, computer equipment and storage medium Pending CN112015418A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010918902.9A CN112015418A (en) 2020-09-03 2020-09-03 Chart generation method and device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010918902.9A CN112015418A (en) 2020-09-03 2020-09-03 Chart generation method and device, computer equipment and storage medium

Publications (1)

Publication Number Publication Date
CN112015418A true CN112015418A (en) 2020-12-01

Family

ID=73515500

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010918902.9A Pending CN112015418A (en) 2020-09-03 2020-09-03 Chart generation method and device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN112015418A (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103092621A (en) * 2013-03-08 2013-05-08 广州市西美信息科技有限公司 Chart creating method and device
CN105574207A (en) * 2016-01-21 2016-05-11 上海谦讯网络科技有限公司 WAP webpage developing method
CN110737850A (en) * 2019-09-10 2020-01-31 苏宁云计算有限公司 chart generation method and device
CN111259643A (en) * 2019-12-10 2020-06-09 深圳市远行科技股份有限公司 Method and equipment for generating graphical report

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103092621A (en) * 2013-03-08 2013-05-08 广州市西美信息科技有限公司 Chart creating method and device
CN105574207A (en) * 2016-01-21 2016-05-11 上海谦讯网络科技有限公司 WAP webpage developing method
CN110737850A (en) * 2019-09-10 2020-01-31 苏宁云计算有限公司 chart generation method and device
CN111259643A (en) * 2019-12-10 2020-06-09 深圳市远行科技股份有限公司 Method and equipment for generating graphical report

Similar Documents

Publication Publication Date Title
US8887135B2 (en) Generating test cases for functional testing of a software application
CN111176996A (en) Test case generation method and device, computer equipment and storage medium
CN111475390A (en) Log collection system deployment method, device, equipment and storage medium
CN110866258A (en) Method for quickly positioning bug, electronic device and storage medium
CN112631557A (en) Method, device and storage medium for generating interface code and/or interface document
CN114090671A (en) Data import method and device, electronic equipment and storage medium
CN107341106A (en) Application compatibility detection method, exploitation terminal and storage medium
CN112988997A (en) Response method and system of intelligent customer service, computer equipment and storage medium
CN112417899A (en) Character translation method, device, computer equipment and storage medium
CN115391439A (en) Document data export method, device, electronic equipment and storage medium
CN111159028B (en) Webpage testing method and device
US11334780B2 (en) Method for generating word code, method and device for recognizing codes
JP4215255B2 (en) Degradation confirmation inspection method, degradation confirmation inspection system, and program therefor
CN112015418A (en) Chart generation method and device, computer equipment and storage medium
EP3425510B1 (en) Automated testing method for application program user interface, electronic device, system, and storage medium
CN114238733A (en) Key information extraction method and device, computer storage medium and electronic equipment
CN112052184A (en) Automatic generation method and device for test script and storage medium
CN114564336A (en) Data consistency checking method, device, equipment and storage medium
CN113792017A (en) Method and system for checking template content imported into excel
CN113722225A (en) Page testing method and device, computer equipment and storage medium
AU2017202199B1 (en) Software integration testing with unstructured database
CN112698883A (en) Configuration data processing method, device, terminal and storage medium
CN112364667A (en) Character checking method and device, computer equipment and computer readable storage medium
CN110688078A (en) File checking method, device and storage medium
CN112015466A (en) Information retrieval method, information retrieval device, computer equipment and storage medium

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