Chart rendering methods, devices, storage media and electronic devices

CN116416357BActive Publication Date: 2026-11-17HAIER YOUJIA INTELLIGENT TECH (BEIJING) CO LTD +2
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202211682083.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-12-26
Publication Date
2026-11-17
Estimated Expiration
2042-12-26

AI Technical Summary

Technical Problem

[0004]本申请提供一种图表渲染方法、装置、存储介质及电子装置,以解决现有的配置项的代码冗余,维护成本较高的问题

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116416357B_ABST
    Figure CN116416357B_ABST
Patent Text Reader

Abstract

This application discloses a chart rendering method, apparatus, storage medium, and electronic device, relating to the field of smart home / intelligent home technology. The method includes: passing parameters of a chart to be processed to a public chart component; the parameters include mandatory parameters and optional parameters; the mandatory parameters include the chart type, and the optional parameters include at least one configuration item among multiple configuration items used for rendering the chart; determining multiple configuration items corresponding to the chart to be processed through the public chart component; the multiple configuration items corresponding to the chart to be processed include: configuration items passed to the public chart component, and / or, default configuration items corresponding to the type; rendering the chart to be processed according to the multiple configuration items corresponding to the chart to be processed, without needing to maintain the code for each configuration item corresponding to the chart, reducing the number of configuration item codes that need to be maintained, reducing maintenance costs, and allowing for custom chart configurations, thus providing greater flexibility.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and more specifically, to a chart rendering method, apparatus, storage medium, and electronic device. Background Technology

[0002] Data visualization refers to the use of graphical means to clearly and effectively convey and communicate information. Appropriate graphics can be selected based on the type and purpose of the data.

[0003] Currently, there are many types of charts used for visualization analysis, such as line charts, bar charts, pie charts, radar charts, and scatter plots. In a large system or application, when multiple types of charts need to be combined to visualize data, a set of configuration items needs to be written for each chart, which results in code redundancy and high maintenance costs. Summary of the Invention

[0004] This application provides a chart rendering method, apparatus, storage medium, and electronic device to solve the problems of code redundancy and high maintenance costs in existing configuration items.

[0005] Firstly, this application provides a chart rendering method, including:

[0006] The parameters of the chart to be processed are passed to the public chart component; the parameters that the public chart component can receive include required parameters and optional parameters; the required parameters include the type of the chart, and the optional parameters include at least one of a plurality of configuration items for rendering the chart;

[0007] The public chart component is used to determine multiple configuration items corresponding to the chart to be processed; wherein, the multiple configuration items corresponding to the chart to be processed include: configuration items passed to the public chart component, and / or, default configuration items corresponding to the type;

[0008] The chart to be processed is rendered according to the multiple configuration items corresponding to the chart to be processed.

[0009] Optionally, multiple configuration items corresponding to the chart to be processed can be determined through the public chart component, including:

[0010] Based on the type of the chart to be processed, determine several default configuration items;

[0011] If the parameters passed to the public chart component do not include non-mandatory parameters, then the multiple configuration items corresponding to the chart to be processed are determined to be the multiple default configuration items;

[0012] If the parameters passed to the public chart component include optional parameters, then the passed parameters are used to replace the corresponding default configuration items to obtain multiple configuration items corresponding to the chart to be processed.

[0013] Optionally, based on the type of the chart to be processed, several default configuration items are determined, including:

[0014] Based on a pre-set configuration file, multiple configuration items corresponding to the type are determined through method parameter passing invocation;

[0015] The configuration file is used to store multiple configuration items corresponding to each type, including legend information, coordinate system grid information, coordinate axis information, and prompt box information.

[0016] Optionally, the optional parameters also include: chart color scheme information; rendering the chart to be processed according to multiple configuration items corresponding to the chart to be processed, including:

[0017] The chart to be processed is rendered according to the multiple configuration items corresponding to the chart to be processed and the chart color information;

[0018] After rendering the chart to be processed, the method further includes:

[0019] Listen to the locally cached theme color through a public chart component; wherein, the theme color is the system or application theme color;

[0020] If the theme color changes, the chart color information is updated, and the chart to be processed is re-rendered according to the updated chart color information.

[0021] Optionally, if the theme color changes, the chart color scheme information is updated, including:

[0022] If the theme color changes, a key-value pair is formed using the current theme color as the key and the type mentioned above as the value.

[0023] Based on a pre-set chart color scheme configuration file, the chart color scheme information that matches the key-value pair is queried through method calls to be used as the updated chart color scheme information;

[0024] The chart color scheme configuration file is used to provide chart color scheme information corresponding to theme colors and types.

[0025] Optionally, the required parameters also include: chart data; rendering the chart to be processed according to multiple configuration items corresponding to the chart to be processed, including:

[0026] Based on the multiple configuration items corresponding to the chart to be processed, the chart data, and the width and height information defined for the chart container, the chart rendering API is called to complete the chart rendering.

[0027] Optional, also includes:

[0028] After the public chart component receives the input parameters, it generates a chart ID based on the input type and the current timestamp;

[0029] Each chart to be processed has a unique chart ID, which is used to render and update the chart to be processed.

[0030] Secondly, this application provides a chart rendering apparatus, the apparatus comprising:

[0031] The input module is used to input the parameters of the chart to be processed into the public chart component; wherein, the parameters that the public chart component can receive include required parameters and optional parameters; the required parameters include the type of the chart, and the optional parameters include at least one of a plurality of configuration items for rendering the chart;

[0032] The determining module is used to determine multiple configuration items corresponding to the chart to be processed through the public chart component; wherein, the multiple configuration items corresponding to the chart to be processed include: configuration items passed to the public chart component, and / or, default configuration items corresponding to the type;

[0033] The rendering module is used to render the chart to be processed according to multiple configuration items corresponding to the chart to be processed.

[0034] Thirdly, this application provides a computer-readable storage medium comprising a stored program, wherein the program, when executed, performs the chart rendering method as described in any of the first aspects.

[0035] Fourthly, this application provides an electronic device including a memory and a processor, wherein the memory stores a computer program and the processor is configured to execute the chart rendering method as described in any of the first aspects through the computer program.

[0036] This invention provides a chart rendering method, apparatus, storage medium, and electronic device. The method includes: passing parameters of a chart to be processed to a public chart component; wherein the parameters that the public chart component can receive include mandatory parameters and optional parameters; the mandatory parameters include the chart type, and the optional parameters include at least one configuration item from a plurality of configuration items for rendering the chart; determining a plurality of configuration items corresponding to the chart to be processed through the public chart component; wherein the plurality of configuration items corresponding to the chart to be processed include: configuration items passed to the public chart component, and / or, default configuration items corresponding to the type; rendering the chart to be processed according to the plurality of configuration items corresponding to the chart to be processed. By receiving the chart type and at least one configuration item through the public chart component, the configuration items corresponding to the chart type are obtained to complete the rendering of the chart. This eliminates the need to maintain code for each configuration item corresponding to a chart, reducing the number of configuration items that need to be maintained and lowering maintenance costs. Furthermore, this method allows for custom chart configurations, providing greater flexibility. Attached Figure Description

[0037] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.

[0038] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0039] Figure 1 This is a schematic diagram illustrating an application scenario of a chart rendering method according to an embodiment of this application;

[0040] Figure 2 This is a flowchart illustrating a chart rendering method according to an embodiment of this application;

[0041] Figure 3 This is a flowchart illustrating another chart rendering method according to an embodiment of this application;

[0042] Figure 4 This is a schematic diagram of the framework of a chart rendering method according to an embodiment of this application;

[0043] Figure 5 This is a schematic diagram of the structure of a chart rendering device according to an embodiment of this application;

[0044] Figure 6 This is a schematic diagram of the structure of an electronic device according to an embodiment of this application. Detailed Implementation

[0045] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort should fall within the scope of protection of the present application.

[0046] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0047] According to one aspect of the embodiments of this application, a chart rendering method is provided. Optionally, in this embodiment, the chart rendering method can be applied to devices such as user terminals or servers, on which a large system or application is installed. A common chart component can be set on the large system or application to implement chart rendering based on the common chart component.

[0048] When multiple charts are displayed on a device, a set of configuration code needs to be maintained for each chart. If there are 10 charts, 10 sets of configuration code need to be maintained, and these charts may contain the same type of charts. This results in a lot of code redundancy and developers have to maintain a large amount of code.

[0049] To address the aforementioned issues, this application provides a common chart component. Figure 1 This is a schematic diagram of an application scenario for a chart rendering method according to an embodiment of this application. The public chart component is set on the system or application. When a chart is displayed on the system or application, parameters can be passed to the public chart component. The public chart component can call the relevant configuration items corresponding to the chart to be processed, thereby obtaining the configuration items required to render the chart to be processed. Only one set of configuration item code needs to be maintained, reducing maintenance costs.

[0050] The following detailed description of some embodiments of this application is provided in conjunction with the accompanying drawings. Where there is no conflict between the embodiments, the following embodiments and features can be combined with each other. Furthermore, the timing of the steps in the following method embodiments is merely an example and not a strict limitation.

[0051] Figure 2 This is a flowchart illustrating a chart rendering method according to an embodiment of this application. The execution entity of the method can be a chart rendering device, which can be implemented through software, hardware, or a combination of both. Figure 2 As shown, the method includes:

[0052] Step S201: Pass the parameters of the chart to be processed into the public chart component.

[0053] The parameters that the public chart component can receive include required parameters and optional parameters; the required parameters include the type of the chart, and the optional parameters include at least one of a plurality of configuration items for rendering the chart.

[0054] The charts to be processed represent the charts displayed on the system or application's page. There can be one or more charts to be processed.

[0055] For a given chart to be processed, the public chart component can receive parameter information for that chart. The passed parameters include the type of chart to be processed, such as line chart, bar chart, pie chart, etc., and this parameter is required.

[0056] The passed parameters can also include one or more other custom configuration items, such as legend information, coordinate system grid information, coordinate axis information, tooltip information, and chart color scheme information. Configuration items indicate the style of the chart to be processed, such as the style and position of the legend, and the scale information of the coordinate axes.

[0057] Step S202: Determine multiple configuration items corresponding to the chart to be processed through the public chart component.

[0058] The configuration items corresponding to the chart to be processed include: configuration items for passing in the public chart component, and / or, default configuration items corresponding to the type.

[0059] After parameters are passed to the public chart component, multiple configuration items corresponding to the chart to be processed can be determined based on the public chart component. The public chart component can obtain the corresponding default configuration items based on the type of chart to be processed. These default configuration items are pre-extracted from common configuration items of similar chart types based on their shared characteristics. For example, line charts and bar charts are similar charts, and their configuration items are also quite similar; bubble charts and scatter plots also have similar configuration items. When a configuration item needs to be modified, it can be modified only once by modifying the extracted configuration item, without needing to modify it multiple times.

[0060] The specified configuration items may include: configuration items passed to the public component and the default configuration items corresponding to this type; or configuration items passed to the public chart component; or the default configuration items corresponding to this chart type.

[0061] Step S203: Render the chart to be processed according to the multiple configuration items corresponding to the chart to be processed.

[0062] Once the configuration items corresponding to the chart to be processed are determined, the chart to be processed can be rendered based on those configuration items.

[0063] Without extracting configuration items, a separate set of configuration item code needs to be maintained for each chart to be processed, resulting in redundant and voluminous code. Furthermore, modifying a configuration item requires multiple modifications, leading to high maintenance costs. By encapsulating a common chart component and extracting configuration items, only one set of configuration item code needs to be maintained, making the code concise, easy to maintain, and reducing maintenance costs. In addition, this method allows for input of optional parameters, enabling customized chart configurations and providing greater flexibility.

[0064] The chart rendering method provided in this application embodiment involves passing parameters of the chart to be processed to a public chart component. The public chart component can receive parameters including required parameters and optional parameters. The required parameters include the chart type, and the optional parameters include at least one configuration item from a plurality of configuration items used for rendering the chart. The public chart component determines the plurality of configuration items corresponding to the chart to be processed. These configuration items include configuration items passed to the public chart component and / or default configuration items corresponding to the type. The chart to be processed is rendered based on these configuration items. By receiving the chart type and at least one configuration item through the public chart component, the configuration items corresponding to that type of chart are obtained to complete the rendering of the chart. This eliminates the need to maintain code for each configuration item corresponding to a chart, reducing the number of configuration items that need to be maintained and lowering maintenance costs. Furthermore, this method allows for custom chart configurations, providing greater flexibility.

[0065] Optionally, multiple configuration items corresponding to the chart to be processed can be determined through the public chart component, including:

[0066] Based on the type of the chart to be processed, determine several default configuration items;

[0067] If the parameters passed to the public chart component do not include non-mandatory parameters, then the multiple configuration items corresponding to the chart to be processed are determined to be the multiple default configuration items;

[0068] If the parameters passed to the public chart component include optional parameters, then the passed parameters are used to replace the corresponding default configuration items to obtain multiple configuration items corresponding to the chart to be processed.

[0069] Different chart types may have different default configuration options. The appropriate default configuration options can be determined based on the type of chart to be processed.

[0070] After determining the default configuration items, multiple configuration items corresponding to the chart to be processed can be determined based on the default configuration items and the parameters passed to the public chart component. When the passed parameters do not include optional parameters, the corresponding default configuration items can be determined as multiple configuration items for the chart to be processed. When the passed parameters include required parameters, it means that the corresponding default configuration items can be omitted, and the chart can be customized.

[0071] For example, when a user wants to customize a certain configuration item of a chart, they can pass that configuration item to the public chart component.

[0072] For a given chart to be processed, the configuration options for the chart can be flexibly set by passing optional parameters to the public chart component.

[0073] Optionally, based on the type of the chart to be processed, several default configuration items are determined, including:

[0074] Based on a pre-set configuration file, multiple configuration items corresponding to the type are determined through method parameter passing invocation;

[0075] The configuration file is used to store multiple configuration items corresponding to each type, including legend information, coordinate system grid information, coordinate axis information, and prompt box information.

[0076] The pre-configured configuration file stores the configuration items corresponding to each chart type. When the public chart component receives the chart type parameter, it can retrieve the corresponding configuration items from the configuration file by passing parameters to a method. For example, if the type is a parameter and the passed chart type is a line chart, the public chart component can determine several default configuration items based on this line chart parameter.

[0077] The configuration items can include legend information, coordinate system grid information, coordinate axis information, and tooltip information.

[0078] By saving configuration items for different types of charts in the configuration file, public chart components can easily obtain the configuration items for the corresponding chart types.

[0079] Figure 3 This is a flowchart illustrating another chart rendering method according to an embodiment of this application, such as... Figure 3 As shown, the chart to be processed is rendered according to multiple configuration items corresponding to the chart to be processed, including:

[0080] Step S301: Render the chart to be processed according to the multiple configuration items corresponding to the chart to be processed and the chart color information;

[0081] After rendering the chart to be processed, the method further includes:

[0082] Step S302: Listen for the locally cached theme color using the public chart component. The theme color refers to the system or application's theme color.

[0083] Step S303: If the theme color changes, update the chart color information and re-render the chart to be processed according to the updated chart color information.

[0084] To ensure a visually appealing chart, you can also set a color scheme. The color scheme is determined based on the chart's color information. This color scheme is optional; it's included in the default configuration. When rendering a chart, the rendering process is based on its legend, coordinate grid, axes, tooltips, and color scheme.

[0085] Normally, once a chart is generated, its color scheme remains unchanged. However, when displaying a chart within a system or application, if the system or application's theme color changes, it's desirable for the chart's color scheme to change accordingly for a better visual effect.

[0086] To achieve the above objectives, a public chart component monitors the theme color in the local cache. When the theme color changes, the chart's color scheme is updated, and the chart to be processed is rendered again based on the updated color scheme. Here, the theme color refers to the system or application's theme color. To facilitate the public chart component's monitoring of theme colors, the system or application's theme color can be obtained and stored in the local cache.

[0087] By listening to the theme color through public chart components, it is easy to obtain the chart color scheme information that matches it, so that the series of chart colors can change with the theme color.

[0088] Optionally, if the theme color changes, the chart color scheme information is updated, including:

[0089] If the theme color changes, a key-value pair is formed using the current theme color as the key and the type as the value. Based on the pre-set chart color configuration file, the chart color information that matches the key-value pair is queried through method calls to be used as the updated chart color information.

[0090] The chart color scheme configuration file is used to provide chart color scheme information corresponding to theme colors and types.

[0091] When updating chart color scheme information, this can be achieved by querying the chart color scheme configuration file using key-value pairs. The configuration file stores methods for determining chart color scheme information corresponding to different keys. Each method can contain color scheme information for different chart types. For example, theme colors can include color 1 and color 2. The chart color scheme configuration file stores method 1 and method 2, which are methods for determining chart color scheme information corresponding to color 1 and color 2, respectively. Both method 1 and method 2 contain color scheme information for different chart types such as bar charts, line charts, and pie charts.

[0092] In the above method for determining chart color information, it can be represented in the form of key-value pairs, with the theme color as the key, the chart type as the value, and the corresponding chart color information stored.

[0093] When querying chart color information, the corresponding method for determining chart color information is called based on the theme color, and then the chart color information corresponding to the theme color is determined based on the type.

[0094] By querying the chart color scheme configuration file using key-value pairs, you can accurately and quickly determine the chart color scheme information that corresponds to the theme color and chart type.

[0095] Optionally, the required parameters also include: chart data; rendering the chart to be processed according to multiple configuration items corresponding to the chart to be processed, including:

[0096] Based on the multiple configuration items corresponding to the chart to be processed, the chart data, and the width and height information defined for the chart container, the chart rendering API is called to complete the chart rendering.

[0097] When rendering the chart to be processed, chart data also needs to be passed to the public chart component. In addition, the chart width and height information can be set. Based on multiple configuration items of the chart to be processed, the chart data, and the width and height information, the final chart can be obtained. Chart rendering can be completed by calling the chart rendering API (Application Programming Interface).

[0098] The width and height of a chart can be a default value, a value entered by the user according to actual needs, or it can be automatically determined based on how the chart is displayed in the application or system.

[0099] Optional, also includes:

[0100] After the public chart component receives the input parameters, it generates a chart ID based on the input type and the current timestamp. Each chart to be processed has a unique chart ID, which is used to render and update the chart to be processed.

[0101] When rendering multiple charts to be processed, a chart ID can be set for each chart to achieve accurate rendering of multiple charts.

[0102] When multiple charts need to be set in the system, a chart ID can be generated for each chart to be processed when parameters are passed to the public chart component. This allows different charts to be rendered when rendering and updating them.

[0103] Determining a chart ID based on its type and timestamp ensures the uniqueness of that chart ID.

[0104] The public chart component automatically generates a chart ID when receiving parameters, eliminating the need for developers to input the chart ID and improving the developer experience.

[0105] Figure 4 This is a schematic diagram of the framework of a chart rendering method according to an embodiment of this application, such as... Figure 4 As shown, in the digital operations platform, for chart visualization, a public chart component and chart configuration file are set up. Chart types can be passed to the public chart component, and based on the chart type, the default configuration items for each chart type can be retrieved from the chart configuration file to complete the chart rendering. To ensure that the chart color information changes with the theme color of the digital operations platform, the public chart component listens for changes in the cached theme color. Based on the chart color configuration file, the changed chart color information is determined, and the chart is re-rendered, thus achieving chart color changes in accordance with the theme color.

[0106] Corresponding to the above method, this application also provides a chart rendering device. Figure 5 This is a schematic diagram of the structure of a chart rendering device according to an embodiment of this application; as shown below. Figure 5 As shown, the device includes:

[0107] The input module 501 is used to input the parameters of the chart to be processed into the public chart component; wherein, the parameters that the public chart component can receive include required parameters and optional parameters; the required parameters include the type of the chart, and the optional parameters include at least one of a plurality of configuration items for rendering the chart;

[0108] The determining module 502 is used to determine multiple configuration items corresponding to the chart to be processed through the public chart component; wherein, the multiple configuration items corresponding to the chart to be processed include: configuration items passed to the public chart component, and / or, default configuration items corresponding to the type;

[0109] The rendering module 503 is used to render the chart to be processed according to multiple configuration items corresponding to the chart to be processed.

[0110] Optionally, when determining multiple configuration items corresponding to the chart to be processed through the public chart component, the determining module 502 is specifically used for:

[0111] Based on the type of the chart to be processed, determine several default configuration items;

[0112] If the parameters passed to the public chart component do not include non-mandatory parameters, then the multiple configuration items corresponding to the chart to be processed are determined to be the multiple default configuration items;

[0113] If the parameters passed to the public chart component include optional parameters, then the passed parameters are used to replace the corresponding default configuration items to obtain multiple configuration items corresponding to the chart to be processed.

[0114] Optionally, when determining multiple default configuration items based on the type of the chart to be processed, the determining module 502 is specifically used for:

[0115] Based on a pre-set configuration file, multiple configuration items corresponding to the type are determined through method parameter passing invocation;

[0116] The configuration file is used to store multiple configuration items corresponding to each type, including legend information, coordinate system grid information, coordinate axis information, and prompt box information.

[0117] Optionally, the optional parameters also include: chart color scheme information; based on the multiple configuration items corresponding to the chart to be processed, the rendering module 503, when rendering the chart to be processed, specifically performs the following:

[0118] The chart to be processed is rendered according to the multiple configuration items corresponding to the chart to be processed and the chart color information;

[0119] The device further includes: a monitoring module and an update module;

[0120] The listening module is specifically used to: after rendering the chart to be processed, listen to the locally cached theme color through the public chart component; wherein, the theme color is the theme color of the system or application;

[0121] The update module is specifically used to: update the chart color information if the theme color changes, and re-render the chart to be processed according to the updated chart color information.

[0122] Optionally, the update module is specifically used for:

[0123] If the theme color changes, a key-value pair is formed using the current theme color as the key and the type mentioned above as the value.

[0124] Based on a pre-set chart color scheme configuration file, the chart color scheme information that matches the key-value pair is queried through method calls to be used as the updated chart color scheme information;

[0125] The chart color scheme configuration file is used to provide optional chart color scheme information corresponding to theme colors and types. The required parameters also include: chart data; the rendering module 503 is specifically used for:

[0126] Based on the multiple configuration items corresponding to the chart to be processed, the chart data, and the width and height information defined for the chart container, the chart rendering API is called to complete the chart rendering.

[0127] Optionally, the apparatus further includes: a generation module, specifically used for:

[0128] After the public chart component receives the input parameters, it generates a chart ID based on the input type and the current timestamp;

[0129] Each chart to be processed has a unique chart ID, which is used to render and update the chart to be processed.

[0130] The specific implementation principle and technical effects of the device provided in this application embodiment can be found in the foregoing embodiments, and will not be repeated here.

[0131] Figure 6 This is a schematic diagram of the structure of an electronic device according to an embodiment of this application. Figure 6 As shown, the electronic device in this embodiment may include:

[0132] A memory 601 and a processor 602, wherein the memory 601 stores a computer program and the processor 602 is configured to execute the method as described in any of the above embodiments through the computer program.

[0133] Alternatively, the memory 601 can be either standalone or integrated with the processor 602.

[0134] The implementation principle and technical effects of the electronic device provided in this embodiment can be found in the foregoing embodiments, and will not be repeated here.

[0135] This application also provides a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, implement the method described in any of the foregoing embodiments.

[0136] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the methods described in any of the foregoing embodiments.

[0137] In the several embodiments provided in this application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For instance, the division of modules is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple modules may be combined or integrated into another system, or some features may be ignored or not executed.

[0138] This method is widely used in whole-house intelligent digital control application scenarios such as smart homes, smart home ecosystems, and smart housing ecosystems. The aforementioned networks can include, but are not limited to, at least one of the following: wired networks and wireless networks. The aforementioned wired networks can include, but are not limited to, at least one of the following: wide area networks (WANs), metropolitan area networks (MANs), and local area networks (LANs). The aforementioned wireless networks can include, but are not limited to, at least one of the following: Wi-Fi (Wireless Fidelity) and Bluetooth. Terminal devices are not limited to PCs, mobile phones, tablets, smart air conditioners, smart range hoods, smart refrigerators, smart ovens, smart stoves, smart washing machines, smart water heaters, smart washing equipment, smart dishwashers, smart projectors, smart TVs, smart clothes racks, smart curtains, smart audio-visual equipment, smart sockets, smart speakers, smart speakers, smart fresh air systems, smart kitchen and bathroom equipment, smart bathroom fixtures, smart robot vacuums, smart window cleaning robots, smart mopping robots, smart air purifiers, smart steam ovens, smart microwave ovens, smart water heaters, smart air purifiers, smart water dispensers, and smart door locks.

[0139] The integrated modules implemented as software functional modules described above can be stored in a computer-readable storage medium. These software functional modules, stored in a storage medium, include several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) or processor to execute some steps of the methods described in the various embodiments of this application.

[0140] It should be understood that the aforementioned processor can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), etc. A general-purpose processor can be a microprocessor or any conventional processor. The steps of the method disclosed in the application can be directly manifested as being executed by a hardware processor, or executed by a combination of hardware and software modules within the processor. The memory may include high-speed RAM, and may also include non-volatile memory (NVM), such as at least one disk storage device, and may also be a USB flash drive, external hard drive, read-only memory, disk, or optical disc, etc.

[0141] The aforementioned storage medium can be implemented from any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk. The storage medium can be any available medium accessible to general-purpose or special-purpose computers.

[0142] An exemplary storage medium is coupled to a processor, enabling the processor to read information from and write information to the storage medium. Alternatively, the storage medium can be an integral part of the processor. Both the processor and the storage medium can reside in an Application Specific Integrated Circuit (ASIC). Alternatively, the processor and storage medium can exist as discrete components in an electronic device or host device.

[0143] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.

[0144] The sequence numbers of the embodiments in this application are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.

[0145] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in the various embodiments of this application.

[0146] The above description is only a preferred embodiment of this application. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of this application, and these improvements and modifications should also be considered within the scope of protection of this application.

Claims

1. A chart rendering method, characterized in that, include: The parameters of the chart to be processed are passed to the public chart component; the parameters that the public chart component can receive include required parameters and optional parameters; the required parameters include the type of the chart, and the optional parameters include at least one of a plurality of configuration items for rendering the chart; the optional parameters also include: chart color information; The public chart component is used to determine multiple configuration items corresponding to the chart to be processed; wherein, the multiple configuration items corresponding to the chart to be processed include: configuration items passed to the public chart component, and / or, default configuration items corresponding to the type; The chart to be processed is rendered according to the multiple configuration items corresponding to the chart to be processed and the chart color information; Listen to the locally cached theme color through a public chart component; wherein, the theme color is the system or application theme color; If the theme color changes, a key-value pair is formed using the current theme color as the key and the type mentioned above as the value. Based on a pre-set chart color scheme configuration file, the chart color scheme information that matches the key-value pair is queried through method calls to be used as the updated chart color scheme information, and the chart to be processed is re-rendered according to the updated chart color scheme information. The chart color scheme configuration file is used to provide chart color scheme information corresponding to theme colors and types.

2. The chart rendering method according to claim 1, characterized in that, The public chart component is used to determine multiple configuration items corresponding to the chart to be processed, including: Based on the type of the chart to be processed, determine several default configuration items; If the parameters passed to the public chart component do not include non-mandatory parameters, then the multiple configuration items corresponding to the chart to be processed are determined to be the multiple default configuration items; If the parameters passed to the public chart component include optional parameters, then the passed parameters are used to replace the corresponding default configuration items to obtain multiple configuration items corresponding to the chart to be processed.

3. The chart rendering method according to claim 2, characterized in that, Based on the type of the chart to be processed, several default configuration items are determined, including: Based on a pre-set configuration file, multiple configuration items corresponding to the type are determined through method parameter passing invocation; The configuration file is used to store multiple configuration items corresponding to each type, including legend information, coordinate system grid information, coordinate axis information, and prompt box information.

4. The chart rendering method according to any one of claims 1-3, characterized in that, The required parameters also include: chart data; rendering the chart to be processed according to multiple configuration items corresponding to the chart to be processed, including: Based on the multiple configuration items corresponding to the chart to be processed, the chart data, and the width and height information defined for the chart container, the chart rendering API is called to complete the chart rendering.

5. The chart rendering method according to any one of claims 1-3, characterized in that, Also includes: After the public chart component receives the input parameters, it generates a chart ID based on the input type and the current timestamp; Each chart to be processed has a unique chart ID, which is used to render and update the chart to be processed.

6. A chart rendering device, characterized in that, The device includes: The input module is used to input the parameters of the chart to be processed into the public chart component; wherein, the parameters that the public chart component can receive include required parameters and optional parameters; the required parameters include the type of the chart, and the optional parameters include at least one of a plurality of configuration items for rendering the chart; the optional parameters also include: chart color information; The determining module is used to determine multiple configuration items corresponding to the chart to be processed through the public chart component; wherein, the multiple configuration items corresponding to the chart to be processed include: configuration items passed to the public chart component, and / or, default configuration items corresponding to the type; The rendering module is used to render the chart to be processed according to multiple configuration items corresponding to the chart and the chart color information; The device further includes: a monitoring module and an update module; The listening module is specifically used to listen to the locally cached theme color through a public chart component after the chart to be processed is rendered; wherein, the theme color is the theme color of the system or application. The update module is specifically used to form a key-value pair with the current theme color as the key and the type as the value if the theme color changes; based on a pre-set chart color configuration file, it queries the chart color information that matches the key-value pair through a method call to obtain the updated chart color information, and re-renders the chart to be processed according to the updated chart color information; wherein, the chart color configuration file is used to provide chart color information corresponding to the theme color and type.

7. A computer-readable storage medium, characterized in that, The computer-readable storage medium includes a stored program, wherein the program, when executed, performs the chart rendering method according to any one of claims 1 to 5.

8. An electronic device comprising a memory and a processor, characterized in that, The memory stores a computer program, and the processor is configured to execute the chart rendering method of any one of claims 1 to 5 through the computer program.

Citation Information

Patent Citations

  • Chart processing method and device

    CN114692044A