Chart creation method and related device

文档序号:700995 发布日期:2021-04-13 浏览:2次 中文

阅读说明:本技术 一种图表创建方法和相关装置 (Chart creation method and related device ) 是由 马风阳 南守拥 卢成业 于 2020-12-31 设计创作,主要内容包括:本申请实施例公开了一种图表创建方法,所述方法包括:获取目标图表创建请求,所述目标图表创建请求包括所述目标图表所对应目标图表类型;确定所述目标图表类型对应的转换函数;获取图表数据;通过所述转换函数,将所述图表数据的数据格式转换为所述目标图表类型所对应数据格式;根据转换后的图表数据创建所述目标图表。处理设备可以基于需要创建的图表的图表类型,通过转换函数将图表数据的数据格式转化为该图表类型所对应的数据格式,从而实现了不同数据类型图表的创建,丰富了图表的多样性,提高了图表的应用广泛度。(The embodiment of the application discloses a chart creating method, which comprises the following steps: acquiring a target chart creating request, wherein the target chart creating request comprises a target chart type corresponding to the target chart; determining a conversion function corresponding to the type of the target graph; acquiring chart data; converting the data format of the chart data into the data format corresponding to the target chart type through the conversion function; and creating the target chart according to the converted chart data. The processing equipment can convert the data format of the chart data into the data format corresponding to the chart type through the conversion function based on the chart type of the chart to be created, so that the creation of the charts with different data types is realized, the diversity of the charts is enriched, and the application range of the charts is improved.)

1. A diagram creation method, the method comprising:

acquiring a target chart creating request, wherein the target chart creating request comprises a target chart type corresponding to the target chart;

determining a conversion function corresponding to the type of the target graph;

acquiring chart data;

converting the data format of the chart data into the data format corresponding to the target chart type through the conversion function;

and creating the target chart according to the converted chart data.

2. The method of claim 1, wherein prior to the obtaining a target chart creation request, the method further comprises:

obtaining a target plug-in package, wherein the target plug-in package comprises the conversion function;

setting the attribute information of the plug-in package corresponding to the target plug-in package according to the type of the target graph;

adding dependency information in the target plug-in package, wherein the dependency information is used for enabling the target plug-in package to be in an available state.

3. The method of claim 2, wherein determining the transfer function corresponding to the target graph type comprises;

and calling a conversion function corresponding to the target graph type from the target plug-in package.

4. The method of claim 1, further comprising:

acquiring a standard chart, wherein the standard chart is a chart corresponding to the type of the target chart;

creating a chart to be verified according to the chart data corresponding to the standard chart and the conversion function;

and determining whether the conversion function is qualified or not according to the comparison result of the chart to be checked and the standard chart.

5. The method of claim 2, further comprising:

and synchronizing the target plug-in package to a plug-in package sharing network.

6. The method of claim 1, wherein the target graph type is ECharts type.

7. A chart creation apparatus characterized by comprising a first acquisition unit, a first determination unit, a second acquisition unit, a conversion unit, and a first creation unit:

the first obtaining unit is configured to obtain a target graph creation request, where the target graph creation request includes a target graph type corresponding to the target graph;

the first determining unit is used for determining a conversion function corresponding to the target graph type;

the second acquiring unit is used for acquiring chart data;

the conversion unit is used for converting the data format of the chart data into the data format corresponding to the target chart type through the conversion function;

the first creating unit is used for creating the target chart according to the converted chart data.

8. The apparatus according to claim 6, further comprising a third obtaining unit, a setting unit, and an adding unit:

the third obtaining unit is configured to obtain a target plug-in package, where the target plug-in package includes the conversion function;

the setting unit is used for setting the plug-in package attribute information corresponding to the target plug-in package according to the type of the target chart;

the adding unit is used for adding dependency information in the target plug-in package, and the dependency information is used for enabling the target plug-in package to be in an available state.

9. The apparatus according to claim 8, wherein the first determining unit is specifically configured to;

and calling a conversion function corresponding to the target graph type from the target plug-in package.

10. The method of claim 7, wherein the apparatus further comprises a fourth obtaining unit, a second creating unit, and a second determining unit:

the fourth obtaining unit is configured to obtain a standard chart, where the standard chart is a chart corresponding to the target chart type;

the second creating unit is used for creating a chart to be verified according to the chart data corresponding to the standard chart and the conversion function;

and the second determining unit is used for determining whether the conversion function is qualified or not according to the comparison result of the chart to be verified and the standard chart.

Technical Field

The present application relates to the field of diagram design technologies, and in particular, to a diagram creation method and a related apparatus.

Background

Data charts are one of the data forms which people frequently contact in daily life, and how to perform more effective chart creation is always a key problem for research of related personnel.

In the related art, a data chart can be created based on a single data format in one data chart software, and the creation of the data chart is limited, so that diversified chart requirements are difficult to meet.

Disclosure of Invention

In order to solve the technical problem, the application provides a chart creating method, and a processing device can convert the data format of chart data into the data format corresponding to the chart type through a conversion function based on the chart type of the chart to be created, so that the creation of charts with different data types is realized, the diversity of the charts is enriched, and the application range of the charts is improved.

The embodiment of the application discloses the following technical scheme:

in a first aspect, an embodiment of the present application provides a diagram creation method, where the method includes:

acquiring a target chart creating request, wherein the target chart creating request comprises a target chart type corresponding to the target chart;

determining a conversion function corresponding to the type of the target graph;

acquiring chart data;

converting the data format of the chart data into the data format corresponding to the target chart type through the conversion function;

and creating the target chart according to the converted chart data.

In one possible implementation, before the obtaining the target chart creation request, the method further includes:

obtaining a target plug-in package, wherein the target plug-in package comprises the conversion function;

setting the attribute information of the plug-in package corresponding to the target plug-in package according to the type of the target graph;

adding dependency information in the target plug-in package, wherein the dependency information is used for enabling the target plug-in package to be in an available state.

In one possible implementation, determining a conversion function corresponding to the target graph type includes;

and calling a conversion function corresponding to the target graph type from the target plug-in package.

In one possible implementation, the method further includes:

acquiring a standard chart, wherein the standard chart is a chart corresponding to the type of the target chart;

creating a chart to be verified according to the chart data corresponding to the standard chart and the conversion function;

and determining whether the conversion function is qualified or not according to the comparison result of the chart to be checked and the standard chart.

In one possible implementation, the method further includes:

and synchronizing the target plug-in package to a plug-in package sharing network.

In one possible implementation, the target graph type is ECharts type.

In a second aspect, an embodiment of the present application provides a chart creation apparatus, where the apparatus includes a first obtaining unit, a first determining unit, a second obtaining unit, a converting unit, and a first creating unit:

the first obtaining unit is configured to obtain a target graph creation request, where the target graph creation request includes a target graph type corresponding to the target graph;

the first determining unit is used for determining a conversion function corresponding to the target graph type;

the second acquiring unit is used for acquiring chart data;

the conversion unit is used for converting the data format of the chart data into the data format corresponding to the target chart type through the conversion function;

the first creating unit is used for creating the target chart according to the converted chart data.

In one possible implementation manner, the apparatus further includes a third obtaining unit, a setting unit, and an adding unit:

the third obtaining unit is configured to obtain a target plug-in package, where the target plug-in package includes the conversion function;

the setting unit is used for setting the plug-in package attribute information corresponding to the target plug-in package according to the type of the target chart;

the adding unit is used for adding dependency information in the target plug-in package, and the dependency information is used for enabling the target plug-in package to be in an available state.

In a possible implementation manner, the first determining unit is specifically configured to determine the first threshold value;

and calling a conversion function corresponding to the target graph type from the target plug-in package.

In a possible implementation manner, the apparatus further includes a fourth obtaining unit, a second creating unit, and a second determining unit:

the fourth obtaining unit is configured to obtain a standard chart, where the standard chart is a chart corresponding to the target chart type;

the second creating unit is used for creating a chart to be verified according to the chart data corresponding to the standard chart and the conversion function;

and the second determining unit is used for determining whether the conversion function is qualified or not according to the comparison result of the chart to be verified and the standard chart.

According to the technical scheme, the graph creating method provided by the embodiment of the application has the advantages that the processing equipment can obtain the target graph creating request, and the target table creating request comprises the target graph type corresponding to the graph to be created. In order to enable the target chart to be successfully created, the processing device may determine a conversion function corresponding to the target chart type, then obtain chart data used for generating the target chart, and convert the data format of the chart data into the data format corresponding to the target chart type through the conversion function, so that the target chart can be created according to the converted chart data. According to the method and the device, the multiple target charts can be generated by using the basic chart data through the conversion function corresponding to the target chart type, the flexibility and the freedom degree of chart creation are improved, and the use experience of a user is improved.

Drawings

In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present application, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.

Fig. 1 is a flowchart of a chart creation method provided in an embodiment of the present application;

FIG. 2 is a schematic diagram of a chart creation method provided by an embodiment of the present application;

FIG. 3 is a schematic diagram of a chart creation method provided by an embodiment of the present application;

FIG. 4 is a schematic diagram of a chart creation method provided by an embodiment of the present application;

FIG. 5 is a schematic diagram of a chart creation method provided by an embodiment of the present application;

FIG. 6 is a schematic diagram of a chart creation method provided by an embodiment of the present application;

FIG. 7 is a schematic diagram of a chart creation method provided by an embodiment of the present application;

FIG. 8 is a schematic diagram of a chart creation method provided by an embodiment of the present application;

fig. 9 is a block diagram illustrating a structure of a chart creation apparatus according to an embodiment of the present application;

Detailed Description

Embodiments of the present application are described below with reference to the accompanying drawings.

A graph is one of common tools in daily life, and for example, mathematical analysis, data statistics, data presentation, and the like are performed on various graphs such as a bar chart, a line chart, and the like. In the related art, a piece of chart software is generally only capable of chart creation based on chart data in one data format, which results in that some charts which are not suitable for the data format cannot be created in the chart software.

In order to solve the technical problem, the application provides a chart creating method, and a processing device can convert the data format of chart data into the data format corresponding to the chart type through a conversion function based on the chart type of the chart to be created, so that the creation of charts with different data types is realized, the diversity of the charts is enriched, and the application range of the charts is improved.

It is to be understood that the method may be applied to a processing device having a chart creation processing function, for example, a terminal device or a server having a chart creation function. The method can be independently operated by the terminal equipment or the server, and can also be applied to a network scene of communication between the terminal equipment and the server, and the method can be operated by the cooperation of the terminal equipment and the server. The terminal device may be a mobile phone, a desktop computer, a Personal Digital Assistant (PDA for short), a tablet computer, or the like. The server may be understood as an application server, or may also be a Web server, and in actual deployment, the server may be an independent physical server, or may be a server cluster or a distributed system formed by a plurality of physical servers. The terminal and the server may be directly or indirectly connected through wired or wireless communication, and the application is not limited herein.

Next, a diagram creation method provided by an embodiment of the present application will be described with reference to the drawings.

Referring to fig. 1, fig. 1 is a flowchart of a diagram creation method provided in an embodiment of the present application, where the method includes:

s101: and acquiring a target chart creating request.

Wherein, the target chart creates the chart needed to be created for the chart. In order for a processing device to be able to successfully create the target chart, it is first necessary for the processing device to acquire chart data that enables the chart to be generated. However, since in actual applications there may be cases where the acquired chart data does not match the type of the chart that needs to be generated, when the type does not match, the processing apparatus cannot create the chart based on the chart data.

Based on this, in order to successfully create the target diagram, the processing device needs to ensure that the acquired diagram data is the diagram data of the type corresponding to the target diagram. First, the target chart creation request may include a target chart type corresponding to the target chart, where the target chart type is used to instruct the processing device to perform data format conversion. The target chart type may include a variety of types, such as a chart that may be of the ECharts type.

S102: and determining a conversion function corresponding to the target graph type.

The conversion function is used for converting the data format of the chart data, the conversion function corresponding to the target chart type is used for converting the data format of the chart data into the data format corresponding to the target chart type, and the chart data in the data format can be used for generating the target chart.

S103: chart data is acquired.

The processing device may obtain the charting data used to generate the target chart from a source such as a charting software backend, for example, the data may be fund price change data, enterprise revenue data, and the like.

S104: and converting the data format of the chart data into the data format corresponding to the target chart type through a conversion function.

And the conversion function is the conversion function corresponding to the target chart type, so that the processing equipment can convert the data format of the chart data into the data format corresponding to the target chart type through the conversion function, and the converted chart data can be used for creating the target chart.

S105: a target chart is created from the converted chart data.

The processing device may create the target chart from the chart data after the format conversion. As shown in fig. 2, fig. 2 shows a code diagram for performing data format conversion by a conversion function and creating a target chart.

According to the technical scheme, the graph creating method provided by the embodiment of the application has the advantages that the processing equipment can obtain the target graph creating request, and the target table creating request comprises the target graph type corresponding to the graph to be created. In order to enable the target chart to be successfully created, the processing device may determine a conversion function corresponding to the target chart type, then obtain chart data used for generating the target chart, and convert the data format of the chart data into the data format corresponding to the target chart type through the conversion function, so that the target chart can be created according to the converted chart data. According to the method and the device, the multiple target charts can be generated by using the basic chart data through the conversion function corresponding to the target chart type, the flexibility and the freedom degree of chart creation are improved, and the use experience of a user is improved.

It will be appreciated that the method of inserting the transfer function in the processing device may also include a variety of methods. In a possible implementation manner, in order to reduce the code correlation between the code related to the conversion function and the code of the graph software itself, thereby avoiding the problem that the maintenance difficulty is too large due to too high coupling degree between the code related to the conversion function and the code of the graph software itself when the conversion function needs to be updated and maintained, the processing device may obtain the conversion function in the manner of an external plug-in package.

Prior to obtaining the target diagram creation request, the processing device may obtain a target plug-in package that includes the transfer function. In order to mark the target plug-in package and enable the processing device to quickly locate the conversion function, the processing device may set the plug-in package attribute information corresponding to the target plug-in package according to the type of the target graph, where the plug-in package attribute information is used to identify the target plug-in package. For example, when the target type of the graph is the ECharts type, the processing device may set the package name, version number, author, description, and other plug-in package attribute information of the target plug-in package according to the target type of the graph. As shown in FIG. 3, FIG. 3 illustrates a code diagram for configuring a target plug-in package. In addition, in order to enable the processing device to normally call the information in the target plug-in package, the processing device may add dependency information in the target plug-in package, the dependency information being used to enable the target plug-in package to be in a callable state. For example, when the processing device is performing graph creation through Superset graph software, the Superset base tool library may be made to depend on the target plug-in package by modifying the configuration file of the target plug-in package, adding dependency information, and then may perform the dependency through npm install. Fig. 4 is a schematic diagram of code for adding dependency information, as shown in fig. 4.

After the target plug-in package is obtained, the processing device may call a conversion function corresponding to the target graph type from the target plug-in package to perform format conversion on the graph data.

It will be appreciated that, in order to improve the accuracy of the chart creation, in one possible implementation, the processing device may also verify the chart creation flow. For example, the processing device may first obtain a standard chart, which is a chart corresponding to the target chart type. Subsequently, in order to control the check variable and obtain an accurate check result, the processing device may create a chart to be checked according to the chart data and the conversion function corresponding to the standard chart. Specifically, the processing device may convert the chart data into a data format corresponding to the target chart type by using the conversion function, and then create a chart to be verified according to the converted chart data. The processing device may compare the chart to be verified with the standard chart, and then determine whether the transfer function is qualified according to a comparison result of the chart to be verified and the standard chart. If the comparison result is consistent, the conversion function is qualified; if not, the product is not qualified. Fig. 5 shows a schematic diagram of a code for checking a conversion function, as shown in fig. 5.

It is to be understood that, in order to enable more processing devices to use the conversion function to create the target graph, in one possible implementation, the processing device may synchronize the target plug-in package to a plug-in package sharing network, for example, an NPM network, for downloading and using by other processing devices. As shown in fig. 6, fig. 6 shows a code diagram for synchronizing a target plug-in package to an NPM network.

In order to facilitate understanding of the technical solution provided by the present application, a diagram creation method provided by the embodiment of the present application will be described below in conjunction with an actual application scenario. In the actual application scenario, the target chart type may be an ECharts chart, and the processing device may be a terminal device capable of creating the chart.

First, the terminal device may create a Package, and then configure information such as Package name, version number, author, description, and the like of the Package according to the ECharts chart type. Subsequently, the terminal device may configure the Superset base tool library dependency for the plug-in package, and execute the npm install dependency information.

The terminal equipment can design a conversion function in the Package plug-in Package, the graph data transmitted from the Superset back end is processed through the conversion function and converted into a data format corresponding to the ECharts table, then the terminal equipment can construct an ECharts node, configure an ECharts Options attribute and create the ECharts graph. The terminal device may package the assembly for use by the Superset software.

In addition, the terminal equipment can also create a unit test module corresponding to the ECharts chart to test the plug-in package, and render the ECharts chart for verification. As shown in fig. 7, fig. 7 is a schematic diagram of an ECharts chart. Finally, the terminal device can release the plug-in package to an NPM website for downloading and using by other terminal devices. As shown in fig. 8, fig. 8 is a schematic interface diagram of an NPM website, where the interface includes a plurality of chart types available for downloading.

Based on the graph creating method provided in the foregoing embodiment, an embodiment of the present application further provides a graph creating apparatus, referring to fig. 9, where fig. 9 is a block diagram of a structure of a graph creating apparatus 900 provided in the embodiment of the present application, where the apparatus 900 includes a first obtaining unit 901, a first determining unit 902, a second obtaining unit 903, a converting unit 904, and a first creating unit 905:

a first obtaining unit 901, configured to obtain a target chart creation request, where the target chart creation request includes a target chart type corresponding to the target chart;

a first determining unit 902, configured to determine a conversion function corresponding to the target graph type;

a second obtaining unit 903 for obtaining chart data;

a conversion unit 904, configured to convert the data format of the graph data into the data format corresponding to the target graph type through the conversion function;

a first creating unit 905, configured to create the target diagram according to the converted diagram data.

In one possible implementation manner, the apparatus 900 further includes a third obtaining unit, a setting unit, and an adding unit:

a third obtaining unit, configured to obtain a target plug-in package, where the target plug-in package includes the conversion function;

the setting unit is used for setting the plug-in package attribute information corresponding to the target plug-in package according to the type of the target chart;

and the adding unit is used for adding dependency information in the target plug-in package, and the dependency information is used for enabling the target plug-in package to be in an available state.

In a possible implementation manner, the first determining unit 902 is specifically configured to;

and calling a conversion function corresponding to the target graph type from the target plug-in package.

In a possible implementation manner, the apparatus 900 further includes a fourth obtaining unit, a second creating unit, and a second determining unit:

the fourth obtaining unit is used for obtaining a standard chart, and the standard chart is a chart corresponding to the type of the target chart;

the second creating unit is used for creating a chart to be verified according to the chart data corresponding to the standard chart and the conversion function;

and the second determining unit is used for determining whether the conversion function is qualified or not according to the comparison result of the chart to be verified and the standard chart.

In one possible implementation, the apparatus 900 further includes a synchronization unit:

and the synchronization unit is used for synchronizing the target plug-in package to a plug-in package sharing network.

In one possible implementation, the target graph type is ECharts type.

Those of ordinary skill in the art will understand that: all or part of the steps for realizing the method embodiments can be completed by hardware related to program instructions, the program can be stored in a computer readable storage medium, and the program executes the steps comprising the method embodiments when executed; and the aforementioned storage medium may be at least one of the following media: various media that can store program codes, such as read-only memory (ROM), RAM, magnetic disk, or optical disk.

It should be noted that, in the present specification, all the embodiments are described in a progressive manner, and the same and similar parts among the embodiments may be referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the apparatus and system embodiments, since they are substantially similar to the method embodiments, they are described in a relatively simple manner, and reference may be made to some of the descriptions of the method embodiments for related points. The above-described embodiments of the apparatus and system are merely illustrative, and the units described as separate parts may or may not be physically separate, and the parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment. One of ordinary skill in the art can understand and implement it without inventive effort.

The above description is only one specific embodiment of the present application, but the scope of the present application is not limited thereto, and any changes or substitutions that can be easily conceived by those skilled in the art within the technical scope of the present application should be covered by the scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

15页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:论文文档的处理方法、处理装置、电子设备及存储介质

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!