Method, system, device and readable storage medium for implementing bidirectional instrument diagram
By developing the bidirectional instrument chart function in echarts and using javascript scripts to display bidirectional indicators, the problem that echarts cannot correctly display bidirectional indicators of thermal power units is solved, and an image display method of data is provided to support production decisions.
Patent Information
- Application Number
- CN202210720295.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-23
- Publication Date
- 2024-09-24
- Estimated Expiration
- 2042-06-23
AI Technical Summary
The existing data visualization tool echarts cannot correctly display some two-way indicators in thermal power units, such as consumption difference, turbine vacuum value, exhaust oxygen, power generation profit, etc. It cannot vividly display the positive and negative deviations of these indicators from the central benchmark.
By developing the two-way instrument chart function in echarts, two superimposed arcs (background arc and numerical arc) are used to represent the two-way indicator, and the javascript scripts echarts.js and echarts-twoWayGauge.js are used to realize the display of the two-way instrument chart. The values of the two-way indicator are processed by normalization, and the color and angle of the numerical arc are dynamically adjusted according to the positive and negative values of the indicator.
It realizes the visual display of two-way indicators in thermal power units. Users can clearly understand the positive and negative direction deviations of the indicators from the central datum at a glance. It provides visual data basis to support production decisions and enriches the data display method of echarts.
Smart Images

Figure CN114995815B
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of electrical digital signal processing, and in particular relates to a method, system, device and readable storage medium for realizing a bidirectional instrument diagram. Background Art
[0002] In the era of big data, with the advancement of informatization and the geometric growth of data, traditional data reports and tables can no longer intuitively display data patterns. Only through data visualization can we understand the patterns of large amounts of data.
[0003] With the development of the field of electrical digital signal processing technology, especially the data visualization front-end display technology, how to convert electrical digital signals into visual charts has attracted more and more attention, especially thermal power unit section, power plant control, etc. need more visual chart display. echarts is a basic tool library for data visualization, which provides a variety of chart display methods. Based on echarts, you can develop a gorgeous data visualization scene interface.
[0004] Echarts has a built-in instrument chart display function, which can display one-way indicators of thermal power units, such as load, load rate, temperature, utilization hours, and plant power consumption rate. However, for some bidirectional indicators with positive and negative deviations based on the center position, such as consumption difference, turbine vacuum value, exhaust oxygen content, power plant power generation profit, etc., the built-in instrument chart in Echarts cannot be correctly displayed. Summary of the invention
[0005] To solve the problems existing in the prior art, the purpose of the present invention is to provide a method, system, device and readable storage medium for realizing a two-way instrument diagram, the method is based on a two-way instrument diagram realized by echarts, and the component is composed of two superimposed arcs, including a background arc and a numerical arc. The two-way instrument diagram can be used to vividly display two-way indicators such as consumption difference, turbine vacuum value, exhaust oxygen content, power generation profit, etc. in thermal power units. Users can understand the deviation of the indicators from the positive and negative directions of the center benchmark at a glance through the two-way instrument, and provide a vivid data basis for production decisions. The present invention supplements the two-way instrument diagram that is lacking in echarts and enriches the data display method of echarts.
[0006] In order to achieve the above object, the present invention adopts the following technical scheme:
[0007] A method for implementing a bidirectional instrument diagram, comprising:
[0008] Create an HTML page and embed the JavaScript scripts echarts.js and echarts-twoWayGauge.js into the page through the script tag;
[0009] Add a DIV element to the HTML page, and create an echarts instance from the DIV element through echarts;
[0010] Read the original values of the related bidirectional indicators of the thermal power unit and standardize the values of the bidirectional indicators. The specific processing formula is as follows:
[0011] standardValue=rawValue-centerValue
[0012] Among them, standardValue is the standard value of the two-way indicator, rawValue is the original value of the two-way indicator, and centerValue is the center reference value of the two-way indicator.
[0013] Create the configuration items required for the two-way instrument chart. The value of the two-way instrument chart in the configuration items is the standard value of the two-way indicator. The configuration items are assigned to the echarts instance, and the corresponding two-way instrument chart is generated on the HTML interface through the two-way instrument chart plug-in based on echarts.
[0014] As a further improvement of the present invention, the creation process of the plug-in of the bidirectional instrument chart based on echarts is specifically as follows:
[0015] Embed the JavaScript scripts echarts.js and echarts-twoWayGauge.js into the new HTML page through the script tag;
[0016] Create echarts-twoWayGauge.js and complete the initialization process; obtain the specific DIV element through the API parameter passed in the render function, and then create an echarts instance on this DIV element;
[0017] Use the configuration items to create a bidirectional instrument diagram generator, and obtain the graphic configuration of the background arc and the graphic configuration of the value arc;
[0018] Add the graphic configuration of the background arc and the graphic configuration of the numerical arc to the overall configuration of echarts and assign the configuration to the echarts instance through the setOption method. The plug-in for the bidirectional instrument chart based on echarts is created.
[0019] As a further improvement of the present invention, the echarts-twoWayGauge.js file implements two necessary interfaces for extending the echarts component: echarts.extendChartView for creating a two-way gauge chart interface and echarts.extendSeriesModel for processing two-way gauge chart data configuration; the echarts.extendChartView includes a render function for drawing a specific two-way gauge chart graphic, and the echarts.extendSeriesModel includes a getInitialData function for standardizing two-way gauge chart graphic data, a defaultOption function for returning a default configuration item of a two-way gauge chart, and an optionUpdated function for processing graphic data after a configuration item changes; the configuration items include the arc of the two-way gauge chart and the width of the two-way gauge chart;
[0020] As a further improvement of the present invention, the defaultOption function in the echarts.extendSeriesModel method of the echarts-twoWayGauge.js is used to return the default configuration items of the two-way gauge chart, in which value is the value of the two-way gauge chart; endValue is the maximum value of the two-way gauge chart; width is the width of the two-way gauge chart; arc is the radian of the two-way gauge chart; positiveColor is the color of the two-way gauge chart when value is a positive value; negativeColor is the color of the two-way gauge chart when value is a negative value.
[0021] As a further improvement of the present invention, the method of creating a bidirectional instrument diagram generator using configuration items to obtain a graphic configuration of a background arc and a graphic configuration of a numerical arc specifically includes:
[0022] Create an instance of echarts in the render function, and then generate the background arc graphic configuration of the two-way instrument chart according to the arc of the two-way instrument chart and the width of the two-way instrument chart. The starting angle of the background arc is 90+arc, the ending angle is 90-arc, and the width of the background arc is width;
[0023] The configuration items also include the limit value endValue of the two-way instrument chart and the value value of the two-way instrument chart; when value<-endValue, the value of -endValue is assigned to value, and when value>ebdVakye, the value of endValue is assigned to value.
[0024] Use arc, value, and endValue to calculate the start and end angles of the numerical arc of the bidirectional instrument diagram;
[0025] Finally, the graphic configuration of the numerical arc is generated through the value value of the two-way meter chart, the positive color positiveColor of the two-way meter chart, the negative color negativeColor of the two-way meter chart, the starting angle startAngle of the numerical arc, and the ending angle endAngle of the numerical arc.
[0026] As a further improvement of the present invention, the starting angle and the ending angle of the numerical arc of the bidirectional instrument diagram are calculated by arc, value, and endValue. The specific formula is as follows:
[0027] When value ≥ 0:
[0028] startAngle=90
[0029] endAngle=90-(value÷endValue×arc)\360
[0030] When value<0:
[0031] startAngle=90+|(value÷endValue)×arc|\360
[0032] endAngle=90
[0033] Where startAngle is the starting angle of the numerical arc, and endAngle is the ending angle of the numerical arc.
[0034] As a further improvement of the present invention, the positiveColor color of the positive value of the two-way instrument graph and the negativeColor color of the negative value of the two-way instrument graph in the configuration item satisfy: when value≥0, the color of the numerical arc of the two-way instrument graph is positiveColor; when value<0, the color of the numerical arc of the two-way instrument graph is negativeColor.
[0035] A system for implementing a bidirectional instrument diagram, characterized in that:
[0036] Create and embed module: used to create an HTML page and embed the JavaScript scripts echarts.js and echarts-twoWayGauge.js into the page through the script tag;
[0037] echarts instance creation module: used to add DIV elements to HTML pages, and create DIV elements as echarts instances through echarts;
[0038] Bidirectional instrument chart generation module: used to create the configuration items required for the bidirectional instrument chart, and assign the configuration items to the echarts instance, and generate the corresponding bidirectional instrument chart on the HTML interface through the bidirectional instrument chart plug-in based on echarts.
[0039] A computer device comprises a memory, a processor and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the steps of the method for realizing a bidirectional instrument diagram are realized.
[0040] A computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the method for realizing a bidirectional instrument diagram are realized.
[0041] Compared with the prior art, the present invention has the following beneficial technical effects:
[0042] The present invention solves the problem that the echarts instrument diagram cannot correctly display the two-way index by adding the function of the two-way instrument diagram to the echarts data visualization tool library, and can display the two-way indexes such as the consumption difference, the vacuum value of the steam turbine, the exhaust oxygen content, and the power generation profit in the thermal power unit in an image, and the user can understand the deviation of the index from the center reference in the positive and negative directions at a glance through the two-way instrument, and provide an image data basis for production decision-making. The present invention follows the echarts component development standard to deeply encapsulate the implementation method of the two-way instrument diagram, simplify the use method, and the user can create a two-way instrument diagram like using the standard echarts component. When developing data visualization, it can show the component implementation code of consistency, improve the readability of the code, and the maintainability of the project. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] The drawings in the specification are used to provide further understanding of the present invention and constitute a part of the present invention. The schematic embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute improper limitations on the present invention.
[0044] Figure 1 It is an overall flow chart of the method for realizing a bidirectional instrument diagram of the present invention;
[0045] Figure 2 To create a flowchart for echarts-twoWayGauge.js;
[0046] Figure 3A flowchart for creating a two-way gauge chart using echarts-twoWayGauge.js;
[0047] Figure 4 It is a bidirectional instrument chart with positive values;
[0048] Figure 5 A bidirectional meter chart with negative values.
[0049] Figure 6 A schematic diagram of the system structure for realizing a bidirectional instrument diagram according to a preferred embodiment of the present invention;
[0050] Figure 7 It is a schematic diagram of the structure of an electronic device according to a preferred embodiment of the present invention. DETAILED DESCRIPTION
[0051] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0052] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices. The instrument chart in echarts cannot well display bidirectional indicators, such as: consumption difference, turbine vacuum value, exhaust oxygen content, power generation profit, etc. The present invention uses two superimposed arcs, including a background arc and a numerical arc. Its characteristic is that when the value is 0, the value of the value arc is in the middle of the background arc. When it is a positive value, the value arc will grow clockwise with the center of the background arc as the center and change color. When it is a negative value, the value arc will grow counterclockwise with the center of the background arc as the center and change color. Thus, a two-way instrument chart is generated.
[0053] like Figure 1 As shown, the present invention provides a method for realizing a bidirectional instrument diagram, comprising the following steps:
[0054] S1, create an HTML page, and embed the JavaScript scripts echarts.js and echarts-twoWayGauge.js into the HTML page through the script tag;
[0055] S2, add a DIV element to the HTML page, and create an echarts instance from the DIV element through echarts;
[0056] S3, reading the original values of the related bidirectional indicators of the thermal power unit, and standardizing the values of the bidirectional indicators;
[0057] S4, the configuration items required by the two-way gauge chart, and assign the configuration items to the echarts instance, echarts-twoWayGauge.js generates the corresponding two-way gauge chart on the HTML interface;
[0058] Among them, the script echarts.js is the main functional module of echarts, and the script echarts-twoWayGauge.js is the main functional module for drawing a two-way gauge diagram.
[0059] As an optional solution of the present invention, the creation process of the script echarts-twoWayGauge.js is specifically as follows:
[0060] Embed the JavaScript scripts echarts.js and echarts-twoWayGauge.js into the new HTML page through the script tag;
[0061] Create an echarts-twoWayGauge.js file, which implements two necessary interfaces for extending the echarts component: echarts.extendChartView for creating a two-way gauge chart interface and echarts.extendSeriesModel for processing two-way gauge chart data configuration; the echarts.extendChartView includes a render function for drawing a specific two-way gauge chart graphic, and the echarts.extendSeriesModel includes a getInitialData function for standardizing two-way gauge chart graphic data, a defaultOption function for returning a default configuration item of a two-way gauge chart, and an optionUpdated function for processing graphic data after a configuration item changes; the configuration items include the arc of the two-way gauge chart and the width of the two-way gauge chart;
[0062] Create a bidirectional instrument chart generator using configuration items;
[0063] Create an instance of echarts in the render function, and then generate the background arc graphic configuration of the two-way instrument chart according to the arc of the two-way instrument chart and the width of the two-way instrument chart. The starting angle of the background arc is 90+arc, the ending angle is 90-arc, and the width of the background arc is width.
[0064] Furthermore, the configuration items also include the limit value endValue of the bidirectional instrument graph and the value value of the bidirectional instrument graph. When value<-endValue, the value of -endValue is assigned to value, and when value>endValue, the value of endValue is assigned to value.
[0065] Furthermore, the start angle and end angle of the numerical arc of the bidirectional instrument diagram are calculated through arc, value, and endValue. The specific formula is as follows:
[0066] When value ≥ 0:
[0067] startAngle=90
[0068] endAngle=90-(value÷endValue×arc)\360
[0069] When value<0:
[0070] startAngle=90+|(value÷endValue)×arc|\360
[0071] endAngle=90
[0072] Where startAngle is the starting angle of the numerical arc, and endAngle is the ending angle of the numerical arc.
[0073] Furthermore, the graphic configuration of the numerical arc of the bidirectional instrument diagram can be created through startAngle, endAngle, and width.
[0074] Furthermore, the configuration items also include the positiveColor color of the bidirectional meter graph's positive value and the negativeColor color of the bidirectional meter graph's negative value. When value≥0, the color of the numerical arc of the bidirectional meter graph is positiveColor, and when value<0, the color of the numerical arc of the bidirectional meter graph is negativeColor.
[0075] Combine the background arc graphic configuration and the numerical arc graphic configuration of the two-way gauge chart into the overall configuration of echarts, assign the echarts overall configuration to the echarts instance through the echarts.setOption function, and complete the creation of the script echarts-twoWayGauge.js.
[0076] The method of the present invention is characterized in that when the value is 0, the value of the numerical arc is in the middle of the background arc. When it is a positive value, the numerical arc will grow clockwise with the center of the background arc as the center and change color. When it is a negative value, the numerical arc will grow counterclockwise with the center of the background arc as the center and change color.
[0077] Example
[0078] This embodiment provides a method for implementing a bidirectional instrument chart based on echarts, including the following steps:
[0079] Step 1:
[0080] To realize the bidirectional instrument chart based on echarts, you need to build the development environment of echarts first. The specific construction method is as follows:
[0081] In the HTML interface, embed the javascript script echarts.js into the HTML page. This script provides basic functional support, and only on the basis of this function can the function development of the two-way instrument chart be carried out.
[0082] Step 2:
[0083] Create the echarts-twoWayGauge.js framework, and then add the interface methods echarts.extendChartView and echarts.extendSeriesModel for echarts plug-in access in the echarts-twoWayGauge.js framework. The render function of echarts.extendChartView is used for drawing the graphics of the specific two-way instrument chart; the getInitialData function of echarts.extendSeriesModel is used for the standardization of the graphic data of the two-way instrument chart, the defaultOption function is used to return the default configuration items of the 3D pie chart, and the optionUpdated function is used to process the data after the configuration items are changed. Here, we only initialize echarts-twoWayGauge.js. For the render function, we only need to create the name of the function, and the following steps will implement the content inside.
[0084] Step 3:
[0085] Implement the defaultOption function in the echarts.extendSeriesModel method of echarts-twoWayGauge.js. This function returns the default configuration items of the two-way gauge chart, where value is the value of the two-way gauge chart; endValue is the maximum value of the two-way gauge chart; width is the width of the two-way gauge chart; arc is the arc of the two-way gauge chart; positiveColor is the color of the two-way gauge chart when value is positive; negativeColor is the color of the two-way gauge chart when value is negative, as shown in the following table:
[0086]
[0087]
[0088] Step 4:
[0089] This step creates a two-way instrument chart generator through configuration items. The specific implementation steps are as follows:
[0090] First, according to the arc of the bidirectional instrument diagram, the starting angle of the background arc is calculated: 90+arc and the ending angle is calculated: 90-arc. And the graphic configuration of the background arc is generated in combination with the width of the bidirectional instrument diagram.
[0091] Then filter the value value of the bidirectional meter chart by the maximum value endValue of the bidirectional meter chart. When value<-endValue, assign the value of -endValue to value, and when value>endValue, assign the value of endValue to value.
[0092] Next, the start angle and end angle of the numerical arc of the bidirectional instrument diagram are calculated through the configuration items arc, value, and endValue of the bidirectional instrument diagram. The specific formula is as follows:
[0093] When value ≥ 0:
[0094] startAngle=90
[0095] endAngle=90-(value÷endValue×arc)\360
[0096] When value<0:
[0097] startAngle=90+|(value÷endValue)×arc|\360
[0098] endAngle=90
[0099] Where startAngle is the starting angle of the numerical arc, and endAngle is the ending angle of the numerical arc.
[0100] Finally, the numerical arc graphic configuration is generated through the value of the bidirectional meter, the positive color of the bidirectional meter, the negative color of the bidirectional meter, the start angle of the numerical arc, and the end angle of the numerical arc. When value ≥ 0, the color of the numerical arc of the bidirectional meter is positiveColor, and when value < 0, the color of the numerical arc of the bidirectional meter is negativeColor.
[0101] Step 5:
[0102] To implement the render function in step 2, first obtain the specific DIV element through the API parameter passed in the render function, and then create an echarts instance on this DIV element.
[0103] Next, create the graphic configuration of the background arc and the graphic configuration of the value arc according to the configuration items defined in step 3 and the two-way instrument chart generator in step 4.
[0104] Then add the graphics configuration of the background arc and the graphics configuration of the numerical arc to the overall configuration of echarts and assign the configuration to the echarts instance through the setOption method.
[0105] At this point, the script echarts-twoWayGauge.js has been created. For details, see Figure 2 .
[0106] Step 6:
[0107] Read the original values of the two-way indicators related to the thermal power unit, such as the original value of the power generation profit, whose central reference value is 0, and then standardize the power generation profit, and the processed standard value is power generation profit-0.
[0108] Step 7:
[0109] Create an HTML page and embed the javascript scripts echarts.js and echarts-twoWayGauge.js into the page through the script tag. echarts-twoWayGauge.js is a plug-in for the two-way gauge chart based on echarts created in steps 1 to 5.
[0110] Add a DIV element to the HTML page and create an echarts instance through echarts.
[0111] According to the configuration item definition in step 3 and the power generation profit standard value obtained in step 6, create the configuration items required for the two-way meter chart and assign the configuration items to the echarts instance. At this time, echarts-twoWayGauge.js will generate the corresponding two-way meter chart on the interface. For the specific usage process, see Figure 3 The final generated two-way instrument diagram is shown in Figure 4 and Figure 5 .
[0112] When the instrument graph is in the positive direction, it means that the power plant is currently profitable, and the greater the deviation in the positive direction, the greater the profit. When the instrument graph is in the negative direction, it means that the power plant is currently losing money, and the greater the deviation in the negative direction, the greater the loss.
[0113] like Figure 6 As shown, the present invention also provides a system for realizing a bidirectional instrument diagram based on echarts, including:
[0114] Create and embed module: used to create HTML pages and embed the JavaScript scripts echarts.js and echarts-twoWayGauge.js into HTML pages through the script tag;
[0115] echarts instance creation module: used to add DIV elements to HTML pages, and create DIV elements as echarts instances through echarts;
[0116] Read original value module: used to read the original values of the two-way indicators related to the thermal power unit, and standardize the values of the two-way indicators;
[0117] Bidirectional instrument chart generation module: used to create the configuration items required for the bidirectional instrument chart. The value of the bidirectional instrument chart in the configuration item is the standard value of the bidirectional indicator, and the configuration item is assigned to the echarts instance. The corresponding bidirectional instrument chart is generated on the HTML interface through the bidirectional instrument chart plug-in based on echarts.
[0118] Among them, the script echarts.js is the main functional module of echarts, and the script echarts-twoWayGauge.js is the main functional module for drawing a two-way gauge diagram.
[0119] Furthermore, the creation process of the script echarts-twoWayGauge.js is specifically as follows:
[0120] Embed the JavaScript script echarts.js into the new HTML page through the script tag;
[0121] Create an echarts-twoWayGauge.js file, which implements two necessary interfaces for extending the echarts component: echarts.extendChartView for creating a two-way gauge chart interface and echarts.extendSeriesModel for processing two-way gauge chart data configuration; the echarts.extendChartView includes a render function for drawing a specific two-way gauge chart graphic, and the echarts.extendSeriesModel includes a getInitialData function for standardizing two-way gauge chart graphic data, a defaultOption function for returning a default configuration item of a two-way gauge chart, and an optionUpdated function for processing graphic data after a configuration item changes; the configuration items include the arc of the two-way gauge chart and the width of the two-way gauge chart;
[0122] Create a bidirectional instrument chart generator using configuration items;
[0123] Create an instance of echarts in the render function, and then generate the background arc graphic configuration of the two-way instrument chart according to the arc of the two-way instrument chart and the width of the two-way instrument chart. The starting angle of the background arc is 90+arc, the ending angle is 90-arc, and the width of the background arc is width.
[0124] Furthermore, the configuration items also include the limit value endValue of the bidirectional instrument graph and the value value of the bidirectional instrument graph. When value<-endValue, the value of -endValue is assigned to value, and when value>endValue, the value of endValue is assigned to value.
[0125] Furthermore, the start angle and end angle of the numerical arc of the bidirectional instrument diagram are calculated through arc, value, and endValue. The specific formula is as follows:
[0126] When value ≥ 0:
[0127] startAngle=90
[0128] endAngle=90-mod((value÷endValue×arc)\360)
[0129] When value<0:
[0130] startAngle=90+mod(|(value÷endValue)×arc|÷360)
[0131] endAngle=90
[0132] Where startAngle is the starting angle of the numerical arc, endAngle is the ending angle of the numerical arc, and mod is the expression symbol for finding the remainder.
[0133] Furthermore, the graphic configuration of the numerical arc of the bidirectional instrument diagram can be created through startAngle, endAngle, and width.
[0134] Furthermore, the configuration items also include the positiveColor color of the bidirectional meter graph's positive value and the negativeColor color of the bidirectional meter graph's negative value. When value≥0, the color of the numerical arc of the bidirectional meter graph is positiveColor, and when value<0, the color of the numerical arc of the bidirectional meter graph is negativeColor.
[0135] Combine the background arc graphic configuration and the numerical arc graphic configuration of the two-way gauge chart into the overall configuration of echarts, assign the echarts overall configuration to the echarts instance through the echarts.setOption function, and complete the creation of the script echarts-twoWayGauge.js.
[0136] like Figure 7 As shown, the third object of the present invention is to provide an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the method for implementing a bidirectional instrument diagram when executing the computer program.
[0137] The method for implementing a bidirectional instrument diagram comprises the following steps:
[0138] Create an HTML page and embed the JavaScript scripts echarts.js and echarts-twoWayGauge.js into the page through the script tag;
[0139] Add a DIV element to the HTML page, and create an echarts instance from the DIV element through echarts;
[0140] Read the original values of the related bidirectional indicators of the thermal power unit and standardize the values of the bidirectional indicators;
[0141] Create the configuration items required for the two-way instrument chart, assign the configuration items to the echarts instance, and generate the corresponding two-way instrument chart on the HTML interface through the two-way instrument chart plug-in based on echarts.
[0142] A fourth object of the present invention is to provide a computer-readable storage medium storing a computer program, wherein the computer program implements the steps of the method for implementing a bidirectional instrument diagram when executed by a processor.
[0143] The method for implementing a bidirectional instrument diagram comprises the following steps:
[0144] Create an HTML page and embed the JavaScript scripts echarts.js and echarts-twoWayGauge.js into the page through the script tag;
[0145] Add a DIV element to the HTML page, and create an echarts instance from the DIV element through echarts;
[0146] Read the original values of the related bidirectional indicators of the thermal power unit and standardize the values of the bidirectional indicators;
[0147] Create the configuration items required for the two-way instrument chart, assign the configuration items to the echarts instance, and generate the corresponding two-way instrument chart on the HTML interface through the two-way instrument chart plug-in based on echarts.
[0148] Those skilled in the art will appreciate that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0149] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0150] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0151] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process in the computer or other programmable device. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0152] 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 its protection scope. Although the present invention has been described in detail with reference to the above embodiments, ordinary technicians in the field should understand that after reading the present invention, those skilled in the art can still make various changes, modifications or equivalent substitutions to the specific implementation methods of the invention, but these changes, modifications or equivalent substitutions are all within the protection scope of the pending claims of the invention.
Claims
1. A method for implementing a bidirectional instrument diagram, characterized in that: include: Create an HTML page and embed the JavaScript scripts echarts.js and echarts-twoWayGauge.js into the page through the script tag; Add a DIV element to the HTML page, and create an echarts instance from the DIV element through echarts; Read the original values of the related bidirectional indicators of the thermal power unit and standardize the values of the bidirectional indicators; Create the configuration items required for the two-way meter chart. The value of the two-way meter chart in the configuration items is the standard value of the two-way indicator. The configuration items are assigned to the echarts instance. The corresponding two-way meter chart is generated on the HTML interface through the two-way meter chart plug-in based on echarts. The creation process of the plug-in for the bidirectional instrument chart based on echarts is as follows: Embed the JavaScript scripts echarts.js and echarts-twoWayGauge.js into the new HTML page through the script tag; Create echarts-twoWayGauge.js and complete the initialization process; obtain the specific DIV element through the API parameter passed in the render function, and then create an echarts instance on this DIV element; Use the configuration items to create a bidirectional instrument diagram generator, and obtain the graphic configuration of the background arc and the graphic configuration of the value arc; Add the graphic configuration of the background arc and the graphic configuration of the numerical arc to the overall configuration of echarts and assign the configuration to the echarts instance through the setOption method. The plug-in of the bidirectional instrument chart based on echarts is created. The method of creating a bidirectional instrument diagram generator using configuration items to obtain the graphic configuration of the background arc and the graphic configuration of the value arc specifically includes: Create an instance of echarts in the render function, and then generate the background arc graphics configuration of the two-way instrument chart according to the arc of the two-way instrument chart and the width of the two-way instrument chart. The starting angle of the background arc is , the ending angle is , the width of the background arc is width; The configuration items also include the limit value endValue of the two-way instrument graph and the value value of the two-way instrument graph; when When -endValue is assigned to value, When , assign the value of endValue to value; Use arc, value, and endValue to calculate the start and end angles of the numerical arc of the bidirectional instrument diagram; Finally, the graphic configuration of the numerical arc is generated through the value value of the two-way meter chart, the positive color positiveColor of the two-way meter chart, the negative color negativeColor of the two-way meter chart, the starting angle startAngle of the numerical arc, and the ending angle endAngle of the numerical arc.
2. The method for realizing a bidirectional instrument diagram according to claim 1, characterized in that: The echarts-twoWayGauge.js file implements two necessary interfaces for extending the echarts component: echarts.extendChartView for creating a two-way gauge chart interface and echarts.extendSeriesModel for processing the two-way gauge chart data configuration; the echarts.extendChartView includes a render function for drawing a specific two-way gauge chart graphic, and the echarts.extendSeriesModel includes a getInitialData function for standardizing the two-way gauge chart graphic data, a defaultOption function for returning the default configuration items of the two-way gauge chart, and an optionUpdated function for processing the graphic data after the configuration items are changed; the configuration items include the arc of the two-way gauge chart and the width of the two-way gauge chart.
3. The method for realizing a bidirectional instrument diagram according to claim 2, characterized in that: The defaultOption function in the echarts.extendSeriesModel method of the echarts-twoWayGauge.js is used to return the default configuration items of the two-way gauge chart. In the default configuration items, value is the value of the two-way gauge chart; endValue is the maximum value of the two-way gauge chart; width is the width of the two-way gauge chart; arc is the arc of the two-way gauge chart; positiveColor is the color of the two-way gauge chart when value is a positive value; negativeColor is the color of the two-way gauge chart when value is a negative value.
4. The method for realizing a bidirectional instrument diagram according to claim 1, characterized in that: The start angle and end angle of the numerical arc of the bidirectional instrument diagram are calculated through arc, value, and endValue. The specific formula is as follows: when hour: when hour: Where startAngle is the starting angle of the numerical arc, and endAngle is the ending angle of the numerical arc.
5. The method for realizing a bidirectional instrument diagram according to claim 1, characterized in that: The positiveColor of the bidirectional instrument graph's positive value and the negativeColor of the bidirectional instrument graph's negative value in the configuration item satisfy the following conditions: When , the color of the numerical arc of the bidirectional instrument chart is positiveColor, when When , the color of the value arc of the bidirectional instrument chart is negativeColor.
6. A system for implementing a bidirectional instrument diagram, characterized in that: The method for realizing a bidirectional instrument diagram according to claim 1 comprises: Create and embed module: used to create an HTML page and embed the JavaScript scripts echarts.js and echarts-twoWayGauge.js into the page through the script tag; echarts instance creation module: used to add DIV elements to HTML pages, and create DIV elements as echarts instances through echarts; Read original value module: used to read the original values of the related bidirectional indicators of the thermal power unit and standardize the values of the bidirectional indicators; Bidirectional instrument chart generation module: used to create the configuration items required for the bidirectional instrument chart. The value of the bidirectional instrument chart in the configuration item is the standard value of the bidirectional indicator, and the configuration item is assigned to the echarts instance. The corresponding bidirectional instrument chart is generated on the HTML interface through the bidirectional instrument chart plug-in based on echarts.
7. A computer device, characterized in that: The invention comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor implements the method for realizing a bidirectional instrument diagram as claimed in any one of claims 1 to 5 when executing the computer program.
8. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method for realizing a bidirectional instrument diagram according to any one of claims 1 to 5 is realized.
Citation Information
Patent Citations
Instrument panel diagram display method and device and electronic equipment
CN112579223A
Technical implementation method and device for instrument panel custom assembly based on Echarts
CN114296710A
Method and system for configuring selection of contextual dashboards
US20160188145A1
Tool for creating charts
US7667582B1
