A chart generation method and device compatible with multiple big data chart library engines
By converting the chart function into an intermediate format and retrieving and converting it according to business needs, the problems of large workload and high cost during the chart function migration process are solved, and compatibility with a variety of big data chart library engines is achieved.
Patent Information
- Application Number
- CN201811549476.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2018-12-18
- Publication Date
- 2024-11-26
- Estimated Expiration
- 2038-12-18
AI Technical Summary
In the prior art, the process of chart function migration has a large workload and high cost, and the syntax supported by different big data chart library engines is different, resulting in difficulty in function migration.
By converting the chart functions in the preset chart library to intermediate formats, retrieving the corresponding intermediate format functions according to business needs, and converting them into a format recognized by the target chart library engine, a chart is generated.
Saves the call program setting process required by different target chart libraries to support different syntaxes, reduces the cost of chart function migration, and achieves compatibility with multiple big data chart library engines.
Smart Images

Figure CN111339169B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data processing technology, and in particular to a chart generation method and device compatible with multiple large data chart library engines. Background Art
[0002] In the prior art, a large number of charts are used for data visualization, and the drawing of these charts is usually completed through third-party chart libraries. Different big data chart library engines have their own characteristics, but they are also different. For example, different big data chart library engines support different syntax, and the interfaces called and the calling methods used when using the same function are different. If the currently used chart library cannot implement a certain function, but this function can be implemented in another chart library, then the corresponding function needs to be migrated from another chart library to the currently used chart library. However, in the actual process of chart function migration, there will be problems such as large migration workload and high migration cost.
[0003] Therefore, how to reduce the migration cost of chart functions as much as possible and generate charts in a way that is compatible with multiple big data chart libraries is a technical problem that needs to be solved at present. Summary of the invention
[0004] In view of the above problems, the present invention is proposed to provide a chart generation method and device that is compatible with multiple big data chart library engines and overcomes the above problems or at least partially solves the above problems.
[0005] According to one aspect of the present invention, a method for generating a chart compatible with multiple big data chart library engines is provided, comprising:
[0006] Get multiple chart functions from the preset chart library;
[0007] Convert the format of each chart function into an intermediate format based on a predefined grammar to obtain a set of chart functions in the intermediate format;
[0008] When receiving the data to be processed and the business requirements for the data to be processed, calling the chart function in the intermediate format corresponding to the business requirements from the chart function set;
[0009] The retrieved chart function in the intermediate format is converted into a chart function in a target format recognizable by a target chart library engine, and a corresponding chart is generated based on the data to be processed using the chart function in the target format.
[0010] Optionally, before acquiring a plurality of chart functions from a preset chart library, the method further includes:
[0011] Collect business requirements related to big data business;
[0012] Based on the collected business requirements, a corresponding grammar is defined, and the grammar serves as a grammatical basis for the conversion of the functional format of the chart.
[0013] Optionally, get multiple charting features from a library of pre-built charts, including:
[0014] The collected business requirements are analyzed, and a plurality of chart functions corresponding to the business requirements are acquired from the preset chart library according to the analysis results.
[0015] Optionally, the business requirement includes: a requirement for drawing a chart of at least one chart style.
[0016] Optionally, the chart style includes any one of the following:
[0017] Line chart, curve chart, area chart, column chart, bar chart, pie chart, scatter chart, bubble chart, line chart.
[0018] Optionally, after converting the format of each chart function into an intermediate format based on a predefined grammar to obtain a set of chart functions in the intermediate format, the following is further included:
[0019] Adding a label to each chart function in the set of chart functions in the intermediate format, wherein the label is used to identify the chart function in the intermediate format and corresponds one-to-one to each chart function in the intermediate format;
[0020] Save the chart function after adding labels.
[0021] Optionally, retrieving a chart function in an intermediate format corresponding to the business requirement from the chart function set includes:
[0022] A tag corresponding to the business requirement is obtained, and a chart function in an intermediate format corresponding to the tag is called according to the tag.
[0023] Optionally, the preset chart library or target chart library includes:
[0024] Any one of echarts chart library, g2 chart library, highcharts chart library;
[0025] The preset chart library and the target chart library support different syntaxes.
[0026] According to another aspect of the present invention, there is also provided a chart generating device compatible with a variety of big data chart library engines, comprising:
[0027] The acquisition module is suitable for obtaining multiple chart functions from the preset chart library;
[0028] A conversion module, adapted to convert the format of each chart function into an intermediate format based on a predefined grammar, to obtain a set of chart functions in the intermediate format;
[0029] a calling module adapted to call a chart function in an intermediate format corresponding to the business requirement from the chart function set when receiving the data to be processed and the business requirement for the data to be processed;
[0030] The generating module is adapted to convert the retrieved chart function in the intermediate format into a chart function in a target format recognizable by a target chart library engine, and to generate a corresponding chart based on the data to be processed using the chart function in the target format.
[0031] Optionally, the device further comprises:
[0032] A collection module, adapted to collect business requirements related to the big data business before the acquisition module acquires multiple chart functions from the preset chart library;
[0033] The definition module is adapted to define corresponding grammar based on the collected business requirements, and the grammar serves as the grammar basis for the conversion of the functional format of the chart.
[0034] Optionally, the acquisition module is further adapted to:
[0035] The collected business requirements are analyzed, and a plurality of chart functions corresponding to the business requirements are acquired from the preset chart library according to the analysis results.
[0036] Optionally, the business requirement includes: a requirement for drawing a chart of at least one chart style.
[0037] Optionally, the chart style includes any one of the following: a straight line chart, a curve chart, an area chart, a column chart, a bar chart, a pie chart, a scatter chart, a bubble chart, and a line chart.
[0038] Optionally, the device further comprises:
[0039] an adding module, adapted to add a label to each chart function in the set of chart functions in the intermediate format after the conversion module converts the format of each chart function into an intermediate format based on a predefined grammar to obtain a set of chart functions in the intermediate format, wherein the label is used to identify the chart function in the intermediate format and corresponds one-to-one to each chart function in the intermediate format;
[0040] The saving module is suitable for saving the chart function after adding labels.
[0041] Optionally, the retrieval module is also suitable for:
[0042] A tag corresponding to the business requirement is obtained, and a chart function in an intermediate format corresponding to the tag is called according to the tag.
[0043] Optionally, the preset chart library or target chart library includes:
[0044] Any one of echarts chart library, g2 chart library, highcharts chart library;
[0045] The preset chart library and the target chart library support different syntaxes.
[0046] According to another aspect of the present invention, a computer storage medium is provided, wherein the computer storage medium stores computer program code, and when the computer program code runs on a computing device, the computing device executes the chart generation method compatible with multiple big data chart library engines in any of the above embodiments.
[0047] According to another aspect of the present invention, a computing device is provided, comprising: a processor; a memory storing computer program code; when the computer program code is executed by the processor, the computing device executes the chart generation method compatible with multiple big data chart library engines in any of the above embodiments.
[0048] The embodiment of the present invention converts the chart function in the preset chart library into a chart function in an intermediate format of a custom syntax first, so that when receiving the data to be processed and the business requirements for the data to be processed, it is not necessary to call the corresponding chart function from the target chart library, but to directly call the chart function in the intermediate format from the set of chart functions in the intermediate format, thereby greatly saving the process of setting different calling programs for different target chart libraries because different target chart libraries support different syntaxes, and also avoiding the problems of large migration workload and high migration cost in the process of migrating chart functions between different chart libraries. Furthermore, after calling the chart function in the intermediate format, the chart function in the intermediate format can be converted into a chart function in any target format, so that it can be compatible with any target chart library engine to realize the processing of the data to be processed and generate a chart of a corresponding style.
[0049] The above description is only an overview of the technical solution of the present invention. In order to more clearly understand the technical means of the present invention, it can be implemented according to the contents of the specification. In order to make the above and other purposes, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are listed below.
[0050] Based on the following detailed description of specific embodiments of the present invention in conjunction with the accompanying drawings, those skilled in the art will become more aware of the above and other objects, advantages and features of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0051] Various other advantages and benefits will become apparent to those of ordinary skill in the art by reading the detailed description of the preferred embodiments below. The accompanying drawings are only for the purpose of illustrating the preferred embodiments and are not to be considered as limiting the present invention. Moreover, the same reference symbols are used throughout the accompanying drawings to represent the same components. In the accompanying drawings:
[0052] Figure 1 A schematic diagram of a chart generation method compatible with multiple big data chart library engines according to an embodiment of the present invention is shown;
[0053] Figure 2 A schematic diagram of a flow chart generation method compatible with multiple big data chart library engines according to another embodiment of the present invention is shown;
[0054] Figure 3 A schematic diagram of the structure of a chart generating device compatible with multiple big data chart library engines according to an embodiment of the present invention is shown;
[0055] Figure 4 A schematic structural diagram of a chart generating device compatible with multiple big data chart library engines according to another embodiment of the present invention is shown. DETAILED DESCRIPTION
[0056] The exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although the exemplary embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided to enable a more thorough understanding of the present disclosure and to fully convey the scope of the present disclosure to those skilled in the art.
[0057] In order to solve the above technical problems, an embodiment of the present invention provides a chart generation method that is compatible with multiple big data chart library engines. Figure 1 The following is a flow chart diagram of a method for generating a chart compatible with multiple big data chart library engines according to an embodiment of the present invention. Figure 1 The method at least includes steps S102 to S108.
[0058] Step S102, obtaining multiple chart functions from a preset chart library.
[0059] Step S104 : converting the format of each chart function into an intermediate format based on a predefined grammar to obtain a chart function set in the intermediate format.
[0060] Step S106 , when the data to be processed and the business requirements for the data to be processed are received, a chart function in an intermediate format corresponding to the business requirements is retrieved from the chart function set.
[0061] Step S108, converting the retrieved chart function in the intermediate format into a chart function in a target format recognizable by the target chart library engine, and using the chart function in the target format to generate a corresponding chart based on the data to be processed.
[0062] The embodiment of the present invention converts the chart function in the preset chart library into a chart function in an intermediate format of a custom syntax first, so that when receiving the data to be processed and the business requirements for the data to be processed, it is not necessary to call the corresponding chart function from the target chart library, but to directly call the chart function in the intermediate format from the set of chart functions in the intermediate format, thereby greatly saving the process of setting different calling programs for different target chart libraries because different target chart libraries support different syntaxes, and also avoiding the problems of large migration workload and high migration cost in the process of migrating chart functions between different chart libraries. Furthermore, after calling the chart function in the intermediate format, the chart function in the intermediate format can be converted into a chart function in any target format, so that it can be compatible with any target chart library engine to realize the processing of the data to be processed and generate a chart of a corresponding style.
[0063] Referring to step S102, since the preset chart library may be a large chart library containing many chart functions, some of which are frequently used, while others are not frequently used. Therefore, when obtaining multiple chart functions from the preset chart library, the chart functions related to the business needs can be obtained according to actual business needs, without having to obtain all the chart functions in the preset chart library.
[0064] In one embodiment of the present invention, when the actual business demand involves the business demand of big data, before obtaining multiple chart functions from the preset chart library, the business demand related to the big data business can be collected first. Then, by analyzing the collected business demand, multiple chart functions corresponding to the business demand can be obtained from the preset chart library according to the analysis results.
[0065] In addition, since the formats of multiple chart functions obtained need to be converted into intermediate formats based on pre-defined grammars, after collecting business requirements related to big data business, corresponding grammars can also be defined based on the collected business requirements, and the defined grammars are used as the grammatical basis for chart function format conversion. For example, part of the program of the intermediate format of the pie chart function obtained based on the defined grammar is as follows:
[0066]
[0067] Of course, the above program embodiment is merely illustrative, which does not impose any specific limitation on the chart function of the intermediate format of the present invention.
[0068] Referring to step S106, in one embodiment of the present invention, the received business requirements for the data to be processed may include one or more chart drawing requirements of chart styles. Of course, the drawing requirements may only indicate that a chart of a certain style needs to be drawn, without indicating which specific chart style needs to be drawn. The subsequent analysis of the type of data to be processed, application scope, and other information to further analyze which chart style the received data to be processed adopts is clearer. For example, the received data to be processed and the business requirements for the data to be processed are to draw a chart of a certain style based on the proportion of company tasks handled by each of the five departments: department a accounts for 35%, department b accounts for 30%, department c accounts for 20%, department d accounts for 10%, and department e accounts for 5%. By analyzing these data and data type information, it can be seen that the pie chart can more clearly reflect the percentage of each department, so the received data can be displayed in the form of a pie chart. Then, the intermediate format chart function corresponding to the pie chart is retrieved from the chart function set.
[0069] In another embodiment of the present invention, the drawing requirement may also be a requirement that clearly indicates which specific style of chart needs to be drawn based on the data to be processed. In this case, there is no need to analyze the type of data to be processed, the scope of application, and other information, and the intermediate format chart function corresponding to the business requirement can be directly retrieved from the chart function set. For example, the received data to be processed and the business requirement for the data to be processed are to draw a bar chart based on the revenue of each department this year and the revenue of last year in the five departments. The revenue of each department this year is 3 million for department a, 2.5 million for department b, 2 million for department c, 1 million for department d, and 500,000 for department e. The revenue of last year was 3.5 million for department a, 3 million for department b, 2 million for department c, 800,000 for department d, and 600,000 for department e. Then, the intermediate format chart function corresponding to the bar chart is directly retrieved from the chart function set.
[0070] In the embodiment of the present invention, a chart function in the chart function set may correspond to a chart of a style. The chart style may include a straight line chart, a curve chart, an area chart, a column chart, a bar chart, a pie chart, a scatter chart, a bubble chart, a line chart, etc. The embodiment of the present invention does not specifically limit the chart style.
[0071] Referring to step S108 above, in an embodiment of the present invention, after a chart function in an intermediate format corresponding to a business requirement is retrieved from a chart function set, the retrieved chart function in an intermediate format can be converted into a chart function in a target format that can be recognized by the target chart library engine according to the target chart library engine selected by the user, and the chart function in the target format is used to generate a corresponding chart based on the data to be processed. In this embodiment, the target chart library engine selected by the user is different, and the target format of the chart function after the intermediate format chart function is converted is also different. Therefore, the scheme of the present invention can use the chart function in any chart library to draw a chart.
[0072] The embodiment of the present invention also provides another chart generation method that is compatible with multiple big data chart library engines. Figure 2 A schematic diagram of a chart generation method compatible with multiple big data chart library engines according to another embodiment of the present invention is shown. Figure 2 The method at least includes steps S202 to S212.
[0073] Step S202, obtaining multiple chart functions from a preset chart library.
[0074] Step S204 : converting the format of each chart function into an intermediate format based on a predefined grammar to obtain a chart function set in the intermediate format.
[0075] Step S206 , adding a label to each chart function in the chart function set in the intermediate format, wherein the label is used to identify the chart function in the intermediate format and corresponds one-to-one to each chart function in the intermediate format.
[0076] Step S208, saving the chart function after adding labels.
[0077] Step S210 , when the data to be processed and the business requirements for the data to be processed are received, a label corresponding to the business requirement is obtained, and a chart function in an intermediate format corresponding to the label is called.
[0078] Step S212: converting the retrieved chart function in the intermediate format into a chart function in a target format recognizable by the target chart library engine, and using the chart function in the target format to generate a corresponding chart based on the data to be processed.
[0079] Referring to step S204, in an embodiment of the present invention, although the current Svg (Scalable Vector Graphics) format can realize various general functions, such as animation function and vector graphics function, its compatibility is poor, it does not support WeChat applets, and it cannot be used specifically for big data chart display. In addition, the performance of Svg is weaker than that of other chart library engines. The embodiment of the present invention refers to the standard format of Svg when converting the format of each chart function into an intermediate format based on a predefined syntax, obtains an intermediate format through corresponding cutting, and then obtains a set of chart functions in the intermediate format.
[0080] Referring to step S206 above, in one embodiment of the present invention, in order to be able to more quickly and conveniently find the intermediate format chart function corresponding to the business needs from the intermediate format chart function set, a label can also be added to each chart function in the intermediate format chart function set. The label can not only identify the corresponding chart function, but also reflect the corresponding business needs, and each label corresponds to a chart function in the intermediate format. For example, the label added to the chart function of the pie chart is pie, and the label added to the chart function of the line chart is line. The examples of chart function labels here are merely illustrative, and the embodiments of the present invention do not make specific limitations on this.
[0081] Furthermore, in step S210, when the data to be processed and the business requirements for the data to be processed are received, the chart function in the intermediate format corresponding to the tag can be called by obtaining the tag corresponding to the business requirement.
[0082] In one embodiment of the present invention, the preset chart library or the target chart library may include any one of the echarts chart library, the g2 chart library, the highcharts chart library, etc., and the preset chart library and the target chart library are different chart libraries, and both support different syntaxes.
[0083] The scheme of the present invention is introduced below with an embodiment, assuming that the preset chart library is the echarts chart library, and the target chart library with the chart function in the target format is the g2 chart library. The echarts chart library is currently used. When calling the chart function (such as the pie chart function) in the echarts chart library, the calling program, calling method and corresponding calling interface used are all corresponding to the echarts chart library, and support the syntax of the echarts chart library.
[0084] However, for the same chart function, the chart effects produced when using different chart libraries will also be different. If you want to use the chart function (such as the pie chart function) in the g2 chart library now, using the existing technology, you need to use the calling method and calling interface corresponding to the g2 chart library to call the chart function in the g2 chart library. The calling program used to call the echarts chart library is not compatible with the g2 chart library. Therefore, it is necessary to design a new calling program compatible with the g2 chart library to implement the calling of the chart function. This method not only increases the development workload of developers, but also easily causes problems such as poor user experience and low chart drawing efficiency.
[0085] By adopting the scheme of the present invention, since multiple chart functions in the preset chart library (echarts chart library) are converted into chart functions with intermediate formats, when you want to use chart functions (such as pie chart functions) in any other chart library (such as g2 chart library), you do not need to design a new caller to adapt to other chart libraries. Instead, you can use a set of callers to retrieve the chart functions in the intermediate format corresponding to the business needs from the chart function set, and then convert the chart functions in the intermediate format into a format that can be recognized by other chart libraries. Therefore, the embodiment of the present invention can be more conveniently compatible with a variety of big data chart library engines to generate corresponding charts.
[0086] In one embodiment of the present invention, the process of converting the format of each chart function into an intermediate format based on a predefined syntax can be realized by a pre-designed intermediate format converter, that is, by importing the acquired chart function into the intermediate format converter to realize the format conversion of the chart function. Of course, in the subsequent process of converting the chart function in the intermediate format into the chart function in the target format, the format conversion can also be realized by a pre-designed intermediate format converter.
[0087] In another embodiment of the present invention, due to the difference in the functions supported by different chart libraries, a chart function that is not supported by a chart library may be supported in another chart library. For the chart function supported by a certain chart library engine alone, a solution similar to the proprietary attribute of browser CSS (Cascading Style Sheets) can be provided. In addition, in order to facilitate the identification of different chart library functions, different identifiers can also be added for different grammars. For example, for the grammar that echarts chart library does not support but g2 supports, it can be started with "-echarts-*", and for the grammar that echarts chart library supports but g2 does not support, it can be started with "-g2-*". For this grammar, when encountering an unsupported situation, the current consideration is to filter out this part of the content.
[0088] Based on the same inventive concept, an embodiment of the present invention further provides a chart generating device compatible with multiple big data chart library engines. Figure 3 FIG. 1 is a schematic diagram showing a structure of a chart generating device compatible with multiple big data chart library engines according to an embodiment of the present invention. Figure 3 The chart generating device 300 compatible with various big data chart library engines includes an acquisition module 310 , a conversion module 320 , a call module 330 , and a generation module 340 .
[0089] The functions of the components or devices of the chart generating device 300 compatible with multiple large data chart library engines according to an embodiment of the present invention and the connection relationship between the components are now introduced:
[0090] The acquisition module 310 is adapted to acquire a plurality of chart functions from a preset chart library;
[0091] The conversion module 320 is coupled to the acquisition module 310 and is adapted to convert the format of each chart function into an intermediate format based on a predefined grammar to obtain a set of chart functions in the intermediate format;
[0092] The retrieval module 330 is coupled to the conversion module 320 and is adapted to retrieve the chart function in the intermediate format corresponding to the business requirement from the chart function set when receiving the data to be processed and the business requirement for the data to be processed;
[0093] The generating module 340 is coupled to the calling module 330 and is adapted to convert the called intermediate format chart function into a target format chart function recognizable by the target chart library engine, and use the target format chart function to generate a corresponding chart based on the data to be processed.
[0094] In an embodiment of the present invention, the business requirement includes a requirement for drawing a chart of at least one chart style.
[0095] In one embodiment of the present invention, the chart styles may include straight line graphs, curve graphs, area graphs, column graphs, bar graphs, pie charts, scatter graphs, bubble graphs, line graphs, and the like.
[0096] In one embodiment of the present invention, the preset chart library or the target chart library includes: any one of echarts chart library, g2 chart library, and highcharts chart library, wherein the preset chart library and the target chart library support different syntaxes.
[0097] The embodiment of the present invention also provides another chart generation device compatible with multiple big data chart library engines. Figure 4 FIG. 1 is a schematic diagram showing a structure of a chart generating device compatible with multiple big data chart library engines according to an embodiment of the present invention. Figure 4The chart generating device 300 compatible with a variety of big data chart library engines includes an acquisition module 310, a conversion module 320, a call module 330, a generation module 340, a collection module 350, a definition module 360, an addition module 370, and a storage module 380.
[0098] The collection module 350 is coupled to the acquisition module 310 and is adapted to collect business requirements related to the big data business before the acquisition module 310 acquires a plurality of chart functions from a preset chart library.
[0099] The definition module 360 is coupled to the collection module 350 and is adapted to define corresponding grammars based on the collected business requirements, and the grammars serve as the grammar basis for the conversion of the functional format of the chart.
[0100] The adding module 370 is coupled to the conversion module 320 and is suitable for adding a label to each chart function in the set of chart functions in the intermediate format after the conversion module 320 converts the format of each chart function into an intermediate format based on a predefined syntax to obtain a set of chart functions in the intermediate format, wherein the label is used to identify the chart function in the intermediate format and corresponds one-to-one to each chart function in the intermediate format.
[0101] The saving module 380 is coupled to the adding module 370 and is adapted to save the chart function after adding labels.
[0102] In an embodiment of the present invention, the acquisition module 310 is further adapted to analyze the collected business requirements and acquire a plurality of chart functions corresponding to the business requirements from a preset chart library according to the analysis results.
[0103] In an embodiment of the present invention, the calling module 330 is further adapted to obtain a tag corresponding to the business requirement, and call a chart function in an intermediate format corresponding to the tag according to the tag.
[0104] According to any one of the above preferred embodiments or a combination of multiple preferred embodiments, the embodiments of the present invention can achieve the following beneficial effects:
[0105] The embodiment of the present invention converts the chart function in the preset chart library into a chart function in an intermediate format of a custom syntax first, so that when receiving the data to be processed and the business requirements for the data to be processed, it is not necessary to call the corresponding chart function from the target chart library, but directly call the chart function in the intermediate format from the set of chart functions in the intermediate format, thereby greatly saving the process of setting different calling programs for different target chart libraries because different target chart libraries support different syntaxes, and also avoiding the problems of large migration workload and high migration cost in the process of migrating chart functions between different chart libraries. Furthermore, after calling the chart function in the intermediate format, the chart function in the intermediate format can be converted into a chart function in any target format, so that it can be compatible with any target chart library engine to realize the processing of the data to be processed and generate a chart of a corresponding style.
[0106] Those skilled in the art can clearly understand that the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments, and for the sake of brevity, they are not further described here.
[0107] In addition, the functional units in various embodiments of the present invention may be physically independent of each other, or two or more functional units may be integrated together, or all functional units may be integrated into one processing unit. The above integrated functional units may be implemented in the form of hardware, or in the form of software or firmware.
[0108] A person of ordinary skill in the art can understand that if the integrated functional unit is implemented in the form of software and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention can essentially or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, which includes a number of instructions to enable a computing device (such as a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods of the embodiments of the present invention when running the instructions. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), magnetic disk or optical disk and other media that can store program codes.
[0109] Alternatively, all or part of the steps of implementing the aforementioned method embodiments may be accomplished by hardware associated with program instructions (such as a computing device such as a personal computer, a server, or a network device), and the program instructions may be stored in a computer-readable storage medium. When the program instructions are executed by a processor of the computing device, the computing device executes all or part of the steps of the methods of the various embodiments of the present invention.
[0110] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that within the spirit and principles of the present invention, the technical solutions described in the aforementioned embodiments can still be modified, or some or all of the technical features therein can be replaced by equivalents. However, these modifications or replacements do not deviate from the protection scope of the present invention.
Claims
1. A chart generation method compatible with multiple big data chart library engines, comprising: Get multiple chart functions from the preset chart library; Convert the format of each chart function into an intermediate format based on a predefined grammar to obtain a set of chart functions in the intermediate format; When receiving the data to be processed and the business requirements for the data to be processed, calling the chart function in the intermediate format corresponding to the business requirements from the chart function set; Converting the retrieved chart function in the intermediate format into a chart function in a target format recognizable by a target chart library engine, and using the chart function in the target format to generate a corresponding chart based on the data to be processed; Before obtaining multiple chart functions from the preset chart library, the method further includes: Collect business requirements related to big data business; Based on the collected business requirements, a corresponding grammar is defined, and the grammar serves as a grammatical basis for the conversion of the functional format of the chart.
2. The method according to claim 1, wherein: Get multiple charting features from a library of pre-built charts, including: The collected business requirements are analyzed, and a plurality of chart functions corresponding to the business requirements are acquired from the preset chart library according to the analysis results.
3. The method according to any one of claims 1 or 2, wherein: The business requirements include: a requirement for drawing a chart of at least one chart style.
4. The method according to claim 3, wherein: The chart style includes any one of the following: straight line chart, curve chart, area chart, column chart, bar chart, pie chart, scatter chart, bubble chart, line chart.
5. The method according to claim 1 or 2, wherein: After converting the format of each chart function into an intermediate format based on a predefined syntax, the chart function set in the intermediate format is obtained, which also includes: Adding a label to each chart function in the set of chart functions in the intermediate format, wherein the label is used to identify the chart function in the intermediate format and corresponds one-to-one to each chart function in the intermediate format; Save the chart function after adding labels.
6. The method according to claim 5, wherein: Retrieving a chart function in an intermediate format corresponding to the business requirement from the chart function set includes: A tag corresponding to the business requirement is obtained, and a chart function in an intermediate format corresponding to the tag is called according to the tag.
7. The method according to any one of claims 1 or 2, wherein: The preset chart library or target chart library includes: Any one of echarts chart library, g2 chart library, highcharts chart library; The preset chart library and the target chart library support different syntaxes.
8. A chart generating device compatible with multiple big data chart library engines, comprising: The acquisition module is suitable for obtaining multiple chart functions from the preset chart library; A conversion module, adapted to convert the format of each chart function into an intermediate format based on a predefined grammar, to obtain a set of chart functions in the intermediate format; a calling module adapted to call a chart function in an intermediate format corresponding to the business requirement from the chart function set when receiving the data to be processed and the business requirement for the data to be processed; A generating module, adapted to convert the retrieved chart function in the intermediate format into a chart function in a target format recognizable by a target chart library engine, and to generate a corresponding chart based on the data to be processed using the chart function in the target format; Among them, it also includes: A collection module, adapted to collect business requirements related to the big data business before the acquisition module acquires multiple chart functions from the preset chart library; The definition module is adapted to define corresponding grammar based on the collected business requirements, and the grammar serves as the grammar basis for the conversion of the functional format of the chart.
9. The device according to claim 8, wherein: The acquisition module is also adapted to: The collected business requirements are analyzed, and a plurality of chart functions corresponding to the business requirements are acquired from the preset chart library according to the analysis results.
10. The device according to any one of claims 8 or 9, wherein: The business requirements include: a requirement for drawing a chart of at least one chart style.
11. The device according to claim 10, wherein: The chart style includes any of the following: Line chart, curve chart, area chart, column chart, bar chart, pie chart, scatter chart, bubble chart, line chart.
12. The device according to any one of claims 8 or 9, wherein: Also includes: an adding module, adapted to add a label to each chart function in the set of chart functions in the intermediate format after the conversion module converts the format of each chart function into an intermediate format based on a predefined grammar to obtain a set of chart functions in the intermediate format, wherein the label is used to identify the chart function in the intermediate format and corresponds one-to-one to each chart function in the intermediate format; The saving module is suitable for saving the chart function after adding labels.
13. The device according to claim 12, wherein: The retrieval module is also suitable for: A tag corresponding to the business requirement is obtained, and a chart function in an intermediate format corresponding to the tag is called according to the tag.
14. The device according to any one of claims 8 or 9, wherein: The preset chart library or target chart library includes: Any one of echarts chart library, g2 chart library, highcharts chart library; The preset chart library and the target chart library support different syntaxes.
15. A computer storage medium storing a computer program code, which, when executed on a computing device, causes the computing device to execute the chart generation method compatible with a variety of big data chart library engines as described in any one of claims 1 to 7.
16. A computing device comprising: processor; a memory storing computer program code; When the computer program code is executed by the processor, it causes the computing device to execute the chart generation method compatible with multiple big data chart library engines as described in any one of claims 1 to 7.
