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

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

Info

Publication number
CN115878102A
CN115878102A CN202111146412.2A CN202111146412A CN115878102A CN 115878102 A CN115878102 A CN 115878102A CN 202111146412 A CN202111146412 A CN 202111146412A CN 115878102 A CN115878102 A CN 115878102A
Authority
CN
China
Prior art keywords
configuration
chart
configuration item
information
echarts
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
CN202111146412.2A
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 Mobile Communications Group Co Ltd
China Mobile Suzhou Software Technology Co Ltd
Original Assignee
China Mobile Communications Group Co Ltd
China Mobile Suzhou Software Technology 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 China Mobile Communications Group Co Ltd, China Mobile Suzhou Software Technology Co Ltd filed Critical China Mobile Communications Group Co Ltd
Priority to CN202111146412.2A priority Critical patent/CN115878102A/en
Publication of CN115878102A publication Critical patent/CN115878102A/en
Pending legal-status Critical Current

Links

Images

Abstract

The embodiment of the invention relates to the technical field of computer data processing, and discloses a chart generation method, which comprises the following steps: acquiring visual attribute configuration information and a data source input by a user on a visual interface; determining target configuration item information corresponding to the visual attribute configuration information according to the visual attribute configuration information and the mapping relation between the visual attributes and the EChats configuration items; and generating a target diagram according to the target configuration item information and the data source. Through the mode, the chart generation efficiency is improved.

Description

Chart generation method, device, equipment and computer storage medium
Technical Field
The embodiment of the invention relates to the technical field of computer data processing, in particular to a chart generation method, a chart generation device, a chart generation equipment and a computer storage medium.
Background
ECharts (Enterprise Charts) is a Javascript-based chart library that provides intuitive, lively, interactive, and highly customizable data visualization Charts. When using ECharts, it is necessary to configure the ECharts.
The inventor finds out in the process of implementing the invention that: the configuration of Echarts is complicated, and the configuration mode of Echarts in the prior art has the problems that the Echarts cannot be used across frames and can only be used under the condition that a specific mapping rule is known, so that the efficiency of generating charts based on the Echarts is low.
Disclosure of Invention
In view of the foregoing problems, embodiments of the present invention provide a chart generation method, apparatus, device and computer storage medium, which are used to solve the problem in the prior art that the chart generation efficiency is low.
According to an aspect of an embodiment of the present invention, there is provided a chart generation method, including:
acquiring visual attribute configuration information and a data source input by a user on a visual interface;
determining target configuration item information corresponding to the visual attribute configuration information according to the visual attribute configuration information and the mapping relation between the visual attribute and the EChats configuration items;
and generating a target chart according to the target configuration item information and the data source.
In an optional manner, the target configuration item information includes at least one ECharts configuration item; the method further comprises the following steps:
determining a target class corresponding to the target configuration item information according to the packaging relationship between the configuration item and the configuration item class;
instantiating the target class according to the target configuration item information to obtain configured EChats;
and importing the data source into the configured EChats to obtain the target chart.
In an optional mode, a plurality of selectable visual attributes are displayed on the visual interface; the visualization attribute configuration information comprises at least one of the selectable visualization attributes; the method further comprises the following steps:
respectively determining the configuration item type information of each ECharts configuration item and the hierarchical relationship between each ECharts configuration item;
respectively determining basic configuration items corresponding to the ECharts configuration items according to the configuration item type information and the hierarchical relationship;
respectively determining parameter field information of each selectable visual attribute and configuration item field information of each basic configuration item;
and mapping between the selectable visual attribute and the basic configuration item according to the parameter field information and the configuration item field information to obtain the mapping relation.
In an alternative, the configuration item type information includes a configuration item hierarchy type; the configuration item hierarchy type is a single-layer type or a multi-layer type; the configuration item type of the basic configuration item is the single-layer type; the method further comprises the following steps:
when the EChats configuration items are of the multilayer type, determining an EChats configuration item subset corresponding to the EChats configuration items according to the hierarchical relationship;
determining the ECharts configuration items of which the configuration item types are single-layer types in the ECharts configuration item subset as the basic configuration items.
In an optional manner, the configuration item type information includes a configuration item function type; the target class is one of a plurality of selectable classes; the method further comprises the following steps:
respectively creating selectable classes corresponding to the function types of the configuration items;
determining an inheritance relationship between the selectable classes according to the hierarchical relationship;
and encapsulating the Echarts configuration items into corresponding optional classes according to the inheritance relationship to obtain the encapsulation relationship of the configuration items.
In an alternative mode, the configuration item function types include a global configuration type, a coordinate system configuration type and a chart series configuration type; the selectable classes comprise a global class, a coordinate system class and a chart series class; the method further comprises the following steps:
determining an associated graph series class corresponding to the coordinate system class according to the hierarchical relation;
causing the associated graphic series class to inherit the coordinate system class;
causing the coordinate system class to inherit the global class.
In an optional manner, the method further comprises:
acquiring an ECharts chart to be analyzed input by a user on the visual interface;
analyzing the ECharts chart to be analyzed to obtain the chart configuration information; the chart configuration information corresponds to at least one of the ECharts configuration items;
determining a chart decoupling rule according to the chart configuration information;
extracting the interface data according to the chart decoupling rule to obtain the data source;
and determining the visual attribute configuration information corresponding to the chart configuration information according to the mapping relation and the configuration item packaging relation.
According to another aspect of the embodiments of the present invention, there is provided a chart generating apparatus including:
the acquisition module is used for acquiring visual attribute configuration information and a data source input by a user on a visual interface;
the determining module is used for determining target configuration item information corresponding to the visual attribute configuration information according to the visual attribute configuration information and the mapping relation between the visual attribute and the EChats configuration items;
and the generating module is used for generating a target chart according to the target configuration item information and the data source.
According to another aspect of the embodiments of the present invention, there is provided a chart generating apparatus including: the system comprises a processor, a memory, a communication interface and a communication bus, wherein the processor, the memory and the communication interface complete mutual communication through the communication bus;
the memory is used for storing at least one executable instruction which causes the processor to execute the operation of the chart generation method.
According to still another aspect of the embodiments of the present invention, there is provided a computer-readable storage medium having at least one executable instruction stored therein, the executable instruction causing a chart generating apparatus to perform the operations of the chart generating method.
The embodiment of the invention obtains the visual attribute configuration information and the data source input by the user on the visual interface; determining target configuration item information corresponding to the visual attribute configuration information according to the visual attribute configuration information and the mapping relation between the visual attributes and the EChats configuration items; and generating a target diagram according to the target configuration item information and the data source.
The method and the device have the advantages that the problems of high learning cost and low configuration efficiency existing in the prior art that a user needs to be familiar with API configuration of a component library or needs to know the corresponding relation between the encapsulated attribute and the ECharts configuration parameters are solved, the visual attribute parameters input on the visual interface are mapped to the ECharts configuration items by providing a user-friendly visual interface, so that the ECharts configuration can be automatically completed, and finally, the configured ECharts is combined with a data source to generate a target chart, so that the efficiency of generating the chart based on the ECharts and the user experience are improved.
The foregoing description is only an overview of the technical solutions of the embodiments of the present invention, and the embodiments of the present invention can be implemented according to the content of the description in order to make the technical means of the embodiments of the present invention more clearly understood, and the detailed description of the present invention is provided below in order to make the foregoing and other objects, features, and advantages of the embodiments of the present invention more clearly understandable.
Drawings
The drawings are only for purposes of illustrating embodiments and are not to be construed as limiting the invention. Also, like reference numerals are used to refer to like parts throughout the drawings. In the drawings:
FIG. 1 is a flow chart diagram illustrating a chart generation method provided by an embodiment of the invention;
FIG. 2 is a diagram illustrating an alternative class inheritance in a diagram generation method according to an embodiment of the present invention;
FIG. 3 is a schematic structural diagram of a chart generation apparatus provided in an embodiment of the present invention;
fig. 4 shows a schematic structural diagram of a chart generation device provided by an embodiment of the present invention.
Detailed Description
Exemplary embodiments of the present invention will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of the invention are shown in the drawings, it should be understood that the invention can be embodied in various forms and should not be limited to the embodiments set forth herein.
FIG. 1 shows a flow diagram of a chart generation method provided by an embodiment of the invention, the method being performed by a computer processing device. The computer processing device may include a cell phone, a notebook computer, etc. As shown in fig. 1, the method comprises the steps of:
step 10: and acquiring visual attribute configuration information and a data source input by a user on a visual interface.
In one embodiment of the invention, a visualization interface is used to receive chart data, present charts, and controls for editing charts. Wherein the chart data includes parameters shown in the chart and parameters for setting a chart showing effect. The control is used for configuring the visual property.
In another embodiment of the present invention, the type of the control may be determined according to a parameter value type corresponding to the visual attribute, for example, the parameter value of the ECharts configuration item of the basic type may be implemented by setting different data types of the visual attribute through number, string, borolean, enum, and the like, and the type of the control corresponding to the visual interface attribute value may be different forms such as a numerical type input box, a character type input box, a check box check, a drop-down box selection, and the like.
The visualization attribute configuration information is information configured for visualization attributes displayed on the visualization interface, and the visualization attributes are used for determining the display effect of the chart data displayed on the visualization interface. Such as the color, type, length, width, etc. of the chart. The data source is used to determine data characteristics, such as specific parameter values, of the chart data presented on the visualization interface.
In one embodiment of the present invention, step 10 further comprises:
step 101: and acquiring the EChats chart to be analyzed input by the user on the visual interface.
In an embodiment of the invention, the ECharts chart to be analyzed can be a chart in an ECharts open source community input by a user or a basic chart example provided by an ECharts authority, and the ECharts chart to be analyzed is generated according to parameter values corresponding to native configuration items in the ECharts.
Step 102: analyzing the ECharts chart to be analyzed to obtain the chart configuration information; the chart configuration information corresponds to at least one of the ECharts configuration items.
In an embodiment of the invention, the native configuration items of the ECharts chart to be analyzed are subjected to traversal analysis according to the list of the ECharts configuration items to obtain chart configuration information.
Step 103: and determining a chart decoupling rule according to the chart configuration information.
In one embodiment of the invention, chart series parameters in the chart configuration information are determined, and a corresponding chart decoupling rule is determined according to type parameters in the chart series parameters. Wherein the type parameter may be a type attribute in ECharts. Each chart series type corresponds to a chart decoupling rule, and the chart series types can be a line chart, a bar chart, a radar chart and the like.
Step 104: and extracting the interface data according to the chart decoupling rule to obtain the data source.
In one embodiment of the invention, for each chart series type, data sources irrelevant to the chart display effect in the interface data are extracted according to the corresponding chart decoupling rule.
Step 105: and determining the visual attribute configuration information corresponding to the chart configuration information according to the mapping relation and the configuration item packaging relation.
In one embodiment of the invention, the mapping relation refers to the corresponding relation between the visualization attribute and the ECharts configuration item displayed on the visualization interface. The configuration item encapsulation relation refers to the encapsulation relation between each ECharts configuration item and each optional class and the inheritance relation between each optional class.
The mapping relation can be preset, the mapping relation is established according to the attribute value type and the field name of the visual attribute, the corresponding field and the ECharts configuration item of the attribute value type, and the optional class comprises an object corresponding to at least one ECharts configuration item.
In an embodiment of the invention, values of chart series configuration items in the EChats configuration are assigned to visual attributes according to the mapping relation, and then reverse search and corresponding assignment are carried out in each optional class from the prototype chain in which each basic configuration item is located according to the configuration item packaging relation. Meanwhile, the other attribute values remain unchanged with the ECharts configuration item default values. Therefore, the native configuration items of the ECharts chart to be analyzed are reversely analyzed into the visual attribute configuration information on the visual interface, so that a user can directly modify the visual attribute values through the control to generate the required visual chart and configuration, and the chart generation efficiency and the user experience are improved.
Step 20: and determining target configuration item information corresponding to the visual attribute configuration information according to the visual attribute configuration information and the mapping relation between the visual attributes and the EChats configuration items.
In one embodiment of the invention, the target configuration item information includes at least one ECharts configuration item; a plurality of selectable visual attributes are displayed on the visual interface; the visualization attribute configuration information includes at least one of the selectable visualization attributes. The ECharts configuration items may be ECharts native configuration items, or processed ECharts configuration items. The mapping relationship includes each selectable visualization attribute and its corresponding ECharts configuration item.
In an embodiment of the present invention, matching is performed in the mapping relationship between the visualization attributes and the ECharts configuration items according to the visualization attribute configuration information, so as to obtain target configuration item information.
In still another embodiment of the present invention, step 20 is preceded by step 201: and respectively determining the configuration item type information of each ECharts configuration item and the hierarchical relationship between each ECharts configuration item.
Considering that some of the Echarts configuration items are multi-level objects, that is, the configuration items include multi-level objects, and each layer of object includes at least one configuration item, when a mapping relationship is established for the configuration items of the multi-level object, it is necessary to deconstruct layer by layer, and maintain the hierarchical relationship between the configuration items until a sub-configuration item of a basic type included in the configuration items of the multi-level type is resolved, a mapping relationship is established between each configuration item of the basic type and a visualization attribute, and the configuration items of the multi-level type are marked with the hierarchical relationship, so as to be distinguished when packaging and resolving are performed later.
For example, the textStyle (style) in the title of the configuration item is a multi-level configuration item, a rich (rich text style) configuration item is also in the multi-level configuration item, and meanwhile, the rich configuration item is also a multi-level configuration item, so in order to keep the level relationship between the configuration items, a multi-level type mark is respectively added to the textStyle and the rich configuration item, and then a mapping relationship is established between the configuration items of the basic type in the multi-level configuration item, thereby realizing that the attribute under the rich object configuration item can be multiplexed in a plurality of different object attributes.
Thus, in one embodiment of the invention, the configuration item type information may include a hierarchical type of each ECharts configuration item. The hierarchy type is used for representing whether a hierarchy relationship exists between attribute values contained in each ECharts configuration item, and can be a single hierarchy or a plurality of hierarchies, wherein the single-hierarchy ECharts configuration item is a parameter type, and the multi-hierarchy ECharts configuration item is an object type.
Considering that when the ECharts are configured, generally, global general configuration items need to be configured in a unified manner, and then, specific configuration items corresponding to each coordinate system and each chart series are configured step by step, in yet another embodiment of the present invention, the ECharts configuration items need to be classified, encapsulated and inherited according to the functional reusable range and the association relationship of the ECharts configuration items, and therefore, the configuration item type information may also be the functional type of the ECharts configuration items.
Step 202: and respectively determining the basic configuration items corresponding to the ECharts configuration items according to the configuration item type information and the hierarchical relationship.
In an embodiment of the present invention, the basic configuration item refers to a single-level configuration item that does not include a configuration item of a next level, and the configuration of ECharts can be completed by configuring all basic configuration items.
Thus, in one embodiment of the present invention, the configuration item type information includes a configuration item hierarchy type; the configuration item hierarchy type is a single-layer type or a multi-layer type; the configuration item type of the basic configuration item is the single-layer type. Step 202 further comprises:
step 2021: and when the EChats configuration items are of the multilayer type, determining an EChats configuration item subset corresponding to the EChats configuration items according to the hierarchical relationship.
In an embodiment of the present invention, when the type of the ECharts configuration item is a multi-level object, each ECharts configuration item in each level included in the ECharts configuration item is determined according to the hierarchical relationship, so as to obtain an ECharts configuration item subset.
Step 2022: determining the ECharts configuration items of which the configuration item types are single-layer types in the ECharts configuration item subset as the basic configuration items.
In one embodiment of the invention, each multi-level ECharts configuration item is analyzed layer by layer until a basic configuration item contained in the ECharts configuration item is obtained.
Step 203: and respectively determining parameter field information of each optional visual attribute and configuration item field information of each basic configuration item.
In one embodiment of the invention, in order to reduce the learning cost of using the visual interface, the field of the optional visual attribute and the field of the basic configuration item can be kept consistent, so that a user can directly find the field to be configured in the visual interface, and the configuration of the ECharts can be completed by inputting the field value without writing and modifying the configuration code of the ECharts by himself. If the attribute value type of the a configuration item is color, the color value corresponding to the a configuration item may be directly input on the visual interface, and the color selector may also select color, thereby completing the configuration of the a configuration item in ECharts.
Step 204: and mapping between the selectable visual attributes and the basic configuration items according to the parameter field information and the configuration item field information to obtain the mapping relation.
In an embodiment of the present invention, parameter field information and configuration item field information are matched, and a mapping relationship is established between the matched selectable visual attribute and the basic configuration item.
In yet another embodiment of the present invention, the configuration item type information includes a configuration item function type; the target class is one of a plurality of selectable classes; step 204 further comprises:
step 2041: and respectively creating selectable classes corresponding to the function types of the configuration items.
In an embodiment of the present invention, for each configuration item function type, a corresponding optional class is created, where the optional class includes attributes and methods corresponding to the configuration item function type. The configuration item function types comprise a global configuration type, a coordinate system configuration type and a chart series configuration type; the optional classes include a global class, a coordinate system class, and a chart series class.
In one embodiment of the present invention, the global configuration type ECharts configuration items may include a title (title), a legend (legend), a prompt box, a zone zoom, and the like. The coordinate system configured ECharts configuration items may include: an X-axis coordinate system, a Y-axis coordinate system, a polar coordinate system, a geographic coordinate system and the like. The ECharts configuration items of the chart series configuration type may include a bar chart, a line chart, a radar chart, and the like.
Step 2042: and determining an inheritance relationship between the optional classes according to the hierarchical relationship.
In one embodiment of the invention, each optional class is determined as a parent class of the optional class corresponding to the configuration item function type with the hierarchical relationship positioned at the next level, so that the effective multiplexing and global consistency of the configuration item parameters are realized. Specifically, the selectable class corresponding to the coordinate system configuration type may be made to inherit the selectable class corresponding to the global configuration type, so that the selectable class corresponding to each chart series configuration type inherits the selectable class corresponding to the coordinate system configuration type corresponding to the chart series.
In yet another embodiment of the present invention, step 2042 further comprises:
step 421: and determining the associated graph series class corresponding to the coordinate system class according to the hierarchical relation.
In one embodiment of the present invention, considering that different chart series correspond to a specific coordinate system, the corresponding coordinate system configuration items need to be multiplexed, and therefore, the associated chart series class corresponding to each coordinate system class is determined according to the hierarchical relationship.
Step 422: causing the associated graphic series class to inherit the coordinate system class.
Step 423: causing the coordinate system class to inherit the global class.
In one embodiment of the present invention, the inheritance relationship between the coordinate system class, the global class and the associated graphic series class can refer to FIG. 2. As shown in fig. 2, the map series class inherits the geographic coordinate system class, the line map series class and the scatter diagram series class inherits the polar coordinate system class, and the scatter diagram series class and the histogram series class inherits the rectangular coordinate system class.
Step 2043: and encapsulating the Echarts configuration items into corresponding optional classes according to the inheritance relationship to obtain the encapsulation relationship of the configuration items.
In one embodiment of the invention, the Echarts configuration items are packaged into the optional class to which the Echarts configuration items correspond. Global configuration items such as titles (titles), legends (legends), prompt boxes and region zooms are packaged into global classes, coordinate system configuration items such as an X-axis coordinate system, a Y-axis coordinate system, a polar coordinate system and a geographic coordinate system are packaged into each coordinate system class, and chart series configuration items such as histograms, line charts and radar charts are packaged into each chart series class.
Step 30: and generating a target chart according to the target configuration item information and the data source.
In view of the fact that there is an association relationship between configuration items, the coordinate systems of charts such as line charts and bar charts are rectangular coordinate systems, and there is a certain hierarchical relationship between configuration items, and all charts need configuration items with some common attributes as bases, such as attributes like titles, legends, etc., therefore, in an embodiment of the present invention, in order to improve the efficiency of chart generation, the associated configuration items may be packaged into a class in advance, and inheritance is implemented between classes according to the hierarchical relationship between configuration items, so that while the logical property of configuration is ensured, the reuse rate of codes is improved, and thus the efficiency of chart generation is improved.
Thus, in a further embodiment of the present invention, step 30 further comprises:
step 301: and determining a target class corresponding to the target configuration item information according to the packaging relation between the configuration item and the configuration item class.
In an embodiment of the present invention, matching is performed in the encapsulation relationship between the configuration items and the configuration item classes according to the ECharts configuration items included in the target configuration item information, and the optional class where the matched configuration items are located is determined as the target class. For example, when the ECharts configuration item included in the target configuration item is an attribute corresponding to a title or a Legend, the target class is a global class.
Step 302: and instantiating the target class according to the target configuration item information to obtain the configured EChats.
In an embodiment of the present invention, a corresponding configuration item object is created in the target class according to the target configuration information, and the configuration item object is assigned according to the value of each ECharts configuration item in the target configuration information, and a corresponding instance is created, so as to obtain configured ECharts.
Step 303: and importing the data source into the configured EChats to obtain the target chart.
In one embodiment of the invention, a chart example is established according to a data source through the configured EChats, a target chart is obtained, and the target chart is displayed on a visual interface.
The chart generation method provided by the embodiment of the invention obtains visual attribute configuration information and a data source input by a user on a visual interface; determining target configuration item information corresponding to the visual attribute configuration information according to the visual attribute configuration information and the mapping relation between the visual attribute and the EChats configuration items; and generating a target diagram according to the target configuration item information and the data source.
The chart generation method provided by the embodiment of the invention has the advantages that the chart generation method is different from the problems of high learning cost and low configuration efficiency caused by the fact that a user needs to be familiar with API (application program interface) configuration of a component library or needs to know the corresponding relation between the encapsulated attribute and the ECharts configuration parameters to use a configuration tool in the prior art, and the visual attribute parameters input on the visual interface are mapped to the ECharts configuration items by providing a user-friendly visual interface, so that the ECharts configuration can be automatically completed, and finally, a target chart is generated by combining a data source based on the configured ECharts, so that the efficiency of generating the chart based on the ECharts and the user experience are improved.
Fig. 3 is a schematic structural diagram of a chart generation apparatus provided in an embodiment of the present invention. As shown in fig. 3, the apparatus 400 includes: an acquisition module 401, a determination module 402 and a generation module 403.
The acquiring module 401 is configured to acquire visual attribute configuration information and a data source, which are input by a user on a visual interface;
a determining module 402, configured to determine, according to the visualization attribute configuration information and a mapping relationship between the visualization attribute and an ECharts configuration item, target configuration item information corresponding to the visualization attribute configuration information;
a generating module 403, configured to generate a target graph according to the target configuration item information and the data source.
In an optional manner, the target configuration item information includes at least one ECharts configuration item; the determining module 402 is further configured to:
determining a target class corresponding to the target configuration item information according to the packaging relation between the configuration item and the configuration item class;
instantiating the target class according to the target configuration item information to obtain configured EChats;
and importing the data source into the configured EChats to obtain the target chart.
In an optional mode, a plurality of selectable visual attributes are displayed on the visual interface; the visualization attribute configuration information comprises at least one of the selectable visualization attributes; the determining module 402 is further configured to:
respectively determining the configuration item type information of each ECharts configuration item and the hierarchical relationship between each ECharts configuration item;
respectively determining basic configuration items corresponding to the ECharts configuration items according to the configuration item type information and the hierarchical relationship;
respectively determining parameter field information of each selectable visual attribute and configuration item field information of each basic configuration item;
and mapping between the selectable visual attributes and the basic configuration items according to the parameter field information and the configuration item field information to obtain the mapping relation.
In an alternative, the configuration item type information includes a configuration item hierarchy type; the configuration item hierarchy type is a single-layer type or a multi-layer type; the configuration item type of the basic configuration item is the single-layer type; the determining module 402 is further configured to:
when the EChats configuration items are of the multilayer type, determining an EChats configuration item subset corresponding to the EChats configuration items according to the hierarchical relationship;
determining the ECharts configuration items of which the configuration item types are single-layer types in the ECharts configuration item subset as the basic configuration items.
In an optional manner, the configuration item type information includes a configuration item function type; the target class is one of a plurality of selectable classes; the determining module 402 is further configured to:
respectively creating selectable classes corresponding to the function types of the configuration items;
determining an inheritance relationship between the selectable classes according to the hierarchical relationship;
and encapsulating the Echarts configuration items into corresponding optional classes according to the inheritance relationship to obtain the encapsulation relationship of the configuration items.
In an optional mode, the configuration item function types comprise a global configuration type, a coordinate system configuration type and a chart series configuration type; the selectable classes comprise a global class, a coordinate system class and a chart series class; the determining module 402 is further configured to:
determining an associated graph series class corresponding to the coordinate system class according to the hierarchical relation;
causing the associated graphic series class to inherit the coordinate system class;
causing the coordinate system class to inherit the global class.
In an optional manner, the obtaining module 401 is further configured to:
acquiring an ECharts chart to be analyzed input by a user on the visual interface;
analyzing the ECharts chart to be analyzed to obtain the chart configuration information; the chart configuration information corresponds to at least one of the ECharts configuration items;
determining a chart decoupling rule according to the chart configuration information;
extracting the interface data according to the chart decoupling rule to obtain the data source;
and determining the visual attribute configuration information corresponding to the chart configuration information according to the mapping relation and the configuration item packaging relation.
The chart generation device provided by the embodiment of the invention acquires visual attribute configuration information and a data source input by a user on a visual interface; determining target configuration item information corresponding to the visual attribute configuration information according to the visual attribute configuration information and the mapping relation between the visual attributes and the EChats configuration items; and generating a target diagram according to the target configuration item information and the data source.
The method and the device for generating the EChats are different from the problems that in the prior art, a user needs to be familiar with API configuration of a component library or needs to know the corresponding relation between the encapsulated attribute and the EChats configuration parameter to use a configuration tool, and the learning cost is high and the configuration efficiency is low.
Fig. 4 shows a schematic structural diagram of a diagram generation device according to an embodiment of the present invention, and a specific embodiment of the present invention does not limit a specific implementation of the diagram generation device.
As shown in fig. 4, the chart generating apparatus may include: a processor (processor) 502, a Communications Interface 504, a memory 506, and a communication bus 508.
Wherein: the processor 502, communication interface 504, and memory 506 communicate with one another via a communication bus 508. A communication interface 504 for communicating with network elements of other devices, such as clients or other servers. The processor 502 is configured to execute the program 510, and may specifically execute the relevant steps in the chart generation method embodiment described above.
In particular, program 510 may include program code comprising computer-executable instructions.
The processor 502 may be a central processing unit CPU, or an Application Specific Integrated Circuit ASIC (Application Specific Integrated Circuit), or one or more Integrated circuits configured to implement an embodiment of the present invention. The chart generation device comprises one or more processors which can be the same type of processor, such as one or more CPUs; or may be different types of processors such as one or more CPUs and one or more ASICs.
A memory 506 for storing a program 510. The memory 506 may comprise high-speed RAM memory, and may also include non-volatile memory (non-volatile memory), such as at least one disk memory.
Specifically, the program 510 may be invoked by the processor 502 to cause the graph generation apparatus to perform the following operations:
acquiring visual attribute configuration information and a data source input by a user on a visual interface;
determining target configuration item information corresponding to the visual attribute configuration information according to the visual attribute configuration information and the mapping relation between the visual attribute and the EChats configuration items;
and generating a target chart according to the target configuration item information and the data source.
In an optional manner, the target configuration item information includes at least one ECharts configuration item; the program 510 is invoked by the processor 502 to cause the chart generation apparatus to perform the following operations:
determining a target class corresponding to the target configuration item information according to the packaging relation between the configuration item and the configuration item class;
instantiating the target class according to the target configuration item information to obtain configured EChats;
and importing the data source into the configured EChats to obtain the target chart.
In an optional mode, a plurality of selectable visual attributes are displayed on the visual interface; the visualization attribute configuration information comprises at least one of the selectable visualization attributes; the program 510 is invoked by the processor 502 to cause the chart generation apparatus to perform the following operations:
respectively determining the configuration item type information of each ECharts configuration item and the hierarchical relationship between each ECharts configuration item;
respectively determining basic configuration items corresponding to the ECharts configuration items according to the configuration item type information and the hierarchical relationship;
respectively determining parameter field information of each selectable visual attribute and configuration item field information of each basic configuration item;
and mapping between the selectable visual attributes and the basic configuration items according to the parameter field information and the configuration item field information to obtain the mapping relation.
In an alternative, the configuration item type information includes a configuration item hierarchy type; the configuration item hierarchy type is a single-layer type or a multi-layer type; the program 510 is invoked by the processor 502 to cause the chart generation apparatus to perform the following operations:
when the EChats configuration items are of the multilayer type, determining an EChats configuration item subset corresponding to the EChats configuration items according to the hierarchical relationship;
determining the ECharts configuration items of which the configuration item types are single-layer types in the ECharts configuration item subset as the basic configuration items.
In an optional manner, the configuration item type information includes a configuration item function type; the target class is one of a plurality of selectable classes; the program 510 is invoked by the processor 502 to cause the chart generation apparatus to perform the following operations:
respectively creating selectable classes corresponding to the function types of the configuration items;
determining an inheritance relationship between the selectable classes according to the hierarchical relationship;
and encapsulating the Echarts configuration items into corresponding optional classes according to the inheritance relationship to obtain the encapsulation relationship of the configuration items.
In an optional mode, the configuration item function types comprise a global configuration type, a coordinate system configuration type and a chart series configuration type; the selectable classes comprise a global class, a coordinate system class and a chart series class; the program 510 is invoked by the processor 502 to cause the chart generation apparatus to perform the following operations:
determining an associated graph series class corresponding to the coordinate system class according to the hierarchical relation;
causing the associated graphic series class to inherit the coordinate system class;
causing the coordinate system class to inherit the global class.
In an alternative manner, the program 510 is invoked by the processor 502 to cause the chart generation apparatus to perform the following operations:
acquiring an ECharts chart to be analyzed input by a user on the visual interface;
analyzing the ECharts chart to be analyzed to obtain the chart configuration information; the chart configuration information corresponds to at least one of the ECharts configuration items;
determining a chart decoupling rule according to the chart configuration information;
extracting the interface data according to the chart decoupling rule to obtain the data source;
and determining the visual attribute configuration information corresponding to the chart configuration information according to the mapping relation and the configuration item packaging relation.
The chart generation equipment provided by the embodiment of the invention acquires visual attribute configuration information and a data source input by a user on a visual interface; determining target configuration item information corresponding to the visual attribute configuration information according to the visual attribute configuration information and the mapping relation between the visual attribute and the EChats configuration items; and generating a target diagram according to the target configuration item information and the data source.
Different from the problems of high learning cost and low configuration efficiency existing in the prior art that a user needs to be familiar with API configuration of a component library or needs to know the corresponding relation between the encapsulated attribute and an ECharts configuration parameter to use a configuration tool, the chart generation equipment provided by the embodiment of the invention provides a user-friendly visual interface, maps the visual attribute parameter input on the visual interface to an ECharts configuration item, so that the configuration of ECharts can be automatically completed, and finally generates a target chart based on the configured ECharts and a data source, thereby improving the efficiency of generating the chart based on the ECharts and the user experience.
An embodiment of the present invention provides a computer-readable storage medium, where the storage medium stores at least one executable instruction, and when the executable instruction is executed on a chart generation device, the chart generation device is caused to execute a chart generation method in any method embodiment described above.
The executable instructions may be specifically configured to cause the graph generation apparatus to perform the following operations:
acquiring visual attribute configuration information and a data source input by a user on a visual interface;
determining target configuration item information corresponding to the visual attribute configuration information according to the visual attribute configuration information and the mapping relation between the visual attributes and the EChats configuration items;
and generating a target chart according to the target configuration item information and the data source.
In an optional manner, the target configuration item information includes at least one ECharts configuration item; the executable instructions cause the chart generation apparatus to:
determining a target class corresponding to the target configuration item information according to the packaging relation between the configuration item and the configuration item class;
instantiating the target class according to the target configuration item information to obtain configured EChats;
and importing the data source into the configured EChats to obtain the target chart.
In an optional mode, a plurality of selectable visualization attributes are displayed on the visualization interface; the visualization attribute configuration information comprises at least one of the selectable visualization attributes; the executable instructions cause the chart generation apparatus to:
respectively determining the configuration item type information of each ECharts configuration item and the hierarchical relationship between each ECharts configuration item;
respectively determining basic configuration items corresponding to the ECharts configuration items according to the configuration item type information and the hierarchical relationship;
respectively determining parameter field information of each selectable visual attribute and configuration item field information of each basic configuration item;
and mapping between the selectable visual attribute and the basic configuration item according to the parameter field information and the configuration item field information to obtain the mapping relation.
In an alternative, the configuration item type information includes a configuration item hierarchy type; the configuration item hierarchy type is a single-layer type or a multi-layer type; the configuration item type of the basic configuration item is the single-layer type; the executable instructions cause the chart generation apparatus to:
when the EChats configuration items are of the multilayer type, determining an EChats configuration item subset corresponding to the EChats configuration items according to the hierarchical relationship;
determining the ECharts configuration items of which the configuration item types are single-layer types in the ECharts configuration item subset as the basic configuration items.
In an optional manner, the configuration item type information includes a configuration item function type; the target class is one of a plurality of selectable classes; the executable instructions cause the chart generation apparatus to:
respectively creating selectable classes corresponding to the function types of the configuration items;
determining an inheritance relationship between the selectable classes according to the hierarchical relationship;
and encapsulating the Echarts configuration items into corresponding optional classes according to the inheritance relationship to obtain the encapsulation relationship of the configuration items.
In an optional mode, the configuration item function types comprise a global configuration type, a coordinate system configuration type and a chart series configuration type; the selectable classes comprise a global class, a coordinate system class and a chart series class; the executable instructions cause the chart generation apparatus to:
determining an associated graph series class corresponding to the coordinate system class according to the hierarchical relation;
causing the associated graphic series class to inherit the coordinate system class;
causing the coordinate system class to inherit the global class.
In an alternative, the executable instructions cause the chart generation apparatus to perform the following operations:
acquiring an EChats chart to be analyzed input by a user on the visual interface;
analyzing the ECharts chart to be analyzed to obtain the chart configuration information; the chart configuration information corresponds to at least one of the ECharts configuration items;
determining a chart decoupling rule according to the chart configuration information;
extracting the interface data according to the chart decoupling rule to obtain the data source;
and determining the visual attribute configuration information corresponding to the chart configuration information according to the mapping relation and the configuration item packaging relation.
The computer-readable storage medium provided by the embodiment of the invention acquires visual attribute configuration information and a data source which are input by a user on a visual interface; determining target configuration item information corresponding to the visual attribute configuration information according to the visual attribute configuration information and the mapping relation between the visual attribute and the EChats configuration items; and generating a target diagram according to the target configuration item information and the data source.
Different from the problems of high learning cost and low configuration efficiency existing in the prior art that a user needs to be familiar with API configuration of a component library or needs to know the corresponding relation between the encapsulated attribute and an ECharts configuration parameter to use a configuration tool, the computer-readable storage medium provided by the embodiment of the invention provides a user-friendly visual interface, and maps the visual attribute parameter input on the visual interface to an ECharts configuration item, so that the configuration of ECharts can be automatically completed, and finally, a target chart is generated based on the configured ECharts and a data source, so that the generation efficiency and the user experience of the chart based on the ECharts are improved.
The embodiment of the invention provides a chart generation device, which is used for executing the chart generation method.
Embodiments of the present invention provide a computer program that can be called by a processor to cause a chart generation apparatus to execute a chart generation method in any of the above method embodiments.
Embodiments of the present invention provide a computer program product comprising a computer program stored on a computer-readable storage medium, the computer program comprising program instructions that, when run on a computer, cause the computer to perform a method of generating a graph in any of the above-described method embodiments.
The algorithms or displays presented herein are not inherently related to any particular computer, virtual system, or other apparatus. Various general purpose systems may also be used with the teachings herein. The required structure for constructing such a system will be apparent from the description above. In addition, embodiments of the present invention are not directed to any particular programming language. It is appreciated that a variety of programming languages may be used to implement the teachings of the present invention as described herein, and any descriptions of specific languages are provided above to disclose the best mode of the invention.
In the description provided herein, numerous specific details are set forth. It is understood, however, that embodiments of the invention may be practiced without these specific details. In some instances, well-known methods, structures and techniques have not been shown in detail in order not to obscure an understanding of this description.
Similarly, it should be appreciated that in the foregoing description of exemplary embodiments of the invention, various features of the embodiments of the invention are sometimes grouped together in a single embodiment, figure, or description thereof for the purpose of streamlining the invention and aiding in the understanding of one or more of the various inventive aspects. However, the disclosed method should not be construed to reflect the intent: that the invention as claimed requires more features than are expressly recited in each claim.
Those skilled in the art will appreciate that the modules in the device in an embodiment may be adaptively changed and disposed in one or more devices different from the embodiment. The modules or units or components of the embodiments may be combined into one module or unit or component, and may be divided into a plurality of sub-modules or sub-units or sub-components. All of the features disclosed in this specification (including any accompanying claims, abstract and drawings), and all of the processes or elements of any method or apparatus so disclosed, may be combined in any combination, except combinations where at least some of such features and/or processes or elements are mutually exclusive. Each feature disclosed in this specification (including any accompanying claims, abstract and drawings) may be replaced by alternative features serving the same, equivalent or similar purpose, unless expressly stated otherwise.
It should be noted that the above-mentioned embodiments illustrate rather than limit the invention, and that those skilled in the art will be able to design alternative embodiments without departing from the scope of the appended claims. In the claims, any reference signs placed between parentheses shall not be construed as limiting the claim. The word "comprising" does not exclude the presence of elements or steps not listed in a claim. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. The invention may be implemented by means of hardware comprising several distinct elements, and by means of a suitably programmed computer. In the unit claims enumerating several means, several of these means can be embodied by one and the same item of hardware. The usage of the words first, second and third, etcetera do not indicate any ordering. These words may be interpreted as names. The steps in the above embodiments should not be construed as limited to the order of execution unless otherwise specified.

Claims (10)

1. A chart generation method, the method comprising:
acquiring visual attribute configuration information and a data source input by a user on a visual interface;
determining target configuration item information corresponding to the visual attribute configuration information according to the visual attribute configuration information and the mapping relation between the visual attribute and the EChats configuration items;
and generating a target chart according to the target configuration item information and the data source.
2. The method of claim 1, wherein the target configuration item information includes at least one ECharts configuration item; generating a target chart according to the target configuration item information and the data source, wherein the generating of the target chart comprises the following steps:
determining a target class corresponding to the target configuration item information according to the packaging relation between the configuration item and the configuration item class;
instantiating the target class according to the target configuration item information to obtain configured EChats;
and importing the data source into the configured EChats to obtain the target chart.
3. The method of claim 1, wherein a plurality of selectable visualization attributes are presented on the visualization interface; the visualization attribute configuration information comprises at least one of the selectable visualization attributes; before determining the target configuration item information corresponding to the visualization attribute configuration information according to the visualization attribute configuration information and the mapping relationship between the visualization attribute and the ECharts configuration items, the method includes:
respectively determining the configuration item type information of each ECharts configuration item and the hierarchical relationship between each ECharts configuration item;
respectively determining basic configuration items corresponding to the ECharts configuration items according to the configuration item type information and the hierarchical relationship;
respectively determining parameter field information of each selectable visual attribute and configuration item field information of each basic configuration item;
and mapping between the selectable visual attributes and the basic configuration items according to the parameter field information and the configuration item field information to obtain the mapping relation.
4. The method of claim 3, wherein the configuration item type information comprises a configuration item hierarchy type; the configuration item hierarchy type is a single-layer type or a multi-layer type; the type of the configuration item of the basic configuration item is the single-layer type; the determining the basic configuration items corresponding to the ECharts configuration items according to the configuration item types and the hierarchical relationship respectively comprises:
when the EChats configuration items are of the multilayer type, determining an EChats configuration item subset corresponding to the EChats configuration items according to the hierarchical relationship;
determining the ECharts configuration items of which the configuration item types are single-layer types in the ECharts configuration item subset as the basic configuration items.
5. The method of claim 3, wherein the configuration item type information comprises a configuration item function type; the target class is one of a plurality of selectable classes; after the determining the hierarchical relationship between the configuration item type information of each ECharts configuration item and the ECharts configuration item, respectively, the method includes:
respectively creating selectable classes corresponding to the function types of the configuration items;
determining an inheritance relationship between the selectable classes according to the hierarchical relationship;
and encapsulating the Echarts configuration items into corresponding optional classes according to the inheritance relationship to obtain the encapsulation relationship of the configuration items.
6. The method of claim 5, wherein the configuration item function types include a global configuration type, a coordinate system configuration type, and a chart series configuration type; the selectable classes comprise a global class, a coordinate system class and a chart series class; the determining an inheritance relationship between the selectable classes according to the hierarchical relationship comprises:
determining an associated graph series class corresponding to the coordinate system class according to the hierarchical relation;
causing the associated graphic series class to inherit the coordinate system class;
causing the coordinate system class to inherit the global class.
7. The method according to claim 2, wherein the acquiring of the visualization attribute configuration information and the data source input by the user on the visualization interface comprises:
acquiring an EChats chart to be analyzed input by a user on the visual interface;
analyzing the ECharts chart to be analyzed to obtain the chart configuration information; the chart configuration information corresponds to at least one of the ECharts configuration items;
determining a chart decoupling rule according to the chart configuration information;
extracting the interface data according to the chart decoupling rule to obtain the data source;
and determining the visual attribute configuration information corresponding to the chart configuration information according to the mapping relation and the configuration item packaging relation.
8. A chart generating apparatus, characterized in that the apparatus comprises:
the acquisition module is used for acquiring visual attribute configuration information and a data source input by a user on a visual interface;
the determining module is used for determining target configuration item information corresponding to the visual attribute configuration information according to the visual attribute configuration information and the mapping relation between the visual attribute and the EChats configuration items;
and the generating module is used for generating a target chart according to the target configuration item information and the data source.
9. A chart generating apparatus, comprising: the system comprises a processor, a memory, a communication interface and a communication bus, wherein the processor, the memory and the communication interface complete mutual communication through the communication bus;
the memory is configured to store at least one executable instruction that causes the processor to perform the operations of the chart generation method of any of claims 1-7.
10. A computer-readable storage medium having stored therein at least one executable instruction that, when executed on a chart generation apparatus, causes the chart generation apparatus to perform operations of the chart generation method of any one of claims 1-7.
CN202111146412.2A 2021-09-28 2021-09-28 Chart generation method, device, equipment and computer storage medium Pending CN115878102A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111146412.2A CN115878102A (en) 2021-09-28 2021-09-28 Chart generation method, device, equipment and computer storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111146412.2A CN115878102A (en) 2021-09-28 2021-09-28 Chart generation method, device, equipment and computer storage medium

Publications (1)

Publication Number Publication Date
CN115878102A true CN115878102A (en) 2023-03-31

Family

ID=85755749

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111146412.2A Pending CN115878102A (en) 2021-09-28 2021-09-28 Chart generation method, device, equipment and computer storage medium

Country Status (1)

Country Link
CN (1) CN115878102A (en)

Similar Documents

Publication Publication Date Title
CN108228169B (en) Chart making method, device, equipment and medium based on eCharts tool
JP7178977B2 (en) Composite control
KR102164418B1 (en) Apparatuses, systems, and methods for providing a visual program for machine vision systems
US20190354355A1 (en) Virtual software application deployment configurations
US10048946B2 (en) Converting visual diagrams into code
TWI460648B (en) Ranking visualization types based upon fitness for visualizing a data set
US20130073994A1 (en) Web-based workflow service visualization and navigation
US20140304214A1 (en) Navigable semantic network definition, modeling, and use
US20110246913A1 (en) Automated User Interface Generator
CN111414166B (en) Code generation method, device, equipment and storage medium
US9367289B2 (en) Method and apparatus for enabling agile development of services in cloud computing and traditional environments
CN107622080B (en) Data processing method and equipment
CN108958611B (en) Information editing method and device
CN112434117A (en) WebGIS visualization configuration method and system based on Vue
CN111611419B (en) Sub-graph identification method and device
CN114647409A (en) Large-screen visualization application creation platform, method, computing device and storage medium
CN115878102A (en) Chart generation method, device, equipment and computer storage medium
US10649743B2 (en) Application developing method and system
CN115291857A (en) Visual business rule arranging method and configurator
US9996648B2 (en) Netlist editing of graphical data
CN114281539A (en) Resource allocation method, system and storage medium
CN107357926B (en) Webpage processing method and device and electronic equipment
CN113535162A (en) Front-end interface configuration method, display method and device
CN112748917A (en) Chart display method and device
CN110908647A (en) Object variable presenting method, device, terminal and storage medium for building block programming

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