Method and related device for realizing curve chart based on javaFx Canvas

By using JavaFX Canvas in the new energy power station monitoring system, off-screen Canvas drawing and a double buffering mechanism are adopted to solve the performance bottlenecks and resource consumption problems of traditional JavaFX chart controls and WebView solutions, and to achieve efficient and dynamic real-time data display.

CN120976362APending Publication Date: 2025-11-18YANCHI ZHONGYING CHUANGNENG NEW ENERGY CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511061015.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-07-30
Publication Date
2025-11-18

AI Technical Summary

Technical Problem

In existing technologies for monitoring new energy power stations, traditional JavaFX chart controls and WebView solutions cannot meet the needs of efficient and dynamic display of real-time data. They suffer from performance bottlenecks, poor real-time performance, and high resource consumption, making it difficult to support complex rendering requirements.

Method used

The method adopts JavaFX Canvas, which obtains real-time data for preprocessing and drawing. It uses the GraphicsContext API to draw static and dynamic parts on the off-screen Canvas and synthesizes curves and charts, avoiding drawing directly on the main view and implementing a double-buffered drawing mechanism.

Benefits of technology

It enables efficient and dynamic display of real-time data from new energy power plants, eliminates high-frequency data refresh flicker, supports complex rendering requirements, and improves system response speed and resource utilization efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120976362A_ABST
    Figure CN120976362A_ABST
Patent Text Reader

Abstract

The invention discloses a method for realizing a curve chart based on javaFx Canvas and a related device. The method comprises the following steps: acquiring real-time data in a new energy station; preprocessing the real-time data, and converting the preprocessed real-time data into data points required by drawing; determining rendering time and rendering content; drawing a static part and a dynamic part on an off-screen Canvas according to the data points, the rendering time and the rendering content required by the drawing; and synthesizing the content of the off-screen buffer layer with the main view to obtain a curve chart, and the method and the related device can efficiently and dynamically display the real-time data of the equipment.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of application system function development, and relates to a method and related apparatus for implementing curve charts based on JavaFX Canvas. Background Technology

[0002] New energy power plant monitoring systems need to collect and display large amounts of equipment data in real time (such as power generation, voltage, temperature, wind speed, etc.), or view historical data trends. Traditional data display solutions are mostly based on static charts or general visualization components (such as LineChart). This presents two main problems: First, they have limited functionality and cannot meet complex business needs, such as mouse crosshairs and data playback. Second, they lack scalability, making it difficult to easily and quickly expand upon them to develop more business functions. Only simple style adjustments can be made.

[0003] Existing technical implementation methods:

[0004] Traditional UI control solution: Use JavaFX controls such as LineChart and AreaChart, and manage data nodes (Node class instances) through XYChart.Series.

[0005] Web Embedded Solution: Integrate third-party JavaScript charting libraries (such as ECharts) and display them through WebView, requiring cross-language communication.

[0006] Open-source Java charting libraries, such as JFreeChart, are based on Swing / AWT and require interaction with the JavaFX compatibility layer.

[0007] Existing technologies have problems:

[0008] Performance bottleneck: Traditional JavaFX chart controls create a Node object for each data point. When new energy power plants update thousands of data points per second (such as wind turbine SCADA data), the frequent addition and deletion of nodes causes the interface to lag and memory to spike.

[0009] Poor real-time performance: The WebView solution suffers from inter-process communication delays, which cannot meet the millisecond-level data refresh requirements of the new energy monitoring system.

[0010] High resource consumption: Open source libraries require the introduction of large dependency packages, and the double-buffered rendering mechanism (JavaFX+Swing) causes GPU resource contention.

[0011] Customization difficulties: Existing solutions are difficult to support complex rendering requirements unique to new energy scenarios, such as dynamic threshold lines (e.g., power limits) and multi-Y-axis overlay (voltage / current / temperature).

[0012] The above problems prevent the efficient and dynamic display of real-time data from the device. Summary of the Invention

[0013] The purpose of this invention is to overcome the shortcomings of the prior art and provide a method and related apparatus for implementing curve charts based on JavaFX Canvas. This method and related apparatus can efficiently and dynamically display real-time data of the device.

[0014] To achieve the above objectives, this invention discloses a method for implementing curve charts based on JavaFX Canvas, comprising:

[0015] Acquire real-time data from new energy power plants;

[0016] The real-time data is preprocessed and converted into data points required for plotting.

[0017] Determine the rendering time and the content to be rendered;

[0018] Based on the data points required for drawing, the rendering time, and the rendering content, draw the static and dynamic parts on the off-screen Canvas;

[0019] The content of the off-screen buffer layer is composited with the main view to obtain a curve chart.

[0020] A further improvement of the method for implementing line charts based on JavaFX Canvas described in this invention is as follows:

[0021] Furthermore, the process of preprocessing the real-time data includes parsing, filtering, and normalizing the real-time data.

[0022] Furthermore, it also includes:

[0023] Obtain the JavaFX Canvas's GraphicsContext API, which is used to execute drawing commands;

[0024] The GraphicsContext API is executed to draw the static and dynamic parts on the off-screen Canvas based on the data points, rendering time, and rendering content required for the drawing.

[0025] Furthermore, it also includes:

[0026] The graph is displayed on the user interface.

[0027] This invention discloses a system for implementing curve charts based on JavaFX Canvas, comprising:

[0028] The acquisition module is used to acquire real-time data from new energy power plants;

[0029] The preprocessing module is used to preprocess the real-time data and convert the preprocessed real-time data into data points required for plotting.

[0030] The determination module is used to determine the rendering time and the content to be rendered;

[0031] The drawing module is used to draw static and dynamic parts on the off-screen Canvas according to the data points, rendering time and rendering content required for the drawing;

[0032] The compositing module is used to composite the content of the off-screen buffer layer with the main view to obtain a curve chart.

[0033] A further improvement of the system for implementing line charts based on JavaFX Canvas described in this invention is as follows:

[0034] Furthermore, the process of preprocessing the real-time data includes parsing, filtering, and normalizing the real-time data.

[0035] Furthermore, it also includes:

[0036] Obtain the JavaFX Canvas's GraphicsContext API, which is used to execute drawing commands;

[0037] The GraphicsContext API is executed to draw the static and dynamic parts on the off-screen Canvas based on the data points, rendering time, and rendering content required for the drawing.

[0038] Furthermore, it also includes:

[0039] The graph is displayed on the user interface.

[0040] The present invention discloses a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of the method for generating and sending trusted status alarm information.

[0041] The present invention discloses a computer-readable storage medium storing a computer program, wherein when the computer program is executed by a processor, the steps of the method for generating and uploading trusted status alarm information are implemented.

[0042] The present invention has the following beneficial effects:

[0043] The method and related apparatus for implementing curve charts based on JavaFX Canvas described in this invention, in specific operation, draws static and dynamic parts on an off-screen Canvas according to the data points, rendering time, and rendering content required for drawing. The content of the off-screen buffer layer is combined with the main view to obtain a curve chart. The direct pixel operation of Canvas avoids the DOM tree rendering bottleneck, and the double buffer drawing mechanism eliminates high-frequency data refresh flickering, thereby achieving efficient and dynamic display of real-time data of the device. Attached Figure Description

[0044] The accompanying drawings, which form part of this specification, are used to provide a further understanding of the invention. The illustrative embodiments of the invention and their descriptions are used to explain the invention and do not constitute an undue limitation of the invention. In the drawings:

[0045] Figure 1 This is a flowchart of the method of the present invention. Detailed Implementation

[0046] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0047] In the description of this invention, it should be understood that the terms "comprising" and "including" indicate the presence of the described features, integrals, steps, operations, elements and / or components, but do not exclude the presence or addition of one or more other features, integrals, steps, operations, elements, components and / or collections thereof.

[0048] It should also be understood that the terminology used in this specification is for the purpose of describing particular embodiments only and is not intended to limit the invention. As used in this specification and the appended claims, the singular forms “a,” “an,” and “the” are intended to include the plural forms unless the context clearly indicates otherwise.

[0049] It should also be further understood that the term "and / or" as used in this specification and the appended claims refers to any combination and all possible combinations of one or more of the associated listed items, and includes such combinations. For example, A and / or B can represent three cases: A alone, A and B simultaneously, and B alone. Additionally, the character " / " in this invention generally indicates that the preceding and following objects have an "or" relationship.

[0050] It should be understood that although terms such as first, second, third, etc., may be used in the embodiments of the present invention to describe the preset range, these preset ranges should not be limited to these terms. These terms are only used to distinguish the preset ranges from one another. For example, without departing from the scope of the embodiments of the present invention, the first preset range may also be referred to as the second preset range, and similarly, the second preset range may also be referred to as the first preset range.

[0051] Depending on the context, the word "if" as used here can be interpreted as "when," "when," "in response to determination," or "in response to detection." Similarly, depending on the context, the phrase "if determination" or "if detection (of the stated condition or event)" can be interpreted as "when determination," "in response to determination," "when detection (of the stated condition or event)," or "in response to detection (of the stated condition or event)."

[0052] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. The components of the embodiments of the present invention described and shown in the accompanying drawings can generally be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present invention provided in the accompanying drawings is not intended to limit the scope of the claimed invention, but merely to illustrate selected embodiments of the invention. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without inventive effort are within the scope of protection of the present invention.

[0053] The accompanying drawings illustrate various structural schematic diagrams according to embodiments disclosed in this invention. These drawings are not to scale, and some details have been enlarged for clarity, and some details may have been omitted. The shapes of the various regions and layers shown in the drawings, as well as their relative sizes and positional relationships, are merely exemplary and may deviate from reality due to manufacturing tolerances or technical limitations. Furthermore, those skilled in the art can design regions / layers with different shapes, sizes, and relative positions as needed.

[0054] Example 1

[0055] refer to Figure 1 The method for implementing line charts based on JavaFX Canvas according to the present invention includes the following steps:

[0056] 1) Acquire real-time data from the new energy power station and send the real-time data out via Modbus or WebSocket protocol.

[0057] 2) Receive the real-time data, preprocess the real-time data, and then convert the preprocessed real-time data into data points required for plotting;

[0058] The process of preprocessing real-time data is as follows: real-time data is parsed, filtered, and normalized.

[0059] 3) Determine the rendering time and content, for example, based on data update frequency and user interaction events;

[0060] 4) Obtain the JavaFX Canvas's GraphicsContext API, which is used to execute drawing commands;

[0061] 5) Execute the GraphicsContext API to draw static parts (such as coordinate axes and grids) and dynamic parts (such as curves) on the off-screen Canvas (i.e., the buffer in memory) according to the data points, rendering time and rendering content required for drawing, to avoid flickering caused by drawing directly on the main Canvas.

[0062] 6) Composite the content of the off-screen buffer layer with the main view, for example, draw the content of the off-screen buffer layer onto the main Canvas.

[0063] 7) Display the synthesis results on the user interface.

[0064] Visible area clipping: Based on the time range of the current view (e.g., the last 10 minutes), only the visible data segments are rendered, reducing the amount of drawing calculations.

[0065] Adaptive data resolution: The data sampling interval is dynamically adjusted according to the time axis scaling level to ensure rendering efficiency.

[0066] Visual elements are drawn in layers. Background layer: static grid and axis labels, redrawn only when the view is zoomed / panned. Data layer: dynamic curves and data point markers, updated in real time. Interaction layer: mouse hover tooltips and selection highlighting, rendered on demand.

[0067] Multi-threaded data synchronization. Data acquisition thread: An independent thread reads real-time data from devices or message queues (such as Kafka). Rendering thread: The JavaFX main thread periodically triggers incremental Canvas rendering to avoid blocking UI responsiveness. Inter-thread communication: UI components are safely updated via Platform.runLater().

[0068] Interactive functionality implementation. Zoom and pan: Listen for mouse wheel and drag events to dynamically adjust the view area. Data point crosshairs: Calculate the data value and timestamp corresponding to the mouse position in real time and display a tooltip.

[0069] The invention is based on the following: bypassing the DOM tree rendering bottleneck through direct pixel manipulation of Canvas; eliminating high-frequency data refresh flicker through a double-buffered drawing mechanism; and supporting second-level rendering of 100,000+ data points using a spatiotemporal data compression algorithm. The advantages of this invention over existing technologies are shown in Table 1.

[0070] Table 1

[0071]

[0072]

[0073] Example 2

[0074] The system for implementing curve charts based on JavaFX Canvas, as described in this invention, includes:

[0075] The acquisition module is used to acquire real-time data from new energy power plants;

[0076] The preprocessing module is used to preprocess the real-time data and convert the preprocessed real-time data into data points required for plotting.

[0077] The determination module is used to determine the rendering time and the content to be rendered;

[0078] The drawing module is used to draw static and dynamic parts on the off-screen Canvas according to the data points, rendering time and rendering content required for the drawing;

[0079] The compositing module is used to composite the content of the off-screen buffer layer with the main view to obtain a curve chart.

[0080] In this embodiment, the process of preprocessing real-time data is as follows: parsing, filtering, and normalizing the real-time data.

[0081] This embodiment also includes:

[0082] Obtain the JavaFX Canvas's GraphicsContext API, which is used to execute drawing commands;

[0083] The GraphicsContext API is executed to draw the static and dynamic parts on the off-screen Canvas based on the data points, rendering time, and rendering content required for the drawing.

[0084] This embodiment also includes:

[0085] The graph is displayed on the user interface.

[0086] The module division in this embodiment is illustrative and represents only one logical functional division. In actual implementation, other division methods may be used. Furthermore, the functional modules in each embodiment of this application can be integrated into a single processor, exist as separate physical entities, or be integrated into a single module. The integrated modules described above can be implemented in hardware or as software functional modules.

[0087] Example 3

[0088] A computer device includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the steps of the method for implementing a curve chart based on JavaFX Canvas. For example, the method includes: acquiring real-time data from a new energy power station; preprocessing the real-time data to convert the preprocessed data into data points required for drawing; determining the rendering time and rendering content; drawing static and dynamic parts on an off-screen Canvas according to the data points, rendering time, and rendering content; and compositing the content of the off-screen buffer layer with the main view to obtain a curve chart. The preprocessing of the real-time data includes parsing, filtering, and normalizing the real-time data. The method also includes: acquiring the GraphicsContext API of JavaFX Canvas, which is used to execute drawing commands; executing the GraphicsContext API to draw static and dynamic parts on an off-screen Canvas according to the data points, rendering time, and rendering content; and displaying the curve chart on a user interface. The memory may include main memory, such as high-speed random access memory (RAM), or non-volatile memory, such as at least one disk storage device. The processor, network interface, and memory are interconnected via an internal bus, which may be an industry-standard architecture bus, a peripheral component interconnection standard bus, or an extended industry-standard architecture bus. The bus can be categorized as an address bus, data bus, or control bus. The memory stores programs; specifically, the program may include program code, which includes computer operation instructions. The memory may include main memory and non-volatile memory, and provides instructions and data to the processor.

[0089] Example 4

[0090] A computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps of a method for implementing a curve chart based on JavaFX Canvas. For example, the method includes: acquiring real-time data from a new energy power station; preprocessing the real-time data to convert it into data points required for plotting; determining the rendering time and rendering content; drawing static and dynamic portions on an off-screen Canvas according to the data points, rendering time, and rendering content; and compositing the content of the off-screen buffer layer with the main view to obtain a curve chart. The preprocessing of the real-time data includes parsing, filtering, and normalizing the real-time data. The method further includes: acquiring the GraphicsContext API of JavaFX Canvas, which is used to execute drawing commands; executing the GraphicsContext API to draw static and dynamic portions on an off-screen Canvas according to the data points, rendering time, and rendering content; and displaying the curve chart on a user interface. Specifically, the computer-readable storage medium includes, but is not limited to, volatile memory and / or non-volatile memory. The volatile memory may include random access memory (RAM) and / or cache memory, etc. The non-volatile memory may include read-only memory (ROM), hard disk, flash memory, optical disk, magnetic disk, etc.

[0091] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied 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.

[0092] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0093] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0094] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0095] Other embodiments of the invention will readily occur to those skilled in the art upon consideration of the specification and disclosure of the invention. This application is intended to cover any variations, uses, or adaptations of the invention that follow the general principles of the invention and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of the invention are indicated by the following claims.

[0096] It should be understood that the present invention is not limited to the precise structure described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of the invention is limited only by the appended claims.

[0097] The above description is merely a preferred embodiment of the present invention and does not constitute any limitation on the present invention. Any simple modifications, alterations, or equivalent structural changes made to the above embodiments based on the technical essence of the present invention shall still fall within the protection scope of the present invention.

Claims

1. A method for implementing line charts based on JavaFX Canvas, characterized in that, include: Acquire real-time data from new energy power plants; The real-time data is preprocessed and converted into data points required for plotting. Determine the rendering time and the content to be rendered; Based on the data points required for drawing, the rendering time, and the rendering content, draw the static and dynamic parts on the off-screen Canvas; The content of the off-screen buffer layer is composited with the main view to obtain a curve chart.

2. The method for implementing curve charts based on JavaFX Canvas according to claim 1, characterized in that, The process of preprocessing real-time data is as follows: real-time data is parsed, filtered, and normalized.

3. The method for implementing curve charts based on JavaFX Canvas according to claim 1, characterized in that, Also includes: Obtain the JavaFX Canvas's GraphicsContext API, which is used to execute drawing commands; The GraphicsContext API is executed to draw the static and dynamic parts on the off-screen Canvas based on the data points, rendering time, and rendering content required for the drawing.

4. The method for implementing curve charts based on JavaFX Canvas according to claim 1, characterized in that, Also includes: The graph is displayed on the user interface.

5. A system for implementing curve charts based on JavaFX Canvas, characterized in that, include: The acquisition module is used to acquire real-time data from new energy power plants; The preprocessing module is used to preprocess the real-time data and convert the preprocessed real-time data into data points required for plotting. The determination module is used to determine the rendering time and the content to be rendered; The drawing module is used to draw static and dynamic parts on the off-screen Canvas according to the data points, rendering time and rendering content required for the drawing; The compositing module is used to composite the content of the off-screen buffer layer with the main view to obtain a curve chart.

6. The system for implementing curve charts based on JavaFX Canvas according to claim 5, characterized in that, The process of preprocessing real-time data is as follows: real-time data is parsed, filtered, and normalized.

7. The system for implementing curve charts based on JavaFX Canvas according to claim 5, characterized in that, Also includes: Obtain the JavaFX Canvas's GraphicsContext API, which is used to execute drawing commands; The GraphicsContext API is executed to draw the static and dynamic parts on the off-screen Canvas based on the data points, rendering time, and rendering content required for the drawing.

8. The system for implementing curve charts based on JavaFX Canvas according to claim 5, characterized in that, Also includes: The graph is displayed on the user interface.

9. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the steps of the method for generating and sending trusted status alarm information as described in any one of claims 1-4.

10. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by the processor, it implements the steps of the method for generating and sending trusted status alarm information as described in any one of claims 1-4.