Data display method and device
By processing the horizontal and vertical axes of the line chart, the problems of discontinuous data and excessively dense data points were solved, improving the display effect and user experience of the line chart.
Patent Information
- Application Number
- CN202411875220.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-18
- Publication Date
- 2025-11-21
- Estimated Expiration
- 2044-12-18
AI Technical Summary
In existing technologies, line charts suffer from unsatisfactory display effects and negatively impact user experience due to discontinuous data sources or excessively dense data points.
By acquiring the data to be displayed and the input parameters, the horizontal axis is determined by processing the input parameters to make the horizontal axis interval a preset time interval, and the vertical axis is assigned and aggregated to generate a line chart.
The display effect of line charts has been improved, enhancing the user experience.
Smart Images

Figure CN119729097B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular to a data display method, apparatus, computer equipment, computer-readable storage medium, and computer program product. Background Technology
[0002] A streamer's data center typically includes a variety of metrics, such as streamer's livestream duration, number of viewers, gift revenue, and number of comments. To gain a clearer understanding of this data, it's often desirable to generate line charts for visualization. The usual approach is for the front-end to retrieve the line chart data from the server, parse it, and then populate the x and y axes with the data to create the displayed line chart. The x-axis represents the time period, and the y-axis represents the corresponding values for each data category.
[0003] However, due to factors such as data source, some intermediate points may be missing, which may cause the line chart to be discontinuous. In addition, if there are many data points, the line chart will be very dense, affecting the display effect of the line chart.
[0004] It should be noted that the above content is not necessarily prior art, nor is it intended to limit the scope of patent protection of this application. Summary of the Invention
[0005] This application provides a data display method, apparatus, computer device, computer-readable storage medium, and computer program product to solve or alleviate one or more of the technical problems mentioned above.
[0006] One aspect of this application provides a data display method, the method comprising:
[0007] Obtain the data to be displayed and the input parameters, wherein the input parameters include at least a preset time interval;
[0008] The first processing is performed based on the input parameters, and the horizontal axis of the line chart to be generated is determined based on the result of the first processing. The first processing includes at least setting the adjacent values of the horizontal axis apart by the preset time interval.
[0009] The second processing is performed on the data to be displayed, and the vertical axis of the line chart to be generated is determined based on the result of the second processing. The second processing includes at least one of the following: assigning values to the vertical axis corresponding to at least a portion of the horizontal axis and performing aggregation processing on a portion of the data to be displayed.
[0010] A line chart is generated based on the horizontal and vertical coordinates for display.
[0011] Optionally, the input parameters may also include start time and end time;
[0012] Correspondingly, the first processing based on the input parameters, and the determination of the horizontal axis of the line chart to be generated based on the result of the first processing, includes:
[0013] Obtain the start time, the end time, and the preset time interval;
[0014] The first processing is performed based on the preset time interval, the start time, and the end time to obtain the horizontal axis of the line chart to be generated.
[0015] Optionally, the input parameters may also include a preset DSL statement;
[0016] Correspondingly, the second processing based on the data to be displayed includes:
[0017] Obtain the preset DSL statement;
[0018] Based on the preset DSL statement and the data to be displayed, values are assigned to the ordinates corresponding to at least a portion of the horizontal coordinates.
[0019] Optionally, the preset DSL statement is a cron expression;
[0020] Correspondingly, the step of assigning values to the ordinates corresponding to at least a portion of the horizontal coordinates based on the preset DSL statement and the data to be displayed includes:
[0021] The cron expression is parsed to obtain the parsing result;
[0022] Based on the analysis results, the required target data is obtained from the data to be displayed;
[0023] Based on the target data and the cron expression, a calculation is performed to determine the result of the calculation of the first ordinate, which is the ordinate corresponding to the cron expression;
[0024] The result of the calculation is assigned to the first vertical coordinate.
[0025] Optionally, the input parameters further include a replacement array, and correspondingly, the method further includes:
[0026] Obtain the replacement array and determine the second ordinate corresponding to the replacement array;
[0027] The second ordinate is assigned a value based on the replacement array.
[0028] Optionally, the input parameters may further include an aggregation threshold;
[0029] Correspondingly, the second processing based on the data to be displayed includes:
[0030] Obtain the aggregation threshold;
[0031] The data to be displayed is aggregated based on the aggregation threshold.
[0032] Another aspect of this application provides a data display device, the device comprising:
[0033] The acquisition module is used to acquire the data to be displayed and the input parameters, wherein the input parameters include at least a preset time interval;
[0034] A first processing module is configured to perform a first processing based on the input parameters and determine the horizontal coordinate of the line chart to be generated based on the result of the first processing. The first processing includes at least setting adjacent values of the horizontal coordinate to be separated by the preset time interval.
[0035] The second processing module is used to perform a second processing based on the data to be displayed, and to determine the vertical coordinate of the line chart to be generated based on the result of the second processing. The second processing includes at least one of assigning values to the vertical coordinates corresponding to at least a portion of the horizontal coordinates and performing aggregation processing on a portion of the data to be displayed.
[0036] The generation module is used to generate a line chart based on the horizontal and vertical coordinates for display.
[0037] Another aspect of this application provides a computer device, including: at least one processor; and a memory communicatively connected to the at least one processor; wherein: the memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to perform the method described above.
[0038] Another aspect of this application provides a computer-readable storage medium storing computer instructions that, when executed by a processor, implement the method described above.
[0039] Another aspect of this application provides a computer program product including a computer program that, when executed by a processor, implements the method described above.
[0040] The embodiments of this application employing the above-described technical solution may have the following advantages:
[0041] By acquiring the data to be displayed and input parameters, and processing the input parameters to ensure that adjacent values of the horizontal axis of the line chart are spaced at a preset time interval, the horizontal axis of the line chart to be generated is determined. Based on the data to be displayed, at least some of the horizontal axes are assigned values to their corresponding vertical axes, and some of the data to be displayed is aggregated to determine the vertical axis of the line chart to be generated. The line chart is then generated and displayed based on the horizontal and vertical axes. Appropriate processing of the horizontal and vertical axes can be performed as needed to improve the display effect of the line chart and enhance the user experience. Attached Figure Description
[0042] The accompanying drawings exemplify embodiments and form part of the specification, serving to explain exemplary implementations of the embodiments together with the textual description. The illustrated embodiments are for illustrative purposes only and do not limit the scope of the claims. Throughout the drawings, the same reference numerals refer to similar but not necessarily identical elements.
[0043] Figure 1 A flowchart illustrating a data display method according to Embodiment 1 of this application is shown schematically;
[0044] Figure 2 Schematic illustration Figure 1 Flowchart of the sub-steps in step S102;
[0045] Figure 3 Schematic illustration Figure 1 Flowchart of the sub-steps in step S104;
[0046] Figure 4 Schematic illustration Figure 3 Flowchart of the sub-steps in step S302;
[0047] Figure 5 The illustration shows a new flow in the data display method according to Embodiment 1 of this application;
[0048] Figure 6 Schematic illustration Figure 1 Flowchart of another sub-step in step S104;
[0049] Figure 7 An example flow of the data display method according to Embodiment 1 of this application is illustrated schematically;
[0050] Figure 8 A block diagram of a data display device according to Embodiment 2 of this application is schematically shown; and
[0051] Figure 9 A schematic diagram of the hardware architecture of a computer device according to Embodiment 3 of this application is shown. Detailed Implementation
[0052] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application. All other embodiments obtained by those skilled in the art based on the embodiments in this application without inventive effort are within the scope of protection of this application.
[0053] It should be noted that the descriptions involving "first," "second," etc., in the embodiments of this application are for descriptive purposes only and should not be construed as indicating or implying their relative importance or implicitly specifying the number of technical features indicated. Therefore, a feature defined with "first" or "second" may explicitly or implicitly include at least one of that feature. Furthermore, the technical solutions of the various embodiments can be combined with each other, but this must be based on the ability of those skilled in the art to implement them. If the combination of technical solutions is contradictory or impossible to implement, it should be considered that such a combination of technical solutions does not exist and is not within the scope of protection claimed in this application.
[0054] In the description of this application, it should be understood that the numerical labels before the steps do not indicate the order of the steps, but are only used to facilitate the description of this application and to distinguish each step, and therefore should not be construed as a limitation of this application.
[0055] First, a definition of the terminology used in this application is provided:
[0056] DSL (Domain Specific Language): It is a computer language tailored for a specific domain (such as databases, networks, configuration, etc.). Compared to general-purpose programming languages (such as C++, Java, Python), DSL syntax and expressions are closer to the business concepts of that domain, enabling developers to express and solve problems in a more natural and intuitive way.
[0057] A Cron expression is a string used to configure scheduled tasks on Unix and Unix-like systems. It uses a series of characters and special symbols to specify when the task should be executed and is widely used in various systems and applications.
[0058] Secondly, to facilitate understanding of the technical solutions provided in the embodiments of this application by those skilled in the art, the relevant technologies are described below:
[0059] The streamer center typically includes a variety of data, such as the streamer's live stream duration, number of viewers, number of gifts, and number of bullet comments. In related technologies, the front-end usually retrieves the data from the server, parses it, and then fills the data into the horizontal and vertical axes of a line chart to create the displayed line graph.
[0060] However, the applicant has learned that the relevant technology still has the following drawbacks:
[0061] Due to factors such as data source, some intermediate points in the line chart may be missing, causing the line chart display to be discontinuous. In addition, if there are many data points, the data displayed in the line chart will be very dense. Both of these situations will result in an unsatisfactory display effect of the generated line chart, affecting the user experience.
[0062] Therefore, this application provides a data display technology solution. In this solution, the horizontal and vertical axes of the line chart can be processed as needed to improve the display effect and enhance the user experience. Details are provided below.
[0063] The technical solutions of this application are described below through several embodiments. It should be understood that these embodiments can be implemented in many different forms and should not be construed as being limited to the embodiments set forth herein.
[0064] Example 1
[0065] Figure 1 A flowchart illustrating a data display method according to Embodiment 1 of this application is shown schematically.
[0066] like Figure 1 As shown, the data display method may include steps S100 to S106, wherein:
[0067] Step S100: Obtain the data to be displayed and the input parameters, wherein the input parameters include at least a preset time interval.
[0068] Step S102: Perform a first process based on the input parameters, and determine the horizontal coordinate of the line chart to be generated based on the result of the first process. The first process includes at least setting adjacent values of the horizontal coordinate to be separated by the preset time interval.
[0069] Step S104: Perform a second processing based on the data to be displayed, and determine the vertical coordinate of the line chart to be generated based on the result of the second processing. The second processing includes at least one of assigning values to the vertical coordinates corresponding to at least a portion of the horizontal coordinates and performing aggregation processing on a portion of the data to be displayed.
[0070] Step S106: Generate a line chart based on the horizontal and vertical coordinates for display.
[0071] The data display method provided in this embodiment obtains the data to be displayed and input parameters. Based on the input parameters, it processes the data to be displayed so that adjacent values of the horizontal axis of the line chart to be generated are separated by a preset time interval, thereby determining the horizontal axis of the line chart. Based on the data to be displayed, it processes the data to be displayed by assigning values to the vertical axes corresponding to at least some of the horizontal axes and by aggregating some of the data to be displayed, thereby determining the vertical axis of the line chart to be generated. Based on the horizontal and vertical axes, a line chart is generated and displayed. The horizontal and vertical axes of the line chart can be appropriately processed as needed to improve the display effect of the line chart and enhance the user experience.
[0072] The following combination Figure 1 The steps in steps S100 to S106 and other optional steps are described in detail.
[0073] Step S100 The system obtains the data to be displayed and the input parameters, wherein the input parameters include at least a preset time interval.
[0074] The data to be displayed can be the main data that the user wants to see, such as the streamer's live broadcast duration, number of viewers, gift revenue, and number of bullet comments, as well as the corresponding time data. This data can be stored in a specific location, such as a database, and retrieved from that location when needed. Optionally, the data to be displayed can be retrieved all at once or continuously, for example, at regular intervals. In the case of continuous retrieval of data, the subsequent processing steps and the generation of the line chart can be a dynamic process. That is, when new data is retrieved, it is processed according to subsequent steps, and a new line chart is generated based on the original one. For example, if the current time is 8:00 AM and the target data only includes data up to and including the current time, and after 8:30 AM the target data is updated to the 8:30 AM data, the 8:30 AM data can be generated based on the original line chart.
[0075] Step S102 The input parameters are processed first, and the horizontal coordinate of the line chart to be generated is determined based on the result of the first processing. The first processing includes at least setting the adjacent values of the horizontal coordinate to be separated by the preset time interval.
[0076] Specifically, a preset time interval can be obtained from the input parameters. Then, the x-axis of the line chart to be generated can be processed according to the preset time interval, so that every two adjacent x-axis values in the line chart are separated by the preset time interval. The input parameters may include other content besides the preset time interval. Some exemplary solutions are provided below.
[0077] In an optional embodiment, the input parameters may further include start time and end time, such as Figure 2 As shown, step S102 may include:
[0078] Step S200: Obtain the start time, the end time, and the preset time interval.
[0079] Step S202: Perform the first processing based on the preset time interval, the start time, and the end time to obtain the horizontal axis of the line chart to be generated.
[0080] Specifically, the start time, end time, and preset time interval can be obtained from the input parameters. Then, based on the start time, end time, and preset time interval, the x-axis of the line chart to be generated is processed to obtain the x-axis of the line chart. For example, if the start time is 8:00, the end time is 10:00, and the preset time interval is 30 minutes, then the x-axis points of 8:00, 8:30, 9:00, 9:30, and 10:00 can be automatically generated. In practical applications, when the data to be displayed includes corresponding time data, the start and end times can also be determined directly based on that time data.
[0081] In this embodiment, by obtaining the start time, end time, and preset time interval from the input parameters, and performing a first process based on the preset time interval, start time, and end time, the horizontal coordinate of the line chart to be generated is obtained. This allows adjacent values of the horizontal coordinate of the line chart to be generated to be spaced apart by a preset time interval, thereby preventing the subsequently generated line chart from being too dense. This effectively controls the density of the generated line chart points, improves the display effect of the generated line chart, and thus enhances the user experience.
[0082] Step S104 The second processing is performed on the data to be displayed, and the vertical coordinate of the line chart to be generated is determined based on the result of the second processing. The second processing includes at least one of the following: assigning values to the vertical coordinates corresponding to at least a portion of the horizontal coordinates and performing aggregation processing on a portion of the data to be displayed.
[0083] Specifically, the input parameters can also include information on how to perform the second processing, allowing users to input relevant processing details as needed, so that the vertical axis of the generated line chart meets different user requirements. Some exemplary solutions are provided below.
[0084] In optional embodiments, the input parameters may further include preset DSL statements, such as Figure 3 As shown, step S104 may include:
[0085] Step S300: Obtain the preset DSL statement.
[0086] Step S302: Assign values to the ordinates corresponding to at least a portion of the horizontal coordinates based on the preset DSL statement and the data to be displayed.
[0087] Understandably, when assigning values to the y-axis of the line chart to be generated does not require the use of a preset DSL statement, the input parameters may not include the preset DSL statement; that is, the user does not need to input the preset DSL statement. If the input parameters include a preset DSL statement, it indicates that the user intends to assign values to the y-axis corresponding to at least a portion of the x-axis using the DSL statement. For example, if the user wants to process and assign values to data from a subset of time points, they can write a preset DSL statement for that subset of time points and then input the written preset DSL statement into the input parameters. This allows them to obtain the preset DSL statement from the input parameters and process and assign values to the data from that subset of time points according to the preset DSL statement. Alternatively, for y-axis values not assigned by a preset DSL statement, the corresponding data from the data to be displayed can be used directly.
[0088] In this embodiment, by obtaining a preset DSL statement, and assigning values to the vertical coordinates corresponding to at least some of the horizontal coordinates based on the preset DSL statement and the data to be displayed, the vertical coordinates of the line chart to be generated can be assigned values according to the DSL statement pre-written by the user, so that the generated line chart can meet the diverse needs of the user.
[0089] In an optional embodiment, the default DSL statement is a cron expression, such as... Figure 4 As shown, step 302 may include:
[0090] Step S400: Parse the cron expression to obtain the parsing result.
[0091] Step S402: Based on the parsing results, obtain the required target data from the data to be displayed.
[0092] Step S404: Perform calculations based on the target data and the cron expression to determine the result of the calculation of the first ordinate, where the first ordinate is the ordinate corresponding to the cron expression.
[0093] Step S406: Assign the calculation result to the first vertical coordinate.
[0094] Specifically, when a cron expression is obtained from the input parameters, it can be parsed according to the rules of cron expressions to determine the target data required by the cron expression; then, the target data is obtained from the data to be displayed, the target data is input into the cron expression for calculation, the calculation result is obtained, and the calculation result is assigned to the vertical coordinate (i.e., the first vertical coordinate) corresponding to the cron expression.
[0095] For example, if the cron expression is (0 0 12 ? For example, if the cron expression is (+10), then according to the rules of cron expressions, the expression is parsed to determine that it represents the value corresponding to 12:00:00 plus 10. Therefore, the value of 12:00:00 is retrieved from the data to be displayed, 10 is added to the retrieved value, and then it is assigned to the vertical axis corresponding to 12:00:00. Another example is if the cron expression is (0 0 12 ? Given (m+10)+(h+5), the expression is parsed according to the rules of cron expressions. It is determined that the value of 12:00:00 is the number of minutes + 10 + the number of hours + 5. The value of 12:00:00 is then obtained from the data to be displayed, and after being entered into the cron expression for calculation, it is assigned to the vertical axis corresponding to 12:00:00.
[0096] In this embodiment, the cron expression is parsed to obtain the parsing result. Based on the parsing result, the required target data is obtained from the data to be displayed. The target data and the cron expression are used to perform calculations to determine the calculation result of the first vertical coordinate. The calculation result is assigned to the first vertical coordinate. The vertical coordinate of the line chart to be generated can be assigned according to the cron expression pre-written by the user, so that the generated line chart can meet the diverse needs of the user and improve the flexibility and display effect of the line chart generation.
[0097] In an optional embodiment, the input parameters may further include a replacement array, such as Figure 5 As shown, the data display method in this application embodiment may further include:
[0098] Step S500: Obtain the replacement array and determine the second ordinate corresponding to the replacement array.
[0099] Step S502: Assign a value to the second ordinate based on the replacement array.
[0100] The replacement array can be derived from the data to be displayed or from other data. For example, in a line chart primarily generated by cron expressions, if certain data points need to be replaced, the replacement array can be obtained from the data to be displayed or other data. This replacement array is then passed into the input parameters. After obtaining the replacement array, the second y-coordinate corresponding to the replacement array is determined, and the values in the replacement array are assigned to the second y-coordinate. For instance, if the replacement array assigns 100 to the value corresponding to 17:00, then after obtaining the replacement array, the y-coordinate corresponding to 17:00 is determined, and the corresponding y-coordinate is assigned the value 100.
[0101] In this embodiment, by obtaining the replacement array and determining the second ordinate corresponding to the replacement array, and assigning a value to the second ordinate based on the replacement array, some point data of the line chart can be replaced according to user needs, thereby meeting diverse user requirements.
[0102] In optional embodiments, the input parameters may further include an aggregation threshold, such as Figure 6 As shown, step S104 may include:
[0103] Step S600: Obtain the aggregation threshold.
[0104] Step S602: Aggregate the data to be displayed based on the aggregation threshold.
[0105] The aggregation threshold refers to a specified time interval or step size used to aggregate time points in the original time series data. During the aggregation process, each aggregated time point will contain a summary (such as summation) of all data values within a certain range before and after that time point (determined by the aggregation threshold). The specific aggregation threshold can be set according to actual needs. For example, if the aggregation threshold is 2, and the horizontal axis has five points: 8:00, 8:30, 9:00, 9:30, and 10:00, then aggregation based on the aggregation threshold will yield three points: 8:00, 9:00, and 10:00. The value of 8:00 can be the value of 8:00 plus the value of 8:30, and the value of 9:00 can be the value of 9:00 plus the value of 9:30, thus reducing the number of data points, facilitating the viewing of the line chart, and improving the display effect of the line chart.
[0106] In this embodiment, by obtaining an aggregation threshold, the data to be displayed is aggregated based on the aggregation threshold. The points of the line chart can be aggregated as needed, thereby effectively reducing the number of points in the line chart and improving the display effect of the line chart.
[0107] Step S106 A line chart is generated based on the horizontal and vertical coordinates for display.
[0108] After determining the x-coordinate and y-coordinate, a point array table for the line chart can be obtained based on the corresponding x-coordinate and y-coordinate. This table can then be input into the line chart to generate the line chart, which can then be displayed to the user.
[0109] To make this application easier to understand, the following is combined with... Figure 7 Here is an example application. As shown in the figure, it can generally include the following process:
[0110] 1. Input parameters: Input parameters may include start time, end time, interval dimension, y-axis generation expression, list of replacement point data, and number of aggregation points (aggregation threshold).
[0111] 2. Divide the data into all corresponding points based on the start time, end time, and interval dimension in the input parameters;
[0112] 3. Determine if a generation expression is passed in as an input parameter. If so, proceed to step 4; otherwise, proceed to step 5.
[0113] 4. Parse the generated expression, find the corresponding point based on the parsing result, and apply the generated expression to obtain the value;
[0114] 5. Determine if a replacement value has been passed into the input parameters. If so, proceed to step 6; otherwise, proceed to step 7.
[0115] 6. Replace the value at the corresponding point with the passed-in replacement value;
[0116] 7. Determine if the number of aggregation points is entered in the input parameters. If so, proceed to step 8; otherwise, proceed to step 9.
[0117] 8. Based on the number of aggregation points, add the aggregated points together to generate new points;
[0118] 9. Output a point array table and generate a line chart.
[0119] In this exemplary application, by inputting parameters, users can select the generation expression to generate the ordinate, replace the values of certain points, and aggregate the points as needed. This allows users to easily customize the generated line chart according to their needs, ensuring that the generated line chart does not have discontinuities or excessively high data density, thereby improving the display effect of the line chart and enhancing the user experience.
[0120] Example 2
[0121] Figure 8The diagram schematically illustrates a data display device according to Embodiment 2 of this application. This device can be divided into one or more program modules. One or more program modules are stored in a storage medium and executed by one or more processors to complete the embodiment of this application. The program module referred to in this embodiment is a series of computer program instruction segments capable of performing a specific function. The following description will specifically introduce the function of each program module in this embodiment. For example... Figure 8 As shown, the device 700 may include: an acquisition module 710, a first processing module 720, a second processing module 730, and a generation module 740, wherein:
[0122] The acquisition module 710 is used to acquire the data to be displayed and input parameters, wherein the input parameters include at least a preset time interval;
[0123] The first processing module 720 is used to perform a first processing based on the input parameters and determine the horizontal coordinate of the line chart to be generated based on the result of the first processing. The first processing includes at least setting the adjacent values of the horizontal coordinate to be separated by the preset time interval.
[0124] The second processing module 730 is used to perform a second processing based on the data to be displayed, and to determine the vertical coordinate of the line chart to be generated based on the result of the second processing. The second processing includes at least one of assigning values to the vertical coordinates corresponding to at least a portion of the horizontal coordinates and performing aggregation processing on a portion of the data to be displayed.
[0125] The generation module 740 is used to generate a line chart based on the horizontal and vertical coordinates for display.
[0126] In an optional embodiment, the input parameters further include a start time and an end time, and the first processing module 720 is further configured to:
[0127] Obtain the start time, the end time, and the preset time interval;
[0128] The first processing is performed based on the preset time interval, the start time, and the end time to obtain the horizontal axis of the line chart to be generated.
[0129] In an optional embodiment, the input parameters further include a preset DSL statement, and the second processing module 730 is further configured to:
[0130] Obtain the preset DSL statement;
[0131] Based on the preset DSL statement and the data to be displayed, values are assigned to the ordinates corresponding to at least a portion of the horizontal coordinates.
[0132] In an optional embodiment, the preset DSL statement is a cron expression, and the second processing module 730 is further configured to:
[0133] The cron expression is parsed to obtain the parsing result;
[0134] Based on the analysis results, the required target data is obtained from the data to be displayed;
[0135] Based on the target data and the cron expression, a calculation is performed to determine the result of the calculation of the first ordinate, which is the ordinate corresponding to the cron expression;
[0136] The result of the calculation is assigned to the first vertical coordinate.
[0137] In an optional embodiment, the input parameters further include a replacement array, and the device 700 is also used for:
[0138] Obtain the replacement array and determine the second ordinate corresponding to the replacement array;
[0139] The second ordinate is assigned a value based on the replacement array. In an optional embodiment, the input parameter further includes an aggregation threshold, and the device 700 is further used for:
[0140] Obtain the aggregation threshold;
[0141] The data to be displayed is aggregated based on the aggregation threshold.
[0142] Example 3
[0143] Figure 9 This illustration schematically shows a hardware architecture diagram of a computer device 10000 suitable for implementing a data display method according to Embodiment 3 of this application. In some embodiments, the computer device 10000 may be a terminal device such as a smartphone, wearable device, tablet computer, personal computer, in-vehicle terminal, game console, virtual device, workbench, digital assistant, set-top box, robot, etc. In other embodiments, the computer device 10000 may be a rack server, blade server, tower server, or cabinet server (including independent servers or server clusters composed of multiple servers), etc. Figure 9 As shown, the computer device 10000 includes, but is not limited to: a memory 10010, a processor 10020, and a network interface 10030 that can communicate and be linked with each other via a system bus. Wherein:
[0144] The memory 10010 includes at least one type of computer-readable storage medium, including flash memory, hard disk, multimedia card, card-type memory (e.g., SD or DX memory), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, magnetic disk, optical disk, etc. In some embodiments, the memory 10010 may be an internal storage module of a computer device 10000, such as the hard disk or memory of the computer device 10000. In other embodiments, the memory 10010 may also be an external storage device of the computer device 10000, such as a plug-in hard disk, smart media card (SMC), secure digital (SD) card, flash card, etc., equipped on the computer device 10000. Of course, the memory 10010 may also include both the internal storage module and the external storage device of the computer device 10000. In this embodiment, the memory 10010 is typically used to store the operating system and various application software installed on the computer device 10000, such as program code for data display methods. Furthermore, the memory 10010 can also be used to temporarily store various types of data that have already been output or will be output.
[0145] In some embodiments, processor 10020 may be a central processing unit (CPU), controller, microcontroller, microprocessor, or other chip. Processor 10020 is typically used to control the overall operation of computer device 10000, such as performing control and processing related to data interaction or communication with computer device 10000. In this embodiment, processor 10020 is used to run program code stored in memory 10010 or process data.
[0146] Network interface 10030 may include a wireless network interface or a wired network interface, which is typically used to establish a communication link between computer device 10000 and other computer devices. For example, network interface 10030 is used to connect computer device 10000 to an external terminal via a network, establishing a data transmission channel and communication link between computer device 10000 and the external terminal. The network may be an intranet, the Internet, Global System for Mobile Communication (GSM), Wideband Code Division Multiple Access (WCDMA), 4G network, 5G network, Bluetooth, Wi-Fi, or other wireless or wired networks.
[0147] It should be pointed out that, Figure 9 Only computer devices with components 10010-10030 are shown; however, it should be understood that it is not required to implement all of the shown components, and more or fewer components may be implemented instead.
[0148] In this embodiment, the data display method stored in memory 10010 can also be divided into one or more program modules and executed by one or more processors (such as processor 10020) to complete the embodiment of this application.
[0149] Example 4
[0150] This application also provides a computer-readable storage medium storing a computer program thereon, wherein the computer program, when executed by a processor, implements the steps of the data display method in the embodiments.
[0151] In this embodiment, the computer-readable storage medium includes flash memory, hard disk, multimedia card, card-type memory (e.g., SD or DX memory), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, magnetic disk, optical disk, etc. In some embodiments, the computer-readable storage medium can be an internal storage unit of a computer device, such as the hard disk or memory of the computer device. In other embodiments, the computer-readable storage medium can also be an external storage device of the computer device, such as a plug-in hard disk, smart media card (SMC), secure digital (SD) card, flash card, etc., equipped on the computer device. Of course, the computer-readable storage medium can also include both the internal storage unit and the external storage device of the computer device. In this embodiment, the computer-readable storage medium is typically used to store the operating system and various application software installed on the computer device, such as the program code of the data display method in the embodiment. In addition, the computer-readable storage medium can also be used to temporarily store various types of data that have been output or will be output.
[0152] Example 5
[0153] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the methods described in the above embodiments.
[0154] Obviously, those skilled in the art should understand that the modules or steps of the embodiments of this application described above can be implemented using general-purpose computer devices. They can be centralized on a single computer device or distributed across a network of multiple computer devices. Optionally, they can be implemented using computer-executable program code, thereby storing them in a storage device for execution by a computer device. In some cases, the steps shown or described can be performed in a different order than those presented here, or they can be fabricated as separate integrated circuit modules, or multiple modules or steps can be fabricated as a single integrated circuit module. Thus, the embodiments of this application are not limited to any particular combination of hardware and software.
[0155] It should be noted that the above are merely preferred embodiments of this application and do not limit the scope of patent protection of this application. Any equivalent structural or procedural changes made using the content of this application's specification and drawings, or direct or indirect applications in other related technical fields, are similarly included within the scope of patent protection of this application.
Claims
1. A data display method, characterized in that, The method includes: Obtain the data to be displayed and the input parameters, wherein the input parameters include at least a preset time interval; The first processing is performed based on the input parameters, and the horizontal axis of the line chart to be generated is determined based on the result of the first processing. The first processing includes at least setting the adjacent values of the horizontal axis apart by the preset time interval. The second processing is performed on the data to be displayed, and the vertical axis of the line chart to be generated is determined based on the result of the second processing. The second processing includes at least one of the following: assigning values to the vertical axis corresponding to at least a portion of the horizontal axis and performing aggregation processing on a portion of the data to be displayed. A line chart is generated based on the horizontal and vertical axes for display. The input parameters also include a preset DSL statement, and the second processing based on the data to be displayed includes: Obtain the preset DSL statement, wherein the preset DSL statement is a cron expression; The cron expression is parsed to obtain the parsing result; Based on the analysis results, the required target data is obtained from the data to be displayed; Based on the target data and the cron expression, a calculation is performed to determine the result of the calculation of the first ordinate, which is the ordinate corresponding to the cron expression; The result of the calculation is assigned to the first vertical coordinate.
2. The method according to claim 1, characterized in that, The input parameters also include start time and end time; Correspondingly, the first processing based on the input parameters, and the determination of the horizontal axis of the line chart to be generated based on the result of the first processing, includes: Obtain the start time, the end time, and the preset time interval; The first processing is performed based on the preset time interval, the start time, and the end time to obtain the horizontal axis of the line chart to be generated.
3. The method according to claim 1, characterized in that, The input parameters also include a replacement array; correspondingly, the method further includes: Obtain the replacement array and determine the second ordinate corresponding to the replacement array; The second ordinate is assigned a value based on the replacement array.
4. The method according to any one of claims 1-3, characterized in that, The input parameters also include an aggregation threshold; Correspondingly, the second processing based on the data to be displayed includes: Obtain the aggregation threshold; The data to be displayed is aggregated based on the aggregation threshold.
5. A data display device, characterized in that, The device includes: The acquisition module is used to acquire the data to be displayed and the input parameters, wherein the input parameters include at least a preset time interval; A first processing module is configured to perform a first processing based on the input parameters and determine the horizontal coordinate of the line chart to be generated based on the result of the first processing. The first processing includes at least setting adjacent values of the horizontal coordinate to be separated by the preset time interval. The second processing module is used to perform a second processing based on the data to be displayed, and to determine the vertical coordinate of the line chart to be generated based on the result of the second processing. The second processing includes at least one of assigning values to the vertical coordinates corresponding to at least a portion of the horizontal coordinates and performing aggregation processing on a portion of the data to be displayed. The generation module is used to generate a line chart based on the horizontal and vertical coordinates for display. The input parameters also include a preset DSL statement, and the second processing based on the data to be displayed includes: Obtain the preset DSL statement, wherein the preset DSL statement is a cron expression; The cron expression is parsed to obtain the parsing result; Based on the analysis results, the required target data is obtained from the data to be displayed; Based on the target data and the cron expression, a calculation is performed to determine the result of the calculation of the first ordinate, which is the ordinate corresponding to the cron expression; The result of the calculation is assigned to the first vertical coordinate.
6. A computer device, characterized in that, include: At least one processor; and A memory communicatively connected to the at least one processor; wherein: The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform the method of any one of claims 1 to 4.
7. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions that, when executed by a processor, implement the method as described in any one of claims 1 to 4.
8. A computer program product, comprising a computer program, characterized in that, When executed by a processor, the computer program implements the steps of the method according to any one of claims 1 to 4.
Citation Information
Patent Citations
Data display method and apparatus
CN108073558A