Configuration storing and loading method during running of DevExpress chart component
By designing the chart component configuration record table and inheriting classes ChartControl_Ex and XtraChart_Desinger_Ex, the problem that the DevExpress chart component ChartControl can only be configured during development is solved, and the runtime configuration saving and loading is realized, which improves the efficiency of the user system.
Patent Information
- Application Number
- CN202510497475.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-21
- Publication Date
- 2025-08-01
AI Technical Summary
The DevExpress chart component ChartControl can only be configured when the developer's code is designed, and cannot configure properties and save them to the database when it is released, resulting in users needing to repeatedly configure charts when using the system, which is inefficient.
Design the chart component configuration record table Sys_Control_Config, create inherited classes ChartControl_Ex and XtraChart_Desinger_Ex, store and load chart configurations through unique ID Control_ID, and use XML documents to realize the saving and loading of the chart component ChartControl runtime.
It realizes the configuration saving and loading of the DevExpress chart component ChartControl at runtime, reducing the repeated configuration work of users and improving work efficiency, and is suitable for multi-user desktop client systems.
Smart Images

Figure CN120407007A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of computer software chart configuration, and particularly relates to a method for saving and loading the runtime configuration of a DevExpress chart component. Background Art
[0002] The safety monitoring of hydropower projects is an important link to ensure the safe operation of hydropower projects. Through a series of monitoring measures, the structure, equipment and operating status of hydropower projects are continuously observed and evaluated to ensure the safety and stability of the projects. The safety monitoring charts of hydropower projects display the operating status of hydropower stations in an intuitive graphical manner, including key parameters such as water flow and water pressure, so as to conduct real-time monitoring and analysis. In a hydropower project safety monitoring system (an online monitoring system applied to water conservancy and hydropower projects such as hydropower stations, which can monitor the operating status of water conservancy and hydropower projects such as dams and reservoirs in real time, such as water level, temperature, displacement, seepage, etc., and can give an alarm in time or send information to relevant personnel so as to take corresponding measures), a part uses the ChartControl component of DevExpress (Developer Express, a well-known interface control suite that provides a series of DotNet interface controls for interface control suites) to draw monitoring charts. There is a problem that the chart visualization configuration (chart layout and attribute configuration) function is only available during the developer's code design. Therefore, after the hydropower project safety monitoring system is released, the functional requirement for users to reconfigure the charts during system runtime and make it immediately effective on all clients is more urgent. Summary of the Invention
[0003] The purpose of the present invention is to provide a method for saving and loading the runtime configuration of a DevExpress chart component. The configurations of each chart are uniformly stored in a record table of a database. After the configuration is saved by clicking the save button after the chart designer pops up by right-clicking the mouse on one client, other clients will also obtain the same configuration from the database for loading and drawing the chart when loading the same chart, which can reduce the repetitive configuration work of charts when users use the system and improve work efficiency.
[0004] The technical solution adopted by the present invention is a method for saving and loading the runtime configuration of a DevExpress chart component, including the following steps:
[0005] S1, design a chart component configuration record table Sys_Control_Config in the database used by the hydropower project safety monitoring system to store the configurations of the ChartControl component of the DevExpress software;
[0006] S2, create a subclass ChartControl_Ex of the chart component ChartControl that inherits from it. In the subclass ChartControl_Ex of the chart component, extend the unique ID Control_ID property of the new chart component to store the unique ID Control_ID of the new chart component.
[0007] S3, create a subclass XtraChart_Desinger_Ex of the chart designer XtraChart_Desinger that inherits from it, perform the layout and property configuration of the chart, and after the configuration is completed, store the XML document of the layout and property configuration of the chart in binary form in the chart component configuration record table Sys_Control_Config to achieve the saving of the runtime configuration of the chart component ChartControl.
[0008] S4, when the chart is initialized and displayed by the user interface, search for the corresponding configuration record in the chart component configuration record table Sys_Control_Config through the unique ID Control_ID of the chart component. After finding the configuration record, override the OnLoad method in the chart component ChartControl_Ex to achieve the loading of the runtime configuration of the chart component ChartControl.
[0009] Further, in S1, the chart component configuration record table Sys_Control_Config includes fields such as the primary key ID, the unique ID Control_ID of the chart component, the chart component configuration Control_Config, and the component type ControlType.
[0010] Further, in S3, call the SaveToFile method of the chart component ChartControl_Ex to store the XML document of the layout and property configuration of the chart in binary form in the chart component configuration record table Sys_Control_Config.
[0011] Further, in step S4, rewrite the OnLoad method in the chart component ChartControl_Ex. This method represents the action triggered when the chart component ChartControl_Ex is loaded by the operation interface. This action mainly passes in the Control_ID parameter to query the configuration record in the chart component configuration record table Sys_Control_Config through the database interface. After finding the configuration record, call the LoadFromStream method of the chart component ChartControl_Ex to load the byte stream of the corresponding configuration field and redraw the chart, thereby realizing the loading of the runtime configuration of the chart component ChartControl.
[0012] The beneficial effects of the present invention are as follows:
[0013] The present invention solves the problem that the chart component ChartControl of the original DevExpress software can only be configured during the developer's code design, and cannot configure properties and save them to the database during runtime after release. It provides an idea and implementation method for the multi-user desktop client system using the chart component ChartControl of the DevExpress software to save and load chart configurations during runtime, which can reduce the repetitive chart configuration work when users use the system, improve work efficiency, bring certain economic benefits, and has broad application prospects and promotion value. Description of the Drawings
[0014] Figure 1 It is a flowchart of the steps of the method for saving and loading the runtime configuration of the DevExpress chart component of the present invention. Detailed Embodiments
[0015] In order to make the objectives, technical solutions, and advantages of the present invention clearer and more understandable, the technical solutions of the present invention will be further described in detail below with reference to the drawings.
[0016] A method for saving and loading the runtime configuration of a DevExpress chart component, as Figure 1 shown, includes the following steps:
[0017] S1, design a chart component configuration record table Sys_Control_Config in the database used by the hydropower project safety monitoring system to store the configuration of the chart component ChartControl of the DevExpress software.
[0018] The chart component configuration record table Sys_Control_Config contains fields such as the primary key ID, the unique ID of the chart component Control_ID, the chart component configuration Control_Config, and the component type ControlType.
[0019] S2, create a subclass ChartControl_Ex of the chart component ChartControl that inherits from it, and in the subclass ChartControl_Ex of the chart component, extend the unique ID Control_ID attribute of the new chart component to store the unique ID Control_ID of the new chart component.
[0020] S3, create a subclass XtraChart_Desinger_Ex of the chart designer XtraChart_Desinger that inherits from it, perform the layout and property configuration of the chart, and after the configuration is completed, store the XML document of the chart layout and property configuration in binary form into the chart component configuration record table Sys_Control_Config to achieve the saving of the runtime configuration of the chart component ChartControl.
[0021] Call the SaveToFile method of the chart component ChartControl_Ex to store the XML document of the chart layout and property configuration in binary form into the chart component configuration record table Sys_Control_Config.
[0022] In a specific embodiment, extend a "Customize" button on the right-click of the chart component ChartControl. This button is bound to a click event. When clicked, a chart designer XtraChart_Desinger_Ex (the chart designer XtraChart_Desinger_Ex inherits from the chart designer XtraChart_Desinger class) is popped up. Extend a text display box and a "Save to Server" button at the bottom of this designer. The text box displays the unique ID Control_ID attribute of the chart component. The click event of the "Save to Server" button realizes storing the XML document of the chart layout and property configuration in binary form into the chart component configuration record table Sys_Control_Config, so as to achieve the saving of the runtime configuration of the chart component ChartControl.
[0023] S4. When the chart is initially displayed by the user interface, find the corresponding configuration record in the chart component configuration record table Sys_Control_Config through the unique ID Control_ID of the chart component. After finding the configuration record, rewrite the OnLoad method in the chart component ChartControl_Ex to implement the loading of the runtime configuration of the chart component ChartControl.
[0024] Rewrite the OnLoad method in the chart component ChartControl_Ex. This method represents the action triggered when the chart component ChartControl_Ex is loaded by the operation interface. This action mainly passes in the Control_ID parameter to find the configuration record in the chart component configuration record table Sys_Control_Config through the database interface. After finding the configuration record, call the LoadFromStream method of the chart component ChartControl_Ex to load the byte stream of the corresponding configuration field and redraw the chart, thus implementing the loading of the runtime configuration of the chart component ChartControl.
[0025] Since the configurations of each chart are uniformly stored in a record table of a database, after the configuration is saved on one client, other clients will also take effect and load the same configuration.
[0026] Through the above technical solution, the configurations of each chart are uniformly stored in a record table of a database. Right-click on the chart component on the client to pop up the chart designer, perform the corresponding property configuration, and then click the save button to save the configuration. When other clients load the same chart, they will also obtain the same configuration from the database for loading and chart drawing, thus implementing the save and load functions of the runtime configuration of the chart component ChartControl of the DevExpress software.
[0027] The content not described in detail in this specification belongs to the well-known prior art to those skilled in the art.
Claims
1. A method for saving and loading based on runtime configuration of DevExpress chart components, characterized in that, The steps are as follows: S1. Design a chart component configuration record table Sys_Control_Config in the database used by the hydropower project safety monitoring system to store the configuration of the chart component ChartControl of DevExpress software; S2. Create a subclass ChartControl_Ex of the chart component ChartControl that inherits from the chart component ChartControl, and extend the unique ID Control_ID attribute of the new chart component in the subclass ChartControl_Ex of the chart component ChartControl to store the unique ID Control_ID of the new chart component; S3. Create a subclass XtraChart_Desinger_Ex of the chart designer XtraChart_Desinger that inherits from the chart designer XtraChart_Desinger, perform the layout and property configuration of the chart, and after the configuration is completed, store the XML document of the layout and property configuration of the chart in binary form in the chart component configuration record table Sys_Control_Config to implement the saving of the runtime configuration of the chart component ChartControl; S4. When the chart is initialized and displayed by the user interface, find the corresponding configuration record in the chart component configuration record table Sys_Control_Config through the unique ID Control_ID of the chart component. After finding the configuration record, override the OnLoad method in the chart component ChartControl_Ex to implement the loading of the runtime configuration of the chart component ChartControl.
2. The method for saving and loading the runtime configuration of the DevExpress chart component according to claim 1, characterized in that, In S1, the chart component configuration record table Sys_Control_Config includes the primary key ID, the unique ID Control_ID of the chart component, the chart component configuration Control_Config, and the component type ControlType fields.
3. The method for saving and loading the runtime configuration of the DevExpress chart component according to claim 1, characterized in that, In S3, call the SaveToFile method of the chart component ChartControl_Ex to store the XML document of the layout and property configuration of the chart in binary form in the chart component configuration record table Sys_Control_Config.
4. The saving and loading method based on the runtime configuration of the DevExpress chart component according to claim 1, wherein, In S4, override the OnLoad method in the chart component ChartControl_Ex. This method represents the action triggered when the chart component ChartControl_Ex is loaded by the operation interface. This action mainly passes in the Control_ID parameter to find the configuration record in the chart component configuration record table Sys_Control_Config through the database interface. After finding the configuration record, call the LoadFromStream method of the chart component ChartControl_Ex to load the byte stream of the corresponding configuration field and redraw the chart, so as to implement the loading of the runtime configuration of the chart component ChartControl.