A data distribution based horizontal histogram display method and related device
By analyzing the data distribution, the scale ratio and display size of the horizontal bar chart were determined, which solved the problem of incomplete display of the horizontal bar chart, achieved complete data display, and improved the display effect.
Patent Information
- Application Number
- CN202210693372.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-17
- Publication Date
- 2025-11-25
- Estimated Expiration
- 2042-06-17
AI Technical Summary
When horizontal bar charts are displayed on electronic devices, the display area is easily limited, resulting in some data being obscured or numbers being incomplete, which affects the interface display effect and user experience.
By analyzing the distribution of the indicator data to be displayed, the scale ratio of the horizontal bar chart is determined, and the display size and attributes of the data are set according to the scale to generate a complete horizontal bar chart.
This avoids the problem of parts of the horizontal bar chart being obscured or not fully displayed, improves the display effect, and ensures that the data is displayed completely.
Smart Images

Figure CN114996542B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the network technical field, and particularly relates to a horizontal column chart display method based on data distribution and related equipment. BACKGROUND
[0002] A chart is a powerful tool for communication. A simple chart can express your thoughts and intentions more clearly than thousands of words, and make complex language simple and clear, and more persuasive. Especially when using a chart to display data, you can more clearly understand the distribution of scattered data in the same category or the rules and trends of data changes.
[0003] When displaying a horizontal column chart on an electronic device, it is more likely to be limited by the display area. In addition, irregular data often leads to the problem that the horizontal column chart and the numbers are covered and not completely displayed on the display page. In addition, the distance from the right side of the horizontal column chart to the display border is inconsistent, which affects the interface display effect and user experience. SUMMARY
[0004] The purpose of the embodiment of the present application is to provide a horizontal column chart display method based on data distribution and related equipment, which solves the problem of incomplete display of the horizontal column chart.
[0005] In order to solve the above technical problems, the embodiment of the present application provides a horizontal column chart display method based on data distribution, which adopts the following technical scheme:
[0006] Receive all to-be-displayed index data returned by a preset interface;
[0007] Analyze the distribution of all the to-be-displayed index data to obtain analysis result data;
[0008] Determine the scale ratio of the horizontal column chart according to the analysis result data;
[0009] Determine the display size of all the to-be-displayed index data according to the scale ratio of the horizontal column chart;
[0010] Set the display size of all the to-be-displayed index data as the attribute of the horizontal column chart, and generate the display of the horizontal column chart on a target display end according to the attribute.
[0011] In order to solve the above technical problems, the embodiment of the present application also provides a horizontal column chart display device based on data distribution, which adopts the following technical scheme:
[0012] A data receiving module is configured to receive all to-be-displayed index data returned by a preset interface;
[0013] A data analysis module is configured to analyze distribution of all the to-be-displayed index data and obtain analysis result data.
[0014] A scale determination module is configured to determine a scale of the horizontal column chart according to the analysis result data.
[0015] A size determination module is configured to determine display sizes of all the to-be-displayed index data according to the scale of the horizontal column chart.
[0016] A data display module is configured to set the display sizes of all the to-be-displayed index data as attributes of the horizontal column chart, and generate the horizontal column chart displayed on the target display end according to the attributes.
[0017] To solve the above technical problems, the embodiment of the present application further provides a computer device, which adopts the technical scheme as follows:
[0018] The computer device comprises a memory and a processor, the memory stores computer readable instructions, and the processor executes the computer readable instructions to realize the steps of the horizontal column chart display method based on data distribution.
[0019] To solve the above technical problems, the embodiment of the present application further provides a computer readable storage medium, which adopts the technical scheme as follows:
[0020] The computer readable storage medium stores computer readable instructions, and the computer readable instructions are executed by the processor to realize the steps of the horizontal column chart display method based on data distribution.
[0021] Compared with the prior art, the embodiment of the present application has the following beneficial effects:
[0022] The present application determines the scale of the horizontal column chart by analyzing the distribution of all the data, further determines the attribute parameters of the horizontal column chart, and generates the complete horizontal column chart displayed on the target display end, thereby avoiding the problem that the horizontal column chart is partially blocked or not completely displayed, and improving the display effect. BRIEF DESCRIPTION OF DRAWINGS
[0023] To more clearly illustrate the schemes in the present application, the drawings needed in the description of the embodiments of the present application will be briefly introduced. Obviously, the drawings in the following description are some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor.
[0024] Figure 1 is the implementation flowchart of the horizontal column chart display method based on data distribution provided by the first embodiment of the present application;
[0025] Figure 2 is Figure 1 is an implementation flowchart of step S103 in
[0026] Figure 3 is an implementation flowchart of determining whether to display a margin in the data distribution-based horizontal column chart display method provided by the embodiment;
[0027] Figure 4 is a structural schematic diagram of the data distribution-based horizontal column chart display device provided by the second embodiment of the application;
[0028] Figure 5 is Figure 4 is a structural schematic diagram of the scale determining module 130 in
[0029] Figure 6 is a structural schematic diagram of an embodiment of the computer device according to the application. DETAILED DESCRIPTION
[0030] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs; the terminology used in the description herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the application; the description herein and the claims of the application and the above description of the drawings herein, the terms "comprising", "comprises" and "having" and any variations thereof are intended to cover without limitation; the description herein and the claims of the application or the above description of the drawings herein, the terms "first", "second" and the like are used to distinguish different objects, not to describe a particular order.
[0031] Reference herein to "an embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment can be included in at least one embodiment of the application. The appearances of the phrase that the phrase in the specification appear in various places in the specification do not necessarily all refer to the same embodiment, or necessarily alternatives thereof, although the applicant reserves the right to so designate the claims and specification in order to manage its intellectual property. It will be explicitly understood by one of ordinary skill in the art that the embodiments described herein can be combined with other embodiments.
[0032] In order to make the person skilled in the art better understand the scheme of the application, the technical solutions in the embodiments of the application will be clearly and completely described below with reference to the drawings.
[0033] Embodiment One
[0034] As shown in Figure 1 , an implementation flowchart of the data distribution-based horizontal column chart display method provided by the first embodiment of the application is shown, and only the parts related to the application are shown for the purpose of illustration.
[0035] The method for displaying horizontal bar charts based on data distribution provided in this embodiment includes the following steps:
[0036] Step S101: Receive all the indicator data to be displayed returned by the preset interface.
[0037] In this embodiment of the application, indicator data refers to data that represents the same indicator quantity, and preset interface refers to a system module or component used to receive indicator data to be displayed. The preset interface returns one or more sets of indicator data for drawing a horizontal bar chart for display on the target display terminal, such as a mobile phone.
[0038] Step S102: Analyze the distribution of all the indicator data to be displayed to obtain the analysis result data.
[0039] In this embodiment, the distribution of the indicator data to be displayed refers to the situation where the indicator data falls within a certain data range, specifically including data sign, data size, ratio of maximum to minimum values, etc. The analysis result data refers to one or more of the data such as data sign, data size, and ratio of maximum to minimum values. The display style of the horizontal bar chart is affected by the distribution of the indicator data.
[0040] In some optional implementations of this embodiment, step S102 specifically includes: sorting all the indicator data to be displayed to obtain a data arrangement distribution, and obtaining the maximum and minimum values in the data arrangement distribution as the analysis result data.
[0041] In this embodiment of the application, the maximum and minimum values of all the indicator data to be displayed are obtained to calculate the value range of the indicator data to be displayed, and are further used to determine the scale of the horizontal bar chart.
[0042] Step S103: Determine the scale of the horizontal bar chart based on the analysis results data.
[0043] refer to Figure 2 The diagram illustrates a possible implementation flowchart of step S103. For ease of explanation, only the parts relevant to this application are shown. In an optional implementation, step S103 specifically includes:
[0044] Step S201: Calculate the value range of all the indicator data to be displayed, where the value range of the indicator data to be displayed is the difference between the maximum and minimum values.
[0045] In this embodiment, the value range of the indicator data to be displayed refers to the distribution interval of all indicator data to be displayed, that is, the indicator values of the left and right endpoints of the horizontal bar chart. The difference between the maximum and minimum values of the indicator data to be displayed is calculated as the value range of the indicator data to be displayed.
[0046] Step S202: determining a display value range of the target display end according to preset parameters, the preset parameters including a maximum display value and a minimum display value of a display region of the target display end and a display value range, the display value range being a difference between the maximum display value and the minimum display value.
[0047] In the embodiment of the present application, the display value range of the target display end is determined according to preset parameters. The display value range refers to a preset numerical interval displayed by the display region of the target display end, that is, a maximum numerical interval that can be displayed by the horizontal column chart. The display value range can be a preset fixed value or can be dynamically adjusted according to the data received by the preset interface.
[0048] Step S203: determining a scale ratio of the horizontal column chart as a ratio of a value range of the to-be-displayed index data to the display value range.
[0049] In the embodiment of the present application, the to-be-displayed index data is mapped to the display value range of the target display end according to a preset mapping rule. The mapping rule can be linear mapping or nonlinear mapping. When the linear mapping rule is used, the scale ratio of the horizontal column chart is determined as a ratio of a value range of the to-be-displayed index data to the display value range, and all the to-be-displayed index data is mapped to the display value range at an equal ratio.
[0050] In the embodiment of the present application, when the to-be-displayed index data is displayed by the horizontal column chart, the to-be-displayed index data needs to be mapped to the display value range of the target display end according to a preset mapping rule due to the limitation of the display effect and the display region of the target display end. The mapping rule can be linear mapping or nonlinear mapping. Different scale ratios are obtained according to different mapping rules, and then different display effects are obtained.
[0051] In the embodiment of the present application, the scale ratio of the horizontal column chart is determined by the linear mapping rule in combination with the preset parameters of the analysis result data and the display region, and the to-be-displayed index data is displayed at an equal ratio on the target display end.
[0052] Step S104: determining display sizes of all the to-be-displayed index data according to the scale ratio of the horizontal column chart.
[0053] In some optional implementation manners of the embodiment, the above step S104 specifically includes: mapping all the to-be-displayed index data to the display region of the target display end at the scale ratio of the horizontal column chart to obtain the display sizes of all the to-be-displayed index data.
[0054] In the embodiment of the present application, the ratio of the value range of the to-be-displayed index data and the display value range is determined as the scale ratio of the horizontal column chart, and all the to-be-displayed index data is proportionally mapped into the display value range by using the linear mapping rule. The display size of the to-be-displayed index data is determined by using the product of the to-be-displayed index data and the scale ratio of the horizontal column chart, and the unit of the display size of the to-be-displayed index data corresponds to the display unit of the target display terminal, such as a pixel.
[0055] In step S105, the display sizes of all the to-be-displayed index data are set as the attributes of the horizontal column chart, and the horizontal column chart is generated and displayed on the target display terminal according to the attributes.
[0056] In the embodiment of the present application, the horizontal column chart is drawn on the target display terminal by using Echarts, and the related attributes of the horizontal column chart are set by using the application program interface in Echarts. For example, the distance between the horizontal column chart and the upper, lower, left and right can be set by using the grid control in the Echarts configuration, and the value, width and style of the horizontal column chart can be set by using the series control. The value of the horizontal column chart is used to specify the data attribute, and the display sizes of all the to-be-displayed index data are set as the data attribute of the horizontal column chart, so that the length of the generated horizontal column chart represents the value of the to-be-displayed index data.
[0057] The horizontal column chart display method based on data distribution provided in the present application comprises the following steps: receiving all to-be-displayed index data returned by a preset interface; analyzing the distribution of all the to-be-displayed index data to obtain analysis result data; determining the scale ratio of the horizontal column chart according to the analysis result data; determining the display size of all the to-be-displayed index data according to the scale ratio of the horizontal column chart; setting the display sizes of all the to-be-displayed index data as the attributes of the horizontal column chart, and generating the horizontal column chart on the target display terminal according to the attributes. The scale ratio of the horizontal column chart is determined by analyzing the distribution of all the data, and the attribute parameters of the horizontal column chart are further determined, so that the complete horizontal column chart is generated and displayed on the target display terminal, thereby avoiding the problem that the horizontal column chart is partially blocked or not completely displayed, and improving the display effect.
[0058] In some optional implementation manners of the embodiment, after step S104, the horizontal column chart display method based on data distribution further comprises: determining whether the margin is displayed according to the distribution of the to-be-displayed index data.
[0059] In the embodiment of the present application, the margin refers to the distance of the horizontal column chart from the upper, lower, left and right boundaries of the display area. Whether the margin is displayed and the specific display area are specified by dynamically setting the properties of the grid control provided by the application program interface of Echarts. When the to-be-displayed index data has special data, the margin setting of the horizontal column chart will affect whether the column chart can be displayed completely and whether the column chart is displayed beautifully. Therefore, the distribution of all the to-be-displayed index data is considered before the margin properties are set.
[0060] With reference to the foregoing description Figure 3 In some optional implementation manners of the embodiment, in the horizontal column chart display method based on data distribution, the determination of whether the margin is displayed according to the distribution of the to-be-displayed index data specifically includes:
[0061] Step S301: Determine the signs of the maximum value and the minimum value, and calculate the ratio of the absolute value of the maximum value to the absolute value of the minimum value.
[0062] Step S302: Determine whether the margin is displayed according to the signs of the maximum value and the minimum value and the ratio of the absolute value of the maximum value to the absolute value of the minimum value. If the sign of the minimum value is non-negative, only the left margin is displayed. If the sign of the maximum value is non-positive, the left and right margins are not displayed. If the sign of the minimum value is negative, the sign of the maximum value is positive, and the ratio of the absolute value of the maximum value to the absolute value of the minimum value is not greater than a preset value, the left and right margins are not displayed. If the sign of the minimum value is negative, the sign of the maximum value is positive, and the ratio of the absolute value of the maximum value to the absolute value of the minimum value is greater than the preset value, only the right margin is displayed.
[0063] In the embodiment of the present application, whether the data is distributed on the same side of the coordinate origin is determined by the signs of the maximum value and the minimum value, and whether the data at both ends is too different is determined by the ratio of the absolute value of the maximum value to the absolute value of the minimum value. Whether the data is distributed on the same side of the coordinate origin and whether the data at both ends is too different will affect the display of the margin.
[0064] In the embodiment of the present application, after determining whether the margin is displayed according to the signs of the maximum value and the minimum value and the ratio of the absolute value of the maximum value to the absolute value of the minimum value, appropriate margin values are set for the margins to be displayed to meet the display effect.
[0065] In some optional implementation manners of the embodiment, after the step S104, the horizontal column chart display method based on data distribution further includes:
[0066] The minimum display size of the target display end is taken as the minimum value of the display size, and a numerical literal is marked, wherein the minimum value is the display size of the data in the to-be-displayed index data which is mapped to the display area in the scale ratio of the horizontal column chart and is smaller than the minimum displayable size.
[0067] In the embodiments of the present application, the target display end has a minimum displayable size, for example, 1 pixel. When the result obtained by mapping the to-be-displayed index data to the value range of the target display end is smaller than the minimum displayable size of the target display end, it is determined that the index data is a minimum value. In order to avoid the index data being mistaken for 0, the data is displayed by using the minimum displayable size of the target display end, that is, 1 pixel is displayed, and the numerical value of the data is marked in the form of a literal at the corresponding position of the column chart. When multiple index data are minimum values at the same time, the horizontal column charts of these index data are all drawn by using the minimum displayable size, and the numerical value marked in the form of a literal is used to distinguish the actual size.
[0068] The horizontal column chart display method based on data distribution provided in the present application determines the scale ratio of the horizontal column chart by analyzing the distribution of all data, further determines the attribute parameters of the horizontal column chart, and generates a complete horizontal column chart displayed on the target display end, thereby avoiding the problem that the horizontal column chart is partially blocked or not completely displayed, and improving the display effect. At the same time, different margin display modes are determined according to different data distribution conditions, so that the margin of the horizontal column chart is displayed completely.
[0069] It should be emphasized that, in order to further ensure the privacy and security of information, the to-be-displayed index data and the data distribution analysis result data can be stored in a node of a blockchain. The blockchain referred to in the present application is a new application mode of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanism and encryption algorithm. The blockchain is essentially a decentralized database, and is a series of data blocks associated by using cryptographic methods, each data block contains the information of a batch of network transactions, and is used to verify the validity (anti-fake) of the information and generate the next block. The blockchain can include a blockchain underlying platform, a platform product service layer and an application service layer.
[0070] The detailed description is described with reference to the accompanying figures. The terminology used in the description is not intended to be limiting. The terms "program," "software module," "application," "module," "system," etc. are used interchangeably herein. Each of these terms can refer to memory that contains instructions that when executed by a processor, cause the processor to perform a certain function. When a module is invoked, the code in the module is executed using the processor. In this context, a processor can be a single core processor; a plurality of core processors; a processor with multiple cores within the same die; a heterogeneous processor platform including of different processors within the same die; and so forth. The application can be practiced in a variety of computer system environments. For example: personal computers, server computers, hand-held devices, portable devices, tablet devices, multiprocessor systems, microprocessor-based systems, set top boxes, programmable consumer electronics, network PCs, minicomputers, mainframe computers, distributed computing environments that include any of the above systems or devices, and the like. The application can be described in the general context of computer-executable instructions, such as program modules, being executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, and the like, that perform particular tasks or implement particular abstract data types. The application can also be practiced in distributed computing environments where tasks are performed by remote processing devices that are linked through a communications network. In a distributed computing environment, program modules can be located in local and remote computer storage media including memory storage devices.
[0071] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be implemented by instructing relevant hardware through computer readable instructions, and the computer readable instructions can be stored in a computer readable storage medium. When the computer readable instructions are executed, the processes of the above-mentioned embodiments of the methods can be included. The storage medium can be a non-volatile storage medium such as a magnetic disk, an optical disk, a read-only memory (ROM), or a random access memory (RAM).
[0072] It should be understood that although each step in the flowchart of the accompanying drawings is displayed in sequence according to the direction of the arrow, these steps are not necessarily executed in sequence according to the direction of the arrow. Unless otherwise specified herein, the execution of these steps is not strictly limited in sequence, and they can be executed in other sequences. Moreover, at least part of the steps in the flowchart of the accompanying drawings can include multiple sub-steps or multiple stages, which are not necessarily executed at the same time, but can be executed at different times, and the execution sequence is not necessarily sequential, but can be executed alternately or alternately with at least part of other steps or sub-steps or stages of other steps.
[0073] Embodiment Two
[0074] Further reference Figure 4 to the method shown in the above Figure 1 , the application provides an embodiment of a data distribution-based horizontal column chart display device, which corresponds to the method embodiment shown in Figure 1 , and the device can be applied to various electronic devices.
[0075] AsFigure 4 As shown, the data distribution-based horizontal histogram display device 100 of the embodiment includes a data receiving module 110, a data analysis module 120, a scale determining module 130, a size determining module 140, and a data display module 150. Among them:
[0076] The data receiving module 110 is configured to receive all to-be-displayed index data returned by a preset interface.
[0077] The data analysis module 120 is configured to analyze the distribution of all the to-be-displayed index data to obtain analysis result data.
[0078] The scale determining module 130 is configured to determine the scale ratio of the horizontal histogram according to the analysis result data.
[0079] The size determining module 140 is configured to determine the display size of all the to-be-displayed index data according to the scale ratio of the horizontal histogram.
[0080] The data display module 150 is configured to set the display size of all the to-be-displayed index data as an attribute of the horizontal histogram, and generate the horizontal histogram displayed on a target display end according to the attribute.
[0081] In the embodiment, the data receiving module 110 receives all to-be-displayed index data returned by a preset interface. The index data refers to data representing the same index quantity, the preset interface refers to a system module or component for receiving to-be-displayed index data, and the preset interface returns one or more groups of index data for drawing a horizontal histogram.
[0082] In the embodiment, the data analysis module 120 analyzes the distribution of all the to-be-displayed index data to obtain analysis result data. The distribution of the to-be-displayed index data refers to the case that the to-be-displayed index data falls in a certain data interval, and specifically includes data symbols, data sizes, and the ratio of maximum and minimum values. The analysis result data refers to one or more of the data symbols, data sizes, and the ratio of maximum and minimum values. The display style of the horizontal histogram is affected by the distribution of the index data.
[0083] In some optional implementation manners of the embodiment, the data analysis module 120 is specifically configured to sort all the to-be-displayed index data to obtain a data arrangement distribution, and obtain the maximum value and the minimum value in the data arrangement distribution as the analysis result data.
[0084] In the embodiment, the data analysis module 120 obtains the maximum value and the minimum value of all the to-be-displayed index data to calculate the value range of the to-be-displayed index data, and further determines the scale ratio of the horizontal histogram.
[0085] In the embodiment of the present application, when the scale determining module 130 displays the to-be-displayed index data in a horizontal histogram, due to the limitation of display effect and display area of the target display terminal, the to-be-displayed index data needs to be mapped to the display value range of the target display terminal according to a preset mapping rule. The mapping rule can be linear mapping or nonlinear mapping, different scales are obtained according to different mapping rules, and then different display effects are obtained.
[0086] In the embodiment of the present application, the scale determining module 130 combines the analysis result data and the preset parameters of the display area to determine the scale of the horizontal histogram in a linear mapping rule, and the to-be-displayed index data is displayed in the target display terminal in equal proportion.
[0087] Reference Figure 5 , the scale determining module 130 is shown. For ease of illustration, only the parts related to the present application are shown.
[0088] In some optional implementation manners of the embodiment, the scale determining module 130 specifically comprises: a data value range calculation sub-module 131, a display value range acquisition sub-module 132, and a scale calculation sub-module 133.
[0089] Among them:
[0090] The data value range calculation sub-module 131 is configured to calculate the value range of all the to-be-displayed index data, and the value range of the to-be-displayed index data is the difference between the maximum value and the minimum value.
[0091] The display value range acquisition sub-module 132 is configured to acquire the display value range according to preset parameters, and the preset parameters comprise the maximum display value and the minimum display value of the display area of the target display terminal and the display value range, and the display value range is the difference between the maximum display value and the minimum display value.
[0092] The scale calculation sub-module 133 is configured to determine the ratio of the value range of the to-be-displayed index data to the display value range as the scale of the horizontal histogram.
[0093] In the embodiment of the present application, the value range of the to-be-displayed index data refers to the distribution interval of all the to-be-displayed index data, that is, the indication value of the left and right endpoints of the horizontal histogram. The data value range calculation sub-module 131 calculates the difference between the maximum value and the minimum value of the to-be-displayed index data as the value range of the to-be-displayed index data.
[0094] In the embodiment of the present application, the display value range acquisition sub-module 132 determines the display value range of the target display terminal according to preset parameters. The display value range refers to the preset numerical interval displayed by the display area of the target display terminal, that is, the maximum numerical interval that can be displayed by the horizontal histogram. The display value range can be a preset fixed value or can be dynamically adjusted according to the data received by the preset interface.
[0095] In the embodiment of the present application, the ruler scale calculation submodule 133 maps the to-be-displayed index data to the display value range of the target display end according to a preset mapping rule, which can be linear mapping or nonlinear mapping. Using the linear mapping rule, the ratio of the value range of the to-be-displayed index data to the display value range is determined as the ruler scale of the horizontal column chart, and all the to-be-displayed index data are mapped into the display value range at the same scale.
[0096] In some optional implementation manners of the embodiment, the size determination module 140 is specifically configured to: map all the to-be-displayed index data to the display region of the target display end at the ruler scale of the horizontal column chart, to obtain the display sizes of all the to-be-displayed index data.
[0097] In the embodiment of the present application, the size determination module 140 uses the linear mapping rule, determines the ratio of the value range of the to-be-displayed index data to the display value range as the ruler scale of the horizontal column chart, and maps all the to-be-displayed index data into the display value range at the same scale. The product of the to-be-displayed index data and the ruler scale of the horizontal column chart is used as the display size of the to-be-displayed index data, and the unit of the display size of the to-be-displayed index data corresponds to the display unit of the target display end, such as a pixel.
[0098] In the embodiment of the present application, the data display module 150 sets the display sizes of all the to-be-displayed index data as the properties of the horizontal column chart. The Echarts is introduced to draw the horizontal column chart on the target display end, and the related properties of the horizontal column chart are set through the application program interface in the Echarts, for example, the distance of the horizontal column chart from the top, bottom, left and right can be set through the grid control in the Echarts configuration, and the value, width, style and the like of the horizontal column chart are configured through the series control. The value of the horizontal column chart is used to specify the data attribute, and the display sizes of all the to-be-displayed index data are set as the data attribute of the horizontal column chart, so that the length of the generated horizontal column chart represents the values of the to-be-displayed index data.
[0099] The horizontal column chart display device based on data distribution provided in the present application determines the ruler scale of the horizontal column chart by analyzing the distribution of all the data, further determines the attribute parameters of the horizontal column chart, and generates a complete horizontal column chart to be displayed on the target display end, thereby avoiding the problem that the horizontal column chart display part is blocked or not completely displayed, and improving the display effect.
[0100] In some optional implementation of the embodiment, after determining the display size of all the to-be-displayed index data according to the scale of the horizontal histogram, the size determining module 140 is further configured to determine whether to display the margin according to the distribution of the to-be-displayed index data.
[0101] In the embodiment, the margin refers to the distance between the horizontal histogram and the upper, lower, left and right boundaries of the display area. The display of the margin and the specific display area are specified by dynamically setting the properties of the grid control provided by the application program interface of Echarts. When the to-be-displayed index data contains special data, the margin setting of the horizontal histogram will affect whether the histogram can be displayed completely and whether the histogram is displayed beautifully. Therefore, the size determining module 140 considers the distribution of all the to-be-displayed index data before setting the margin properties.
[0102] In some optional implementation of the embodiment, when determining whether to display the margin according to the distribution of the to-be-displayed index data, the size determining module 140 is specifically configured to:
[0103] determine the sign of the maximum value and the sign of the minimum value, and calculate the ratio of the absolute value of the maximum value to the absolute value of the minimum value;
[0104] determine whether to display the margin according to the sign of the maximum value and the sign of the minimum value and the ratio of the absolute value of the maximum value to the absolute value of the minimum value. If the sign of the minimum value is non-negative, only the left margin is displayed. If the sign of the maximum value is non-positive, the left and right margins are not displayed. If the sign of the minimum value is negative, the sign of the maximum value is positive, and the ratio of the absolute value of the maximum value to the absolute value of the minimum value is not greater than a preset value, the left and right margins are not displayed. If the sign of the minimum value is negative, the sign of the maximum value is positive, and the ratio of the absolute value of the maximum value to the absolute value of the minimum value is greater than the preset value, only the right margin is displayed.
[0105] In the embodiment, the size determining module 140 determines whether the data is distributed on the same side of the coordinate origin by determining the sign of the maximum value and the sign of the minimum value, and determines whether the data at both ends is too large by calculating the ratio of the absolute value of the maximum value to the absolute value of the minimum value. Whether the data is distributed on the same side of the coordinate origin and whether the data at both ends is too large will affect the display of the margin.
[0106] In the embodiment, after determining whether to display the margin according to the sign of the maximum value and the sign of the minimum value and the ratio of the absolute value of the maximum value to the absolute value of the minimum value, the size determining module 140 sets appropriate margin values for the margins to be displayed to meet the display effect.
[0107] In some optional implementations of the embodiment, after the size determining module 140 determines the display size of all the to-be-displayed index data according to the scale of the transverse histogram, the size determining module 140 is further configured to:
[0108] taking the minimum displayable size of the target display end as the minimum value of the display size, and marking the numerical literal, the minimum value being the display size of the to-be-displayed index data that is less than the minimum displayable size after the to-be-displayed index data is mapped to the display region according to the scale of the transverse histogram.
[0109] In the embodiment, the target display end has a minimum displayable size, for example, 1 pixel. When the size determining module 140 maps the to-be-displayed index data to the display value range of the target display end and the result is less than the minimum displayable size of the target display end, it is determined that the index data is the minimum value. To avoid the index data being mistaken for 0, the index data is displayed as the minimum displayable size of the target display end, that is, 1 pixel, and the numerical literal of the data is marked in the form of a literal at the corresponding position of the histogram. When multiple index data are the minimum value at the same time, the transverse histograms of the index data are all drawn with the minimum displayable size, and the numerical literal is used to distinguish the actual size.
[0110] In summary, the transverse histogram display device based on data distribution provided in the application determines the scale of the transverse histogram by analyzing the distribution of all the data, further determines the attribute parameters of the transverse histogram, and generates a complete transverse histogram to be displayed on the target display end, thereby avoiding the problem that the transverse histogram display is partially blocked or not completely displayed, and improving the display effect. At the same time, different margin display modes are determined according to different data distribution conditions, so that the margin of the transverse histogram is displayed completely.
[0111] To solve the above technical problem, the embodiment of the application further provides a computer device. For details, please refer to Figure 6 , Figure 6 The basic structure block diagram of the computer device in the embodiment is shown in FIG. 1.
[0112] The computer device 200 includes a memory 210, a processor 220, and a network interface 230 which are communicatively connected by a system bus. It should be noted that the computer device 200 is only shown with components 210-230, but it should be understood that not all of the shown components are required to be implemented, and more or less components can be alternatively implemented. Among them, those skilled in the art can understand that the computer device herein is a device capable of automatically performing numerical calculation and / or information processing according to pre-set or stored instructions, and its hardware includes but is not limited to microprocessors, application specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), digital signal processors (DSPs), embedded devices, etc.
[0113] The computer device can be a desktop computer, a notebook computer, a palm computer, a cloud server, and the like. The computer device can interact with the user through a keyboard, a mouse, a remote controller, a touchpad, a voice control device, and the like.
[0114] The memory 210 includes at least one type of readable storage medium, including a flash memory, a hard disk, a multimedia card, a card-type memory (e.g., an SD or DX memory, etc.), a random access memory (RAM), a static random access memory (SRAM), a read-only memory (ROM), an electrically erasable programmable read-only memory (EEPROM), a programmable read-only memory (PROM), a magnetic memory, a magnetic disk, an optical disk, and the like. In some embodiments, the memory 210 can be an internal storage unit of the computer device 200, such as a hard disk or a memory of the computer device 200. In other embodiments, the memory 210 can also be an external storage device of the computer device 200, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, and the like. Of course, the memory 210 can also include both the internal storage unit and the external storage device of the computer device 200. In this embodiment, the memory 210 is generally used to store an operating system and various application software installed in the computer device 200, such as computer readable instructions based on the data distribution-based horizontal column chart display method, and the like. In addition, the memory 210 can also be used to temporarily store various data that has been output or will be output.
[0115] The processor 220 may be a central processing unit (CPU), a controller, a microcontroller, a microprocessor, or other data processing chip in some embodiments. The processor 220 is generally used to control the overall operation of the computer device 200. In the present embodiment, the processor 220 is configured to execute computer readable instructions stored in the memory 210 or process data, such as computer readable instructions of the data distribution based horizontal column chart display method.
[0116] The network interface 230 may include a wireless network interface or a wired network interface, and is generally used to establish a communication connection between the computer device 200 and other electronic devices.
[0117] The data distribution based horizontal column chart display method provided in the present application determines the scale of the horizontal column chart by analyzing the distribution of all data, further determines the attribute parameters of the horizontal column chart, and generates a complete horizontal column chart for display on a target display end, thereby avoiding the problem of partial occlusion or incomplete display of the horizontal column chart, and improving the display effect. At the same time, different margin display methods are determined according to different data distribution conditions, so that the margin of the horizontal column chart is displayed completely.
[0118] The present application also provides another embodiment, that is, a computer readable storage medium storing computer readable instructions, which can be executed by at least one processor to enable the at least one processor to perform the steps of the data distribution based horizontal column chart display method as described above.
[0119] The data distribution based horizontal column chart display method provided in the present application determines the scale of the horizontal column chart by analyzing the distribution of all data, further determines the attribute parameters of the horizontal column chart, and generates a complete horizontal column chart for display on a target display end, thereby avoiding the problem of partial occlusion or incomplete display of the horizontal column chart, and improving the display effect. At the same time, different margin display methods are determined according to different data distribution conditions, so that the margin of the horizontal column chart is displayed completely.
[0120] Those skilled in the art can clearly understand the above-mentioned embodiment method can be realized by means of software and the necessary general hardware platform, of course, it can also be realized by hardware, but in many cases, the former is a better embodiment. Based on such understanding, the technical solutions of the present application can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes a plurality of instructions for making a terminal device (which can be a mobile phone, computer, server, air conditioner, or network device, etc.) execute the method described in each embodiment of the present application.
[0121] Obviously, the above-described embodiments are only some of the embodiments of the present application, not all the embodiments, and the drawings show the preferred embodiments of the present application, but do not limit the patent scope of the present application. The present application can be implemented in many different forms, and conversely, the purpose of providing these embodiments is to make the disclosure of the present application more thorough and comprehensive. Although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art can still modify the technical solutions recorded in the foregoing specific embodiments, or make equivalent replacements to some of the technical features. Any equivalent structure made by using the content of the specification and drawings, directly or indirectly applied to other related technical fields, is also within the scope of the patent protection of the present application.
Claims
1. A data distribution-based horizontal histogram display method, characterized by, The method comprises the following steps: receiving all the to-be-displayed index data returned by a preset interface; analyzing the distribution of all the to-be-displayed index data to obtain analysis result data, wherein the step of analyzing the distribution of all the to-be-displayed index data to obtain analysis result data specifically comprises: sorting all the to-be-displayed index data to obtain a data arrangement distribution, and obtaining the maximum value and the minimum value in the data arrangement distribution as the analysis result data; determining the scale ratio of a horizontal column chart according to the analysis result data; determining the display size of all the to-be-displayed index data according to the scale ratio of the horizontal column chart, wherein after the step of determining the display size of all the to-be-displayed index data according to the scale ratio of the horizontal column chart, the method further comprises: taking the minimum displayable size of a target display end as the display size of the minimum value, and marking the numerical value, wherein the minimum value is the data whose display size is smaller than the minimum displayable size after the to-be-displayed index data is mapped to the display area according to the scale ratio of the horizontal column chart, specifically, the target display end has a minimum displayable size, when the to-be-displayed index data is mapped to the display value domain of the target display end, and the obtained result is smaller than the minimum displayable size of the target display end, it is determined that the to-be-displayed index data is the minimum value, the minimum displayable size of the target display end is used to display the minimum value, and the numerical value of the to-be-displayed index data is marked in the form of text at the corresponding position of the target horizontal column chart, wherein the target horizontal column chart represents the horizontal column chart corresponding to the horizontal width when the to-be-displayed index data is the minimum value, and the horizontal column chart has the minimum displayable size; setting the display size of all the to-be-displayed index data as the attribute of the horizontal column chart, and generating the horizontal column chart on the target display end according to the attribute, and specifically, the step of generating the horizontal column chart on the target display end according to the attribute comprises: drawing the horizontal column chart on the target display end by introducing Echarts; setting the distance between the corresponding horizontal column chart and the upper, lower, left and right borders of the display interface, i.e. the margin, by using the grid control in the Echarts configuration, and determining whether the margin is displayed according to the distribution of the to-be-displayed index data, wherein the step of determining whether the margin is displayed according to the distribution of the to-be-displayed index data specifically comprises: determining the signs of the maximum value and the minimum value, and calculating the ratio of the absolute value of the maximum value to the absolute value of the minimum value; The margin is determined according to the sign of the maximum value, the sign of the minimum value, and the ratio of the absolute value of the maximum value to the absolute value of the minimum value; if the sign of the minimum value is non-negative, only the left margin is displayed; if the sign of the maximum value is non-positive, no left and right margins are displayed; if the sign of the minimum value is negative, the sign of the maximum value is positive, and the ratio of the absolute value of the maximum value to the absolute value of the minimum value is not greater than a preset value, no left and right margins are displayed; if the sign of the minimum value is negative, the sign of the maximum value is positive, and the ratio of the absolute value of the maximum value to the absolute value of the minimum value is greater than the preset value, only the right margin is displayed. The value, width and style of the horizontal column chart are configured through a series control, and the value of the horizontal column chart is specified by an attribute, representing the horizontal length of the horizontal column chart.
2. The data distribution-based horizontal histogram display method according to claim 1, wherein, The step of determining the scale ratio of the horizontal column chart according to the analysis result data specifically comprises: calculating the value range of all the to-be-displayed index data, the value range of the to-be-displayed index data being the difference between the maximum value and the minimum value; according to a preset parameter, the preset parameter including the maximum display value and the minimum display value of the display area of the target display end and a display value range, the display value range being the difference between the maximum display value and the minimum display value; determining the ratio of the value range of the to-be-displayed index data to the display value range as the scale ratio of the horizontal column chart.
3. The data distribution based horizontal histogram display method according to any one of claims 1 or 2, characterized in that, The step of determining the display size of all the to-be-displayed index data according to the scale ratio of the horizontal column chart specifically comprises: mapping all the to-be-displayed index data to the display area of the target display end with the scale ratio of the horizontal column chart to obtain the display size of all the to-be-displayed index data.
4. A data distribution-based horizontal histogram display device, characterized by comprising: The horizontal column chart display device based on data distribution is used to implement the steps of the horizontal column chart display method based on data distribution, and comprises: a data receiving module configured to receive all to-be-displayed index data returned by a preset interface; a data analysis module configured to analyze the distribution of all the to-be-displayed index data to obtain analysis result data; a scale determining module configured to determine the scale ratio of the horizontal column chart according to the analysis result data; a size determining module configured to determine the display size of all the to-be-displayed index data according to the scale ratio of the horizontal column chart. The data display module is configured to set display sizes of all the to-be-displayed index data as attributes of a horizontal column chart, and generate the horizontal column chart on a target display end according to the attributes. Specifically, the generating the horizontal column chart on the target display end according to the attributes comprises: introducing the Echarts to draw the horizontal column chart on the target display end; setting a distance of the corresponding horizontal column chart from the upper, lower, left and right borders of a display interface, i.e. a margin, through a grid control in the Echarts configuration, and determining whether the margin is displayed according to a distribution of the to-be-displayed index data; and configuring values, widths and styles of the horizontal column chart through a series control, wherein the values of the horizontal column chart are specified by attributes, and represent a horizontal length of the horizontal column chart. 5.A computer device, comprising a memory and a processor, wherein the memory stores computer readable instructions, and the processor executes the computer readable instructions to implement the steps of the horizontal column chart display method based on data distribution according to any one of claims 1 to 3.
6. A computer-readable storage medium, characterized in that, The computer readable storage medium stores computer readable instructions, and the computer readable instructions are executed by the processor to implement the steps of the horizontal column chart display method based on data distribution according to any one of claims 1 to 3.
Citation Information
Patent Citations
A method and a device for realizing data display
CN109460496A