CN113326314B - Data visualization method, device, electronic equipment and readable storage medium - Google Patents
Data visualization method, device, electronic equipment and readable storage medium Download PDFInfo
- Publication number
- CN113326314B CN113326314B CN202110743259.5A CN202110743259A CN113326314B CN 113326314 B CN113326314 B CN 113326314B CN 202110743259 A CN202110743259 A CN 202110743259A CN 113326314 B CN113326314 B CN 113326314B
- Authority
- CN
- China
- Prior art keywords
- chart
- data
- database
- generating
- user
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
- 238000000034 method Methods 0.000 title claims abstract description 54
- 238000013079 data visualisation Methods 0.000 title claims abstract description 39
- 230000009466 transformation Effects 0.000 claims abstract description 50
- 230000001960 triggered effect Effects 0.000 claims abstract description 23
- 238000012545 processing Methods 0.000 claims abstract description 18
- 238000012800 visualization Methods 0.000 claims abstract description 16
- 230000000007 visual effect Effects 0.000 claims description 31
- 230000008859 change Effects 0.000 claims description 18
- 238000004590 computer program Methods 0.000 claims description 12
- 238000011897 real-time detection Methods 0.000 claims 1
- 238000005516 engineering process Methods 0.000 abstract description 5
- 238000011161 development Methods 0.000 abstract description 2
- 230000006870 function Effects 0.000 description 12
- 238000004891 communication Methods 0.000 description 8
- 238000006243 chemical reaction Methods 0.000 description 6
- 238000004422 calculation algorithm Methods 0.000 description 5
- 238000001514 detection method Methods 0.000 description 5
- 238000010586 diagram Methods 0.000 description 5
- 238000007726 management method Methods 0.000 description 5
- 230000008569 process Effects 0.000 description 5
- 238000004458 analytical method Methods 0.000 description 4
- 238000010223 real-time analysis Methods 0.000 description 3
- 238000011896 sensitive detection Methods 0.000 description 3
- 230000035945 sensitivity Effects 0.000 description 3
- 238000004364 calculation method Methods 0.000 description 2
- 125000004122 cyclic group Chemical group 0.000 description 2
- 238000007405 data analysis Methods 0.000 description 2
- 230000002452 interceptive effect Effects 0.000 description 2
- 239000004973 liquid crystal related substance Substances 0.000 description 2
- 230000003287 optical effect Effects 0.000 description 2
- 230000002093 peripheral effect Effects 0.000 description 2
- 230000009286 beneficial effect Effects 0.000 description 1
- 230000005540 biological transmission Effects 0.000 description 1
- 238000013500 data storage Methods 0.000 description 1
- 238000000802 evaporation-induced self-assembly Methods 0.000 description 1
- 230000007246 mechanism Effects 0.000 description 1
- 238000005065 mining Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/26—Visual data mining; Browsing structured data
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/22—Indexing; Data structures therefor; Storage structures
- G06F16/2228—Indexing structures
- G06F16/2246—Trees, e.g. B+trees
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/22—Indexing; Data structures therefor; Storage structures
- G06F16/2282—Tablespace storage structures; Management thereof
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/28—Databases characterised by their database models, e.g. relational or object models
- G06F16/284—Relational databases
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/28—Databases characterised by their database models, e.g. relational or object models
- G06F16/284—Relational databases
- G06F16/285—Clustering or classification
- G06F16/287—Visualization; Browsing
Landscapes
- Engineering & Computer Science (AREA)
- Databases & Information Systems (AREA)
- Theoretical Computer Science (AREA)
- Data Mining & Analysis (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Software Systems (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
- User Interface Of Digital Computer (AREA)
Abstract
The invention relates to a development technology, and discloses a data visualization method, which comprises the following steps: when a chart generation instruction triggered by a user is received, generating a database language according to the chart generation instruction; generating an abstract syntax tree according to a database language by utilizing a pre-constructed database connection pool, traversing the data of the abstract syntax tree to obtain traversed data; performing visualization processing on the traversal data to generate a chart; detecting track parameters of a user based on the chart in real time by a whole layout rasterization method; and carrying out shape transformation or position transformation on the graph according to the track parameters to obtain the target graph. The invention also provides a data visualization device, electronic equipment and a storage medium. The invention can improve the real-time performance of the chart display.
Description
Technical Field
The present invention relates to the field of development, and in particular, to a data visualization method, apparatus, electronic device, and readable storage medium.
Background
The data visualization can display the data with multiple dimensions and different types in the form of a visualization chart, and is beneficial to deep analysis and mining of the data by realizing the data visualization, so that the application of the data visualization technology in enterprises is more and more extensive.
However, the chart presentation form of a single template of the data visualization platform on the market at present is single, so that the sensitivity of the drag drawing engine is often ignored for emphasizing the data presentation degree, and the visualization delay is caused.
Disclosure of Invention
The invention provides a data visualization method, a data visualization device, electronic equipment and a computer readable storage medium, and mainly aims to improve the instantaneity of chart display.
In order to achieve the above object, the present invention provides a data visualization method, including:
when a chart generation instruction triggered by a user is received, generating a database language according to the chart generation instruction;
generating an abstract syntax tree according to the database language by utilizing a pre-constructed database connection pool, traversing the data of the abstract syntax tree, and obtaining traversed data;
performing visualization processing on the traversal data to generate a chart;
detecting the track parameters of the user based on the chart in real time by a whole layout rasterization method;
and carrying out shape transformation or position transformation on the chart according to the track parameters to obtain a target chart.
Optionally, the detecting, in real time, the track parameter of the user based on the chart by using the overall layout rasterization method includes:
Determining row and column positioning and width and height of a plurality of grid elements, and splitting a related display area of the chart into the plurality of grid elements according to the row and column positioning and the width and height;
acquiring an initial selection position and a movement end position when the drawing operation is carried out on the chart by utilizing row-column positioning and width-height of the grid elements;
calculating a difference value between the initial selection position and the movement ending position;
and determining the initial selection position, the movement ending position and the difference value as track parameters of the user based on the chart.
Optionally, the performing shape transformation or position transformation on the graph according to the track parameter to obtain a target graph includes:
determining an operation intention of the user according to the track parameter, wherein the operation intention comprises shape transformation or position transformation;
and calling a preset application programming interface to connect a graphic container, and carrying out shape change or position change on the graph through the graphic container to obtain a target graph after the shape change or the position change.
Optionally, the generating an abstract syntax tree according to the database language by using the pre-constructed database connection pool includes:
Connecting the target database by utilizing a pre-constructed database connection pool;
after being connected with the target database, the database language is utilized to inquire in the target database, and form data in the target database are obtained;
splitting the form data into character strings, and generating an abstract syntax tree according to the character strings.
Optionally, the step of performing visualization processing on the traversal data to generate a chart includes:
acquiring a data list corresponding to the traversal data from a preset chart index library;
and searching the visual chart type corresponding to the data list from the chart index library, and generating a chart according to the visual chart type.
Optionally, the generating a chart according to the visual chart type includes:
according to the visual chart types, selecting an initial chart of any one type of the visual chart types, and configuring a chart style of the initial chart;
and displaying the traversal data in the initial chart of the chart style to obtain the chart.
Optionally, when receiving a user-triggered chart generation instruction, generating a database language according to the chart generation instruction, including:
Displaying a user operation interface, and receiving a chart generation instruction triggered by the operation of a user on the operation interface;
and constructing a database language module according to the chart generation instruction, and generating a database language by utilizing the database language module.
In order to solve the above problems, the present invention also provides a data visualization apparatus including:
the database language generating module is used for generating a database language according to the chart generating instruction when receiving the chart generating instruction triggered by the user;
the chart generation module is used for generating an abstract syntax tree according to the database language by utilizing a pre-constructed database connection pool, traversing the data of the abstract syntax tree to obtain traversed data, and carrying out visualization processing on the traversed data to generate a chart;
and the chart transformation module is used for detecting the track parameters of the user based on the chart in real time through an overall layout rasterization method, and carrying out shape transformation or position transformation on the chart according to the track parameters to obtain a target chart.
In order to solve the above-mentioned problems, the present invention also provides an electronic apparatus including:
a memory storing at least one computer program; and
And a processor executing the computer program stored in the memory to implement the data visualization method.
In order to solve the above-mentioned problems, the present invention also provides a computer-readable storage medium having stored therein at least one computer program that is executed by a processor in an electronic device to implement the above-mentioned data visualization method.
According to the embodiment of the invention, the chart instruction is visualized according to the chart instruction generated by the user, so that automatic generation of the chart is realized; further, track parameters of the user based on the chart are detected in real time through an overall layout rasterization method; and carrying out shape transformation or position transformation on the chart according to the track parameters to obtain a target chart, realizing the requirements that a user can randomly select indexes and visualize chart types, add and delete indexes and randomly adjust the chart size, realizing active real-time analysis, ensuring accurate and sensitive detection of the track parameters of the user based on the chart through layout rasterization, and improving the real-time performance of chart display. Therefore, the data visualization method, the device, the electronic equipment and the readable storage medium provided by the embodiment of the invention can improve the real-time performance of chart display.
Drawings
FIG. 1 is a flow chart of a data visualization method according to an embodiment of the present invention;
FIG. 2 is a schematic block diagram of a data visualization device according to an embodiment of the present invention;
fig. 3 is a schematic diagram of an internal structure of an electronic device for implementing a data visualization method according to an embodiment of the present invention;
the achievement of the objects, functional features and advantages of the present invention will be further described with reference to the accompanying drawings, in conjunction with the embodiments.
Detailed Description
It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the invention.
The embodiment of the invention provides a data visualization method. The execution subject of the data visualization method includes, but is not limited to, at least one of a server, a terminal, and the like, which can be configured to execute the method provided by the embodiments of the present application. In other words, the data visualization method may be performed by software or hardware installed in a terminal device or a server device, and the software may be a blockchain platform. The service end includes but is not limited to: a single server, a server cluster, a cloud server or a cloud server cluster, and the like.
Referring to fig. 1, a flow chart of a data visualization method according to an embodiment of the present invention is shown, where in the embodiment of the present invention, the data visualization method includes:
S1, when a chart generation instruction triggered by a user is received, generating a database language according to the chart generation instruction.
In this embodiment, the instruction for generating the chart refers to an instruction triggered by the user inputting a keyword operation in the user operation interface, or an instruction triggered by clicking an interactive button.
The database language is a database query and programming language and is mainly used for accessing data and querying, updating and managing a relational database system.
In detail, when receiving a user-triggered chart generation instruction, generating a database language according to the chart generation instruction, including:
displaying the user operation interface, and receiving a chart generation instruction triggered by the operation of a user on the operation interface;
and constructing a database language module according to the chart generation instruction, and generating a database language by utilizing the database language module.
In this embodiment, a database language module may be constructed according to the chart generating instruction, and the chart generating instruction may be used to generate a database language at the back end.
For example, a Table command is generated as a Table, a database language template is created by using the Table command, the Table is connected with a database terminal by using the template, and the database language Select Table, the Create Table, the Insert Table and the like are generated by parameter conversion of the database terminal.
Preferably, the database language may be SQL.
S2, generating an abstract syntax tree according to the database language by utilizing a pre-constructed database connection pool, traversing the data of the abstract syntax tree, and obtaining traversed data.
In this embodiment, the abstract syntax tree refers to a syntax structure of a programming language expressed in a tree form, each node on the tree represents a structure in a source code, and the main function of the abstract syntax tree is to embody an algorithm and a relationship to be expressed in the database language in a specific code.
The traversal data refers to data contained in a chart generated according to the user generated chart instruction.
In detail, the generating an abstract syntax tree according to the database language by using the pre-constructed database connection pool includes:
connecting the target database by utilizing a pre-constructed database connection pool;
after being connected with the target database, the database language is utilized to inquire in the target database, and form data in the target database are obtained;
splitting the form data into character strings, and generating an abstract syntax tree according to the character strings.
In this embodiment, the target database is a database where data related in the graph is located, and the target database may be one or at least two.
In this embodiment, the form data refers to all forms and data in the forms queried from the target database.
The main function of the database connection pool is to store the connection of the database as an object in a memory, when the database needs to be accessed, a new connection is not required to be established, an established idle connection object is taken out of the connection pool, and after the access terminal is finished, the connection is put back into the connection pool for the next access terminal to use.
Preferably, the database connection pool may be Alibaba guide, the database connection may be implemented through JDBC, and the database language may perform operations such as Create Table/Insert/Select on the database.
Specifically, in this embodiment, a query operation may be performed on a target database through an SQL database language to obtain a form structure in the target database and data in a table, the form structure and the data in the table are split into character strings, the obtained character strings are connected into structured data, an abstract syntax tree is obtained, and all parameter information included in the character strings can be accurately known according to the abstract syntax tree.
For example, a database is queried through SQL to obtain a student attendance table, the student attendance table is detachable into name, number, time and the like, the name comprises a plurality of student names, and the student names are connected with corresponding academia and time of the student names to obtain an abstract syntax tree.
In this embodiment, the process of parsing the database language into the abstract syntax tree may implement data governance and depth calculation, and interact with a data set during the parsing process, so as to implement dynamic data analysis and display.
Further, the traversing and analyzing the data of the abstract syntax tree to obtain traversing and analyzing data, including:
performing stack pressing operation on the abstract syntax tree to obtain form data fields, and popping out of a stack;
the push operation is circulated until the push operation becomes an empty stack;
when the push operation is changed into the empty stack, stopping circulation and storing all form data fields;
and converting the form data field into traversal data.
In this embodiment, the stack refers to a linear table in which an insert or delete operation is performed only at the tail of the table. The empty table without elements is called an empty stack. The form data field refers to all form structures and field information in the data in the form.
And S3, performing visualization processing on the traversal analysis data to generate a chart.
In detail, the step of performing visualization processing on the traversal analysis data to generate a chart includes:
acquiring a data list corresponding to the traversal data from a preset chart index library;
And searching the visual chart type corresponding to the data list from the chart index library, and generating a chart according to the visual chart type.
In this embodiment, the index library refers to a view style in which data can be converted into views, and includes all visual charts, where types of the visual charts may include, but are not limited to, scatter charts, bar charts, line charts, pie charts, maps, and may also store data imported by a user and view charts created by the user.
In this embodiment, the index library includes a data list and a visual chart type corresponding to the data list, so that the data list corresponding to the traversal data and the visual chart type corresponding to the data list may be obtained from a preset chart index library.
Specifically, the data list included in the index library may be cyclic data, table data, numerical algorithm data, a data set describing points, and the like.
For example, the traversal data list is a warehouse in-out bill list, the identifiable fields of the bill list include a bill name, a bill number, a bill in-out time, a bill number, and the like, and the visualized chart type consistent with the table field of the acquired bill list is acquired from a preset chart index library.
In the embodiment of the invention, the chart index library corresponding to the data list comprises visual chart types such as a scatter chart, a column chart, a bar chart, a line chart, a pie chart, a map and the like, and the line chart or a chart formed by overlapping the line chart and the column chart can be selected as the generated chart.
Further, the generating a chart according to the visual chart type includes:
according to the visual chart types, selecting an initial chart of any one type of the visual chart types, and configuring a chart style of the initial chart;
and displaying the traversal data in the initial chart of the chart style to obtain the chart.
Specifically, in this embodiment, the chart style may include a color conversion, a gradient color conversion, whether to add a title, and the like of the chart. For example, a line graph may be selected according to the type of the visual chart, the color and gradient of the chart may be converted from the line graph, and a chart title may be displayed, to finally obtain the chart.
S4, detecting the track parameters of the user based on the chart in real time through a whole layout rasterization method.
In this embodiment, the overall layout rasterization refers to dividing the screen visible area into 12 grid elements of equal width, each grid element being a minimum unit for limiting scaling. The track parameter refers to a position track moved when a user performs a drag operation on the chart.
In detail, the detecting the track parameter of the user based on the chart in real time through the whole layout rasterization method includes:
determining row and column positioning and width and height of a plurality of grid elements, and splitting a related display area of the chart into the plurality of grid elements according to the row and column positioning and the width and height;
acquiring an initial selection position and a movement end position when the drawing operation is carried out on the chart by utilizing row-column positioning and width-height of the grid elements;
calculating a difference value between the initial selection position and the movement ending position;
and determining the initial selection position, the movement ending position and the difference value as track parameters of the user based on the chart.
The existing track detection technology mainly utilizes first-order differential processing to realize track detection by calculating the distance between two adjacent track points.
Specifically, in this embodiment, the overall layout rasterization method is used to detect the track parameter of the user based on the chart in real time, so as to ensure the accurate positioning of the drag and zoom operation.
For example, a plurality of grid elements are generated and configured with default row and column positioning and width and height. When the user presses the mouse or moves the mouse on the chart, the current mouse position, i.e. the initial selection position and the end movement position, can be obtained by calculating the coordinates (x, y) of the initial selection position and the coordinates (x) of the end movement position 1 ,y 1 ) The difference value is obtained, so that the difference value between the initial selection position and the movement end position is obtained, the track parameters of the grid elements are detected in real time, and the sensitivity of a user in dragging and scaling operation of the chart is improved.
Further, when the drag and zoom operation is finished, row and column positioning and width and height parameter storage of the grid elements are submitted to the rear end, the view type created by the user can be recorded, and the style, the position and the layout of the view are stored, so that the user can restore the last operation of the user when entering the user operation interface next time.
S5, performing shape transformation or position transformation on the chart according to the track parameters to obtain a target chart.
In detail, the performing shape transformation or position transformation on the graph according to the track parameter to obtain a target graph includes:
determining an operation intention of the user according to the track parameter, wherein the operation intention comprises shape transformation or position transformation;
and calling a preset application programming interface to connect a graphic container, and carrying out shape change or position change on the graph through the graphic container to obtain a target graph after the shape change or the position change.
Preferably, the graphics container may be a canvas and the application programming interface may be a canvas API.
Specifically, in this embodiment, before the chart is displayed in the page, the chart includes a plurality of components, and the user is identified to perform shape transformation operation on the chart according to the track parameter, then the application programming interface canvas API is utilized to mount a new component and unload and update an old component on a changed part of the chart in the graphic container canvas, the page is re-rendered, and page refreshing is triggered, so that shape transformation updating operation is further implemented, and a target chart after shape change is obtained.
According to the embodiment of the invention, the chart instruction is visualized according to the chart instruction generated by the user, so that automatic generation of the chart is realized; further, track parameters of the user based on the chart are detected in real time through an overall layout rasterization method; and carrying out shape transformation or position transformation on the chart according to the track parameters to obtain a target chart, realizing the requirements that a user can randomly select indexes and visualize chart types, add and delete indexes and randomly adjust the chart size, realizing active real-time analysis, ensuring accurate and sensitive detection of the track parameters of the user based on the chart through layout rasterization, and improving the real-time performance of chart display. Therefore, the data visualization method provided by the embodiment of the invention can improve the real-time performance of the chart display.
As shown in fig. 2, a functional block diagram of the data visualization device of the present invention is shown.
The data visualization apparatus 100 of the present invention may be installed in an electronic device. Depending on the functions implemented, the data visualization means may comprise a database language generation module 101, a chart generation module 102, a chart transformation module 103, which modules may also be referred to as units, refer to a series of computer program segments capable of being executed by a processor of an electronic device and of performing fixed functions, which are stored in a memory of the electronic device.
In the present embodiment, the functions concerning the respective modules/units are as follows:
the database language generating module 101 is configured to generate a database language according to a chart generating instruction when receiving the chart generating instruction triggered by a user.
In this embodiment, the instruction for generating the chart refers to an instruction triggered by the user inputting a keyword operation in the user operation interface, or an instruction triggered by clicking an interactive button.
The database language is a database query and programming language and is mainly used for accessing data and querying, updating and managing a relational database system.
In detail, the database language generation module 101 generates a database language according to a user-triggered generate chart instruction when the generate chart instruction is received by performing the following operations:
Displaying the user operation interface, and receiving a chart generation instruction triggered by the operation of a user on the operation interface;
and constructing a database language module according to the chart generation instruction, and generating a database language by utilizing the database language module.
In this embodiment, a database language module may be constructed according to the chart generating instruction, and the chart generating instruction may be used to generate a database language at the back end.
For example, a Table command is generated as a Table, a database language template is created by using the Table command, the Table is connected with a database terminal by using the template, and the database language Select Table, the Create Table, the Insert Table and the like are generated by parameter conversion of the database terminal.
Preferably, the database language may be SQL.
The chart generation module 102 is configured to generate an abstract syntax tree according to the database language by using a pre-configured database connection pool, traverse data of the abstract syntax tree to obtain traversed data, and perform visualization processing on the traversed data to generate a chart.
In this embodiment, the abstract syntax tree refers to a syntax structure of a programming language expressed in a tree form, each node on the tree represents a structure in a source code, and the main function of the abstract syntax tree is to embody an algorithm and a relationship to be expressed in the database language in a specific code.
The traversal data refers to data contained in a chart generated according to the user generated chart instruction.
In detail, the diagram generation module 102 generates an abstract syntax tree from the database language using a pre-constructed database connection pool by performing the following operations:
connecting the target database by utilizing a pre-constructed database connection pool;
after being connected with the target database, the database language is utilized to inquire in the target database, and form data in the target database are obtained;
splitting the form data into character strings, and generating an abstract syntax tree according to the character strings.
In this embodiment, the target database is a database where data related in the graph is located, and the target database may be one or at least two.
In this embodiment, the form data refers to all forms and data in the forms queried from the target database.
The main function of the database connection pool is to store the connection of the database as an object in a memory, when the database needs to be accessed, a new connection is not required to be established, an established idle connection object is taken out of the connection pool, and after the access terminal is finished, the connection is put back into the connection pool for the next access terminal to use.
Preferably, the database connection pool may be Alibaba guide, the database connection may be implemented through JDBC, and the database language may perform operations such as Create Table/Insert/Select on the database.
Specifically, in this embodiment, a query operation may be performed on a target database through an SQL database language to obtain a form structure in the target database and data in a table, the form structure and the data in the table are split into character strings, the obtained character strings are connected into structured data, an abstract syntax tree is obtained, and all parameter information included in the character strings can be accurately known according to the abstract syntax tree.
For example, a database is queried through SQL to obtain a student attendance table, the student attendance table is detachable into name, number, time and the like, the name comprises a plurality of student names, and the student names are connected with corresponding academia and time of the student names to obtain an abstract syntax tree.
In this embodiment, the process of parsing the database language into the abstract syntax tree may implement data governance and depth calculation, and interact with a data set during the parsing process, so as to implement dynamic data analysis and display.
Further, the traversing and analyzing the data of the abstract syntax tree to obtain traversing and analyzing data, including:
performing stack pressing operation on the abstract syntax tree to obtain form data fields, and popping out of a stack;
the push operation is circulated until the push operation becomes an empty stack;
when the push operation is changed into the empty stack, stopping circulation and storing all form data fields;
and converting the form data field into traversal data.
In this embodiment, the stack refers to a linear table in which an insert or delete operation is performed only at the tail of the table. The empty table without elements is called an empty stack. The form data field refers to all form structures and field information in the data in the form.
In detail, the chart generation module 102 performs visualization processing on the traversal analysis data to generate a chart by performing the following operations:
acquiring a data list corresponding to the traversal data from a preset chart index library;
and searching the visual chart type corresponding to the data list from the chart index library, and generating a chart according to the visual chart type.
In this embodiment, the index library refers to a view style in which data can be converted into views, and includes all visual charts, where types of the visual charts may include, but are not limited to, scatter charts, bar charts, line charts, pie charts, maps, and may also store data imported by a user and view charts created by the user.
In this embodiment, the index library includes a data list and a visual chart type corresponding to the data list, so that the data list corresponding to the traversal data and the visual chart type corresponding to the data list may be obtained from a preset chart index library.
Specifically, the data list included in the index library may be cyclic data, table data, numerical algorithm data, a data set describing points, and the like.
For example, the traversal data list is a warehouse in-out bill list, the identifiable fields of the bill list include a bill name, a bill number, a bill in-out time, a bill number, and the like, and the visualized chart type consistent with the table field of the acquired bill list is acquired from a preset chart index library.
In the embodiment of the invention, the chart index library corresponding to the data list comprises visual chart types such as a scatter chart, a column chart, a bar chart, a line chart, a pie chart, a map and the like, and the line chart or a chart formed by overlapping the line chart and the column chart can be selected as the generated chart.
Further, the chart generation module 102 generates a chart from the visualization chart types by performing the following operations:
According to the visual chart types, selecting an initial chart of any one type of the visual chart types, and configuring a chart style of the initial chart;
and displaying the traversal data in the initial chart of the chart style to obtain the chart.
Specifically, in this embodiment, the chart style may include a color conversion, a gradient color conversion, whether to add a title, and the like of the chart. For example, a line graph may be selected according to the type of the visual chart, the color and gradient of the chart may be converted from the line graph, and a chart title may be displayed, to finally obtain the chart.
The chart transformation module 103 is configured to detect, in real time, a track parameter of the user based on the chart by using an overall layout rasterization method, and perform shape transformation or position transformation on the chart according to the track parameter, so as to obtain a target chart.
In this embodiment, the overall layout rasterization refers to dividing the screen visible area into 12 grid elements of equal width, each grid element being a minimum unit for limiting scaling. The track parameter refers to a position track moved when a user performs a drag operation on the chart.
In detail, the chart transformation module 103 detects the trajectory parameters of the user based on the chart in real time through the overall layout rasterization method:
Determining row and column positioning and width and height of a plurality of grid elements, and splitting a related display area of the chart into the plurality of grid elements according to the row and column positioning and the width and height;
acquiring an initial selection position and a movement end position when the drawing operation is carried out on the chart by utilizing row-column positioning and width-height of the grid elements;
calculating a difference value between the initial selection position and the movement ending position;
and determining the initial selection position, the movement ending position and the difference value as track parameters of the user based on the chart.
The existing track detection technology mainly utilizes first-order differential processing to realize track detection by calculating the distance between two adjacent track points.
Specifically, in this embodiment, the overall layout rasterization method is used to detect the track parameter of the user based on the chart in real time, so as to ensure the accurate positioning of the drag and zoom operation.
For example, a plurality of grid elements are generated and configured with default row and column positioning and width and height. When the user presses the mouse or moves the mouse on the chart, the current mouse position, i.e. the initial selection position and the end movement position, can be obtained by calculating the coordinates (x, y) of the initial selection position and the coordinates (x) of the end movement position 1 ,y 1 ) The difference value is obtained, so that the difference value between the initial selection position and the movement end position is obtained, the track parameters of the grid elements are detected in real time, and the sensitivity of a user in dragging and scaling operation of the chart is improved.
Further, when the drag and zoom operation is finished, row and column positioning and width and height parameter storage of the grid elements are submitted to the rear end, the view type created by the user can be recorded, and the style, the position and the layout of the view are stored, so that the user can restore the last operation of the user when entering the user operation interface next time.
In detail, the chart transformation module 103 performs shape transformation or position transformation on the chart according to the trajectory parameters by performing the following operations, including:
determining an operation intention of the user according to the track parameter, wherein the operation intention comprises shape transformation or position transformation;
and calling a preset application programming interface to connect a graphic container, and carrying out shape change or position change on the graph through the graphic container to obtain a target graph after the shape change or the position change.
Preferably, the graphics container may be a canvas and the application programming interface may be a canvas API.
Specifically, in this embodiment, before the chart is displayed in the page, the chart includes a plurality of components, and the user is identified to perform shape transformation operation on the chart according to the track parameter, then the application programming interface canvas API is utilized to mount a new component and unload and update an old component on a changed part of the chart in the graphic container canvas, the page is re-rendered, and page refreshing is triggered, so that shape transformation updating operation is further implemented, and a target chart after shape change is obtained.
According to the embodiment of the invention, the chart instruction is visualized according to the chart instruction generated by the user, so that automatic generation of the chart is realized; further, track parameters of the user based on the chart are detected in real time through an overall layout rasterization method; and carrying out shape transformation or position transformation on the chart according to the track parameters to obtain a target chart, realizing the requirements that a user can randomly select indexes and visualize chart types, add and delete indexes and randomly adjust the chart size, realizing active real-time analysis, ensuring accurate and sensitive detection of the track parameters of the user based on the chart through layout rasterization, and improving the real-time performance of chart display. Therefore, the data visualization device provided by the embodiment of the invention can improve the real-time performance of the chart display.
Fig. 3 is a schematic structural diagram of an electronic device for implementing the data visualization method according to the present invention.
The electronic device may comprise a processor 10, a memory 11, a communication bus 12 and a communication interface 13, and may further comprise a computer program, such as a data visualization program, stored in the memory 11 and executable on the processor 10.
The memory 11 includes at least one type of readable storage medium, including flash memory, a mobile hard disk, a multimedia card, a card memory (e.g., SD or DX memory, etc.), a magnetic memory, a local magnetic disk, an optical disk, etc. The memory 11 may in some embodiments be an internal storage unit of the electronic device, such as a mobile hard disk of the electronic device. The memory 11 may in other embodiments also be an external storage device of the electronic device, such as a plug-in mobile hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card) or the like, which are provided on the electronic device. Further, the memory 11 may also include both an internal storage unit and an external storage device of the electronic device. The memory 11 may be used not only for storing application software installed in an electronic device and various types of data, such as codes of a data visualization program, but also for temporarily storing data that has been output or is to be output.
The processor 10 may be comprised of integrated circuits in some embodiments, for example, a single packaged integrated circuit, or may be comprised of multiple integrated circuits packaged with the same or different functions, including one or more central processing units (Central Processing unit, CPU), microprocessors, digital processing chips, graphics processors, combinations of various control chips, and the like. The processor 10 is a Control Unit (Control Unit) of the electronic device, connects various components of the entire electronic device using various interfaces and lines, and executes various functions of the electronic device and processes data by running or executing programs or modules (e.g., data visualization programs, etc.) stored in the memory 11, and calling data stored in the memory 11.
The communication bus 12 may be a peripheral component interconnect standard (perIPheral component interconnect, PCI) bus, or an extended industry standard architecture (extended industry standard architecture, EISA) bus, among others. The bus may be classified as an address bus, a data bus, a control bus, etc. The communication bus 12 is arranged to enable a connection communication between the memory 11 and at least one processor 10 etc. For ease of illustration, the figures are shown with only one bold line, but not with only one bus or one type of bus.
Fig. 3 shows only an electronic device with components, and it will be understood by those skilled in the art that the structure shown in fig. 3 is not limiting of the electronic device and may include fewer or more components than shown, or may combine certain components, or a different arrangement of components.
For example, although not shown, the electronic device may further include a power source (such as a battery) for supplying power to the respective components, and preferably, the power source may be logically connected to the at least one processor 10 through a power management device, so that functions of charge management, discharge management, power consumption management, and the like are implemented through the power management device. The power supply may also include one or more of any of a direct current or alternating current power supply, recharging device, power failure detection circuit, power converter or inverter, power status indicator, etc. The electronic device may further include various sensors, bluetooth modules, wi-Fi modules, etc., which are not described herein.
Optionally, the communication interface 13 may comprise a wired interface and/or a wireless interface (e.g., WI-FI interface, bluetooth interface, etc.), typically used to establish a communication connection between the electronic device and other electronic devices.
Optionally, the communication interface 13 may further comprise a user interface, which may be a Display, an input unit, such as a Keyboard (Keyboard), or a standard wired interface, a wireless interface. Alternatively, in some embodiments, the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, an OLED (Organic Light-Emitting Diode) touch, or the like. The display may also be referred to as a display screen or display unit, as appropriate, for displaying information processed in the electronic device and for displaying a visual user interface.
It should be understood that the embodiments described are for illustrative purposes only and are not limited to this configuration in the scope of the patent application.
The data visualization program stored in the memory 11 in the electronic device is a combination of a plurality of computer programs, which, when run in the processor 10, can implement:
when a chart generation instruction triggered by a user is received, generating a database language according to the chart generation instruction;
generating an abstract syntax tree according to the database language by utilizing a pre-constructed database connection pool, traversing the data of the abstract syntax tree, and obtaining traversed data;
Performing visualization processing on the traversal data to generate a chart;
detecting the track parameters of the user based on the chart in real time by a whole layout rasterization method;
and carrying out shape transformation or position transformation on the chart according to the track parameters to obtain a target chart. In particular, the specific implementation method of the processor 10 on the computer program may refer to the description of the relevant steps in the corresponding embodiment of fig. 1, which is not repeated herein.
Further, the electronic device integrated modules/units, if implemented in the form of software functional units and sold or used as stand-alone products, may be stored in a computer readable storage medium. The computer readable medium may be non-volatile or volatile. The computer readable medium may include: any entity or device capable of carrying the computer program code to be described, a recording medium, a U disk, a removable hard disk, a magnetic disk, an optical disk, a computer Memory, a Read-Only Memory (ROM).
Embodiments of the present invention may also provide a computer readable storage medium storing a computer program which, when executed by a processor of an electronic device, may implement:
When a chart generation instruction triggered by a user is received, generating a database language according to the chart generation instruction;
generating an abstract syntax tree according to the database language by utilizing a pre-constructed database connection pool, traversing the data of the abstract syntax tree, and obtaining traversed data;
performing visualization processing on the traversal data to generate a chart;
detecting the track parameters of the user based on the chart in real time by a whole layout rasterization method;
and carrying out shape transformation or position transformation on the chart according to the track parameters to obtain a target chart. Further, the computer-usable storage medium may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required for at least one function, and the like; the storage data area may store data created from the use of blockchain nodes, and the like.
In the several embodiments provided in the present invention, it should be understood that the disclosed apparatus, device and method may be implemented in other manners. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the modules is merely a logical function division, and there may be other manners of division when actually implemented.
The modules described as separate components may or may not be physically separate, and components shown as modules may or may not be physical units, may be located in one place, or may be distributed over multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional module in the embodiments of the present invention may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit. The integrated units can be realized in a form of hardware or a form of hardware and a form of software functional modules.
It will be evident to those skilled in the art that the invention is not limited to the details of the foregoing illustrative embodiments, and that the present invention may be embodied in other specific forms without departing from the spirit or essential characteristics thereof.
The present embodiments are, therefore, to be considered in all respects as illustrative and not restrictive, the scope of the invention being indicated by the appended claims rather than by the foregoing description, and all changes which come within the meaning and range of equivalency of the claims are therefore intended to be embraced therein. Any reference signs in the claims shall not be construed as limiting the claim concerned.
The blockchain is a novel application mode of computer technologies such as distributed data storage, point-to-point transmission, consensus mechanism, encryption algorithm and the like. The Blockchain (Blockchain), which is essentially a decentralised database, is a string of data blocks that are generated by cryptographic means in association, each data block containing a batch of information of network transactions for verifying the validity of the information (anti-counterfeiting) and generating the next block. The blockchain may include a blockchain underlying platform, a platform product services layer, an application services layer, and the like.
Furthermore, it is evident that the word "comprising" does not exclude other elements or steps, and that the singular does not exclude a plurality. A plurality of units or means recited in the system claims can also be implemented by means of software or hardware by means of one unit or means. The terms second, etc. are used to denote a name, but not any particular order.
Finally, it should be noted that the above-mentioned embodiments are merely for illustrating the technical solution of the present invention and not for limiting the same, and although the present invention has been described in detail with reference to the preferred embodiments, it should be understood by those skilled in the art that modifications and equivalents may be made to the technical solution of the present invention without departing from the spirit and scope of the technical solution of the present invention.
Claims (8)
1. A method of visualizing data, the method comprising:
when a chart generation instruction triggered by a user is received, generating a database language according to the chart generation instruction;
generating an abstract syntax tree according to the database language by utilizing a pre-constructed database connection pool, traversing the data of the abstract syntax tree, and obtaining traversed data;
performing visualization processing on the traversal data to generate a chart;
detecting the track parameters of the user based on the chart in real time by a whole layout rasterization method;
performing shape transformation or position transformation on the chart according to the track parameters to obtain a target chart;
wherein the abstract syntax tree refers to a syntax structure of a programming language expressed in a tree form, and each node on the tree represents a structure in source code; the traversal data refers to data contained in a chart generated according to the chart generation instruction;
the real-time detection of the track parameters of the user based on the chart by the whole layout rasterization method comprises the following steps: determining row and column positioning and width and height of a plurality of grid elements, and splitting a related display area of the chart into the plurality of grid elements according to the row and column positioning and the width and height; acquiring an initial selection position and a movement end position when the drawing operation is carried out on the chart by utilizing row-column positioning and width-height of the grid elements; calculating a difference value between the initial selection position and the movement ending position; determining the initial selection position, the movement ending position and the difference value as track parameters of the user based on the chart;
The generating an abstract syntax tree according to the database language by utilizing the pre-constructed database connection pool comprises the following steps: connecting the target database by utilizing a pre-constructed database connection pool; after being connected with the target database, the database language is utilized to inquire in the target database, and form data in the target database are obtained; splitting the form data into character strings, and generating an abstract syntax tree according to the character strings.
2. The data visualization method of claim 1, wherein the performing shape transformation or position transformation on the graph according to the trajectory parameter to obtain a target graph comprises:
determining an operation intention of the user according to the track parameter, wherein the operation intention comprises shape transformation or position transformation;
and calling a preset application programming interface to connect a graphic container, and carrying out shape change or position change on the graph through the graphic container to obtain a target graph after the shape change or the position change.
3. The data visualization method of claim 1, wherein the visualizing the traversal data to generate a graph comprises:
Acquiring a data list corresponding to the traversal data from a preset chart index library;
and searching the visual chart type corresponding to the data list from the chart index library, and generating a chart according to the visual chart type.
4. The data visualization method of claim 3, wherein the generating a chart from the visualization chart type comprises:
according to the visual chart types, selecting an initial chart of any one type of the visual chart types, and configuring a chart style of the initial chart;
and displaying the traversal data in the initial chart of the chart style to obtain the chart.
5. A data visualization method as recited in any one of claims 1 to 4, wherein upon receiving a user-triggered generate chart instruction, generating a database language from the generate chart instruction comprises:
displaying a user operation interface, and receiving a chart generation instruction triggered by the operation of a user on the operation interface;
and constructing a database language module according to the chart generation instruction, and generating a database language by utilizing the database language module.
6. A data visualization apparatus for implementing the data visualization method according to any one of claims 1 to 5, comprising:
The database language generating module is used for generating a database language according to the chart generating instruction when receiving the chart generating instruction triggered by the user;
the chart generation module is used for generating an abstract syntax tree according to the database language by utilizing a pre-constructed database connection pool, traversing the data of the abstract syntax tree to obtain traversed data, and carrying out visualization processing on the traversed data to generate a chart;
and the chart transformation module is used for detecting the track parameters of the user based on the chart in real time through an overall layout rasterization method, and carrying out shape transformation or position transformation on the chart according to the track parameters to obtain a target chart.
7. An electronic device, the electronic device comprising:
at least one processor; the method comprises the steps of,
a memory communicatively coupled to the at least one processor; wherein,
the memory stores computer program instructions executable by the at least one processor to enable the at least one processor to perform the data visualization method of any one of claims 1 to 5.
8. A computer readable storage medium storing a computer program, wherein the computer program when executed by a processor implements a data visualization method according to any one of claims 1 to 5.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110743259.5A CN113326314B (en) | 2021-06-30 | 2021-06-30 | Data visualization method, device, electronic equipment and readable storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110743259.5A CN113326314B (en) | 2021-06-30 | 2021-06-30 | Data visualization method, device, electronic equipment and readable storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN113326314A CN113326314A (en) | 2021-08-31 |
CN113326314B true CN113326314B (en) | 2024-01-30 |
Family
ID=77425377
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202110743259.5A Active CN113326314B (en) | 2021-06-30 | 2021-06-30 | Data visualization method, device, electronic equipment and readable storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN113326314B (en) |
Families Citing this family (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114116106A (en) * | 2021-11-30 | 2022-03-01 | 上海商汤科技开发有限公司 | Chart display method and device, electronic equipment and storage medium |
CN114742430B (en) * | 2022-04-21 | 2024-07-26 | 平安科技(深圳)有限公司 | User retention early warning visualization method, device, equipment and storage medium |
CN114935997B (en) * | 2022-04-24 | 2023-11-07 | 阿里巴巴(中国)有限公司 | Chart interaction method and electronic equipment |
CN115422167B (en) * | 2022-09-27 | 2023-02-17 | 北京柏睿数据技术股份有限公司 | Cross-data source database view visualization construction method and system |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101515372A (en) * | 2009-02-04 | 2009-08-26 | 北京石油化工学院 | Visual analyzing and predicting method based on a virtual geological model |
CN112560422A (en) * | 2020-12-10 | 2021-03-26 | 北京煜邦电力技术股份有限公司 | Chart processing method, device, equipment and medium |
CN112926288A (en) * | 2019-12-06 | 2021-06-08 | 北京阿博茨科技有限公司 | Business intelligent data visualization method, system, device and readable storage medium |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20180144065A1 (en) * | 2015-04-29 | 2018-05-24 | Mahesh Yellai | Method for Generating Visual Representations of Data Based on Controlled Natural Language Queries and System Thereof |
-
2021
- 2021-06-30 CN CN202110743259.5A patent/CN113326314B/en active Active
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101515372A (en) * | 2009-02-04 | 2009-08-26 | 北京石油化工学院 | Visual analyzing and predicting method based on a virtual geological model |
CN112926288A (en) * | 2019-12-06 | 2021-06-08 | 北京阿博茨科技有限公司 | Business intelligent data visualization method, system, device and readable storage medium |
CN112560422A (en) * | 2020-12-10 | 2021-03-26 | 北京煜邦电力技术股份有限公司 | Chart processing method, device, equipment and medium |
Also Published As
Publication number | Publication date |
---|---|
CN113326314A (en) | 2021-08-31 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN113326314B (en) | Data visualization method, device, electronic equipment and readable storage medium | |
KR102143889B1 (en) | System for metadata management | |
JP5965477B2 (en) | A map-based method for visualizing relational databases | |
CN110292775B (en) | Method and device for acquiring difference data | |
CN107766309B (en) | Data table generation method and device, storage medium and electronic device | |
CN103678705B (en) | A Parallel Transformation Method of Vector Data from VCT File to Shapefile | |
CN112035667A (en) | Knowledge graph display method and device and terminal equipment | |
CN104750771B (en) | The method and system of context data analysis is carried out using domain information | |
CN104866426A (en) | Software test integrated control method and system | |
US20190286635A1 (en) | Systems and methods for an end-to-end visual analytics system for massive-scale geospatial data | |
CN102541867A (en) | Data dictionary generating method and system | |
CN112883042A (en) | Data updating and displaying method and device, electronic equipment and storage medium | |
JP2022505230A (en) | Systems and methods for dependency analysis in a multidimensional database environment | |
CN112364107A (en) | System analysis visualization method and device, electronic equipment and computer readable storage medium | |
US8230319B2 (en) | Web-based visualization, refresh, and consumption of data-linked diagrams | |
CN103853809A (en) | Efficient space allocation for business objects | |
CN116931783A (en) | Front-end massive tree structure display method and device, electronic equipment and medium | |
CN116662528A (en) | Map self-adaptive recommendation method based on knowledge graph and related equipment | |
CN117933206B (en) | Service data processing method, device, equipment, storage medium and program product | |
CN103809915B (en) | The reading/writing method of a kind of disk file and device | |
US20230325383A1 (en) | User interface for query composition and data visualization | |
Noskov et al. | Open-data-driven embeddable quality management services for map-based web applications | |
JP5706306B2 (en) | Method of rendering an electronic document with linked text boxes, computer readable storage medium and system including instructions for rendering | |
Polášek et al. | Information and knowledge retrieval within software projects and their graphical representation for collaborative programming | |
US9208224B2 (en) | Business content hierarchy |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |