A method for generating dynamic data chart
By using a dynamic data chart generation method and a timer to control the dynamic presentation of data in the chart, the problem of insufficient intuitiveness in displaying large amounts of data in charts is solved, and the efficiency of data input and modification is improved.
Patent Information
- Application Number
- CN201811558537.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2018-12-19
- Publication Date
- 2024-11-01
- Estimated Expiration
- 2038-12-19
AI Technical Summary
Existing technologies are not intuitive or simple enough for processing large amounts of data in charts, and the data input and integration process is complex, resulting in low efficiency.
A dynamic data chart generation method is adopted, which uses an Excel spreadsheet, Python and C++ to parse JSON data, and a timer to control the dynamic presentation of data in the chart, thereby realizing data visualization and dynamism, including timer switching of data, sorting and transition value processing.
It enables simple, intuitive, and dynamic presentation of large amounts of data, improving the efficiency of data input and modification.
Smart Images

Figure CN109815466B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of chart editing, and in particular to a method for generating a dynamic data chart. Background Art
[0002] Nowadays, with the widespread application of computers and the development of network technology, people have migrated from paper statistics to computer charts for input, storage and display. Computer charts can intuitively display the attributes of data statistical information. Graphic structures that play a key role in knowledge mining and intuitive and vivid perception of information are a good means of "visualizing" object attribute data intuitively and vividly.
[0003] However, for charts with large amounts of data, the display of data and graphic structure is not intuitive and simple enough, the entire data input and integration process is relatively complicated, and post-production and modification are also relatively troublesome, resulting in slow data input into charts and affecting efficiency. Summary of the invention
[0004] In order to overcome the deficiencies of the prior art, the present invention provides a method for generating a dynamic data chart, which can integrate a large amount of data, visualize and dynamize the data, and present the data dynamically in a simple and intuitive manner, while making post-production and modification easier and more efficient.
[0005] The purpose of the present invention is achieved by the following technical solution:
[0006] A method for generating a dynamic data chart comprises the following steps:
[0007] Organize data: configure Excel spreadsheet, export JSON configuration data through Python xlrd library, parse JSON with C++, and save all data;
[0008] Import data into the chart generator. The chart generator defines three timers. The first timer is used to switch to the next row of data at a fixed time interval. The second timer is used to automatically update the data ranking at a fixed time interval. The third timer is used to transition the current data on all items to the target value.
[0009] Load configuration data and present a dynamic picture: each line of page items displays N data, and switches to the next line of entry data at a fixed time interval; the first N data are arranged and refreshed regularly each time, and the entry data is sorted from high to low, with a smaller and smaller width; each time switching to the next line, the data transitions from the currently displayed value to the target value display within a fixed time interval.
[0010] Furthermore, the importing of data into the chart generator is specifically as follows: using the fread interface of C++ to read the json configuration, and then using cjson to parse the data, and saving the data in a vector container.
[0011] Furthermore, the first timer is used to set a fixed time, read each row of data in the corresponding Excel table in turn, sort them from high to low according to the target value, extract the first N data, create entries and display them on the screen, and the data with the largest value is placed at the top of the chart window, and the progress bar width is the width of the chart.
[0012] Furthermore, the widths of the progress bars of other items are calculated according to the formula W1 (current item width) = W2 (icon width) * C1 (current item value) / C2 (maximum item value).
[0013] Furthermore, the second timer is used to move all entries to corresponding positions after sorting from high to low according to the current values of the first N entries that have been created on the current screen.
[0014] Furthermore, if the ranking is not in the top N, the off-screen destruction is removed.
[0015] Furthermore, the third timer is used to traverse all items on the screen, gradually transitioning from the currently displayed value to the target value display; and updating the value and position of the items in the horizontal direction.
[0016] Furthermore, the time interval of the third timer is the same as the time interval of the first timer.
[0017] Furthermore, the value of N does not exceed the entry data of the original row.
[0018] Compared with the prior art, the present invention has the following beneficial effects:
[0019] The dynamic data chart generation method configures table data, imports the data into the program to present a dynamic picture, integrates a large amount of data, makes the data visual and dynamic, and makes the data simply and intuitively presented dynamically. At the same time, post-production and modification are easier and more efficient. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] Figure 1 The present invention provides a flow chart of a method for generating a dynamic data chart. DETAILED DESCRIPTION
[0021] The present invention is further described below in conjunction with the accompanying drawings and specific implementation methods. It should be noted that, under the premise of no conflict, the various embodiments or technical features described below can be arbitrarily combined to form a new embodiment.
[0022] See also Figure 1 , a method for generating a dynamic data chart, specifically comprising the following steps:
[0023] S1. Arrange data and configure Excel table: clear the Excel table before configuration, set the first column to the items to be compared each time dynamically displayed, and set the first row to the items to be ranked; enter the corresponding data in the remaining rows and columns;
[0024] S2. Export json configuration data through python xlrd library: convert the data input in the Excel table into json configuration data, and use the xlrd extension tool to read the json configuration data in Python language;
[0025] S3. C++ parses json: C++ parses the file or string generated by json, exports the json configuration data, and saves all data;
[0026] S4. Import data into the chart generator. The chart generator defines three timers. The first timer is used to switch to the next row of data at a fixed time interval. The second timer is used to automatically update the data ranking at a fixed time interval. The third timer is used to transition the current data on all items to the target value.
[0027] S5. Load configuration data and present a dynamic picture: each line of the page entry displays N data items, and switches to the entry data in the next line at a fixed time interval; the first N data items are arranged and refreshed regularly each time, and the entry data are sorted from high to low, with a smaller and smaller width; each time it switches to the next line, the data transitions from the currently displayed value to the target value display within a fixed time interval, and when the page entry display switches to the next line, the specific table data of the column entry is also loaded from the data in the current line to the specific table data in the next line accordingly, and the loading process is that the current value gradually increases or decreases to the target value within the time interval.
[0028] Preferably, in Python language, xlrd is an extended tool for reading Excel tables, which can realize the reading of specified forms and specified cells.
[0029] Preferably, JSON is a lightweight data exchange format that uses a text format that is completely independent of programming languages to store and represent data. It is easy for people to read and write, and is also easy for machines to parse and generate, and can effectively improve network transmission efficiency.
[0030] The interval time of the three timers can be set according to different situations.
[0031] Preferably, the time of the first timer is set to 5 seconds, the time of the second timer is set to 0.2 seconds, and the time of the third timer is set to 5 seconds.
[0032] Furthermore, importing data into the chart generator involves using C++'s fread interface to read the json configuration, then using cjson to parse the data and save the data in a vector container.
[0033] Furthermore, the first timer is used to set a fixed time, read each row of data in the corresponding Excel table in turn, sort it from high to low according to the target value, extract the first N data, create entries and display them on the screen, and the data with the largest value is placed at the top of the chart window, and the progress bar width is the width of the chart.
[0034] Furthermore, the widths of the progress bars of other items are calculated according to the formula W1 (current item width) = W2 (icon width) * C1 (current item value) / C2 (maximum item value).
[0035] Furthermore, the second timer is used to move all entries to corresponding positions after sorting from high to low according to the current values of the first N entries that have been created on the current screen.
[0036] Furthermore, if the ranking is not in the top N, the off-screen destruction is removed.
[0037] Furthermore, the third timer is used to traverse all items on the screen, gradually transitioning from the currently displayed value to the target value display; and updating the values and positions of the items in the horizontal direction.
[0038] Furthermore, the time interval of the third timer is the same as the time interval of the first timer.
[0039] Furthermore, the value of N does not exceed the entry data of an original row, and the value of N is determined according to specific requirements.
[0040] The above-mentioned embodiments are only preferred embodiments of the present invention and cannot be used to limit the scope of protection of the present invention. Any non-substantial changes and substitutions made by technicians in this field on the basis of the present invention shall fall within the scope of protection required by the present invention.
Claims
1. A method for generating a dynamic data chart, characterized in that: The specific steps include: Organize data: configure Excel spreadsheet, export JSON configuration data through Python xlrd library, parse JSON with C++, and save all data; Import data into the chart generator. The chart generator defines three timers. The first timer is used to switch to the next row of data at a fixed time interval. The second timer is used to automatically update the data ranking at a fixed time interval. The third timer is used to transition the current data on all items to the target value. Load configuration data and present a dynamic picture: each row of page items displays N data, and switches to the next row of item data at a fixed time interval; each time the first N data are arranged and refreshed regularly, the item data are sorted from high to low, and the item width is getting smaller and smaller; wherein, current item width = icon width * current item value / maximum item value; each time the item is switched to the next row, the data transitions from the currently displayed value to the target value display within a fixed time interval; the first timer is used to set a fixed time, read each row of data in the corresponding excel table in turn, sort from high to low according to the target value, extract the first N data, create an item and display it on the screen, the data with the largest value is placed at the top of the chart window, and the progress bar width is the width of the chart; the second timer is used to move all items to the corresponding positions after sorting from high to bottom according to the current values of the first N items created on the current screen; the third timer is used to traverse all items on the screen, and gradually transition from the currently displayed value to the target value display; update the value and position of the horizontal entry; The specific steps of importing data into the chart generator are: using the C++ fread interface to read the json configuration, then using cjson to parse the data, and saving the data in a vector container; Move all data except the first N pieces of data off the screen and destroy them; The time interval of the third timer is the same as the time interval of the first timer.
2. The method for generating a dynamic data chart according to claim 1, wherein: The value of N should not exceed the number of entries in a row of the Excel table.
