CN117555918A - Visual chart generation method and device for clearing index data - Google Patents

Visual chart generation method and device for clearing index data Download PDF

Info

Publication number
CN117555918A
CN117555918A CN202311574745.4A CN202311574745A CN117555918A CN 117555918 A CN117555918 A CN 117555918A CN 202311574745 A CN202311574745 A CN 202311574745A CN 117555918 A CN117555918 A CN 117555918A
Authority
CN
China
Prior art keywords
data
index data
chart
array
clear
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
CN202311574745.4A
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.)
State Grid Corp of China SGCC
Electric Power Research Institute of State Grid Hunan Electric Power Co Ltd
State Grid Hunan Electric Power Co Ltd
Original Assignee
State Grid Corp of China SGCC
Electric Power Research Institute of State Grid Hunan Electric Power Co Ltd
State Grid Hunan Electric Power 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 State Grid Corp of China SGCC, Electric Power Research Institute of State Grid Hunan Electric Power Co Ltd, State Grid Hunan Electric Power Co Ltd filed Critical State Grid Corp of China SGCC
Priority to CN202311574745.4A priority Critical patent/CN117555918A/en
Publication of CN117555918A publication Critical patent/CN117555918A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/242Query formulation
    • G06F16/2428Query predicate definition using graphical user interfaces, including menus and forms
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/25Integrating or interfacing systems involving database management systems
    • G06F16/258Data format conversion from or to a database
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q50/00Information and communication technology [ICT] specially adapted for implementation of business processes of specific business sectors, e.g. utilities or tourism
    • G06Q50/06Energy or water supply

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • Business, Economics & Management (AREA)
  • General Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • Health & Medical Sciences (AREA)
  • General Engineering & Computer Science (AREA)
  • Economics (AREA)
  • General Health & Medical Sciences (AREA)
  • Human Computer Interaction (AREA)
  • Mathematical Physics (AREA)
  • Public Health (AREA)
  • Water Supply & Treatment (AREA)
  • Computational Linguistics (AREA)
  • Human Resources & Organizations (AREA)
  • Marketing (AREA)
  • Primary Health Care (AREA)
  • Strategic Management (AREA)
  • Tourism & Hospitality (AREA)
  • General Business, Economics & Management (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention discloses a visual chart generation method of clear index data, which comprises the following steps: reading the clear index data to be displayed, and converting the clear index data into a preset format; and creating a preset component library which comprises a plurality of chart subassemblies and has a data format of a preset format, and selecting a corresponding chart subassembly from the preset component library according to the display requirement of the clear index data so as to generate a visual chart corresponding to the clear index data. The invention also discloses a visual chart generating device for the clear index data. According to the method, the clearing index data are converted into the preset format, the data format of each chart subassembly in the created preset subassembly library is also the preset format, and data interaction and sharing among different chart subassemblies are ensured, so that the consistency and operability of the data are realized, the data can be not required to be repeatedly processed in the process of processing the same clearing index data, the workload is simplified, and the efficiency is improved.

Description

Visual chart generation method and device for clearing index data
Technical Field
The invention mainly relates to the technical field of power systems, in particular to a visual chart generation method and device for clearing index data.
Background
In the field of electric power markets, the clearing results refer to electric power trade results determined in the market clearing process. The result plays a vital role in the aspects of power supply and demand balance, market price, power grid operation safety and the like, and is also beneficial to promoting market competition and improving market operation efficiency. The clearing index is a key parameter for measuring the result, and comprises important factors such as supply and demand, market price and the like. However, relying solely on alphanumeric characters to describe the clearness index often lacks intuitiveness and it is difficult to capture key features and trends. Therefore, there is a need to demonstrate these indicators in a more intuitive manner. Generating a visual chart is a good presentation analysis tool that can help a decision maker better understand and interpret the power market situation in order to formulate a corresponding strategy.
For the display requirement of the clearing index, it may be desirable to display in a different form, such as a line graph or a table. However, the conventional display mode specifically processes the out-of-definition index data according to the display requirement, and then converts the out-of-definition index data into a data format which meets the use requirement of the existing open source component. The method causes inflexible switching of the charts, different charts are generated by the same clear index data, and different data processing modes are adopted. This results in complex logic to handle, inability to perform uniform configuration, and complex use.
Disclosure of Invention
The technical problem to be solved by the invention is as follows: aiming at the technical problems existing in the prior art, the invention provides a visual chart generation method and device for clear index data, which have strong universality and high flexibility.
In order to solve the technical problems, the technical scheme provided by the invention is as follows:
a visual chart generation method for clearing index data comprises the following steps:
s1, reading out clear index data to be displayed, and converting the clear index data into a preset format;
s2, creating a preset component library which comprises a plurality of chart subassemblies and has a data format of the preset format, and selecting a corresponding chart subassembly from the preset component library according to the display requirement of the clear index data so as to generate a visual chart corresponding to the clear index data.
As a further improvement of the above technical scheme:
in step S1, the step of converting the clearing index data into a preset format includes the steps of:
receiving the clearing index data, and analyzing and judging the data dimension type of the clearing index data;
performing corresponding conversion operation according to the data dimension type so as to convert the clearing index data into a preset format;
wherein the data dimension type comprises: single value, array of values, different body + single value, different body + array of values, array + different body + single value, array + different body + array of values;
The preset format includes: clear case ID, clear case name, and chart data.
Performing a corresponding conversion operation according to the data dimension type, comprising the steps of:
a1, if the data dimension type is a single value, adding the clearing index data into a newly built first array to finish conversion of a preset format;
a2, traversing all the attributes of the objects in the clearing index data if the data dimension type is a numerical array, adding all the attributes into a second array, traversing the second array in a preset circulation range to sequentially obtain a new object, setting the attribute of the new object to be the value of a preset circulation index of the corresponding attribute of the object in the clearing index data one by one, adding the new object into a third array until all the attributes of the object in the clearing index data are corresponding, and completing the conversion of a preset format;
a3, if the data dimension type is different main bodies+single values, different main bodies+numerical value arrays, arrays+different main bodies+single values or arrays+different main bodies+numerical value arrays, determining a mode of converting the clear index data into a preset format according to constraint conditions and the data dimension type so as to complete conversion of the preset format.
Determining a mode of converting the clear index data into a preset format according to constraint conditions, wherein the method comprises the following steps of:
when the constraint is a simple data type conversion:
if the data dimension type is different main bodies and single values or different main body and numerical value arrays, traversing the clear index data, screening out object attributes of which the object attribute value is a simple data type for each object in the clear index data to obtain new objects, and adding the new objects into a fourth array to finish conversion of a preset format;
if the data dimension type is an array+different main bodies+single value or an array+different main bodies+numerical value array, traversing the clearing index data in a double-layer circulation mode, screening out object attributes of which the object attribute value is a simple data type for each object in the clearing index data in the bottommost layer circulation mode to obtain new objects, adding the new objects into a fifth array, returning the fifth array as a return value, finally receiving the double-layer circulation returned data, and finishing conversion of a preset format;
when the constraint is a composite data type conversion:
traversing the clear index data if the data dimension type is different main bodies and single values or different main body and numerical value arrays, screening object attributes of which the object attribute value is a composite data type for each object in the clear index data to obtain a new object, processing and returning each object according to the step A2 in the traversal process, and finally receiving the traversed and returned data to finish conversion of a preset format;
And B, if the data dimension type is an array, a different main body, a single value or an array, a different main body and a numerical value array, traversing the clear index data in a double-layer circulation mode, screening out the object attribute of which the object attribute value is of a composite data type for each object in the clear index data in the bottommost layer circulation mode to obtain a new object, processing each object according to the step A2 in the traversal process, returning the obtained data as a return value, and finally receiving the data returned in the double-layer circulation mode to finish the conversion of a preset format.
In step S2, a preset component library including a plurality of chart subcomponents is created, including the steps of:
determining the business requirements corresponding to each chart subassembly, wherein the business requirements comprise chart styles and interaction functions;
according to the business requirements of each chart sub-component, importing corresponding components and patterns into a UI component library and a visual chart library and performing secondary packaging;
creating an application programming interface of each chart subassembly, wherein the application programming interface comprises a method, attributes and a data source, and the format of the data source is defined as the preset format;
configuring function processing, loading state and rendering state in each graph sub-assembly, and exporting the configured graph sub-assemblies, wherein all the graph sub-assemblies jointly form a preset assembly library;
The chart subassembly comprises a line chart subassembly, a column chart subassembly, a price chart subassembly, a grouping pie chart subassembly, an overview chart subassembly and a table subassembly.
In step S1, reading the to-be-displayed clear index data, including the steps of:
judging the interface type of the clear index data required to be requested, and executing one of the following steps according to the interface type:
if the interface type of the clear index data to be requested is a universal interface, a universal interface tool is used for obtaining the clear index data, and the universal interface request tool is used for obtaining the clear index data directly stored in a database;
if the interface type of the clear index data to be requested is a script interface, the clear index data is obtained by using a script interface tool, and the script interface tool is used for obtaining the clear index data to be calculated in real time by matching with the calculation parameters.
In step S1, before converting the clearing index data into the preset format, the method further includes the steps of:
judging whether the clear index data needs to be expanded or not, if so, executing the expansion processing of the clear index data, and specifically comprising the following steps:
receiving clear index data returned from a general interface tool or a script interface tool and calculating parameters used for data calculation;
Carrying out data preprocessing on the received clear index data to be expanded; the data preprocessing comprises checking the input parameters of the ex-definition index data, checking the data types and performing exception processing;
calculating the clear index data according to the calculation type to obtain the clear index data after the expansion processing; the calculation type comprises the calculation of the maximum value, the minimum value, the average value or the summary value of the clear index data or the custom calculation of the clear index data.
In step S2, according to the display requirement of the clearing index data, selecting a corresponding chart subassembly from a preset subassembly library to generate a visual chart of the clearing index data, including the steps of:
s21, selecting a required chart subassembly from the preset subassembly library according to the display requirement of the clearing index data;
s22, setting corresponding configuration information and data information for the selected chart sub-assembly, wherein the configuration information comprises a clear index name, a clear index unit and corresponding configuration of other chart sub-assemblies, and the data information comprises clear index data converted into a preset format;
s23, generating a visual chart display according to the configuration information and the data information.
The invention also provides a visual chart generating device for the clearing index data, which comprises the following steps:
the data reading and converting module is used for reading the clear index data to be displayed and converting the clear index data into a preset format;
the visual chart generation module is used for creating a preset component library which comprises a plurality of chart subassemblies and has a data format of the preset format, and selecting a corresponding chart subassembly from the preset component library according to the display requirement of the clearing index data so as to generate a visual chart of the clearing index data.
The present invention also provides a computer-readable storage medium having stored therein a computer program for programming or configuring by a microprocessor to perform the above-described visual chart generation method of the present invention.
Compared with the prior art, the invention has the advantages that:
according to the visual chart generation method of the clearing index data, the clearing index data are converted into the preset format, so that data display and operation of the clearing index data are facilitated, the data format of each chart subassembly in the created preset subassembly library is also the preset format, and the data interaction and sharing among different chart subassemblies can be ensured by setting the same preset format, so that data consistency and operability are achieved. Compared with the existing open source component which has different accessed data formats, when the same clear index data is displayed, the data is required to be converted into different formats to support the generation of a visual chart.
Drawings
Fig. 1 is a flow chart illustrating a method for generating a visual chart of the present invention for generating the clear index data according to an embodiment of the present invention.
Fig. 2 is a flow chart illustrating the conversion of the clearing index data into the preset format in the present embodiment.
Fig. 3 shows a flow chart of format conversion for different data dimension types in the present embodiment.
Fig. 4 shows a flow chart of creating a preset library including several chart subcomponents in the present embodiment.
Fig. 5 shows a flowchart of the complete steps of the visual chart generation method of the present embodiment of the present invention.
Detailed Description
The invention is further described below with reference to the drawings and specific examples.
As shown in fig. 1, the present embodiment provides a method for generating a visual chart of a clearing index data, including the steps of:
s1, reading out clear index data to be displayed, and converting the clear index data into a preset format;
s2, creating a preset component library which comprises a plurality of chart subassemblies and has a data format of a preset format, and selecting a corresponding chart subassembly from the preset component library according to the display requirement of the clear index data so as to generate a visual chart corresponding to the clear index data.
It can be understood that, in the visual chart generation method of the clear index data of the embodiment, the clear index data is converted into the preset format, so that the data display and operation of the clear index data in the step S2 are facilitated, the data format of each chart subassembly in the created preset subassembly library is also the preset format, and the data interaction and sharing between different chart subassemblies can be ensured by setting the same preset format, so that the consistency and operability of the data are realized. Compared with the existing open source components (such as a line graph and a table component) which have different accessed data formats, when the same clear index data is displayed, the data is required to be converted into different formats to support the generation of a visual chart, and the method of the embodiment can be used for processing the same clear index data without repeatedly processing the data, so that the workload is simplified and the efficiency is improved.
In this embodiment, in step S1, the conversion of the clearing index data into the preset format includes the steps of:
receiving the clearing index data, and analyzing and judging the data dimension type of the clearing index data;
performing corresponding conversion operation according to the data dimension type so as to convert the clearing index data into a preset format;
Wherein the data dimension types include: single value, array of values, different body + single value, different body + array of values, array + different body + single value, array + different body + array of values;
the preset format includes: clear case ID, clear case name, and chart data.
Specifically, the data dimension types are single value, value array, different body+single value, different body+value array, array+different body+single value, array+different body+value array, and array+different body+value array, respectively, are further explained below.
Single value: it means that the data statistics returned by the statistics report is a single value, such as the maximum value of the statistics system load, and the statistics is { systemLoad: 20099.01}.
Numerical value array: it means that the statistics returned by the statistics index is an array containing single values, such as statistics of system load at all times of day, and the statistics are { tvSystemLoad } [12709.384, 12396.232, 12280.784, 11970.288, 11735.632, 11692.608, 11436.872, 11358.096, 11201.52, … ].
Different body + single value or different body + value array: it means that the statistics returned by the statistics index is an array comprising different body data. The main body can be understood as an analysis object for calculating the clear index, and for an electric power system, the main body at present comprises a group, a power plant, a power generation group, a user, a section and the like. If the unit names, rated capacities and unit time-of-day predicted output of different units are counted, the counted results are as follows: [ { UNITName: 'Unit 1', rateCap: 100, tvForecast: [72.801, 73.24, 73.691, 74.111, 74.52, 74.901, 75.261, 75.59, 75.92, 76.24, 76.59, 76.96, 77.371, … ] }, { UNITName: 'Unit 2', rateCap: 50, tvForecast: [30.07, 29.951, 29.921, 30, 30.05, 29.861, 30.16, 30.341, 30.57, 30.761, 30.47, 30.81, 30.56, 30.71, … ] }.
Array + different body + single value or array + different body + value array: it means that the statistics returned by the statistics are an array of array data comprising different body data. For example, the unit names, rated capacities, and unit time-of-day predicted outputs of all units under different groups are counted as [ { group 1', unitName: ' group 1', rateCap: 100, tvForecast: [72.801, 73.24, 73.691, 74.111, 74.52, 74.901, 75.261, 75.59, 75.92, 76.24, 76.59, 76.96, 77.371, … ] }, { group Name: ' group 1', unitName: ' group 2', rateCap: 50, tvForecast: [30.07, 29.951, 29.921, 30, 30.05, 29.861, 30.16, 30.341, 30.57, 30.761, 30.47, 30.81, 30.56, 30.71, … ] }, { group 2', group 3', rateCap: group 100, 4837, 37, 73.691, 73.691, 73.691.
As a preferred implementation, the preset format in this embodiment is the chart general data format IGroupData, and the definition of the data format is shown in table 1:
TABLE 1
As a preferred embodiment, fig. 2 shows the specific steps of converting the out-of-definition index data into a chart generic data format:
Step B1, data receiving, namely receiving the out-of-definition index data of various data dimension types, wherein the data dimension types comprise single values, numerical value arrays, different main bodies, single values, different main bodies, numerical value arrays, different main bodies, single values and arrays, different main bodies and numerical value array types;
step B2, data analysis, namely analyzing and extracting key information in the data according to the received clear index data, wherein the data type comprises character strings, numerical values, objects, character strings and the like, and the data dimension type is determined through the key information in the data so as to facilitate the follow-up distinguishing of data conversion modes according to different data type dimensions;
step B3, converting the analyzed data to enable the data to meet the requirements of a general data format of the chart;
and step B4, outputting data, namely outputting the clear index data converted into a chart general data format.
Wherein, the data conversion in the step B3 includes the following steps:
according to the data dimension type and the data type to be converted, a conversion rule and a constraint condition are formulated:
when the data dimension type is a single value, the graph data is represented as a single object, and the attribute value type in the object is a character string or a numerical value, namely a simple data type, the data hierarchy structure is represented uniformly, and the data can be directly converted;
When the data dimension type is a numerical value array, the graph data is represented as a single object, and the attribute type in the object is an array, namely a composite data type, the data hierarchy structure is represented as uniform, and the data can be directly converted;
when the data dimension type is different main bodies+single values or different main bodies+value arrays, the graph data is represented as an object array, and the attribute value in each object in the array can be a simple data type such as a character string or a value, or a composite data type such as an array. Since the hierarchical structure of simple data types and compound data types is different, the conversion logic between them is also different. Therefore, both types of data cannot be converted at the same time. However, since the data shown in the graph all adopt the same hierarchical structure, an appropriate data type can be selected for conversion according to the requirement. While receiving the data, constraint conditions are formulated to determine whether data of a composite data type or a simple data type needs to be converted.
When the data dimension type is array+different main body+single value or array+different main body+value array, the graph data is two-dimensional object array, each object at the bottom of each two-dimensional array can be simple data type such as character string or value, and the like, and can also be composite data type such as array, and the like. The method is consistent with the reasons that the data dimension types are different main bodies and single values or different main bodies and numerical value arrays, and can select proper data types for conversion according to requirements while receiving data. While receiving the data, constraint conditions are formulated to determine whether data of a composite data type or a simple data type needs to be converted.
According to the conversion rule and the constraint condition, a conversion method of the universal data format of the chart is realized by writing JavaScript conversion logic;
outputting the converted result data, wherein the format of the converted result data is the chart general data format IGroupData.
The method for converting the different data dimension types into the chart universal data format in step B3 is further described below with reference to fig. 3.
Step B31, determining the data dimension type by using a data dimension type judging method: when the data dimension type is a single value, executing the step B32; when the data dimension type is a numerical array, executing the step B33; if the data dimension type is different body+single value or different body+value array, executing step B34; when the data dimension type is array+different entity+single value or array+different entity+value array, then step B37 is performed. The data dimension type judging method is to write a logic implementation by combining with built-in data type structure methods such as array, isarray, typeof and the like in JavaScript.
Step B32, converting the data dimension type into single value: and creating a result array, inserting the original data into the array, and returning the converted data, namely the result array, wherein the result array is the data converted into the universal data format of the chart.
Step B33, converting the data dimension type into a numerical array: traversing the attribute of an object in the original data (namely the read out index data), for example, the object is { tvSystemLoad: [1,2], tvBidSpace: [3] }, the attribute in the object is [ 'tvSystemLoad', 'tvBidSpace' ], judging the corresponding attribute value length of the corresponding attribute, for example, the attribute tvSystemLoad attribute value length is 2, the attribute tvBidSpace attribute value length is 1, obtaining the maximum length maxLength of all attribute values is 2, and adding all the attributes into a dataKey array; traversing the dataKeys array from 0 to maximum length by one cycle, traversing the dataKeys array simultaneously in each cycle, obtaining a new object each time, wherein the attribute of the object corresponds to the attribute of one object in the original data, setting the attribute value of the object as the value of the corresponding object attribute value cycle index in the original data, adding the new objects into the newly built result array, and finally obtaining the result array which is the data converted into the chart general data format.
Step B34, for the data dimension types of the clear index data of different main bodies and single values or different main bodies and value arrays, judging whether parameters in the constraint conditions accessed by the conversion method are simple data types or compound data types according to the constraint conditions, and if the parameters are the simple data types, executing the step B35; if the data is the composite data type, step B36 is performed.
Step B35, converting the different body+single value or different body+value array (converting only the data of which the object attribute value type is the simple data type): traversing the original data, screening out object attributes with object attribute values of simple data types from each object to obtain new objects, adding the objects into a newly-built result array, and finally obtaining the result array which is the data converted into the general data format of the chart.
Step B36, converting the different body+single value or different body+value array (converting only the data of the object attribute value type into the composite data type): traversing the original data, screening out object attributes with object attribute values of composite data types from each object to obtain new objects, processing and returning each object according to the step B33 in the traversing process, and finally receiving the data returned by traversing, namely the data converted into the general data format of the chart.
Step B37, for the data dimension type of the data array, the different main bodies, the single value or the data array, the different main bodies and the numerical value array, judging whether the parameters in the constraint conditions accessed by the conversion method are simple data types or composite data types according to the constraint conditions, and if the parameters are the simple data types, executing the step B38; if the data is the composite data type, step B39 is executed.
Step B38, array+different body+single value or array+different body+numeric array conversion (converting only data whose object attribute value type is simple data type): the double-layer circulation traverses the original data, object attributes with object attribute values of simple data types are screened out for each object in the bottommost circulation, new objects are obtained, the objects are added into a newly built result array, and the result array is returned as a return value. And finally, receiving the data returned by double-layer circulation, namely the data converted into the universal data format of the chart.
Step B39, array+different body+single value or array+different body+numeric array conversion (converting only data whose object attribute value type is composite data type): b33, traversing the original data in a double-layer circulation, screening out object attributes with object attribute values of composite data types for each object in the bottommost layer circulation to obtain new objects, processing each object according to the step B33 in the traversing process, returning the obtained data as a return value, and finally receiving the data returned in the double-layer circulation to obtain the data converted into the general data format of the chart.
It can be understood that the different data dimension types are converted into the chart general data format in different modes, and under the condition that the clear index data contains multiple data dimension types, the quick classification and targeted conversion can be realized, so that the error rate of data conversion is reduced, the workload is reduced, and the development efficiency is improved.
In this embodiment, in step S2, a preset component library including a plurality of chart subassemblies is created, including the steps of:
determining the business requirements corresponding to each chart subassembly, wherein the business requirements comprise chart styles and interaction functions;
according to the business requirements of each chart sub-component, importing corresponding components and patterns into a UI component library and a visual chart library and performing secondary packaging;
creating an application programming interface of each chart subassembly, wherein the application programming interface comprises a method, attributes and a data source, and the format of the data source is defined as a preset format;
configuring function processing, loading state and rendering state in each graph sub-assembly, and exporting the configured graph sub-assemblies, wherein all graph sub-assemblies jointly form a preset assembly library;
the chart subassembly comprises a line chart subassembly, a column chart subassembly, a price chart subassembly, a grouping pie chart subassembly, an overview chart subassembly and a table subassembly.
It can be understood that, compared with the existing open source component, the data source formats used by the various chart subassemblies in the preset component library in this embodiment are uniform and are all preset formats (i.e., chart universal data formats). For the same clear index data, the data can be displayed in different chart forms without multiple times of processing, so that the processing and displaying of the data are more efficient, and meanwhile, the interoperability among different chart forms is enhanced. In addition, the chart component is secondarily packaged based on the business requirement to support the common requirement of clear index data display (namely, common requirements such as a line graph, a bar graph, a price chart, a grouping pie chart, an overview chart, a table and the like). The secondary packaging mode remarkably simplifies development and configuration work, and improves data processing and displaying efficiency and development efficiency.
In particular, development of the chart subcomponent requires reliance on an open source UI component library and a visualization chart library. The UI component library used in the embodiment is Ant Design, and the visual chart library is ECharts; and carrying out secondary packaging on the components by selecting proper components and combining with service requirements to obtain the graph sub-components meeting the requirements. The service requirement refers to the display requirement of the clearing index commonly existing in the power system, and the display requirement comprises a style, an interactive function and the like.
The steps for creating chart subassemblies in the preset library will be further described with reference to fig. 4:
the business requirements, including styles, interactive functions, etc., required for each chart subcomponent are determined. The style includes font size, height, width, background color, inner and outer edge distance, frame, etc.; the interactive functions include presentation of a clearing index, clicking events, highlighting selected content, title suspension cues, etc.
An API (application programming interface) for each graph sub-component is created according to business requirements. The API of the chart subassembly refers to the interfaces and methods that the chart subassembly provides for use by other components, including methods, properties, and data sources that can be invoked, etc. Wherein, for all chart subcomponents, the API-defined data source format is the chart generic data format IGroupData.
The development of each graph sub-component is realized according to the API and the business requirement of the component, and the development specifically comprises the following steps:
installing an Ant Design library, an ECharts library and related dependencies;
importing required components and styles, for example, importing a Table component in an Ant Design library and a custom CSS style file for secondary packaging, wherein the custom CSS style file content comprises font size, height, width, background color, inner edge distance, outer edge distance, frame and the like;
an API for creating components, including methods, attributes and data sources, such as row data, column data, title names, whether sequence number columns are displayed, whether screening is started, fuzzy search, sorting, etc. defining a table;
according to the service requirement, defining a function processing program in the component to realize JavaScript processing logic corresponding to the service requirement, for example, defining a processing program with functions of screening, fuzzy searching, sorting and the like for data by clicking a table column;
defining a loading state in the component, displaying the loading state when the data is loaded, and hiding the loading state after the loading is completed, wherein the loading state has the function of providing a feedback mechanism to enable a user to know that the component is loading the data or processing the request, thereby providing better user experience;
Implementing a rendering function in the component, rendering the graph by using the imported attribute of the component;
the component is exported for use elsewhere.
In particular, in order to better understand the development of the components, the following describes in detail the development of the table components as an example.
First, determining the business requirement needed by the form component: the interior of the component can be flexibly configured with component patterns including height, width, background color, inner and outer edge distances, frames and the like; whether the support form displays serial number configuration or not; the method comprises the steps of supporting the operation of ordering, screening and fuzzy searching of table columns; and supporting a custom data processing mode of the table column data.
Secondly, creating an API of the form component according to the service requirement: selecting a Table component of the Ant Design library for secondary packaging, and adding the following attributes in the component API except for inheriting the default API of the Table component of the Ant Design:
TABLE 2
The Column Table Column configuration type TableColumnProps not only inherits the attribute of the Table component Column of Ant Design, but also adds the following attributes:
TABLE 3 Table 3
Thirdly, developing logic inside the form component according to the API and business requirement of the created form component.
It can be understood that in this embodiment, the secondary packaging is performed on the components existing in the open-source UI component library and the visual chart library, so that interfaces and methods for increasing the common service requirements are increased, and the common visual chart can be conveniently and quickly generated; and the format of the data source in the packaged icon sub-assembly is the universal data format of the chart, and the format of the data source is consistent with the format of the read out index data, so that the data interaction and sharing among different assemblies can be ensured, the consistency and operability of the data are realized, the data is not required to be repeatedly processed in the process of processing the same out index, the development workload is simplified, and the efficiency is improved.
In this embodiment, in step S1, before converting the clearing index data into the preset format, the method further includes the steps of:
judging whether the clear index data needs to be expanded or not, if so, executing the expansion processing of the clear index data, and specifically comprising the following steps:
receiving clear index data returned from a general interface tool or a script interface tool and calculating parameters used for data calculation;
carrying out data preprocessing on the received clear index data to be expanded; the data preprocessing comprises checking the input parameters of the out-of-definition index data, checking the data types and performing exception processing;
Calculating the clear index data according to the calculation type to obtain the clear index data after the expansion processing; the calculation type comprises the calculation of the maximum value, the minimum value, the average value or the summary value of the clear index data or the custom calculation of the clear index data.
It can be appreciated that by aggregating new clearing index data by performing efficient, accurate and intelligent computation on existing clearing index data, for example, calculating the maximum value of all data in a certain clearing index as a new clearing index, unnecessary interface data requests can be reduced and the problem of redundant clearing index stored in the database can be solved, thereby improving the efficiency of data processing while achieving customized data operation.
As a preferred embodiment, the expansion processing of the out-going index data includes the steps of:
receiving data and calculating parameters: receiving the clear index data returned by the interface request tool and the calculation parameters for data calculation, wherein the clear index data and the calculation parameters comprise: new clear index ID, clear index ID to be calculated, calculation type and user-defined calculation method; the calculation type comprises a maximum value, a minimum value, an average value, a summary value or a custom, the custom type needs to be additionally added with a custom method parameter for inputting, and the custom method is used for custom calculation logic calculation data.
Data preprocessing: after receiving the data, data preprocessing is performed, including incoming parameter checking, data type checking, exception handling, etc., to ensure accuracy and consistency of the data.
Specifically, checking whether the input parameters are complete, including the definition index data, the calculation type and the self-defining method (the calculation type is required when the self-defining is performed); checking whether the corresponding data type is the numerical value type or not through the calculated clearing index ID, wherein numerical value calculation such as maximum value, minimum value and the like can be performed only by the data of the numerical value type, if the checking is not passed, corresponding abnormal information is thrown out and printed on a console, and the calculation is finished.
And (3) data calculation: judging the calculation type, if the calculation type is a maximum value, a minimum value, an average value or a summary value, obtaining corresponding data through the calculation of the clearing index ID to be calculated, calculating the maximum value, the minimum value, the average value or the summary value of the data, and finally assigning the calculation result to the newly added clearing index ID attribute; if the calculation type is custom, calculating by an incoming custom method, and finally assigning the calculation result to the newly added clearing index ID attribute.
And (3) outputting results: after the calculation processing, new clear index data are returned to be output.
The following describes the complete steps of the visual chart generation method of the present embodiment of the present invention with reference to fig. 5.
Step T1, determining clear index data needing to be generated for displaying a visual chart according to service requirements;
step T2, determining an interface of the clearing index data required by the step T1 and corresponding request parameters, wherein the request parameters are used for determining the source of the clearing index data and the clearing index data required to be returned, and mainly comprise a clearing case ID, a clearing index and the like;
step T3, if the interface to be requested is a universal interface, using a universal interface tool to request the interface to obtain the clearing index data, wherein the universal interface tool is used for obtaining the clearing index data directly stored in the database;
step T4, if the interface to be requested is a script interface, using a script interface tool to request the interface to obtain clear index data, wherein the script interface tool is used for obtaining clear index data to be calculated in real time in cooperation with calculation parameters;
step T5, judging whether the clear index needs to be expanded to meet the generation of the visual chart, if so, executing step T6, and if not, executing step T7;
Step T6, expanding the clear index data, and calculating to obtain new clear index data so as to meet the generation of a visual chart;
step T7, processing the clear index data into a general data format of the chart, so that the chart can be conveniently displayed in multiple forms by the same clear index, for example, the same clear index is displayed by using a table and a line graph respectively;
step T8, selecting a proper chart subassembly from a secondarily packaged subassembly library according to service requirements;
step T9, corresponding configuration information and data information are set for the component according to the selected chart sub-component, wherein the configuration information and the data information comprise the name of the clearing index, the unit of the clearing index and the data converted into the general data format by the corresponding configuration and use of other public chart components;
and step T10, generating a visual chart display according to the input configuration information and the data information.
It can be appreciated that the method of the embodiment meets the requirement of the existing power system on the multi-form display visual chart of the clearing index data, reduces the complexity of the characteristic logic processing in the chart generation configuration process, improves the universality and flexibility of the clearing index visual chart generation, and reduces the difficulty of developing the clearing index visual chart page; the clear index data is displayed through the chart, key features and trends can be intuitively captured, a decision maker is helped to better understand and read the electric power market condition, and a corresponding strategy is formulated.
The embodiment also provides a visual chart generating device for clearing index data, which comprises:
the data reading and converting module is used for reading the clear index data to be displayed and converting the clear index data into a preset format;
the visual chart generation module is used for creating a preset component library which comprises a plurality of chart subassemblies and has a data format of a preset format, and selecting a corresponding chart subassembly from the preset component library according to the display requirement of the clearing index data so as to generate a visual chart of the clearing index data.
The present embodiment also provides a computer-readable storage medium in which a computer program is stored, the computer program being used to program or configure the aforementioned visual chart generation method for the calculation index data by a microprocessor.
The system and medium of the present invention correspond to the above method and also have the advantages described in the above method.
The present invention may be implemented in whole or in part by a computer program which, when executed by a processor, performs the steps of the method embodiments described above, and which may be implemented by instructing the relevant hardware. Wherein the computer program comprises computer program code, which may be in the form of source code, object code, executable files or in some intermediate form, etc. The computer readable medium includes: any entity or device capable of carrying computer program code, a recording medium, a U disk, a removable hard disk, a magnetic disk, an optical disk, a computer Memory, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), an electrical carrier signal, a telecommunications signal, a software distribution medium, and so forth. The memory is used for storing computer programs and/or modules, and the processor implements various functions by running or executing the computer programs and/or modules stored in the memory and invoking data stored in the memory. The memory may include high-speed random access memory, and may also include non-volatile memory, such as a hard disk, memory, plug-in hard disk, smart Media Card (SMC), secure Digital (SD) Card, flash Card (Flash Card), at least one disk storage device, flash memory device, or other volatile solid state storage device, etc.
The above is only a preferred embodiment of the present invention, and the protection scope of the present invention is not limited to the above examples, and all technical solutions belonging to the concept of the present invention belong to the protection scope of the present invention. It should be noted that modifications and adaptations to the invention without departing from the principles thereof are intended to be within the scope of the invention as set forth in the following claims.

Claims (10)

1. A visual chart generation method for clearing index data is characterized by comprising the following steps:
s1, reading out clear index data to be displayed, and converting the clear index data into a preset format;
s2, creating a preset component library which comprises a plurality of chart subassemblies and has a data format of the preset format, and selecting a corresponding chart subassembly from the preset component library according to the display requirement of the clear index data so as to generate a visual chart corresponding to the clear index data.
2. The visual chart generating method of claim 1, wherein in step S1, the step of converting the score index data into a predetermined format includes the steps of:
receiving the clearing index data, and analyzing and judging the data dimension type of the clearing index data;
Performing corresponding conversion operation according to the data dimension type so as to convert the clearing index data into a preset format;
wherein the data dimension type comprises: single value, array of values, different body + single value, different body + array of values, array + different body + single value, array + different body + array of values;
the preset format includes: clear case ID, clear case name, and chart data.
3. The visual chart generating method of the present invention as defined in claim 2, wherein the step of performing the corresponding conversion operation according to the data dimension type comprises the steps of:
a1, if the data dimension type is a single value, adding the clearing index data into a newly built first array to finish conversion of a preset format;
a2, traversing all the attributes of the objects in the clearing index data if the data dimension type is a numerical array, adding all the attributes into a second array, traversing the second array in a preset circulation range to sequentially obtain a new object, setting the attribute of the new object to be the value of a preset circulation index of the corresponding attribute of the object in the clearing index data one by one, adding the new object into a third array until all the attributes of the object in the clearing index data are corresponding, and completing the conversion of a preset format;
A3, if the data dimension type is different main bodies+single values, different main bodies+numerical value arrays, arrays+different main bodies+single values or arrays+different main bodies+numerical value arrays, determining a mode of converting the clear index data into a preset format according to constraint conditions and the data dimension type so as to complete conversion of the preset format.
4. The visual chart generating method of the present invention as defined in claim 3, wherein the method for determining the way of converting the present invention into the predetermined format according to the constraint condition comprises the steps of:
when the constraint is a simple data type conversion:
if the data dimension type is different main bodies and single values or different main body and numerical value arrays, traversing the clear index data, screening out object attributes of which the object attribute value is a simple data type for each object in the clear index data to obtain new objects, and adding the new objects into a fourth array to finish conversion of a preset format;
if the data dimension type is an array+different main bodies+single value or an array+different main bodies+numerical value array, traversing the clearing index data in a double-layer circulation mode, screening out object attributes of which the object attribute value is a simple data type for each object in the clearing index data in the bottommost layer circulation mode to obtain new objects, adding the new objects into a fifth array, returning the fifth array as a return value, finally receiving the double-layer circulation returned data, and finishing conversion of a preset format;
When the constraint is a composite data type conversion:
traversing the clear index data if the data dimension type is different main bodies and single values or different main body and numerical value arrays, screening object attributes of which the object attribute value is a composite data type for each object in the clear index data to obtain a new object, processing and returning each object according to the step A2 in the traversal process, and finally receiving the traversed and returned data to finish conversion of a preset format;
and B, if the data dimension type is an array, a different main body, a single value or an array, a different main body and a numerical value array, traversing the clear index data in a double-layer circulation mode, screening out the object attribute of which the object attribute value is of a composite data type for each object in the clear index data in the bottommost layer circulation mode to obtain a new object, processing each object according to the step A2 in the traversal process, returning the obtained data as a return value, and finally receiving the data returned in the double-layer circulation mode to finish the conversion of a preset format.
5. The visual chart generation method of the out-of-definition index data according to claim 1, wherein in step S2, a preset component library including a plurality of chart subcomponents is created, comprising the steps of:
S21, determining service requirements corresponding to each chart subassembly, wherein the service requirements comprise chart styles and interaction functions;
according to the business requirements of each chart sub-component, importing corresponding components and patterns into a UI component library and a visual chart library and performing secondary packaging;
s22, creating an application programming interface of each chart subassembly, wherein the application programming interface comprises a method, attributes and a data source, and the format of the data source is defined as the preset format;
s23, configuring function processing, loading states and rendering states in each graph sub-assembly, and exporting the configured graph sub-assemblies, wherein all the graph sub-assemblies jointly form a preset assembly library;
the chart subassembly comprises a line chart subassembly, a column chart subassembly, a price chart subassembly, a grouping pie chart subassembly, an overview chart subassembly and a table subassembly.
6. The visual chart generating method of the present invention as defined in claim 1, wherein in step S1, reading the present index data to be displayed includes the steps of:
judging the interface type of the clear index data required to be requested, and executing one of the following steps according to the interface type:
If the interface type of the clear index data to be requested is a universal interface, a universal interface tool is used for obtaining the clear index data, and the universal interface request tool is used for obtaining the clear index data directly stored in a database;
if the interface type of the clear index data to be requested is a script interface, the clear index data is obtained by using a script interface tool, and the script interface tool is used for obtaining the clear index data to be calculated in real time by matching with the calculation parameters.
7. The visual chart generating method of claim 6, wherein before converting the score index data into the preset format in step S1, the method further comprises the steps of:
judging whether the clear index data needs to be expanded or not, if so, executing the expansion processing of the clear index data, and specifically comprising the following steps:
receiving clear index data returned from a general interface tool or a script interface tool and calculating parameters used for data calculation;
carrying out data preprocessing on the received clear index data to be expanded; the data preprocessing comprises checking the input parameters of the ex-definition index data, checking the data types and performing exception processing;
Calculating the clear index data according to the calculation type to obtain the clear index data after the expansion processing; the calculation type comprises the calculation of the maximum value, the minimum value, the average value or the summary value of the clear index data or the custom calculation of the clear index data.
8. The method for generating a visual chart of the present invention as set forth in claim 1, wherein in step S2, according to the display requirement of the present invention, a corresponding chart subassembly is selected from a preset component library to generate the visual chart of the present invention, and the method comprises the steps of:
selecting a required chart subassembly from the preset subassembly library according to the display requirement of the clearing index data;
setting corresponding configuration information and data information for the selected chart sub-assembly, wherein the configuration information comprises a clearing index name, a clearing index unit and corresponding configuration of other chart sub-assemblies, and the data information comprises clearing index data converted into a preset format;
and generating a visual chart display according to the configuration information and the data information.
9. A visual chart generating device for clearing index data is characterized by comprising:
the data reading and converting module is used for reading the clear index data to be displayed and converting the clear index data into a preset format;
The visual chart generation module is used for creating a preset component library which comprises a plurality of chart subassemblies and has a data format of the preset format, and selecting a corresponding chart subassembly from the preset component library according to the display requirement of the clearing index data so as to generate a visual chart of the clearing index data.
10. A computer-readable storage medium having a computer program stored therein, wherein the computer program is for being programmed or configured by a microprocessor to perform the visual chart generation method of the clearing index data according to any one of claims 1 to 8.
CN202311574745.4A 2023-11-23 2023-11-23 Visual chart generation method and device for clearing index data Pending CN117555918A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311574745.4A CN117555918A (en) 2023-11-23 2023-11-23 Visual chart generation method and device for clearing index data

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311574745.4A CN117555918A (en) 2023-11-23 2023-11-23 Visual chart generation method and device for clearing index data

Publications (1)

Publication Number Publication Date
CN117555918A true CN117555918A (en) 2024-02-13

Family

ID=89816432

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311574745.4A Pending CN117555918A (en) 2023-11-23 2023-11-23 Visual chart generation method and device for clearing index data

Country Status (1)

Country Link
CN (1) CN117555918A (en)

Similar Documents

Publication Publication Date Title
US5033009A (en) System for generating worksheet files for electronic spreadsheets
US5293615A (en) Point and shoot interface for linking database records to spreadsheets whereby data of a record is automatically reformatted and loaded upon issuance of a recalculation command
CN111027294B (en) Method, device and system for summarizing table
US8938720B2 (en) Trace visualization for object oriented programs
CN106599039B (en) Statistical representation method supporting free combination nesting of relational database data
CN112926288B (en) Business intelligent data visualization method, system, equipment and readable storage medium
CN110543303B (en) Visual service platform
CN112650766A (en) Database data operation method, system and server
US9135314B2 (en) System and method for improved consumption models for summary analytics
CN112527373A (en) Visual platform expanding method based on operation integrated management center service
CN111126019A (en) Report generation method and device based on mode customization and electronic equipment
EP3786810A1 (en) Automatic generation of computing artifacts for data analysis
CN116627418B (en) Multi-level form interface visual generation method and device based on recursion algorithm
CN116468010A (en) Report generation method, device, terminal and storage medium
CN112348420A (en) Storage position information acquisition method and system, storage medium and electronic equipment
CN115422903A (en) Report output method and device, electronic equipment and computer readable storage medium
CN111797125A (en) Report creating method and device, electronic equipment and computer readable storage medium
CN111159991A (en) Report modeling design device and method
CN117555918A (en) Visual chart generation method and device for clearing index data
CN116126297A (en) Multi-type database configuration code generation method and device and electronic equipment
CN115617338A (en) Method and device for quickly generating service page and readable storage medium
US20070255746A1 (en) Method for Processing Associated Software Data
CN109085424B (en) Intelligent meter display parameter reading and writing method
JPH0934938A (en) Cost setting method
US7065741B2 (en) Method of designing organizational information processing and operational system based upon information providers and information consumers

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