Computer analysis system
Through the combination of BS architecture and specific libraries, the use and development of data visualization tools are simplified, the problems of existing tools are solved, and the complexity of existing tools and code redundancy are achieved, and efficient data visualization and interactivity are achieved.
Patent Information
- Application Number
- CN202410958216.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-17
- Publication Date
- 2024-11-22
AI Technical Summary
Existing data visualization tools are cumbersome in data copying, pasting and operating, requiring professional knowledge, resulting in code redundancy, and the variety of chart types leads to a large number of pages, which increases the burden on developers.
Computer analysis system using BS architecture generates charts through echarts and Openpyxl library, uses JSON configuration files to store model information, designs special mapping models for chart rendering and component correspondence, combines vue and flask framework to realize browser and server interaction, simplifies the front-end Assemble the data model, use object-oriented thinking to process Excel table data and package it into an exe file through pyinstaller.
It simplifies the use and development of data visualization tools, reduces the amount of code, improves page interactivity, and non-professionals can also write components, which greatly reduces the workload of developers.
Smart Images

Figure CN119002869A_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the field of data visualization tools, in particular to a computer analysis system, a data visualization interactive system designed for non-professional users. Background Art
[0002] Data visualization refers to the conversion of structured or unstructured data into appropriate visual charts, and then directly presenting the information hidden in the data to people. It is a scientific and technological study on the visual representation of data. It mainly refers to technically advanced technical methods, which allow the use of graphics, image processing, computer vision and user interfaces to visualize data through expression, modeling and display of three-dimensional, surface, attribute and animation.
[0003] The existing ChartCool data visualization tool requires users to copy and paste the data to be visualized before data visualization. If the amount of data is large, copying and pasting is troublesome. In addition, professional knowledge is required to operate this tool for visualization. In addition, the code for user operations on the table and parsing the user's data is mostly the same, which may cause a lot of code redundancy and increase the amount of code.
[0004] In some existing data visualization tools, different charts require different data because of their different characteristics. However, due to the large number of chart types, corresponding pages need to be made according to the chart types, resulting in numerous pages and a burden for developers. The traditional solution is to extract all user configuration component codes into n HTML files, and then on the page that displays the chart, the area that displays the configuration items is used <iframe>Wrapped in tags, the extracted n html will be used to fill in the<iframe> This area, but using<iframe> The amount of label code is still not small, which will lead to a lot of code redundancy.
[0005] Therefore, those skilled in the art have proposed a computer analysis system for use as a data visualization tool. Summary of the invention
[0006] In order to solve the above technical problems, the present invention provides a computer analysis system to solve the problems raised in the background technology. A computer analysis system, whose system architecture adopts BS architecture, i.e., the interactive mode of browser and server, by creating a platform providing multiple visualization templates, users are allowed to select and configure charts according to their needs, using echarts as the chart generated by visualization engine, and using Openpyxl as the library for processing excel files, using JSON configuration file to store model information and configuration data, while designing a special mapping model to perform the rendering of chart model and the one-to-one correspondence of components, so that each chart can be correctly generated and configured, and using pyinstaller to package achievements into exe files, users can start the server and open the project by double-clicking the file, and the system is provided with a password mechanism to prevent cracking.
[0008] Preferably, excel is used as the data submitted, and the Openpyxl framework is used as the function read by excel, and excel is subjected to data visualization, and two situations of uniformly taking data according to rows and uniformly taking data according to columns are adopted, and the visualization of specific rows or columns is determined by the user;
[0009] The JSON configuration file is used to store data, and the character string in the special format is converted from JSON into a corresponding list and dictionary nested data structure.
[0010] Preferably, the system architecture adopts BS architecture, that is, the interactive mode of browser and server, the browser is used to display data to the client, and at the same time receives the user's selection of the chart model and the setting of the configuration, and the server is used to organize and process the data;
[0011] The client uses vue for data binding, and synchronizes the view and data model through template syntax and vue's reactive system; uses bootstrap and elementUI component libraries for page display; uses axios to send asynchronous HTTP requests in the browser and Node.js, handles different types of HTTP requests, and uses axios to communicate between the client and the server;The server uses the flask framework to allow developers to select and integrate various third-party libraries. The template engine of flask is Jinja2. Based on the template compilation and rendering process, the following steps are included:
[0013] a. Template loading: Jinja2 provides the `FileSystemLoader` class to process template files stored in the file system; b . Template compilation: The loaded template is compiled into an internal representation, and Jinja2 parses the Jinja2 syntax in the template into Python code to generate a template object;
[0015] c. Context rendering: In the rendering stage, the template object is passed a context, i.e., the variables and data used in the template, and the template object generates the final HTML content according to the context;
[0016] d. Output generation: The rendered HTML content is directly output to the browser, written to a file, or returned to the client via an HTTP response.
[0017] Preferably, establishing a correspondence between the chart type, chart model, chart configuration, and chart component configuration includes: establishing a unique correspondence between the value of the chart type type and the chart information, establishing a unique correspondence between the value of the chart type type and the chart initial configuration, establishing a unique correspondence between the value of the chart type type and the required component, establishing a unique correspondence between the interval of the chart type type and the chart type, and establishing a unique correspondence between the required component and the component model data;
[0018] The rule of type value is set, firstly, various types of charts are estimated, then Arabic numerals are used to represent the type of each chart, which is used to calculate the interval range, and the interval is determined according to the range, and the type of the chart is determined according to the interval;
[0019] Storing chart information, the data structure of the chart initialization configuration is stored and represented by the data structure of the rule file and the data structure of the chart configuration, and each type of chart corresponds to a rule configuration file; By vue data binding and flask in engine template Jinja2 and server and browser , the axios used for interaction maps data to corresponding positions;At the same time, a class that specializes in manipulating json files finds the file according to the file path, extracts the data in it and converts it into the corresponding data structure, and then transmits the data directly to the client. The client renders the chart after receiving the chart information.
[0021] Preferably, the operation of the Excel table adopts an object-oriented concept, i.e., encapsulation, inheritance and polymorphism; the content extracted from all the attributes and behaviors of a class of things is encapsulation, and the instance created according to all the encapsulated contents is the object; and three attributes are set in the class, namely: self.wb, self.active and self.sheet;
[0022] According to the file data uploaded by the user, i.e., excel, the server downloads the user's excel table to the local server through the network io, and the naming method of the file is the same as the naming method of the user. Preferably , when displaying a chart by echarts, json data is used as option mapping template, and the chart option content generated by the data provided by the user is used as option configuration, and the process is used as option mapping; wherein the data of the user configuration item is replaced in the option mapping template, and the option configuration is converted into json and sent to the client, so that the user can freely choose the template, and the chart finally generated is similar to the chart of the template;
[0024] The user's operation and analysis of the table data and option mapping all adopt object-oriented programming, which is encapsulated into two classes;
[0025] The user's operation and analysis of the table data are divided into 8 situations, and the behaviors of the 8 situations are processed and allowed to return the x-axis data and the y-axis data. The 8 situations include: do not want the first data, take the data source as the x-axis according to a certain row, and take the data source as the y-axis according to a certain row; do not want the first data, take the data source as the x-axis according to a certain row, and take the data source as the y-axis according to several rows; want the first data, take the data source as the x-axis according to a certain row, and take the data source as the y-axis according to a certain row; want the first data, take the data source as the x-axis according to a certain row, and take the data source as the y-axis according to several rows; do not want the first data, take the data source as the x-axis according to a certain column, and take the data source as the y-axis according to a certain column; do not want the first data, take the data source as the x-axis according to a certain column, and take the data source as the y-axis according to several columns; want the first data, take the data source as the x-axis according to a certain column, and take the data source as the y-axis according to several columns; want the first data, take the data source as the x-axis according to a certain column, and take the data source as the y-axis according to a certain column; want the first data, take the data source as the x-axis according to a certain column, and take the data source as the y-axis according to several columns;
[0026] Option mapping, determine the number of curves in the chart, when it is a single curve, directly replace the data of the x and y axes; when it is multiple groups of curves, extract the corresponding x-axis template or y-axis template, use the template as the basic template, and fill in the x-axis data and y-axis data of each curve in turn.
[0027] Preferably, each component in the component configuration is taken as a component template, the data model corresponding to the component template is taken as component template data, the group formed by different component templates is taken as a component model, and the data model to be bound to the component model is taken as component model data; that is, the relationship between the value of the chart type Type and the component is called a chart type mapping relationship, the corresponding relationship between the user component and the model data is called a component data mapping relationship, the unique corresponding relationship between the value of the chart type type and the information of the chart is called a chart information mapping relationship, the unique corresponding relationship between the value of the chart type type and the option mapping template is called a chart template mapping relationship, and the unique corresponding relationship between the interval of the chart type type and the type of the chart is called a model type mapping relationship;
[0028] Using chart information mapping, create an object according to the data_to_acid class, call the get_data method in it, convert the data in the json file into the data structure corresponding to python, read the data of different rule files according to different routes, rely on the template engine jinja2 in flask to transfer the data in the rule file, and then render the chart information by the process control structure, variables and expressions in jinja2, and add conditional judgment in left_navbar.html to add a new model to a certain category;
[0029] Using chart type mapping, set the value of type to an integer, each type corresponds to a type interval, each chart type option mapping template is in a different folder, get the value of type in the request line, store the value of type in the session, get the table selected by the user, and determine the currently used table by the table name selected by the user;
[0030] Using chart component mapping, all components are written in order on the page, each component is numbered, and represented through a configuration file according to the set data structure. When a component is used, the chart type is directly written in the container data structure corresponding to the component number, and then the conditional rendering engine of jinja2 is used to remove the components that are not in the chart and the rules;The data structure is set to match each component with its corresponding component template data in the form of key-value pairs according to its number, then traverse the final result of the previous model, that is, the number of the structural component model, and then traverse the number of the entire data model, and collect the component template data corresponding to each component template in turn.
[0031] Preferably, the triggering condition of the anti-cracking password mechanism is whether the current date exceeds the prescribed usage date. If it exceeds, the password mechanism is triggered, and a corresponding activation code is generated according to the receipt code generated by the program used by the user. When the activation code is entered incorrectly, a new receipt code will be generated; the receipt code generates a random UUID object by calling uuid.uuid4(), and then calls the hex attribute to convert the UUID into a corresponding 32-bit hexadecimal string; the activation code algorithm is as follows: first, (receipt code + custom password + current time) encodes the above-mentioned spliced string into a byte sequence, assuming that the result is result1; secondly, through result2 = [(~x+256)%256for x in The list comprehension [result1] operates on each byte in the encoded byte sequence one by one, where ~x represents the bitwise inversion of the byte, +256 represents adding 256, and %256 is used for modulo to ensure that the result is between 0 and 256. Finally, the integer list result2 is converted into a byte object, and each byte in the byte object is converted into an 8-bit binary string through the list comprehension [bin(x)[2:].zfill(8)for x in bytes(result)]. Where bin(x)[2:] represents converting the byte into a binary string and removing the prefix 0b, and .zfill(8) ensures that each binary string is 8 bits long. If it is less than 8 bits, add 0 in front, and concatenate all binary strings into a long string. Compared with the prior art, the present invention has the following beneficial effects: 1. The present invention simplifies the problems of front-end, sending request, and data model assembly through the provided mapping method. The assembly of the front-end and the data model, and the work of sending request can be completed by only making configuration according to the rules;
[0034] 2. The present invention can quickly perform different levels of visual analysis on the data in the table, so that the charts are fully decoupled from each other, and the overall page has better interactivity;Meanwhile, when designing this data visualization tool, the actual workload of developers is much less than that of existing visualization tools. The amount of code is small, and after preparation, non-professionals can also write components, which is simple and easy to implement. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] Figure 1 is a diagram of the relationship between chart types of the present invention;
[0036] Figure 2 is a diagram of the inheritance relationship of templates of the present invention;
[0037] Figure 3 is a flowchart of the program operation of the present invention;
[0038] Figure 4 is a diagram of the mapping method of chart information of the present invention;
[0039] Figure 5 is a diagram of the mapping method of chart types of the present invention;
[0040] Figure 6 is a diagram of the mapping method of chart components of the present invention;
[0041] Figure 7 is the data structure diagram of component data mapping of the present invention.Detailed implementation mode
[0042] The following further describes the implementation mode of the present invention in detail in conjunction with the drawings and embodiments. The following embodiments are used to illustrate the present invention, but cannot be used to limit the scope of the present invention.
[0043] As shown in Figure 1 to Figure 7:
[0044] Embodiment: The present invention provides a computer analysis system. Its system architecture adopts the BS architecture, that is, the interaction mode between the browser and the server. By creating a platform that provides a variety of visualization templates, users can select and configure charts according to their own needs. The charts are generated using echarts as the visualization engine, and Openpyxl is used as the library for processing excel files. The JSON configuration file is used to store model information and configuration data. At the same time, a special mapping model is designed for the rendering of the chart model and the one-to-one correspondence of components, so that each chart can be correctly generated and configured. And pyinstaller is used to package the results into an exe file. The user can double-click this file to start the server and open the project. At the same time, the system is set with an anti-cracking password mechanism.
[0045] Excel is used as the submitted data. The Openpyxl framework is used as the function for reading excel. In the data visualization of excel, two situations of uniformly fetching data by row and uniformly fetching data by column are adopted, and the user determines the visualization of the specific row or column;
[0046] The JSON configuration file is used to store data, and the character string in the special format is converted from JSON into a corresponding list and dictionary nested data structure.
[0047] The system architecture adopts BS architecture, that is, the interactive mode of browser and server, the browser is used to display data to the client, and at the same time receive the user's selection of the chart model and the setting of the configuration, and the server is used to organize and process the data; The client uses vue to bind data, and synchronizes the view and data model through the template syntax and the reactive system of vue; Bootstrap and elementUI component library are used to display pages; Axios is used to send asynchronous HTTP requests in browsers and Node.js , and different types of HTTP requests are processed, and axios is used to communicate between the client and the server; Its vue uses the `Object.defineProperty` method to hijack the properties of the data object, and each property is converted to getter and setter. When the data changes, setter triggers the relevant update logic. Vue will collect dependencies when accessing data attributes, and add the view component that depends on the attribute to the dependency list. When the attribute value changes, vue will notify all view components that depend on this attribute to update. Vue parses the template and compiles the template into a rendering function (RenderFunction). The rendering function will access the data attributes when executed, thereby triggering dependency collection. When the data changes, Vue will generate a new virtual DOM tree by re-executing the rendering function, and then compare the difference (Diffing) with the old virtual DOM tree, and only update the necessary parts, thereby efficiently updating the real DOM. This enables Vue.js to efficiently synchronize data and views, providing a good development experience and performance. Axios is a Promise-based HTTP client for sending asynchronous HTTP requests in browsers and Node.js. When Vue is used for client development, different components have different data models. The present invention not only solves the problem that different models correspond to different components, but also solves the problem that different components correspond to different data models. The server uses the flask framework, allowing developers to select and integrate various third-party libraries. The template engine of flask is Jinja2. Based on the template compilation and rendering process, the following steps are included:
[0050] a. Template loading: Jinja2 provides the `FileSystemLoader` class to process template files stored in the file system;b . Template compilation: The loaded template is compiled into an internal representation, and Jinja2 parses the Jinja2 syntax in the template into Python code to generate a template object;
[0052] c. Context rendering: In the rendering stage, the template object is passed a context, i.e., the variables and data used in the template, and the template object generates the final HTML content according to the context;
[0053] d. Output generation: The rendered HTML content is directly output to the browser, written into a file, or returned to the client via an HTTP response. Jinja2 allows the creation of basic templates, and inherits and expands in sub-templates. This mode greatly reduces duplicate code, and improves the maintainability of templates; variables and expressions can be used in templates. Jinja2 supports multiple operators and built-in filters for processing data; supports conditional statements (if / else) and loops (for), making template logic more abundant; provides abundant built-in filters and tests, and allows users to define custom filters and tests; can define and reuse macros (similar to functions), and import other templates or modules in templates.
[0055] establishing a correspondence between chart types, chart models, chart configurations, and chart component configurations, including: establishing a unique correspondence between the value of the chart type type and the information of the chart, establishing a unique correspondence between the value of the chart type type and the initial configuration of the chart, establishing a unique correspondence between the value of the chart type type and the required components, establishing a unique correspondence between the interval of the chart type type and the type of the chart, and establishing a unique correspondence between the required components and component model data;
[0056] The rule of type value is set, firstly, various types of charts are estimated, then Arabic numerals are used to represent the type of each chart, which is used to calculate the interval range, and the interval is determined according to the range, and the type of the chart is determined according to the interval;
[0057] Storing chart information, the data structure of the chart initialization configuration is stored and represented by the data structure of the rule file and the data structure of the chart configuration, wherein the data structure of the rule file corresponds to a rule configuration file for each type of chart, thereby reducing coupling, so that the subsequent addition of a new chart type only requires the creation of a new rule configuration file;The data structure of the chart configuration is determined by the type of the chart. Each type corresponds to a chart configuration file, which records the type of a chart, the data to be displayed, etc.
[0058] Map the data to the corresponding position through vue data binding, the Jinja2 engine template in flask, and axios used for the interaction between the server and the browser; as shown in the template inheritance relationship of Figure 2, where base.html is used to specify the base template and introduce all the common resources needed, such as some js, css, etc.; left_navbar.htm is a left navigation bar, which records what types there are; main.html adds the main styles and inherits the common template of left_navbar.html. If a new type needs to be introduced later, only main.html needs to be inherited, and then write a route on the server side to upload the corresponding data, which greatly reduces the coupling; at the same time, there is a class specifically for manipulating json files, which finds the file according to the file path, extracts the data inside and converts it into the corresponding data structure, and then directly passes the data to the client. After the client receives the chart information and renders it, the chart displayed by the visualization of this chart is the configuration written before, not the data generated by the user through the table. Upload the excel table through the client, and the user retrieves the data by column or row respectively, and then compares the current framework for reading excel data, and finally uses Openpyxl to read the data.
[0059] Adopt the object-oriented thinking for the operation of the excel table, namely encapsulation, inheritance and polymorphism; the content extracted from all the attributes and behaviors of a class of things is encapsulation, and the instance created according to all the encapsulated content is an object; and set three attributes in the class, namely: self.wb, self.active and self.sheet; where the self.wb attribute represents loading an Excel workbook from the specified path; the self.active attribute represents the currently active worksheet in the loaded workbook;self.sheet represents the worksheet currently to be used.
[0060] According to the file data uploaded by the user, i.e., excel, the server downloads the user's excel table to the local server through the network io. At the same time, the naming method of the file is the same as the naming method of the user, which is convenient for the user to visualize the historical chart.
[0061] When displaying a chart through echarts, json data is used as an option mapping template, and the chart option content generated by the data provided by the user is used as the option configuration, and the process is called option mapping; wherein the data of the user configuration item is replaced in the option mapping template, and the option configuration is converted into json and sent to the client, so that the user can freely choose a template, and the chart finally generated is similar to the chart of the template; the specific process is: 1. Create a container in the HTML file for placing the chart; 2. In the JavaScript code, initialize an echarts instance and bind it to the container created above; 3. Use the option object to specify the configuration and data of the chart, and the option object contains a series of attributes to define the type, data and style of the chart; 4. By calling the setOption method, the option object is passed to the echarts instance to generate a chart.
[0062] The user's operation and analysis of table data and option mapping all adopt object-oriented programming, which is encapsulated into two classes;
[0063] The user's operation and analysis of the table data are divided into 8 situations, and the behaviors of the 8 situations are processed and allowed to return the x-axis data and the y-axis data. The 8 situations include: do not want the first data, take the data source as the x-axis according to a certain row, and take the data source as the y-axis according to a certain row; do not want the first data, take the data source as the x-axis according to a certain row, and take the data source as the y-axis according to several rows; want the first data, take the data source as the x-axis according to a certain row, and take the data source as the y-axis according to a certain row; want the first data, take the data source as the x-axis according to a certain row, and take the data source as the y-axis according to several rows; do not want the first data, take the data source as the x-axis according to a certain column, and take the data source as the y-axis according to a certain column; do not want the first data, take the data source as the x-axis according to a certain column, and take the data source as the y-axis according to several columns; want the first data, take the data source as the x-axis according to a certain column, and take the data source as the y-axis according to several columns; want the first data, take the data source as the x-axis according to a certain column, and take the data source as the y-axis according to a certain column; want the first data, take the data source as the x-axis according to a certain column, and take the data source as the y-axis according to several columns;
[0064] Map the options, determine the number of curves in the chart. When there is a single curve, directly replace the data on the x-axis and y-axis. When there are multiple groups of curves, extract the corresponding x-axis template or y-axis template, and use this template as the base template to fill in the x-axis data and y-axis data of each curve in turn.
[0065] As shown in Figure 3, each component in the component configuration is used as a component template, the data model corresponding to the component template is used as the component template data, the collective formed by different component templates is used as the component model, and the data model to be bound to the component model is used as the component model data; that is, the relationship between the value of the chart type Type and the components is called the chart type mapping relationship, the corresponding relationship between the user components and the model data is called the component data mapping relationship, the unique corresponding relationship between the value of the chart type type and the chart information is called the chart information mapping relationship, the unique corresponding relationship between the value of the chart type type and the option mapping template is called the chart template mapping relationship, and the unique corresponding relationship between the interval of the chart type type and the chart types is called the model type mapping relationship;
[0066] As shown in Figure 4, adopt chart information mapping, create an object according to the class of data_to_acid, call the get_data method inside, convert the data in the json file into the corresponding data structure in python, according to different routes, read the data of different rule files, rely on the template engine jinja2 in flask to transfer the data in the rule files, and then use the flow control structure, variables and expressions in jinja2 to render the chart information, and by adding conditional judgments in left_navbar.html, a new model can be added to a certain type;
[0067] As shown in Figure 5, by using chart type mapping, the value of type is set to an integer. Each type corresponds to an interval of type. The option mapping templates for each chart type are in different folders. The value of type is obtained in the request line and stored in the session. The user-selected table is retrieved, and the currently used table is determined based on the name of the user-selected table.
[0068] As shown in Figure 6, by using chart component mapping, all components are written on the page in sequence, numbered for each component, and represented through a configuration file according to the set data structure. When a certain component is used, the chart type is directly written in the container data structure corresponding to the component number. Then, using the conditional rendering engine of jinja2, components that do not conform to the diagram and rules are removed; the set data structure is as shown in Figure 7. Each component corresponds to its corresponding component template data in the form of key-value pairs according to the number. Then, the numbers of the structural component models in the final result of the previous model are traversed, and then the numbers of the entire data model are traversed, and the component template data corresponding to each component template is collected in sequence. Through the above preparatory work, when setting components later, only a chart number needs to be written in the corresponding place; through the above model mapping, the coupling is reduced, thereby reducing the amount of code and the error rate of the code, and simplifying the later maintenance.
[0069] Embodiment 2: This embodiment is basically the same as the previous embodiment, except that data anomalies in excel are processed. All illegal characters are replaced with NAN. When NAN is detected later, it is replaced with the corresponding data in a corresponding manner. If the total number of data exceeds 100, the interpolation method is used to replace the value at the NAN position;If the total amount of data is less than or equal to 100, the mean difference method is used to replace the NAN value.
[0070] Embodiment 3: This embodiment is basically the same as the previous embodiment, except that the triggering condition of the anti-cracking password mechanism is whether the current date exceeds the specified usage date. If it exceeds, the password mechanism is triggered, and the corresponding activation code is generated according to the receipt code generated by the program used by the user. When the activation code is entered incorrectly, a new receipt code will be generated; the receipt code generates a random UUID object by calling uuid.uuid4(), and then calls the hex attribute to convert the UUID into a corresponding 32-bit hexadecimal string; the algorithm of the activation code is: first, (receipt code + custom password + current time) encodes the above-mentioned spliced string into a byte sequence, assuming that the result is result1; secondly, each byte in the encoded byte sequence is operated one by one through the list analysis of result2 = [(~x+256)%256forxinresult1], where ~x represents the bitwise inversion of the byte, +256 represents adding 256, and %256 takes the modulus to ensure that the result is between 0 and 256;Finally, convert the integer list result2 into a byte object. Use the list comprehension expression [bin(x)[2:].zfill(8)for x in bytes(result)] to convert each byte in the byte object into an 8-bit binary string. bin(x)[2:] means converting the byte into a binary string and removing the prefix 0b. .zfill(8) ensures that each binary string is 8 bits long. If it is not, add 0 in front. All binary strings are concatenated into a long string.
[0071] Additionally, in order to provide a concise description of exemplary embodiments, all features of an actual embodiment (i.e., those features that are not relevant to the best mode presently contemplated for carrying out the invention or those features that are not relevant to implementing the invention) may not be described.
[0072] It should be understood that in the development process of any actual implementation, such as in any engineering or design project, a large number of specific implementation decisions may be made. Such development efforts may be complex and time consuming, but for those of ordinary skill who benefit from this disclosure, without excessive experimentation, the development efforts will be a routine task of design, manufacture and production.
[0073] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit the present invention. 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 the technical solutions of the present invention may be modified or replaced by equivalents without departing from the spirit and scope of the technical solutions of the present invention, which should all be included in the scope of the claims of the present invention. ;< / iframe>
Claims
1. A computer analysis system, characterized in that: Its system architecture adopts BS architecture, that is, the interaction mode between browser and server. By creating a platform that provides a variety of visualization templates, users can choose and configure charts according to their own needs. Echarts is used as the visualization engine to generate charts, and Openpyxl is used as the library for processing Excel files. JSON configuration files are used to store model information and configuration data. At the same time, a special mapping model is designed for rendering chart models and one-to-one correspondence of components, so that each chart can be correctly generated and configured, and pyinstaller is used to package the results into an exe file. Users can start the server and open the project by double-clicking the file. At the same time, the system is equipped with an anti-cracking password mechanism.
2. A computer analysis system as claimed in claim 1, characterized in that: Excel is used as the submitted data, and the Openpyxl framework is used as the function of reading Excel. In the data visualization of Excel, two situations are adopted: uniformly fetching data by row and uniformly fetching data by column. The user determines the visualization of specific rows or columns; Use JSON configuration files to store data, and convert special format strings from JSON into corresponding list and dictionary nested data structures.
3. A computer analysis system as claimed in claim 1, characterized in that: The system architecture adopts BS architecture, which is the interaction mode between browser and server. The browser is used to display data to customers and receive users' selection of chart models and configuration settings. The server is used to organize and process data. The client uses vue for data binding, and synchronizes the view and data model through template syntax and vue's reactive system; uses bootstrap and elementUI component libraries for page display; uses axios to send asynchronous HTTP requests in the browser and Node.js, handles different types of HTTP requests, and uses axios for communication between the client and the server; The server uses the flask framework, allowing developers to select and integrate various third-party libraries. The template engine of flask is Jinja2. The template compilation and rendering process includes the following steps: a. Template loading: Jinja2 provides the `FileSystemLoader` class to process template files stored in the file system; b. Template compilation: The loaded template is compiled into an internal representation. Jinja2 parses the Jinja2 syntax in the template into Python code to generate a template object. c. Context rendering: During the rendering phase, the template object is passed a context, which is the variables and data used in the template. The template object generates the final HTML content based on the context. d. Output generation: The rendered HTML content is directly output to the browser, written to a file, or returned to the client via an HTTP response.
4. A computer analysis system as claimed in claim 3, characterized in that: Establishing correspondences between chart types, chart models, chart configurations, and chart component configurations, including: establishing a unique correspondence between the value of the chart type type and the chart information, establishing a unique correspondence between the value of the chart type type and the chart initial configuration, establishing a unique correspondence between the value of the chart type type and the required components, establishing a unique correspondence between the interval of the chart type type and the chart type, and establishing a unique correspondence between the required components and component model data; Among them, the rules for type values are set. First, an estimate is made for various types of charts. Then Arabic numerals are used to represent the type of each chart. The interval is determined based on the range, and the type of the chart is determined based on the interval. Store chart information. The data structure of chart initialization configuration uses the data structure of rule file and the data structure of chart configuration to store and represent it, and each type of chart corresponds to a rule configuration file; The data is mapped to the corresponding location through vue data binding, the engine template Jinja2 in flask, and axios used for interaction between the server and the browser; at the same time, a class that specializes in manipulating json files finds the file according to the file path, extracts the data in it and converts it into the corresponding data structure, and then transmits the data directly to the client. The client renders the chart after receiving the chart information.
5. A computer analysis system as claimed in claim 2, characterized in that: The operation of Excel spreadsheets adopts object-oriented thinking, namely encapsulation, inheritance and polymorphism; the content that extracts all the attributes and behaviors of a class of things is encapsulation, and the instance created according to all the encapsulated contents is the object; and three attributes are set in the class, namely: self.wb, self.active and self.sheet; According to the file data uploaded by the user, that is, Excel, the server downloads the user's Excel spreadsheet locally on the server through network IO, and the file is named in the same way as the user.
6. A computer analysis system as claimed in claim 1, characterized in that: When displaying a chart through echarts, the json data is used as the option mapping template, and the chart option content generated by the data provided by the user is used as the option configuration. This process is called option mapping; The data of the user configuration item is replaced in the option mapping template, and the option configuration is converted into json and sent to the client, so that the user can freely choose the template. The chart finally generated is similar to the chart of the template; The user's operation and analysis of table data and option mapping are all done in an object-oriented programming way, which is encapsulated into two classes; The user's operation and analysis of the table data are divided into 8 situations. The behaviors of the 8 situations are processed and the x-axis data and y-axis data are returned. The 8 situations include: do not want the first data, take the data source according to a certain row as the x-axis, and take the data source according to a certain row as the y-axis; do not want the first data, take the data source according to a certain row as the x-axis, and take the data source according to several rows as the y-axis; want the first data, take the data source according to a certain row as the x-axis, and take the data source according to a certain row as the y-axis; want the first data, take the data source according to a certain row as the x-axis, and take the data source according to several rows as the y-axis; do not want the first data, take the data source according to a certain column as the x-axis, and take the data source according to a certain column as the y-axis; do not want the first data, take the data source according to a certain column as the x-axis, and take the data source according to several columns as the y-axis; want the first data, take the data source according to a certain column as the x-axis, and take the data source according to several columns as the y-axis; want the first data, take the data source according to a certain column as the x-axis, and take the data source according to a certain column as the y-axis; want the first data, take the data source according to a certain column as the x-axis, and take the data source according to several columns as the y-axis; Map the options and determine the number of curves in the chart. When it is a single curve, directly replace the data on the x and y axes. When it is multiple groups of curves, extract the corresponding x-axis template or y-axis template, use this template as the basic template, and fill in the x-axis data and y-axis data of each curve in turn.
7. A computer analysis system as claimed in claim 6, characterized in that: Each component in the component configuration is regarded as a component template, the data model corresponding to the component template is regarded as component template data, the group formed by different component templates is regarded as a component model, and the data model to be bound to the component model is regarded as component model data; that is, the relationship between the value of the chart type Type and the component is called a chart type mapping relationship, the corresponding relationship between the user component and the model data is called a component data mapping relationship, the unique corresponding relationship between the value of the chart type type and the chart information is called a chart information mapping relationship, the unique corresponding relationship between the value of the chart type type and the option mapping template is called a chart template mapping relationship, and the unique corresponding relationship between the interval of the chart type type and the type of the chart is called a model type mapping relationship; Using chart information mapping, create an object according to the data_to_acid class, call the get_data method in it, convert the data in the json file into the corresponding data structure of python, read the data of different rule files according to different routes, rely on the template engine jinja2 in flask to transfer the data in the rule file, and then use the process control structure, variables and expressions in jinja2 to render the chart information, and add conditional judgment in left_navbar.html to add a new model to a certain category; Use chart type mapping, set the value of type to an integer, each type corresponds to a type interval, and each chart type option mapping template is in a different folder. Get the value of type in the request line, store the value of type in the session, get the table selected by the user, and determine the currently used table by the table name selected by the user; Using chart component mapping, all components are written in order on the page, each component is numbered, and represented through the configuration file according to the set data structure. When a component is used, the chart type is directly written into the container data structure corresponding to the component number, and then the conditional rendering engine of jinja2 is used to remove the components that are not charts and rules; The data structure is set to match each component with its corresponding component template data in the form of key-value pairs according to its number, then traverse the final result of the previous model, that is, the number of the structural component model, and then traverse the number of the entire data model, and collect the component template data corresponding to each component template in turn.
8. A computer analysis system as claimed in claim 1, characterized in that: The triggering condition of the anti-cracking password mechanism is whether the current date exceeds the specified usage date. If it exceeds, the password mechanism is triggered, and the corresponding activation code is generated according to the receipt code generated by the program used by the user. When the activation code is entered incorrectly, a new receipt code will be generated; the receipt code generates a random UUID object by calling uuid.uuid4(), and then calls the hex attribute to convert the UUID into a corresponding 32-bit hexadecimal string; the algorithm of the activation code is as follows: first, (receipt code + custom password + current time) encodes the above concatenated string into a byte sequence, assuming that the result is result1; secondly, each byte in the encoded byte sequence is operated one by one through the list analysis expression result2 = [(~x+256)%256forx in result1], where ~x represents the bitwise inversion of the byte, +256 represents adding 256, and %256 takes the modulus to ensure that the result is between 0 and 256; finally, the result2 integer list is converted into a byte object, and [bin(x)[2:].zfill(8)for x in bytes(result)] This list comprehension converts each byte in the byte object into an 8-bit binary string, where bin(x)[2:] means converting the byte into a binary string and removing the prefix 0b. .zfill(8) ensures that each binary string is 8 bits long. If it is not, it will be padded with 0 in front. All binary strings are concatenated into a long string.
Citation Information
Patent Citations
Technical implementation method and device for instrument panel custom assembly based on Echarts
CN114296710A
Data chart page generation method based on visual configuration and related equipment
CN115510361A
