Event processing method and device based on Echarts
By establishing an index data structure in Echarts and determining the target data type and data points, the event processing method is optimized, and the response delay and event processing chaos in Echarts when processing a large number of data points is solved, achieving efficient chart interaction and user experience improvement.
Patent Information
- Application Number
- CN202411880019.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-19
- Publication Date
- 2025-04-15
- Estimated Expiration
- 2044-12-19
AI Technical Summary
When Echarts processes charts with a large number of data points, click events may be misjudged, with high response delays, which affects the user experience. Under the complex chart layout, the logic of event propagation and processing is not optimized enough, resulting in confusion and inconsistency in event processing.
An Echarts-based event processing method is provided. By establishing an indexed data structure, including each data type identification, region coordinate information and data point information, receiving event triggering instructions, determining the target data type and data point, and responding to events based on the target data point.
The event propagation path is optimized, unnecessary redraw operations are reduced, chart interaction is smooth, and users' efficiency and satisfaction in data exploration and analysis are improved.
Smart Images

Figure CN119828936A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of data visualization technology, and in particular to an event processing method and device based on Echarts. Background Art
[0002] Echarts is a JavaScript library widely used for data visualization, designed to help users display complex data through intuitive charts. It not only supports various types of charts, but also has powerful interactive performance, suitable for visualization needs of Web and mobile devices. It supports a variety of basic charts, such as line charts, bar charts, pie charts, scatter charts, radar charts, etc. It also supports dynamic and composite charts, such as funnel charts, relationship charts, candlestick charts, etc. It can also handle large amounts of data. By using Canvas rendering technology, it ensures efficient graphics drawing and updating, and has functions such as virtual scrolling and data slicing, which improves the performance in large data scenarios, and provides certain interactive functions, such as mouse click, suspension, zoom and other event responses.
[0003] However, with the increase of data volume and the complexity of charts, the original event processing algorithm of Echarts gradually exposed some problems in performance and response accuracy. For example, when processing charts with a large number of data points, click events may be misjudged, and the response delay is high, affecting the user experience. At the same time, under complex chart layouts, the logic of event propagation and processing is not optimized enough, which may lead to confusion and inconsistency in event processing. Summary of the invention
[0004] The purpose of this application is to solve at least one of the above-mentioned technical deficiencies.
[0005] On the one hand, an embodiment of the present application provides an event processing method based on Echarts, the method comprising:
[0006] Get all data points bound to Echarts and the data types included in all data points;
[0007] Establishing an index data structure for all data points according to the data types included in all data points, the index data structure including each data type identifier, the region coordinate information corresponding to each data type identifier, and the data point information corresponding to each data type identifier;
[0008] Receive an event trigger instruction, and obtain the trigger coordinate information corresponding to the event trigger instruction and the trigger type corresponding to the event trigger instruction;
[0009] Determine the target data type identifier corresponding to the event trigger instruction according to the trigger coordinate information and the area coordinate information corresponding to each data type identifier in the index data structure;
[0010] According to the trigger type, trigger coordinate information and data point information corresponding to the target data type identifier, the target data point corresponding to the event trigger instruction is determined, and the event trigger instruction is responded to according to the target data point to obtain a response display result.
[0011] Optionally, all data points include global data points and local data points, and the index data structure includes a first index data structure and a second index data structure;
[0012] An index data structure is created for all data points according to the data types included in all data points, including:
[0013] Establishing a first index data structure for the global data point according to the first data type included in the global data point, the first index data structure including each first data type identifier, region coordinate information corresponding to each first data type identifier, and data point information corresponding to each first data type identifier;
[0014] A second index data structure is established for the local data points according to the second data type included in the local data points. The second index data structure includes each second data type identifier, the area coordinate information corresponding to each second data type identifier, and the data point information corresponding to each second data type identifier.
[0015] Optionally, determining the target data type identifier corresponding to the event trigger instruction according to the trigger coordinate information and the area coordinate information corresponding to each data type identifier in the index data structure includes:
[0016] According to the trigger coordinate information, the area coordinate information corresponding to each first data type identifier and the area coordinate information corresponding to each second data type identifier, the target data type identifier corresponding to the trigger instruction is determined from each first data type identifier and each second data type identifier.
[0017] Optionally, the data point information includes coordinate information of the data point, and the trigger type is a click trigger type and a suspension trigger type. According to the trigger type, the trigger coordinate information, and the data point information corresponding to the target data type identifier, determining the target data point corresponding to the event trigger instruction includes:
[0018] If the trigger type is a click trigger type, the distance between the event trigger instruction and each data point is determined according to the trigger coordinate information and the coordinate information of the data point corresponding to the target data type identifier, and the data point that meets the distance requirement is used as the target data point corresponding to the event trigger instruction;
[0019] If the trigger type is a floating trigger type, the data points within the set distance range of the event trigger instruction are determined based on the trigger coordinate information and the coordinate information of the data points corresponding to the target data type identifier, and the data points within the set range are used as the target data points corresponding to the event trigger instruction.
[0020] Optionally, the target data point includes an information data point and a rendering data point, and the event triggering instruction is responded to according to the target data point to obtain a response display result, including:
[0021] Determine the data information to be displayed according to the information data point;
[0022] The data information to be displayed is rendered according to the rendering data point to obtain a response display result of the event triggering instruction, and the response display result includes one of displaying data, updating the interface display size and interface translation.
[0023] Optionally, respond to event-triggered instructions based on target data points, including:
[0024] Get the number of target data points;
[0025] According to the number of target data points, determine the number of times to process the target data points and the target data points to be processed each time;
[0026] Respond to event trigger instructions based on the number of target data points and the target data points that need to be processed each time.
[0027] Optionally, the data type includes at least one of an oral and nasal airflow data type, a snoring data type, a respiratory effort data type, a pulse rate, a blood oxygen data type, and a body position data type; the event trigger instruction is one of a waveform zoom in instruction, a waveform zoom out instruction, a new event instruction, a delete event instruction, an event information display instruction, and an event update instruction; the data information includes at least one of obstructive apnea information, central apnea information, mixed apnea information, Cheyne-Stokes breathing information, hypoventilation information, flow limitation information, and respiratory effort-related micro-arousal information.
[0028] Optionally, after responding to the event trigger instruction according to the target data point and obtaining the response display result, it also includes:
[0029] Determine the triggering number corresponding to the event triggering instruction;
[0030] If the triggering times exceed the preset times, the target data points and the response display results will be stored.
[0031] Optionally, the method further includes:
[0032] Determine whether the number of all data points exceeds a quantity threshold;
[0033] If the number of all data points exceeds the quantity threshold, the data downsampling rate function event is executed.
[0034] On the one hand, an embodiment of the present application provides an event processing device based on Echarts, comprising:
[0035] The data acquisition module is used to obtain all data points bound to Echarts and the data types included in all data points;
[0036] An index building module, used to build an index data structure for all data points according to the data types included in all data points, the index data structure including each data type identifier, the area coordinate information corresponding to each data type identifier, and the data point information corresponding to each data type identifier;
[0037] An event receiving module is used to receive an event trigger instruction and obtain the trigger coordinate information and the trigger type corresponding to the event trigger instruction;
[0038] The event response module is used to determine the target data type identifier corresponding to the event trigger instruction based on the trigger coordinate information and the area coordinate information corresponding to each data type identifier in the index data structure; and to determine the target data point corresponding to the event trigger instruction based on the trigger type, trigger coordinate information and the data point information corresponding to the target data type identifier, and respond to the event trigger instruction based on the target data point to obtain a response display result.
[0039] On the other hand, an embodiment of the present application provides an electronic device, including a processor and a memory:
[0040] The memory is configured to store machine-readable instructions, which, when executed by the processor, enable the processor to execute any one of the event processing methods based on Echarts.
[0041] The beneficial effects brought by the technical solution provided by the embodiment of the present application include at least:
[0042] In the embodiment of the present application, the target data type identifier corresponding to the event trigger instruction can be determined based on the index data structure, and then the target data point corresponding to the event trigger instruction is determined according to the trigger type, trigger coordinate information and the data point information corresponding to the target data type identifier, and the event trigger instruction can be responded to only according to the target data point. At this time, it is not necessary to process data other than the target data point, which optimizes the event propagation path and reduces unnecessary redrawing operations, making the chart interaction smooth as silk, and users can easily perform various operations on the chart, thereby improving the efficiency and satisfaction of users in data exploration and analysis.
[0043] In the embodiment of the present application, the number of times to process the target data points can be determined according to the number of target data points, and then the target data points can be processed in batches according to the determined number of times to achieve the response to the event trigger instruction. At this time, for the information update of a large number of data points, batch update is adopted instead of one by one update, thereby reducing the number of times and overhead of redrawing the chart.
[0044] In an embodiment of the present application, the number of all data points bound to Echarts can also be determined, and then the determined number is compared with the set number threshold. If the number of all data points exceeds the number threshold, the data downsampling rate function event is executed to reduce the data sampling rate and improve the performance of the Echarts page.
[0045] In the embodiment of the present application, the number of times the event trigger instruction corresponds can be determined. If the number of triggers exceeds the preset number, it means that the event is triggered frequently. At this time, the target data point and the response display result can be stored. Accordingly, when the same event trigger instruction appears again and the event parameters are similar within a certain range, the last event response result can be directly obtained from the cache to avoid repeated calculations and processing, thereby improving the response speed. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0047] Figure 1a A schematic diagram of an event processing flow based on Echarts provided in an embodiment of the present application;
[0048] Figure 1b A schematic diagram of an index data structure provided in an embodiment of the present application;
[0049] Figure 2 A schematic diagram of a global waveform provided in an embodiment of the present application;
[0050] Figure 3 A schematic diagram of a local waveform provided in an embodiment of the present application;
[0051] Figure 4 A schematic diagram of an Echarts interface provided in an embodiment of the present application;
[0052] Figure 5 A schematic diagram of another Echarts interface provided in an embodiment of the present application;
[0053] Figure 6A schematic diagram of another Echarts interface provided in an embodiment of the present application;
[0054] Figure 7 A schematic diagram of an interface for adding an event instruction provided in an embodiment of the present application;
[0055] Figure 8 A schematic diagram of a code for implementing a storage event instruction provided in an embodiment of the present application;
[0056] Fig. 9 A schematic diagram of a code for executing a data downsampling rate function event provided in an embodiment of the present application;
[0057] Fig.10 A schematic diagram of the structure of an event processing device based on Echarts provided in an embodiment of the present application;
[0058] Fig.11 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0059] The embodiments of the present application are described in detail below, and examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present application, and cannot be interpreted as limiting the present invention.
[0060] It will be understood by those skilled in the art that, unless expressly stated, the singular forms "one", "said", and "the" used herein may also include plural forms. It should be further understood that the term "comprising" used in the specification of the present application refers to the presence of the features, integers, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or groups thereof. It should be understood that when we refer to an element as being "connected" or "coupled" to another element, it may be directly connected or coupled to the other element, or there may be intermediate elements. In addition, the "connection" or "coupling" used herein may include wireless connection or wireless coupling. The term "and / or" used herein includes all or any unit and all combinations of one or more associated listed items.
[0061] In order to make the objectives, technical solutions and advantages of the present application clearer, the implementation methods of the present application will be further described in detail below with reference to the accompanying drawings.
[0062] The technical solution of the present application and how the technical solution of the present application solves the above-mentioned technical problems are described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below in conjunction with the accompanying drawings.
[0063] Specifically, Figure 1a As shown, the method may include:
[0064] Step S101, obtaining all data points bound to Echarts and the data types included in all data points.
[0065] Optionally, all data points bound to Echarts refer to data points used to display information in the current Echarts interface. All data points can be divided into different data types. The data types in the embodiment of the present application may refer to data types such as oral and nasal airflow, snoring, respiratory effort, pulse rate, blood oxygen and body position in the field of medical data.
[0066] Step S102, establishing an index data structure for all data points according to the data types included in all data points, the index data structure including each data type identifier, the region coordinate information corresponding to each data type identifier, and the data point information corresponding to each data type identifier.
[0067] Optionally, all data points can be classified to create an index data structure (specifically, Figure 1b The index data structure shown in the figure includes the identifier of each data type, the coordinate information of the area included by all data points under the data type, and the data point information of each data point under the data type. For example, an index data structure may include the identifier of the mouth and nose type, the position of the data point belonging to the mouth and nose type (the position can be represented by coordinates), and the area occupied by all data points belonging to the mouth and nose type.
[0068] In an optional embodiment of the present application, all data points include global data points and local data points, and the index data structure includes a first index data structure and a second index data structure;
[0069] An index data structure is created for all data points according to the data types included in all data points, including:
[0070] Establishing a first index data structure for the global data point according to the first data type included in the global data point, the first index data structure including each first data type identifier, region coordinate information corresponding to each first data type identifier, and data point information corresponding to each first data type identifier;
[0071] A second index data structure is established for the local data points according to the second data type included in the local data points. The second index data structure includes each second data type identifier, the area coordinate information corresponding to each second data type identifier, and the data point information corresponding to each second data type identifier.
[0072] Optionally, all bound data points may include global data points and local data points. The global data point refers to a data point (i.e., a global waveform) used to display all data from the start time to the end time of the waveform. For example, the global waveform may be Figure 2 As shown, the local data point refers to the data point (i.e., the local waveform) used to display all data half an hour after the start time of the global waveform. The local waveform can be as shown in Figure 3 shown.
[0073] for
[0074] Correspondingly, the global data points and the local data points both include their own data types (i.e., the first data type and the second data type). For example, the global data points include data types such as oronasal airflow, snoring, respiratory effort, pulse rate, blood oxygen and body position, and the local data points also include data types such as oronasal airflow, snoring, respiratory effort, pulse rate, blood oxygen and body position. In other words, the first data type and the second data type are the same data type.
[0075] Furthermore, for global data points, a corresponding first index data structure can be established for the global data points based on the first data type included in the global data points, and the first index data structure includes each first data type identifier included in the global data point, the regional coordinate information corresponding to each first data type identifier, and the data point information corresponding to each first data type identifier; and for local data points, a corresponding second index data structure can also be established for the local data points based on the second data type included in the local data points, and the second index data structure includes each second data type identifier included in the local data point, the regional coordinate information corresponding to each second data type identifier, and the data point information corresponding to each second data type identifier.
[0076] Step S103, receiving an event trigger instruction, and obtaining trigger coordinate information corresponding to the event trigger instruction and a trigger type corresponding to the event trigger instruction.
[0077] Optionally, when relevant personnel want to make changes to the Echarts interface or want to view some chart data, they can trigger an event trigger instruction. Accordingly, after receiving the event trigger instruction, the trigger coordinate information corresponding to the event trigger instruction and the trigger type corresponding to the event trigger instruction can be obtained. Among them, the trigger coordinate information refers to the location information of receiving the event trigger instruction, which can be expressed by coordinates. The trigger type refers to the method by which the instruction is triggered. The trigger type can include a click trigger type and a suspension trigger type. The click trigger type can refer to triggering the instruction by clicking the mouse, etc., and the suspension trigger type can refer to triggering the instruction by leaving the mouse at a certain position, etc.
[0078] Step S104, determining the target data type identifier corresponding to the event trigger instruction according to the trigger coordinate information and the area coordinate information corresponding to each data type identifier in the index data structure.
[0079] Optionally, after obtaining the trigger coordinate information, it is possible to determine the data point in which the event trigger instruction triggers the data point based on the trigger coordinate information and the area coordinate information corresponding to each data type identifier in the index data structure, that is, to determine the target data type identifier corresponding to the event trigger instruction.
[0080] In an optional embodiment of the present application, determining the target data type identifier corresponding to the event trigger instruction according to the trigger coordinate information and the area coordinate information corresponding to each data type identifier in the index data structure includes:
[0081] According to the trigger coordinate information, the area coordinate information corresponding to each first data type identifier and the area coordinate information corresponding to each second data type identifier, the target data type identifier corresponding to the trigger instruction is determined from each first data type identifier and each second data type identifier.
[0082] Optionally, since there are global waveforms and local waveforms in the Echarts interface, and both the global waveform and the local waveform have their own corresponding index data structures, when determining the target data type identifier corresponding to the trigger instruction, the trigger coordinate information can be compared with the regional coordinate information of the data type identifier in the first index data structure and the second index data structure, and the target data type identifier corresponding to the event trigger instruction can be determined from each first data type identifier and each second data type identifier.
[0083] Step S105, determining the target data point corresponding to the trigger instruction according to the trigger type, trigger coordinate information and data point information corresponding to the target data type identifier, and responding to the event trigger instruction according to the target data point to obtain a response display result.
[0084] Optionally, after the trigger type and the target data type of the trigger coordinate information of the event trigger instruction are known, the target data point corresponding to the target data type identifier can be further determined based on the data point information corresponding to the target data type identifier, that is, it is determined which data points the event trigger instruction is specifically targeting. Accordingly, after the data point (i.e., the target data point) specifically targeted by the event trigger instruction is known, the event trigger instruction can be responded to based on the target data point to obtain a response display result.
[0085] In an optional embodiment of the present application, the data point information includes coordinate information of the data point, the trigger type is a click trigger type and a suspension trigger type, and the target data point corresponding to the event trigger instruction is determined according to the trigger type, the trigger coordinate information, and the data point information corresponding to the target data type identifier, including:
[0086] If the trigger type is a click trigger type, the distance between the event trigger instruction and each data point is determined according to the trigger coordinate information and the coordinate information of the data point corresponding to the target data type identifier, and the data point that meets the distance requirement is used as the target data point corresponding to the event trigger instruction;
[0087] If the trigger type is a floating trigger type, the data points within the set distance range of the event trigger instruction are determined based on the trigger coordinate information and the coordinate information of the data points corresponding to the target data type identifier, and the data points within the set range are used as the target data points corresponding to the event trigger instruction.
[0088] Optionally, the data point information corresponding to the data type identifier may refer to the coordinate information of the data point, and the specific location of each data point included in each data type can be known based on the coordinate information. At this time, for different trigger types, the method for determining the target data point corresponding to the event trigger instruction is also different. Specifically, when the trigger type of the event trigger instruction is a click trigger type, the distance between the trigger instruction and each data point can be determined based on the coordinates of the event trigger instruction and the coordinates of each data point in the target data type identifier, and then the data point whose distance meets the requirements is used as the target data point corresponding to the event trigger instruction. When the trigger type is a floating trigger type, the set distance range around the coordinates of the event trigger instruction is determined based on the coordinates of the event trigger instruction, and then the data points within the set range are determined based on the coordinates of each data point in the target data type identifier, and the data points within the set range are used as the target data points corresponding to the event trigger instruction.
[0089] For example, Figure 4 As shown, when the mouse is placed on Figure 4When the coordinates of the event trigger instruction are within the start and end range (that is, the coordinates of the event trigger instruction are within the start and end range), the data points between the start and end at this time are all data points within the set range, and the data points between the start and end are the target data points corresponding to the event trigger instruction.
[0090] In an optional embodiment of the present application, the target data point includes an information data point and a rendering data point, and responding to the event trigger instruction according to the target data point to obtain a response display result includes:
[0091] Determine the data information to be displayed according to the information data point;
[0092] The data information to be displayed is rendered according to the rendering data point to obtain a response display result of the event triggering instruction, and the response display result includes one of displaying data, updating the interface display size and interface translation.
[0093] Optionally, the determined target data points may include information data points and rendering data points, wherein information data points are data points required to display data information, and rendering data points are data points required to render and display data information points. Accordingly, after determining the target data points, the data information to be displayed can be determined based on the information data points in the target data points, and then the data information is rendered based on the rendering data points to achieve a response to the event triggering instruction, obtain a response display result, and then display the display result in the interface. For example, when the mouse is placed on Figure 4 When the start and end range is within the range, the data information to be displayed is determined according to the information data point. Figure 4 The information in the black rectangular box in the figure can be rendered according to the rendered data points, and the information in the black rectangular box can be displayed.
[0094] Optionally, the response display result may include display data, update interface display size and interface translation. Wherein, updating interface display size refers to enlarging or reducing the global waveform or local waveform. For example, when the event trigger instruction is in Figure 5 The response display result is the enlarged display of the global waveform. When the event trigger instruction is in Figure 5 The response display result obtained by moving the down arrow in the red rectangle is to zoom out the global waveform. The interface translation refers to the translation of the entire interface to display new data information. For example, when the event trigger instruction is in Figure 6 When the red rectangular frame is centered and translated left and right, the resulting response is the left and right translation of the global waveform.
[0095] In an optional embodiment of the present application, the data type includes at least one of an oral and nasal airflow data type, a snoring data type, a respiratory effort data type, a pulse rate, a blood oxygen data type, and a body position data type; the event trigger instruction is one of a waveform zoom-in instruction, a waveform zoom-out instruction, a new event instruction, a delete event instruction, an event information display instruction, and an event update instruction; the data information includes at least one of obstructive apnea (OA) information, central apnea (CA) information, mixed apnea information (MA), Cheyne-Stokes respiration (CSR) information, hypopnea (H) information, flow limitation (FL) information, and respiratory effort-related awakening (RERA). For example, Figure 7 As shown, when the mouse clicks Figure 7 The event trigger command triggered in the red rectangle is a new event command. Figure 7 Select the data type in the white rectangle and add it to Figure 7 In the red rectangle.
[0096] In an optional embodiment of the present application, responding to the event trigger instruction according to the target data point includes:
[0097] Get the number of target data points;
[0098] According to the number of target data points, determine the number of times to process the target data points and the target data points to be processed each time;
[0099] Respond to event trigger instructions based on the number of target data points and the target data points that need to be processed each time.
[0100] Optionally, in the event response process, for operations that may affect the rendering performance of the chart, the number of target points determined at this time will also be relatively large. At this time, the number of times the target data points are processed can be determined based on the number of target data points, and then the target data points are processed in batches according to the determined number of times to achieve a response to the event trigger instruction. In an embodiment of the present application, for information updates of a large number of data points, batch updates are used instead of one by one updates to reduce the number of times and overhead of redrawing the chart.
[0101] In an optional embodiment of the present application, after responding to the event trigger instruction according to the target data point and obtaining the response display result, the method further includes:
[0102] Determine the triggering number corresponding to the event triggering instruction;
[0103] If the triggering times exceed the preset times, the target data points and the response display results will be stored.
[0104] Optionally, after responding to the event trigger instruction according to the target data point and obtaining the response display result, the number of times the event trigger instruction corresponds to can be determined. If the number of triggers exceeds the preset number, it means that the event is triggered frequently. At this time, the target data point and the response display result can be stored. Accordingly, when the same event trigger instruction appears again and the event parameters (such as coordinate position, data point attributes, etc.) are similar within a certain range, the last event response result is directly obtained from the cache to avoid repeated calculations and processing and improve the response speed. For example, in actual applications, it can be based on Figure 8 The code in implements storage.
[0105] In an optional embodiment of the present application, the method further includes:
[0106] Determine whether the number of all data points exceeds a quantity threshold;
[0107] If the number of all data points exceeds the quantity threshold, the data downsampling rate function event is executed.
[0108] Yes, in this application, the number of all data points bound to Echarts can also be determined, and then the determined number is compared with the set number threshold. If the number of all data points exceeds the number threshold, the data downsampling rate function event is executed (in actual applications, it can be based on Fig. 9 ), thereby reducing the data sampling rate and improving the performance of the Echarts page.
[0109] In addition, in this application, data can be processed locally according to the data type, so the consistency of the interactive experience on multiple devices (such as computer monitors with different resolutions and mobile device screens) can be improved. It can also adapt to the characteristics of different devices and maintain good interactive performance on various devices. Some functions that were originally difficult to implement or had poor effects in complex charts or large amounts of data can now work normally and efficiently.
[0110] The present application embodiment provides an event processing device based on Echarts, such as Fig.10 As shown, the device may include: a data acquisition module 901, an index establishment module 902, an event receiving module 903 and an event response module 904, wherein:
[0111] The data acquisition module is used to obtain all data points bound to Echarts and the data types included in all data points;
[0112] An index building module, used to build an index data structure for all data points according to the data types included in all data points, the index data structure including each data type identifier, the area coordinate information corresponding to each data type identifier, and the data point information corresponding to each data type identifier;
[0113] An event receiving module is used to receive an event trigger instruction and obtain the trigger coordinate information and the trigger type corresponding to the event trigger instruction;
[0114] The event response module is used to determine the target data type identifier corresponding to the event trigger instruction based on the trigger coordinate information and the area coordinate information corresponding to each data type identifier in the index data structure; and to determine the target data point corresponding to the event trigger instruction based on the trigger type, trigger coordinate information and the data point information corresponding to the target data type identifier, and respond to the event trigger instruction based on the target data point to obtain a response display result.
[0115] Optionally, all data points include global data points and local data points, and the index data structure includes a first index data structure and a second index data structure;
[0116] The index building module builds an index data structure for all data points according to the data types included in all data points, specifically for:
[0117] Establishing a first index data structure for the global data point according to the first data type included in the global data point, the first index data structure including each first data type identifier, region coordinate information corresponding to each first data type identifier, and data point information corresponding to each first data type identifier;
[0118] A second index data structure is established for the local data points according to the second data type included in the local data points. The second index data structure includes each second data type identifier, the area coordinate information corresponding to each second data type identifier, and the data point information corresponding to each second data type identifier.
[0119] Optionally, when the event response module determines the target data type identifier corresponding to the event trigger instruction according to the trigger coordinate information and the area coordinate information corresponding to each data type identifier in the index data structure, it is specifically used to:
[0120] According to the trigger coordinate information, the area coordinate information corresponding to each first data type identifier and the area coordinate information corresponding to each second data type identifier, the target data type identifier corresponding to the trigger instruction is determined from each first data type identifier and each second data type identifier.
[0121] Optionally, the data point information includes coordinate information of the data point, and the trigger type is a click trigger type and a suspension trigger type. When the event response module determines the target data point corresponding to the event trigger instruction according to the trigger type, the trigger coordinate information and the data point information corresponding to the target data type identifier, it is specifically used to:
[0122] If the trigger type is a click trigger type, the distance between the event trigger instruction and each data point is determined according to the trigger coordinate information and the coordinate information of the data point corresponding to the target data type identifier, and the data point that meets the distance requirement is used as the target data point corresponding to the event trigger instruction;
[0123] If the trigger type is a floating trigger type, the data points within the set distance range of the event trigger instruction are determined based on the trigger coordinate information and the coordinate information of the data points corresponding to the target data type identifier, and the data points within the set range are used as the target data points corresponding to the event trigger instruction.
[0124] Optionally, the target data point includes an information data point and a rendering data point. When the event response module responds to the event trigger instruction according to the target data point and obtains a response display result, it is specifically used to:
[0125] Determine the data information to be displayed according to the information data point;
[0126] The data information to be displayed is rendered according to the rendering data point to obtain a response display result of the event triggering instruction, and the response display result includes one of displaying data, updating the interface display size and interface translation.
[0127] Optionally, when the event response module responds to the event trigger instruction according to the target data point, it is specifically used to:
[0128] Get the number of target data points;
[0129] According to the number of target data points, determine the number of times to process the target data points and the target data points to be processed each time;
[0130] Respond to event trigger instructions based on the number of target data points and the target data points that need to be processed each time.
[0131] Optionally, the data type includes at least one of an oral and nasal airflow data type, a snoring data type, a respiratory effort data type, a pulse rate, a blood oxygen data type, and a body position data type; the event trigger instruction is one of a waveform zoom in instruction, a waveform zoom out instruction, a new event instruction, a delete event instruction, an event information display instruction, and an event update instruction; the data information includes at least one of obstructive apnea information, central apnea information, mixed apnea information, Cheyne-Stokes breathing information, hypoventilation information, flow limitation information, and respiratory effort-related micro-arousal information.
[0132] Optionally, the device further includes an event storage device, specifically used for:
[0133] After responding to the event trigger instruction according to the target data point and obtaining the response display result, determining the triggering number corresponding to the event trigger instruction;
[0134] If the triggering times exceed the preset times, the target data points and the response display results will be stored.
[0135] Optionally, the event storage device is also used for:
[0136] Determine whether the number of all data points exceeds a quantity threshold;
[0137] If the number of all data points exceeds the quantity threshold, the data downsampling rate function event is executed.
[0138] An event processing device based on Echarts in this embodiment can execute an event processing method based on Echarts shown in the embodiment of the present application. The implementation principle is similar and will not be repeated here.
[0139] An embodiment of the present application provides an electronic device, and the electronic device in the embodiment of the present application includes: a processor; and a memory, the memory is configured to store machine-readable instructions, and when the instructions are executed by the processor, the processor executes an event processing method based on Echarts.
[0140] The present application embodiment provides an electronic device, such as Fig.11 As shown, Fig.11 The electronic device shown includes: a processor 2001 and a memory 2003. The processor 2001 and the memory 2003 are connected, such as through a bus 2002. Optionally, the electronic device 2000 may also include a transceiver 2004. It should be noted that in actual applications, the transceiver 2004 is not limited to one, and the structure of the electronic device 2000 does not constitute a limitation on the embodiments of the present application.
[0141] Processor 2001 may be a CPU, a general-purpose processor, a DSP, an ASIC, an FPGA or other programmable logic device, a transistor logic device, a hardware component or any combination thereof. It may implement or execute various exemplary logic blocks, modules and circuits described in conjunction with the disclosure of this application. Processor 2001 may also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of a DSP and a microprocessor, etc.
[0142] The bus 2002 may include a path to transmit information between the above components. The bus 2002 may be a PCI bus or an EISA bus, etc. The bus 2002 may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Fig.11 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0143] The memory 2003 may be a ROM or other type of static storage device that can store static information and instructions, a RAM or other type of dynamic storage device that can store information and instructions, or an EEPROM, a CD-ROM or other optical disk storage, an optical disk storage (including a compressed optical disk, a laser disk, an optical disk, a digital versatile disk, a Blu-ray disk, etc.), a magnetic disk storage medium or other magnetic storage device, or any other medium that can be used to carry or store the desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited to these.
[0144] The memory 2003 is used to store the application code for executing the solution of the present application, and the execution is controlled by the processor 2001. The processor 2001 is used to execute the application code stored in the memory 2003 to implement Fig.10 The illustrated embodiment provides an action of an event processing device based on Echarts.
[0145] It should be understood that, although the steps in the flowchart of the accompanying drawings are displayed in sequence as indicated by the arrows, these steps are not necessarily executed in sequence in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least a part of the steps in the flowchart of the accompanying drawings may include multiple sub-steps or multiple stages, and these sub-steps or stages are not necessarily executed at the same time, but can be executed at different times, and their execution order is not necessarily sequential, but can be executed in turn or alternately with other steps or at least a part of the sub-steps or stages of other steps.
[0146] The above is only part of the embodiments of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principle of the present invention, and these improvements and modifications should also be regarded as the protection scope of the present invention.
Claims
1. An event processing method based on Echarts, characterized in that: include: Get all data points bound to Echarts and the data types included in all data points; Establishing an index data structure for all the data points according to the data types included in all the data points, the index data structure including each data type identifier, the region coordinate information corresponding to each data type identifier, and the data point information corresponding to each data type identifier; Receive an event trigger instruction, and obtain trigger coordinate information corresponding to the event trigger instruction and a trigger type corresponding to the event trigger instruction; Determine the target data type identifier corresponding to the event trigger instruction according to the trigger coordinate information and the area coordinate information corresponding to each data type identifier in the index data structure; According to the trigger type, the trigger coordinate information and the data point information corresponding to the target data type identifier, the target data point corresponding to the event trigger instruction is determined, and the event trigger instruction is responded to according to the target data point to obtain a response display result.
2. The method according to claim 1, characterized in that The all data points include global data points and local data points, and the index data structure includes a first index data structure and a second index data structure; The step of establishing an index data structure for all the data points according to the data types included in all the data points comprises: Establishing a first index data structure for the global data point according to the first data type included in the global data point, wherein the first index data structure includes each first data type identifier, region coordinate information corresponding to each first data type identifier, and data point information corresponding to each first data type identifier; A second index data structure is established for the local data point according to the second data type included in the local data point, wherein the second index data structure includes each second data type identifier, the area coordinate information corresponding to each second data type identifier, and the data point information corresponding to each second data type identifier.
3. The method according to claim 2, characterized in that The step of determining the target data type identifier corresponding to the event trigger instruction according to the trigger coordinate information and the area coordinate information corresponding to each data type identifier in the index data structure includes: According to the trigger coordinate information, the area coordinate information corresponding to each first data type identifier and the area coordinate information corresponding to each second data type identifier, the target data type identifier corresponding to the trigger instruction is determined from each of the first data type identifiers and each of the second data type identifiers.
4. The method according to claim 1, characterized in that The data point information includes coordinate information of the data point, the trigger type is a click trigger type and a suspension trigger type, and determining the target data point corresponding to the event trigger instruction according to the trigger type, the trigger coordinate information and the data point information corresponding to the target data type identifier includes: If the trigger type is a click trigger type, the distance between the event trigger instruction and each data point is determined according to the trigger coordinate information and the coordinate information of the data point corresponding to the target data type identifier, and the data point whose distance meets the requirement is used as the target data point corresponding to the event trigger instruction; If the trigger type is a floating trigger type, the data points within the set distance range of the event trigger instruction are determined based on the trigger coordinate information and the coordinate information of the data points corresponding to the target data type identifier, and the data points within the set range are used as the target data points corresponding to the event trigger instruction.
5. The method according to claim 1, characterized in that The target data point includes an information data point and a rendering data point, and the step of responding to the event trigger instruction according to the target data point to obtain a response display result includes: Determining the data information to be displayed according to the information data point; The data information to be displayed is rendered according to the rendering data point to obtain a response display result of the event triggering instruction, wherein the response display result includes one of display data, update interface display size and interface translation.
6. The method according to claim 1, characterized in that The responding to the event trigger instruction according to the target data point includes: Obtaining the number of target data points; According to the number of the target data points, determining the number of times to process the target data points and the target data points to be processed each time; The event trigger instruction is responded to according to the number of the target data points and the target data points that need to be processed each time.
7. The method according to claim 5, characterized in that The data type includes at least one of an oral and nasal airflow data type, a snoring data type, a respiratory effort data type, a pulse rate, a blood oxygen data type, and a body position data type; the event trigger instruction is one of a waveform zoom-in instruction, a waveform zoom-out instruction, a new event instruction, a delete event instruction, an event information display instruction, and an event update instruction; the data information includes at least one of obstructive apnea information, central apnea information, mixed apnea information, Cheyne-Stokes breathing information, hypoventilation information, flow limitation information, and respiratory effort-related micro-arousal information.
8. The method according to claim 1, characterized in that After responding to the event trigger instruction according to the target data point and obtaining a response display result, the method further includes: Determine the triggering number corresponding to the event triggering instruction; If the triggering times exceed the preset times, the target data point and the response display result are stored.
9. The method according to claim 1, characterized in that: The method further comprises: Determining whether the quantity of all data points exceeds a quantity threshold; If the quantity of all data points exceeds the quantity threshold, a data downsampling rate function event is executed.
10. An event processing device based on Echarts, characterized in that: include: The data acquisition module is used to obtain all data points bound to Echarts and the data types included in all the data points; An index building module, used to build an index data structure for all the data points according to the data types included in all the data points, wherein the index data structure includes each data type identifier, the region coordinate information corresponding to each data type identifier, and the data point information corresponding to each data type identifier; An event receiving module, used to receive an event trigger instruction, and obtain trigger coordinate information corresponding to the event trigger instruction and a trigger type corresponding to the event trigger instruction; An event response module is used to determine the target data type identifier corresponding to the event trigger instruction based on the trigger coordinate information and the area coordinate information corresponding to each data type identifier in the index data structure; and to determine the target data point corresponding to the event trigger instruction based on the trigger type, the trigger coordinate information and the data point information corresponding to the target data type identifier, and respond to the event trigger instruction based on the target data point to obtain a response display result.
Citation Information
Patent Citations
Statistical data display method and apparatus
CN105554799A
Method for realizing synchronous linkage carousel of Chinese map and broken line graph data
CN110990431A
Echarts chart component packaging method and device
CN112433726A
Data processing method and apparatus, server, and storage medium
WO2023226682A1