CN113326314A - Data visualization method and device, electronic equipment and readable storage medium - Google Patents

Data visualization method and device, electronic equipment and readable storage medium Download PDF

Info

Publication number
CN113326314A
CN113326314A CN202110743259.5A CN202110743259A CN113326314A CN 113326314 A CN113326314 A CN 113326314A CN 202110743259 A CN202110743259 A CN 202110743259A CN 113326314 A CN113326314 A CN 113326314A
Authority
CN
China
Prior art keywords
chart
data
database
generating
visualization
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.)
Granted
Application number
CN202110743259.5A
Other languages
Chinese (zh)
Other versions
CN113326314B (en
Inventor
林文发
李福宇
高宏
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
China Merchants Finance Technology Co Ltd
Original Assignee
China Merchants Finance Technology Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by China Merchants Finance Technology Co Ltd filed Critical China Merchants Finance Technology Co Ltd
Priority to CN202110743259.5A priority Critical patent/CN113326314B/en
Publication of CN113326314A publication Critical patent/CN113326314A/en
Application granted granted Critical
Publication of CN113326314B publication Critical patent/CN113326314B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/26Visual data mining; Browsing structured data
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/22Indexing; Data structures therefor; Storage structures
    • G06F16/2228Indexing structures
    • G06F16/2246Trees, e.g. B+trees
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/22Indexing; Data structures therefor; Storage structures
    • G06F16/2282Tablespace storage structures; Management thereof
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/28Databases characterised by their database models, e.g. relational or object models
    • G06F16/284Relational databases
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/28Databases characterised by their database models, e.g. relational or object models
    • G06F16/284Relational databases
    • G06F16/285Clustering or classification
    • G06F16/287Visualization; Browsing

Abstract

The invention relates to a development technology, and discloses a data visualization method, which comprises the following steps: when a chart generating instruction triggered by a user is received, generating a database language according to the chart generating instruction; generating an abstract syntax tree according to a database language by using a pre-constructed database connection pool, and traversing data of the abstract syntax tree to obtain traversed data; performing visualization processing on the traversal data to generate a chart; detecting the trajectory 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 diagram according to the track parameters to obtain a target diagram. The invention also provides a data visualization device, electronic equipment and a storage medium. The invention can improve the real-time performance of chart display.

Description

Data visualization method and device, electronic equipment and readable storage medium
Technical Field
The present invention relates to the field of development, and in particular, to a data visualization method and apparatus, an electronic device, and a readable storage medium.
Background
Data visualization can display data of different types and dimensions in a visualization chart mode, deep analysis and data mining are facilitated by achieving data visualization, and therefore the data visualization technology is applied to enterprises more and more widely.
However, the chart display form of a single template of a data visualization platform on the market is single, so the sensitivity of dragging a drawing engine is often ignored in order to emphasize the presentation degree of data, and the visualization is delayed.
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 real-time performance of chart display.
In order to achieve the above object, the present invention provides a data visualization method, including:
when a chart generating instruction triggered by a user is received, generating a database language according to the chart generating instruction;
generating an abstract syntax tree according to the database language by using a pre-constructed database connection pool, and traversing data of the abstract syntax tree to obtain traversed data;
performing visualization processing on the traversal data to generate a chart;
detecting the trajectory 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 diagram according to the track parameters to obtain a target diagram.
Optionally, the detecting, in real time, the trajectory parameter of the user based on the chart by the overall layout rasterization method includes:
determining the row and column positioning and the width and the 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 the height;
obtaining an initial selection position and a movement ending position when the chart is dragged by utilizing the row and column positioning and the width and height of the grid elements;
calculating the 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 the trajectory parameters of the user based on the chart.
Optionally, the performing shape transformation or position transformation on the graph according to the trajectory parameter to obtain a target graph includes:
determining an operation intention of the user according to the track parameters, 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 diagram through the graphic container to obtain a target diagram after the shape change or the position change.
Optionally, the generating an abstract syntax tree according to the database language by using a preconfigured database connection pool includes:
connecting the target database by using a pre-constructed database connection pool;
after the connection with the target database, utilizing the database language to query in the target database, and acquiring form data in the target database;
and splitting the form data into character strings, and generating an abstract syntax tree according to the character strings.
Optionally, the visualizing 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 visualization chart type corresponding to the data list from the chart index library, and generating a chart according to the visualization chart type.
Optionally, the generating a chart according to the visualization chart type includes:
selecting any one type of initial chart in the visualization chart types according to the visualization chart types, and configuring the 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 a chart generating instruction triggered by a user is received, generating a database language according to the chart generating instruction includes:
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 generating instruction, and generating a database language by using the database language module.
In order to solve the above problem, the present invention also provides a data visualization apparatus, comprising:
the database language generation module is used for generating a database language according to a generated chart instruction when the generated chart instruction triggered by a user is received;
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 data of the abstract syntax tree to obtain traversal data, and performing visualization processing on the traversal data to generate a chart;
and the chart transformation module is used for detecting the user trajectory parameters 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 trajectory parameters to obtain a target chart.
In order to solve the above problem, the present invention also provides an electronic device, including:
a memory storing at least one computer program; and
a processor executing the computer program stored in the memory to implement the data visualization method described above.
In order to solve the above problem, the present invention further provides a computer-readable storage medium, in which at least one computer program is stored, and the at least one computer program is executed by a processor in an electronic device to implement the data visualization method described above.
According to the embodiment of the invention, a chart instruction is generated by a user, and is subjected to visualization processing, so that automatic generation of a chart is realized; further, detecting the trajectory 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, so that the requirements that a user can randomly select indexes and visual chart types, add and delete the indexes and randomly adjust the size of the chart are met, active real-time analysis is realized, accurate and sensitive detection of the track parameters of the user based on the chart can be ensured through layout rasterization, and the real-time performance of chart display is improved. Therefore, the data visualization method, the data visualization 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 schematic 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 apparatus according to an embodiment of the present invention;
fig. 3 is a schematic internal structural diagram of an electronic device implementing a data visualization method according to an embodiment of the present invention;
the implementation, functional features and advantages of the objects of the present invention will be further explained with reference to the accompanying drawings.
Detailed Description
It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit 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 electronic devices such as a server and a terminal, 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 the terminal device or the server device, and the software may be a blockchain platform. The server 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 a flowchart of a data visualization method provided in an embodiment of the present invention shown in fig. 1, in an embodiment of the present invention, the data visualization method includes:
and S1, when a chart generating instruction triggered by a user is received, generating a database language according to the chart generating instruction.
In this embodiment, the instruction for generating the chart refers to an instruction triggered by a user operating through inputting a keyword in a user operation interface, or an instruction triggered by clicking an interactive button.
The database language is a database query and programming language that is primarily used to access data and query, update, and manage relational database systems.
In detail, when a chart generating instruction triggered by a user is received, generating a database language according to the chart generating instruction includes:
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 generating instruction, and generating a database language by using 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 generated in a database language at a back end by using the database language module.
For example, the chart generating instruction is Table, a database language template is created by using the Table instruction, the Table is connected with the database end by using the template, and the database languages of Select Table, Create Table and Insert Table are generated through parameter conversion of the database end.
Preferably, the database language may be SQL.
And S2, generating an abstract syntax tree according to the database language by using a pre-constructed database connection pool, and traversing the data of the abstract syntax tree to obtain traversed data.
In this embodiment, the abstract syntax tree refers to a syntax structure that represents a programming language in the form of a tree, each node on the tree represents one structure in the source code, and the abstract syntax tree mainly functions 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 a pre-constructed database connection pool includes:
connecting the target database by using a pre-constructed database connection pool;
after the connection with the target database, utilizing the database language to query in the target database, and acquiring form data in the target database;
and 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 in which data related to the chart 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 database connection pool is mainly used for storing the connection of the database as an object in a memory, when the database needs to be accessed, a new connection is not needed to be established, an established idle connection object is taken out from 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 an Alibaba drive, and the database connection may be implemented by JDBC, and the database language may perform Create Table/Insert/Select operations on the database.
Specifically, in this embodiment, query operation may be performed on the target database through the SQL database language to obtain a form structure in the target database and data in the table, the form structure and the data in the table are split into character strings, the obtained character strings are connected to structured data to obtain an abstract syntax tree, and all parameter information included in the character strings may be accurately known according to the abstract syntax tree.
For example, a database is queried through SQL to obtain a student attendance table, which can be divided into a name, a number, time, and the like, where the name includes a plurality of student names, and the plurality of student names are connected with the school numbers and times corresponding to the plurality of student names to obtain an abstract syntax tree.
In this embodiment, the process of parsing the database language into the abstract syntax tree can implement data management and deep computation, and interact with a data set in the parsing process to implement dynamic data analysis and display.
Further, the step of analyzing the data of the abstract syntax tree in the traversal manner to obtain traversal analysis data includes:
performing stack pressing operation on the abstract syntax tree to obtain form data fields, and popping up the form data fields;
looping the push operation until the push operation becomes an empty stack;
when the stack pushing operation is changed into the empty stack, stopping circulation and storing all the form data fields;
and converting the form data fields into traversal data.
In this embodiment, the stack refers to a linear table that performs an insertion or deletion operation only at the end of the table. An empty table without an element is called an empty stack. The form data fields refer 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 visualizing 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 visualization chart type corresponding to the data list from the chart index library, and generating a chart according to the visualization chart type.
In this embodiment, the index library refers to a view style in which data can be converted into a view, and includes all visual charts, where the types of the visual charts may include, but are not limited to, a scatter chart, a bar chart, a line chart, a pie chart, and a map, and may also store data imported by a user and a view chart created by the user.
In this embodiment, the index database includes a data list and a visualization chart type corresponding to the data list, so that the data list corresponding to the traversal data and the visualization chart type corresponding to the data list can be obtained from a preset chart index database.
Specifically, the data list included in the index library may be cycle data, table data, numerical algorithm data, a data set describing a point location, and the like.
For example, the traversal data list is a goods list table for warehouse entry and exit, identifiable fields of the goods list table include goods names, goods numbers, goods entry and exit time, goods quantity and the like, and a visual chart type consistent with the table fields of the obtained list table is obtained from a preset chart index library.
In the embodiment of the invention, the chart index library corresponding to the data list comprises visualization chart types such as a scatter chart, a bar chart, a line chart, a pie chart, a map and the like, and the line chart or the chart formed by overlapping the line chart and the bar chart can be selected as a generated chart.
Further, the generating a chart according to the visualization chart type includes:
selecting any one type of initial chart in the visualization chart types according to the visualization chart types, and configuring the 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 change of the chart, a gradient color change, whether to add a title, and the like. For example, a line chart may be selected according to the type of the visual chart, the color and gradient color of the chart may be changed for the line chart, and a chart title may be displayed, thereby finally obtaining the chart.
And S4, detecting the trajectory parameters of the user based on the chart in real time through an overall layout rasterization method.
In this embodiment, the overall layout rasterization refers to dividing the screen visible area into 12 grid elements with equal width, and each grid element is the minimum unit for limiting scaling. The track parameter refers to a position track moved when a user drags the chart.
In detail, the detecting the trajectory parameter of the user based on the chart in real time by the overall layout rasterization method includes:
determining the row and column positioning and the width and the 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 the height;
obtaining an initial selection position and a movement ending position when the chart is dragged by utilizing the row and column positioning and the width and height of the grid elements;
calculating the 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 the trajectory parameters of the user based on the chart.
The conventional track detection technology mainly utilizes first-order difference processing to detect a track by calculating the distance between two adjacent track points.
Specifically, in this embodiment, the overall layout rasterization method is utilized to detect the trajectory parameters of the user based on the diagram in real time, so as to ensure the accurate positioning of the dragging and zooming operations.
For example, a plurality of grid elements are generated and configured with default row and column positioning and width and height. When the user is right to the chartThe current mouse position can be obtained by pressing or moving the mouse, namely the corresponding initial selection position and the ending movement position, and the coordinates (x, y) of the initial selection position and the coordinates (x) of the ending movement position are calculated1,y1) And obtaining the difference between the initial selection position and the movement ending position, so as to detect the track parameters of the grid elements in real time and improve the sensitivity of the user in dragging and zooming the diagram.
Further, when the dragging and zooming operation is finished, the row and column positioning and the width and height parameters of the grid elements are stored and submitted to the back end, the view type created by the user can be recorded, and the style, the position and the layout of the view can be stored, so that the last operation of the user can be restored when the user enters the user operation interface next time.
And S5, carrying out shape transformation or position transformation on the graph according to the track parameters to obtain a target graph.
In detail, the performing shape transformation or position transformation on the graph according to the trajectory parameters to obtain a target graph includes:
determining an operation intention of the user according to the track parameters, 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 diagram through the graphic container to obtain a target diagram 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, the graph includes a plurality of components before being displayed on the page, and the shape transformation operation performed on the graph by the user is identified according to the trajectory parameter, and then the new component is mounted and the old component is unloaded and updated on the changed portion of the graph in the graphic container canvas by using the API, the page is re-rendered, and the page refresh is triggered, so that the shape transformation update operation is realized, and the target graph after the shape change is obtained.
According to the embodiment of the invention, a chart instruction is generated by a user, and is subjected to visualization processing, so that automatic generation of a chart is realized; further, detecting the trajectory 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, so that the requirements that a user can randomly select indexes and visual chart types, add and delete the indexes and randomly adjust the size of the chart are met, active real-time analysis is realized, accurate and sensitive detection of the track parameters of the user based on the chart can be ensured through layout rasterization, and the real-time performance of chart display is improved. Therefore, the data visualization method provided by the embodiment of the invention can improve the real-time performance of chart display.
Fig. 2 is a functional block diagram of the data visualization apparatus according to the present invention.
The data visualization apparatus 100 of the present invention can be installed in an electronic device. According to the implemented functions, the data visualization apparatus may include a database language generation module 101, a chart generation module 102, and a chart transformation module 103, which may also be referred to as a unit, and refer to a series of computer program segments that can be executed by a processor of an electronic device and can perform fixed functions, and are stored in a memory of the electronic device.
In the present embodiment, the functions regarding the respective modules/units are as follows:
the database language generation module 101 is configured to generate a database language according to a chart generation instruction triggered by a user when the chart generation instruction is received.
In this embodiment, the instruction for generating the chart refers to an instruction triggered by a user operating through inputting a keyword in a user operation interface, or an instruction triggered by clicking an interactive button.
The database language is a database query and programming language that is primarily used to access data and query, update, and manage relational database systems.
In detail, the database language generation module 101 generates the database language according to a chart generation instruction triggered by a user when the chart generation instruction is received by executing 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 generating instruction, and generating a database language by using 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 generated in a database language at a back end by using the database language module.
For example, the chart generating instruction is Table, a database language template is created by using the Table instruction, the Table is connected with the database end by using the template, and the database languages of Select Table, Create Table and Insert Table are generated through parameter conversion of the database end.
Preferably, the database language may be SQL.
The chart generating module 102 is configured to generate an abstract syntax tree according to the database language by using a preconfigured database connection pool, traverse data of the abstract syntax tree to obtain traversal data, perform visualization processing on the traversal data, and generate a chart.
In this embodiment, the abstract syntax tree refers to a syntax structure that represents a programming language in the form of a tree, each node on the tree represents one structure in the source code, and the abstract syntax tree mainly functions 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 graph 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 using a pre-constructed database connection pool;
after the connection with the target database, utilizing the database language to query in the target database, and acquiring form data in the target database;
and 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 in which data related to the chart 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 database connection pool is mainly used for storing the connection of the database as an object in a memory, when the database needs to be accessed, a new connection is not needed to be established, an established idle connection object is taken out from 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 an Alibaba drive, and the database connection may be implemented by JDBC, and the database language may perform Create Table/Insert/Select operations on the database.
Specifically, in this embodiment, query operation may be performed on the target database through the SQL database language to obtain a form structure in the target database and data in the table, the form structure and the data in the table are split into character strings, the obtained character strings are connected to structured data to obtain an abstract syntax tree, and all parameter information included in the character strings may be accurately known according to the abstract syntax tree.
For example, a database is queried through SQL to obtain a student attendance table, which can be divided into a name, a number, time, and the like, where the name includes a plurality of student names, and the plurality of student names are connected with the school numbers and times corresponding to the plurality of student names to obtain an abstract syntax tree.
In this embodiment, the process of parsing the database language into the abstract syntax tree can implement data management and deep computation, and interact with a data set in the parsing process to implement dynamic data analysis and display.
Further, the step of analyzing the data of the abstract syntax tree in the traversal manner to obtain traversal analysis data includes:
performing stack pressing operation on the abstract syntax tree to obtain form data fields, and popping up the form data fields;
looping the push operation until the push operation becomes an empty stack;
when the stack pushing operation is changed into the empty stack, stopping circulation and storing all the form data fields;
and converting the form data fields into traversal data.
In this embodiment, the stack refers to a linear table that performs an insertion or deletion operation only at the end of the table. An empty table without an element is called an empty stack. The form data fields refer to all form structures and field information in the data in the form.
In detail, the chart generation module 102 generates a chart by performing the following operations to visualize the traversal parsing data:
acquiring a data list corresponding to the traversal data from a preset chart index library;
and searching the visualization chart type corresponding to the data list from the chart index library, and generating a chart according to the visualization chart type.
In this embodiment, the index library refers to a view style in which data can be converted into a view, and includes all visual charts, where the types of the visual charts may include, but are not limited to, a scatter chart, a bar chart, a line chart, a pie chart, and a map, and may also store data imported by a user and a view chart created by the user.
In this embodiment, the index database includes a data list and a visualization chart type corresponding to the data list, so that the data list corresponding to the traversal data and the visualization chart type corresponding to the data list can be obtained from a preset chart index database.
Specifically, the data list included in the index library may be cycle data, table data, numerical algorithm data, a data set describing a point location, and the like.
For example, the traversal data list is a goods list table for warehouse entry and exit, identifiable fields of the goods list table include goods names, goods numbers, goods entry and exit time, goods quantity and the like, and a visual chart type consistent with the table fields of the obtained list table is obtained from a preset chart index library.
In the embodiment of the invention, the chart index library corresponding to the data list comprises visualization chart types such as a scatter chart, a bar chart, a line chart, a pie chart, a map and the like, and the line chart or the chart formed by overlapping the line chart and the bar chart can be selected as a generated chart.
Further, the chart generation module 102 generates a chart from the visualization chart type by performing the following operations:
selecting any one type of initial chart in the visualization chart types according to the visualization chart types, and configuring the 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 change of the chart, a gradient color change, whether to add a title, and the like. For example, a line chart may be selected according to the type of the visual chart, the color and gradient color of the chart may be changed for the line chart, and a chart title may be displayed, thereby finally obtaining the chart.
The chart transformation module 103 is configured to detect a trajectory parameter of the user based on the chart in real time through an overall layout rasterization method, and perform shape transformation or position transformation on the chart according to the trajectory parameter to obtain a target chart.
In this embodiment, the overall layout rasterization refers to dividing the screen visible area into 12 grid elements with equal width, and each grid element is the minimum unit for limiting scaling. The track parameter refers to a position track moved when a user drags the chart.
In detail, the chart transformation module 103 detects the trajectory parameters of the user based on the chart in real time through an overall layout rasterization method:
determining the row and column positioning and the width and the 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 the height;
obtaining an initial selection position and a movement ending position when the chart is dragged by utilizing the row and column positioning and the width and height of the grid elements;
calculating the 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 the trajectory parameters of the user based on the chart.
The conventional track detection technology mainly utilizes first-order difference processing to detect a track by calculating the distance between two adjacent track points.
Specifically, in this embodiment, the overall layout rasterization method is utilized to detect the trajectory parameters of the user based on the diagram in real time, so as to ensure the accurate positioning of the dragging and zooming operations.
For example, a plurality of grid elements are generated and configured with default row and column positioning and width and height. When a user presses the mouse or moves the mouse on the chart to obtain the current mouse position, namely the current mouse position corresponds to the initial selection position and the ending movement position, and the coordinates (x, y) of the initial selection position and the coordinates (x) of the ending movement position are calculated1,y1) And obtaining the difference between the initial selection position and the movement ending position, so as to detect the track parameters of the grid elements in real time and improve the sensitivity of the user in dragging and zooming the diagram.
Further, when the dragging and zooming operation is finished, the row and column positioning and the width and height parameters of the grid elements are stored and submitted to the back end, the view type created by the user can be recorded, and the style, the position and the layout of the view can be stored, so that the last operation of the user can be restored when the user enters the user operation interface next time.
In detail, the graph transformation module 103 performs shape transformation or position transformation on the graph according to the trajectory parameters by performing the following operations to obtain a target graph, including:
determining an operation intention of the user according to the track parameters, 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 diagram through the graphic container to obtain a target diagram 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, the graph includes a plurality of components before being displayed on the page, and the shape transformation operation performed on the graph by the user is identified according to the trajectory parameter, and then the new component is mounted and the old component is unloaded and updated on the changed portion of the graph in the graphic container canvas by using the API, the page is re-rendered, and the page refresh is triggered, so that the shape transformation update operation is realized, and the target graph after the shape change is obtained.
According to the embodiment of the invention, a chart instruction is generated by a user, and is subjected to visualization processing, so that automatic generation of a chart is realized; further, detecting the trajectory 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, so that the requirements that a user can randomly select indexes and visual chart types, add and delete the indexes and randomly adjust the size of the chart are met, active real-time analysis is realized, accurate and sensitive detection of the track parameters of the user based on the chart can be ensured through layout rasterization, and the real-time performance of chart display is improved. Therefore, the data visualization device provided by the embodiment of the invention can improve the real-time performance of chart display.
Fig. 3 is a schematic structural diagram of an electronic device 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, which includes flash memory, removable hard disk, multimedia card, card-type memory (e.g., SD or DX memory, etc.), magnetic memory, local magnetic disk, optical disk, etc. The memory 11 may in some embodiments be an internal storage unit of the electronic device, for example a removable hard disk of the electronic device. The memory 11 may also be an external storage device of the electronic device in other embodiments, such as a plug-in mobile hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), and 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 to store application software installed in the electronic device and various types of data, such as codes of a data visualization program, but also to temporarily store data that has been output or is to be output.
The processor 10 may be composed of an integrated circuit in some embodiments, for example, a single packaged integrated circuit, or may be composed of a plurality of integrated circuits packaged with the same or different functions, including one or more Central Processing Units (CPUs), microprocessors, digital Processing chips, graphics processors, and combinations of various control chips. The processor 10 is a Control Unit (Control Unit) of the electronic device, connects various components of the electronic device by using various interfaces and lines, and executes various functions and processes data of the electronic device 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 (PCI) bus or an Extended Industry Standard Architecture (EISA) bus. The bus may be divided into an address bus, a data bus, a control bus, etc. The communication bus 12 is arranged to enable connection communication between the memory 11 and at least one processor 10 or the like. For ease of illustration, only one thick line is shown, but this does not mean that there is only one bus or one type of bus.
Fig. 3 shows only an electronic device having components, and those skilled in the art will appreciate that the structure shown in fig. 3 does not constitute a limitation of the electronic device, and may include fewer or more components than those shown, or some components may be combined, or a different arrangement of components.
For example, although not shown, the electronic device may further include a power supply (such as a battery) for supplying power to each component, and preferably, the power supply 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 realized through the power management device. The power supply may also include any component of one or more dc or ac power sources, recharging devices, power failure detection circuitry, power converters or inverters, power status indicators, and the like. The electronic device may further include various sensors, a bluetooth module, a Wi-Fi module, and the like, which are not described herein again.
Optionally, the communication interface 13 may include a wired interface and/or a wireless interface (e.g., WI-FI interface, bluetooth interface, etc.), which is generally used to establish a communication connection between the electronic device and other electronic devices.
Optionally, the communication interface 13 may further include a user interface, which may be a Display (Display), an input unit (such as a Keyboard (Keyboard)), and optionally, a standard wired interface, or 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 device, or the like. The display, which may also be referred to as a display screen or display unit, is suitable, among other things, for displaying information processed in the electronic device and for displaying a visualized user interface.
It is to be understood that the described embodiments are for purposes of illustration only and that the scope of the appended claims is not limited to such structures.
The data visualization program stored in the memory 11 of the electronic device is a combination of a plurality of computer programs, which when executed in the processor 10, may implement:
when a chart generating instruction triggered by a user is received, generating a database language according to the chart generating instruction;
generating an abstract syntax tree according to the database language by using a pre-constructed database connection pool, and traversing data of the abstract syntax tree to obtain traversed data;
performing visualization processing on the traversal data to generate a chart;
detecting the trajectory 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 diagram according to the track parameters to obtain a target diagram. Specifically, the processor 10 may refer to the description of the relevant steps in the embodiment corresponding to fig. 1 for a specific implementation method of the computer program, which is not described herein again.
Further, the electronic device integrated module/unit, if implemented in the form of a software functional unit and sold or used as a separate product, 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, recording medium, U disk, removable hard disk, magnetic disk, optical disk, computer Memory, Read-Only Memory (ROM).
Embodiments of the present invention may also provide a computer-readable storage medium, where the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor of an electronic device, the computer program may implement:
when a chart generating instruction triggered by a user is received, generating a database language according to the chart generating instruction;
generating an abstract syntax tree according to the database language by using a pre-constructed database connection pool, and traversing data of the abstract syntax tree to obtain traversed data;
performing visualization processing on the traversal data to generate a chart;
detecting the trajectory 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 diagram according to the track parameters to obtain a target diagram. 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 according to the use of the blockchain node, and the like.
In the embodiments provided in the present invention, it should be understood that the disclosed apparatus, device and method can be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the modules is only one logical functional division, and other divisions may be realized in practice.
The modules described as separate parts may or may not be physically separate, and parts displayed as modules may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment.
In addition, functional modules in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, or in a form of hardware plus a software functional module.
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 attributes 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 block chain is a novel application mode of computer technologies such as distributed data storage, point-to-point transmission, a consensus mechanism, an encryption algorithm and the like. A block chain (Blockchain), which is essentially a decentralized database, is a series of data blocks associated by using a cryptographic method, and each data block contains information of a batch of network transactions, so as to verify the validity (anti-counterfeiting) of the information and generate a next block. The blockchain may include a blockchain underlying platform, a platform product service layer, an application service layer, and the like.
Furthermore, it is obvious that the word "comprising" does not exclude other elements or steps, and the singular does not exclude the plural. A plurality of units or means recited in the system claims may also be implemented by one unit or means in software or hardware. The terms second, etc. are used to denote names, but not any particular order.
Finally, it should be noted that the above embodiments are only for illustrating the technical solutions of the present invention and not for limiting, and although the present invention is described in detail with reference to the preferred embodiments, it should be understood by those skilled in the art that modifications or equivalent substitutions may be made on the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention.

Claims (10)

1. A method for data visualization, the method comprising:
when a chart generating instruction triggered by a user is received, generating a database language according to the chart generating instruction;
generating an abstract syntax tree according to the database language by using a pre-constructed database connection pool, and traversing data of the abstract syntax tree to obtain traversed data;
performing visualization processing on the traversal data to generate a chart;
detecting the trajectory 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 diagram according to the track parameters to obtain a target diagram.
2. The data visualization method as claimed in claim 1, wherein the detecting the trajectory parameters of the user based on the chart in real time by the overall layout rasterization method comprises:
determining the row and column positioning and the width and the 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 the height;
obtaining an initial selection position and a movement ending position when the chart is dragged by utilizing the row and column positioning and the width and height of the grid elements;
calculating the 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 the trajectory parameters of the user based on the chart.
3. The data visualization method according to 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 parameters, 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 diagram through the graphic container to obtain a target diagram after the shape change or the position change.
4. A method for visualizing data as in claim 1, wherein said utilizing a pre-constructed pool of database connections to generate an abstract syntax tree from said database language comprises:
connecting the target database by using a pre-constructed database connection pool;
after the connection with the target database, utilizing the database language to query in the target database, and acquiring form data in the target database;
and splitting the form data into character strings, and generating an abstract syntax tree according to the character strings.
5. 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 visualization chart type corresponding to the data list from the chart index library, and generating a chart according to the visualization chart type.
6. The data visualization method of claim 5, wherein said generating a chart according to the visualization chart type comprises:
selecting any one type of initial chart in the visualization chart types according to the visualization chart types, and configuring the chart style of the initial chart;
and displaying the traversal data in the initial chart of the chart style to obtain the chart.
7. A data visualization method as claimed in any one of claims 1 to 6 wherein said generating a database language in accordance with a generate chart instruction upon receiving a user triggered 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 generating instruction, and generating a database language by using the database language module.
8. A data visualization device, comprising:
the database language generation module is used for generating a database language according to a generated chart instruction when the generated chart instruction triggered by a user is received;
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 data of the abstract syntax tree to obtain traversal data, and performing visualization processing on the traversal data to generate a chart;
and the chart transformation module is used for detecting the user trajectory parameters 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 trajectory parameters to obtain a target chart.
9. An electronic device, characterized in that the electronic device comprises:
at least one processor; and the number of the first and second groups,
a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,
the memory stores computer program instructions executable by the at least one processor to enable the at least one processor to perform a method of visualizing data as claimed in any one of claims 1 to 7.
10. A computer-readable storage medium, in which a computer program is stored which, when being executed by a processor, carries out a data visualization method as claimed in one of claims 1 to 7.
CN202110743259.5A 2021-06-30 2021-06-30 Data visualization method, device, electronic equipment and readable storage medium Active CN113326314B (en)

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 true CN113326314A (en) 2021-08-31
CN113326314B 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)

Cited By (3)

* Cited by examiner, † Cited by third party
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
CN114935997A (en) * 2022-04-24 2022-08-23 阿里巴巴(中国)有限公司 Chart interaction method and electronic equipment
CN115422167A (en) * 2022-09-27 2022-12-02 北京柏睿数据技术股份有限公司 Cross-data source database view visualization construction method and system

Citations (4)

* Cited by examiner, † Cited by third party
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
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
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

Patent Citations (4)

* Cited by examiner, † Cited by third party
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
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
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

Cited By (6)

* Cited by examiner, † Cited by third party
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
WO2023097998A1 (en) * 2021-11-30 2023-06-08 上海商汤智能科技有限公司 Chart display method and apparatus, electronic device, storage medium, and program
CN114935997A (en) * 2022-04-24 2022-08-23 阿里巴巴(中国)有限公司 Chart interaction method and electronic equipment
CN114935997B (en) * 2022-04-24 2023-11-07 阿里巴巴(中国)有限公司 Chart interaction method and electronic equipment
CN115422167A (en) * 2022-09-27 2022-12-02 北京柏睿数据技术股份有限公司 Cross-data source database view visualization construction method and system
CN115422167B (en) * 2022-09-27 2023-02-17 北京柏睿数据技术股份有限公司 Cross-data source database view visualization construction method and system

Also Published As

Publication number Publication date
CN113326314B (en) 2024-01-30

Similar Documents

Publication Publication Date Title
CN113326314B (en) Data visualization method, device, electronic equipment and readable storage medium
Lee et al. Context-aware risk management for architectural heritage using historic building information modeling and virtual reality
KR102143889B1 (en) System for metadata management
US8570326B2 (en) Rule based visualization mechanism
CN103577524A (en) Business object representations and detail boxes display
CN113449187A (en) Product recommendation method, device and equipment based on double portraits and storage medium
CN112883042A (en) Data updating and displaying method and device, electronic equipment and storage medium
CN112364107A (en) System analysis visualization method and device, electronic equipment and computer readable storage medium
CN113095995A (en) Webpage watermark adding method and device, electronic equipment and storage medium
CN114020256A (en) Front-end page generation method, device and equipment and readable storage medium
CN113961584A (en) Method and device for analyzing field blood relationship, electronic equipment and storage medium
CN113327136A (en) Attribution analysis method and device, electronic equipment and storage medium
CN113434542B (en) Data relationship identification method and device, electronic equipment and storage medium
CN114398346A (en) Data migration method, device, equipment and storage medium
CN113468288A (en) Content extraction method of text courseware based on artificial intelligence and related equipment
CN111444368A (en) Method and device for constructing user portrait, computer equipment and storage medium
CN103809915B (en) The reading/writing method of a kind of disk file and device
CN114840631A (en) Spatial text query method and device, electronic equipment and storage medium
CN115186188A (en) Product recommendation method, device and equipment based on behavior analysis and storage medium
CN115114297A (en) Data lightweight storage and search method and device, electronic equipment and storage medium
CN115238179A (en) Project pushing method and device, electronic equipment and computer readable storage medium
CN114880308A (en) Metadata processing method, device and medium based on big data
CN114398282A (en) Test script generation method, device, equipment and storage medium
CN114490666A (en) Chart generation method, device and equipment based on data requirements and storage medium
CN114816371A (en) Message processing method, device, equipment and medium

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