Detailed Description
In order to make those skilled in the art better understand the technical solutions in the embodiments of the present specification, the technical solutions in the embodiments of the present specification will be described in detail below with reference to the drawings in the embodiments of the present specification, and it is obvious that the described embodiments are only a part of the embodiments of the present specification, and not all the embodiments. All other embodiments that can be derived by one of ordinary skill in the art from the embodiments given herein are intended to be within the scope of protection.
The visual report forms generally comprise contents such as tables, charts and the like, so that data information can be displayed in a visual form, and a user can acquire key information more intuitively and analyze data. From a wide range of flattened charts such as line charts, pie charts, bar charts, stacked bar charts and the like to advanced three-dimensional interactive charts or functional hotspot charts, GIS maps and the like are common visual chart forms.
As shown in fig. 1, the visual report is presented in the form of a graph. The report includes 2 parameters, namely province and date, and 3 kinds of data, namely time, PV (Page View) and UV (Uniform viewer). By selecting different parameter values, i.e. selecting different provinces and dates, the corresponding data information can be dynamically displayed, i.e. the PV and UV graphs of the province at various time points on the day can be displayed.
In addition, along with the updating of the data in the database, the data information in the report can be updated in real time. For example, if the date selected is the day, the graph of the page presentation at 17:00 may be as shown in FIG. 1, while the graph of the page presentation after 19:00 may also include data for 18:00 and 19: 00.
Different visual reports generally show different data information through different parameter types and data types, and when data analysis is required to be performed through the visual reports, the parameter types and the data types included in the reports need to be determined at first, so that a table data structure of bottom data stored in a database is designed.
Taking the report form shown in fig. 1 as an example, it is first determined that the parameter types are province and city, date 2, and the data types are time, PV, and UV 3, so that it can be determined that the data table corresponding to the report form in the database needs to include 2 parameter columns and 3 data columns. Then, in order to improve the data search efficiency and meet the demand of instant analysis, an index needs to be established for 2 parameter columns, so that under the condition that province and date parameter values are specified, corresponding 3 types of data can be quickly searched.
After the data structure of the table is designed according to the parameter types and the data types in the report, indexes of the data table and the parameter columns can be established in the database, and therefore the construction of the visual report is achieved. After the visual report is constructed, by selecting the values of all the parameters in the page, the data corresponding to the call can be quickly searched through the index, and a table, a chart and the like are generated and displayed in the page.
According to the above process, it can be seen that, for different visual reports, because the parameter types, the data types, and the required indexes are different, the table data structures used for storing the underlying data need to be designed respectively, and in addition, if the parameter types in the constructed reports need to be modified, the indexes need to be established again at least.
Therefore, based on the prior art, the visual report construction and data display efficiency is low, and the maintenance difficulty is increased by various table data structures.
In view of the above technical problem, an embodiment of the present disclosure provides a method for displaying visual report data, which is shown in fig. 2 and may include the following steps:
s201, under the condition of receiving a data display request, obtaining data corresponding to a parameter value specified by the data display request according to a multidimensional index of a pre-constructed visual report;
in the embodiment of the specification, the table data structure of the visual report is abstracted, so that a universal table for storing bottom data of different reports is designed and created. The universal table can be directly used for storing bottom data when the visual report is constructed, the multidimensional index of the universal table can be directly used in data display, and the data corresponding to the selected parameter value is obtained for display, so that the efficiency of constructing the visual report and displaying the data is improved.
The general table of the embodiments of the present disclosure may include N parameter columns and M data columns. Each column of parameter columns may correspond to a parameter class and each column of data columns may correspond to a data class. Before the visual report is not constructed, the general table can be an empty table without stored data, and also can be prestored with bottom data which is possibly used for constructing the visual report.
1 universal table can be created in the database in advance, and N and M need to adopt larger numerical values so as to meet the requirements of more visual reports on parameter columns and data columns, and the corresponding parameter columns and data columns can be determined according to the conditions of the parameter types and the data types when the visual lists are constructed.
The database may also be pre-created with a plurality of general tables, and pre-estimate the requirements of different visual reports on the parameter columns and the data columns, and pre-create general tables with different values for N and M, for example, a plurality of general tables including 2 parameter columns and 5 data columns, a plurality of general tables including 5 parameter columns and 10 data columns, a plurality of general tables including 5 parameter columns and 20 data columns, and so on. When the visual list is constructed, the corresponding general list, parameter columns and data columns can be determined according to the conditions of the parameter types and the data types.
In the embodiment of the present specification, a research and development worker may set values of N and M and the number of pre-created general tables according to actual requirements, and may also adjust the values according to requirements in actual application, which is not limited in the present specification.
In addition, when data of the visual report is displayed, rapid searching can be achieved through indexes of the parameter columns, and therefore real-time analysis is conducted.
It can be understood that the more comprehensive the multidimensional index is built, the higher the efficiency of the data query applied to the visual report. For example, 1 two-dimensional index may be established for each 2 rows of parameter columns of the general table, when any 2 rows of the general table correspond to 2 parameter categories of a certain visual report, the two-dimensional index established for the 2 rows in advance may be directly used to query data, and when a certain visual report includes 3 parameter categories, the 3 two-dimensional indexes established pairwise in advance for the corresponding 3 rows of parameter columns need to be used during data query, or at least 2 of the two-dimensional indexes query data are taken to form an intersection, which may be lower than the efficiency of querying data after three-dimensional indexes are established for the 3 parameter rows directly.
Therefore, a relatively comprehensive multidimensional index can be established for each parameter column in the general table, for example, if a general table comprises 4 parameter columns, 6 two-dimensional indexes, 4 three-dimensional indexes and 1 four-dimensional index can be respectively established, so that efficient data query is provided for different possible visual reports.
On the other hand, the more comprehensive establishment of the multidimensional index increases the index amount, so that a person skilled in the art can flexibly establish the multidimensional index according to the actual situation, and the embodiment of the present specification is not limited.
For example, a more comprehensive multidimensional index may be established when the value of N is small, and only two-dimensional and three-dimensional indexes may be established when the value of N is large, and so on.
In addition, different databases, such as MySQL, Oracle, SQL Server, and the like, support different types of indexes, for example, the MySQL database may support types of BTree indexes, hash indexes, full-text indexes, and the like, and the specific type of establishing the index is not limited in the embodiments of the present specification.
Based on a pre-designed and created general table, as shown in fig. 3, in an embodiment of this specification, a method for pre-constructing a visual report may include:
s301, determining the parameter type and the data type in the visual report to be constructed according to the received visual report construction instruction;
s302, determining a parameter column and a data column corresponding to the parameter type and the data type in a preset general table of a database, and obtaining a multi-dimensional index pre-established for the parameter column;
as described above, the pre-created general table may be an empty table, or may store underlying data that may be used to construct a visual report, and correspondingly, when determining the parameter column and the data column corresponding to the parameter category and the data category, it may first check whether the data of the parameter category or the data category is already stored in the general table, if so, the data may be directly called when displaying the data, otherwise, it is necessary to determine the idle parameter column and the data column to store the data.
In an embodiment of the present specification, a corresponding parameter column number n may be obtained according to the number of the parameter categories; obtaining a corresponding data column number m according to the number of the data categories; wherein n and m are positive integers; then, in a preset general table of a database, determining idle n columns of the created multidimensional indexes as parameter columns of the visual report constructed this time, and determining idle m columns of the non-created multidimensional indexes as data columns of the visual report constructed this time; and finally, writing a plurality of data of the visual report constructed this time into the determined parameter column and data column.
As described above, the number of the pre-created common tables may be one or several, and thus, as an example, the corresponding 1 common table may be determined for a certain visual report to be constructed, specifically, any idle common table meeting the preset conditions may be first determined as the target common table of the visual report to be constructed in the plurality of common tables preset in the database; the preset conditions are as follows: the number of preset parameter columns of the target general table is not less than n, and the number of preset data columns of the target general table is not less than m; then, determining n parameter columns in the target general table as the parameter columns for constructing the visual report; and determining the n columns of data columns in the target general table as the data columns for constructing the visual report.
In order to improve the utilization rate of the universal table, when any idle universal table meeting the preset conditions is determined as the target universal table of the visual report constructed this time, the numerical relationship between n and N, M and M can be further compared, and any idle universal table with the minimum parameter column number and/or data column number in the idle universal table meeting the preset conditions is determined as the target universal table of the visual report constructed this time.
In addition, the single table of the database generally has the limitation of the maximum number of records, so that when a general table is created in advance, a plurality of general tables with the same value of N and M can be created, and when a plurality of pieces of data for constructing the visual report form at this time are written into the determined parameter columns and data columns, whether the number of idle records exists in the target general table or not is judged; and if not, determining a second target general table of the visual report constructed this time by using any idle general table meeting the preset conditions in a plurality of preset general tables of the database, wherein the second target general table is used for continuously writing in the data of the visual report constructed this time.
After the visual report is constructed in advance, when a data display request is received, the data corresponding to the parameter value specified by the request can be obtained according to the multidimensional index of the constructed visual report.
S202, displaying the obtained data according to a preset visual report model;
specifically, the visual report model may be displayed in a form of a table, a two-dimensional graph, a three-dimensional graph, or the like, may be displayed in a static or dynamic form, may be set with respect to a line, a color, or the like, and the specification does not limit the preset visual report model.
The following describes a method for displaying visual report data provided in the present specification with reference to a more specific example.
Suppose that a user needs to analyze the page browsing volume PV and the page visiting volume UV of different provinces and cities in a certain webpage at different dates and time periods based on a visual report.
First, a visual report can be constructed. And determining the parameter types as province and date, and the data types as time, PV and UV, so that 2 columns of parameter columns and 3 columns of data columns corresponding to idle states are determined in a preset general table of the database. And writing the bottom layer data into the determined parameter columns and data columns, and obtaining two-dimensional indexes which are created for the 2 columns of parameter columns in advance.
Secondly, a visual report model can be set, for example, a graph form is adopted, the vertical axis is the number, the horizontal axis is the time, the PV curve is red, the UV curve is blue, and the like.
The user can select the parameter values of 2 parameters by clicking a button of a visual report display page, such as selecting Beijing and selecting 2018-02-11 by province and city and date, and triggers a data display request. After receiving the data display request, the data corresponding to the parameter value can be positioned in the bottom layer data stored in the general table according to the two-dimensional index. The data are obtained, the obtained data are displayed according to the preset visual report model, and the display result can be shown in fig. 1.
By applying the scheme, when data needs to be analyzed based on the visual report, the visual report can be directly constructed based on the pre-established general table, and the data can be quickly searched for display through the multidimensional index, so that the data display efficiency of the visual report is improved.
Corresponding to the above method embodiment, an embodiment of the present specification further provides a visual report data display apparatus, and referring to fig. 4, the apparatus may include:
the data acquisition module 120 is configured to, in a case that a data display request is received, acquire data corresponding to a parameter value specified by the data display request according to a multidimensional index of a pre-constructed visual report;
the data display module 130 is used for displaying the obtained data according to a preset visual report model;
the apparatus further includes a report building module 110, including: the category determining submodule 111 is configured to determine, according to the received visual report building instruction, a parameter category and a data category included in a visual report to be built; the index acquisition submodule 112 is configured to determine a parameter column and a data column corresponding to the parameter category and the data category in a preset general table of a database, and obtain a multidimensional index pre-created for the parameter column; in the general table, each parameter type corresponds to one parameter column, each data type corresponds to one data column, and each multidimensional index is an index created based on at least 2 parameter columns.
In a specific embodiment provided in this specification, the index obtaining sub-module 112 may include:
a column number determining unit, configured to obtain a corresponding parameter column number n according to the number of the parameter categories; obtaining a corresponding data column number m according to the number of the data categories; wherein n and m are positive integers;
the report list determining unit is used for determining the idle n columns with the created multi-dimensional indexes as parameter columns for constructing the visual report at this time and determining the idle m columns without the created multi-dimensional indexes as data columns for constructing the visual report at this time in a preset general list of the database;
and the data writing unit is used for writing the plurality of data of the visual report constructed this time into the determined parameter columns and data columns.
In a specific embodiment provided in this specification, the report list determining unit may include:
the universal table determining subunit is used for determining any idle universal table meeting preset conditions in a plurality of preset universal tables in the database as a target universal table for constructing the visual report; the preset conditions are as follows: the number of preset parameter columns of the target general table is not less than n, and the number of preset data columns of the target general table is not less than m;
the report column determining subunit is used for determining n parameter columns in the target general table as the parameter columns for constructing the visual report; and determining the n columns of data columns in the target general table as the data columns for constructing the visual report.
In a specific embodiment provided in this specification, the data writing unit may be specifically configured to:
judging whether the target general table has the number of idle records or not; and if not, determining a second target general table of the visual report constructed this time by using any idle general table meeting the preset conditions in a plurality of preset general tables of the database, wherein the second target general table is used for continuously writing in the data of the visual report constructed this time.
In an embodiment provided in this specification, the general table determining subunit may be specifically configured to:
and determining any idle general table with the minimum parameter column number and/or data column number in the idle general tables meeting the preset conditions as a target general table for constructing the visual report.
The implementation process of the functions and actions of each module in the above device is specifically described in the implementation process of the corresponding step in the above method, and is not described herein again.
The embodiment of the present specification further provides a computer device, which at least includes a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein the processor implements the aforementioned visual report data presentation method when executing the program. The method at least comprises the following steps:
under the condition of receiving a data display request, obtaining data corresponding to a parameter value specified by the data display request according to a multidimensional index of a pre-constructed visual report;
displaying the obtained data according to a preset visual report model;
the method for constructing the visual report comprises the following steps: determining the parameter type and the data type included in the visual report to be constructed according to the received visual report construction instruction; determining a parameter column and a data column corresponding to the parameter type and the data type in a preset general table of a database, and obtaining a multi-dimensional index pre-established for the parameter column; in the general table, each parameter type corresponds to one parameter column, each data type corresponds to one data column, and each multidimensional index is an index created based on at least 2 parameter columns.
Fig. 5 is a schematic diagram illustrating a more specific hardware structure of a computing device according to an embodiment of the present disclosure, where the computing device may include: a processor 1010, a memory 1020, an input/output interface 1030, a communication interface 1040, and a bus 1050. Wherein the processor 1010, memory 1020, input/output interface 1030, and communication interface 1040 are communicatively coupled to each other within the device via bus 1050.
The processor 1010 may be implemented by a general-purpose CPU (Central Processing Unit), a microprocessor, an Application Specific Integrated Circuit (ASIC), or one or more Integrated circuits, and is configured to execute related programs to implement the technical solutions provided in the embodiments of the present disclosure.
The Memory 1020 may be implemented in the form of a ROM (Read Only Memory), a RAM (Random Access Memory), a static storage device, a dynamic storage device, or the like. The memory 1020 may store an operating system and other application programs, and when the technical solution provided by the embodiments of the present specification is implemented by software or firmware, the relevant program codes are stored in the memory 1020 and called to be executed by the processor 1010.
The input/output interface 1030 is used for connecting an input/output module to input and output information. The i/o module may be configured as a component in a device (not shown) or may be external to the device to provide a corresponding function. The input devices may include a keyboard, a mouse, a touch screen, a microphone, various sensors, etc., and the output devices may include a display, a speaker, a vibrator, an indicator light, etc.
The communication interface 1040 is used for connecting a communication module (not shown in the drawings) to implement communication interaction between the present apparatus and other apparatuses. The communication module can realize communication in a wired mode (such as USB, network cable and the like) and also can realize communication in a wireless mode (such as mobile network, WIFI, Bluetooth and the like).
Bus 1050 includes a path that transfers information between various components of the device, such as processor 1010, memory 1020, input/output interface 1030, and communication interface 1040.
It should be noted that although the above-mentioned device only shows the processor 1010, the memory 1020, the input/output interface 1030, the communication interface 1040 and the bus 1050, in a specific implementation, the device may also include other components necessary for normal operation. In addition, those skilled in the art will appreciate that the above-described apparatus may also include only those components necessary to implement the embodiments of the present description, and not necessarily all of the components shown in the figures.
The embodiment of the present specification further provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the method for displaying visual report data is implemented. The method at least comprises the following steps:
under the condition of receiving a data display request, obtaining data corresponding to a parameter value specified by the data display request according to a multidimensional index of a pre-constructed visual report;
displaying the obtained data according to a preset visual report model;
the method for constructing the visual report comprises the following steps: determining the parameter type and the data type included in the visual report to be constructed according to the received visual report construction instruction; determining a parameter column and a data column corresponding to the parameter type and the data type in a preset general table of a database, and obtaining a multi-dimensional index pre-established for the parameter column; in the general table, each parameter type corresponds to one parameter column, each data type corresponds to one data column, and each multidimensional index is an index created based on at least 2 parameter columns.
Computer-readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), Read Only Memory (ROM), Electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), Digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device. As defined herein, a computer readable medium does not include a transitory computer readable medium such as a modulated data signal and a carrier wave.
From the above description of the embodiments, it is clear to those skilled in the art that the embodiments of the present disclosure can be implemented by software plus necessary general hardware platform. Based on such understanding, the technical solutions of the embodiments of the present specification may be essentially or partially implemented in the form of a software product, which may be stored in a storage medium, such as a ROM/RAM, a magnetic disk, an optical disk, etc., and includes several instructions for enabling a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the methods described in the embodiments or some parts of the embodiments of the present specification.
The systems, devices, modules or units illustrated in the above embodiments may be implemented by a computer chip or an entity, or by a product with certain functions. A typical implementation device is a computer, which may take the form of a personal computer, laptop computer, cellular telephone, camera phone, smart phone, personal digital assistant, media player, navigation device, email messaging device, game console, tablet computer, wearable device, or a combination of any of these devices.
The embodiments in the present specification are described in a progressive manner, and the same and similar parts among the embodiments are referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the apparatus embodiment, since it is substantially similar to the method embodiment, it is relatively simple to describe, and reference may be made to some descriptions of the method embodiment for relevant points. The above-described apparatus embodiments are merely illustrative, and the modules described as separate components may or may not be physically separate, and the functions of the modules may be implemented in one or more software and/or hardware when implementing the embodiments of the present disclosure. And part or all of the modules can be selected according to actual needs to achieve the purpose of the scheme of the embodiment. One of ordinary skill in the art can understand and implement it without inventive effort.
The foregoing is only a specific embodiment of the embodiments of the present disclosure, and it should be noted that, for those skilled in the art, a plurality of modifications and decorations can be made without departing from the principle of the embodiments of the present disclosure, and these modifications and decorations should also be regarded as the protection scope of the embodiments of the present disclosure.