A method for implementing map fireworks components based on echarts

By introducing firework components into the Echarts map, displaying the area where data growth is achieved, the problem of unintuitive data changes is solved, and more intuitive data display and improved user experience is achieved.

CN114663608BActive Publication Date: 2024-12-03海看网络科技(山东)股份有限公司
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210245663.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-03-14
Publication Date
2024-12-03
Estimated Expiration
2042-03-14

AI Technical Summary

Technical Problem

In the Echarts map component, data changes are not intuitive enough, especially when there are many areas or large values, it is difficult for users to discover changes and trends in the numerical value in a timely manner, and the text stacking and occlusion problems are serious.

Method used

Using the Echarts-based map firework component implementation method, by rendering a three-dimensional map, obtaining data increments, filtering data growth areas, converting coordinate points and generating firework components, using the path map component to display the firework effect, adjusting the position and animation delay of the firework component Time to show the growth of data.

Benefits of technology

This enables the data to be displayed in a circular manner in the form of fireworks when it grows, which significantly improves the intuitiveness and user experience of data display.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114663608B_ABST
    Figure CN114663608B_ABST
Patent Text Reader

Abstract

The present invention belongs to the field of data representation technology, and specifically relates to a method for realizing a map fireworks component based on Echarts, including: rendering a three-dimensional map; obtaining data from the background at a fixed time; filtering out areas with data growth; converting areas into coordinate points; creating a fireworks component for each coordinate point; and randomly setting the delay time of the animation display of each fireworks component so that the animations of each coordinate point are staggered. This application solves the problem that the display of Echarts map data is not intuitive when it grows. If the data grows, it will be displayed cyclically in the form of fireworks during the data query cycle. This solution makes the display more intuitive and greatly improves the user experience.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of data representation, and in particular to a method for realizing a map fireworks component based on Echarts. Background Art

[0002] Echarts is an open source visualization library implemented in JavaScript. It is compatible with most current browsers and relies on the vector graphics library ZRender. It provides intuitive, interactive, and highly customizable data visualization charts. It provides a map component that can use map data in GeoJSon format to draw maps. In actual use, Echarts' map component is often used to display data such as population distribution density from the dimension of administrative divisions. Currently, in the map component, data is displayed in the form of text within the drawn geographic area. Map data is mainly displayed in the form of color, text, or bar charts. When there are many areas or large values, users cannot discover the changes in values ​​and the trend of changes in time and comprehensively.

[0003] That is, the map component of Echarts can be combined with the visualMap component or the bar chart component to more intuitively represent the value size. By setting the maximum and minimum values ​​of the visualMap component and the colors corresponding to the maximum and minimum values, each area of ​​the map component can be filled with color according to the data, and the depth of the color is used to represent the value size. However, the visualMap component sets the color according to the value segment. The color of the value within a small range is the same. Only when the maximum and minimum values ​​are close, or the map data changes greatly, the color change will be more obvious. The bar chart component can display the map value in the form of a bar chart in the map area. When the data base is large, a small increase in data cannot be intuitively reflected by the change of color and bar chart. In addition, when the data is dense, the text will have problems such as overlapping and occlusion, and it cannot be clearly reflected. Summary of the invention

[0004] In order to overcome the above-mentioned shortcomings, the purpose of the present invention is to provide a new universal display component to solve the problem that the data changes of Echarts map are not intuitive enough when displaying regional data.

[0005] The technical solution adopted by the present invention to solve the technical problem is: a method for realizing a map fireworks component based on Echarts, comprising:

[0006] S1. Rendering a three-dimensional map: Rendering multiple maps on the page, overlaying the maps and adding shadows. By adjusting the level, angle, position, direction and size of each map, the map will present a 3D effect visually, so that the fireworks component will be more obvious and three-dimensional when displayed later.

[0007] S2. Get data from the background. The page gets data from the background regularly. The background queries data based on the region dimension and provides two ways to determine whether the data has grown. For data that is continuously accumulated in the business, the data increment within a certain time interval is obtained. If the increment is greater than 0, it means that the data has grown. For data that is not accumulated in the business, the total data is obtained and passed to the front-end page. The front-end page compares it with the data obtained last time. If the current value is greater than the value obtained last time, it means that the data has grown.

[0008] S3. Filter out the areas with data growth. The page distinguishes the areas with data growth based on the returned value or by comparing the value with the last obtained value.

[0009] S4, converting the region into a coordinate point, setting a correspondence table between the region name and the geographic location coordinate, and converting the region name with data growth into the corresponding geographic location coordinate;

[0010] S5. Generate a fireworks component at the coordinate point, traverse the geographic coordinate list, use the geographic coordinate system of Echarts to locate the geographic coordinate on the page, create a fireworks component for each coordinate, and the fireworks component consists of three parts, namely, the fireworks highlight, the fireworks head, and the fireworks tail. Use three Echarts path map components to display the fireworks highlight, the fireworks head, and the fireworks tail. The fireworks highlight is set to a smaller size, no tail and no shadow, and the color is white. The head is set to a larger size, no tail, shadow, and color. The tail is set to a moderate size, with a tail, shadow, and color. Adjust the positions of the three to form a fireworks graphic.

[0011] S6. Randomly set the delay time of each firework component animation display so that the firework animations at each coordinate point are staggered.

[0012] The present invention has the following beneficial effects: This application solves the problem of unintuitive display when the Echarts map data grows. If the data grows, it will be cyclically displayed in the form of fireworks during the data query cycle. This solution makes the display more intuitive and greatly improves the user experience. BRIEF DESCRIPTION OF THE DRAWINGS

[0013] Figure 1 A flow chart showing the data of the present invention;

[0014] Figure 2 It is a schematic diagram of a fireworks assembly of the present invention;

[0015] The meanings of the symbols in the accompanying drawings are as follows:

[0016] 101. The head of the firework; 102. The tail of the firework; 103. The highlight of the firework. DETAILED DESCRIPTION

[0017] The present invention will now be described in further detail with reference to the accompanying drawings.

[0018] according to Figure 1 , 2 The method for implementing a map fireworks component based on Echarts shown in the figure specifically includes:

[0019] S1. Render a 3D map. Create a map component, including GeoJSon map data and a table of corresponding area names and position coordinate points. The map component uses Echarts combined with GeoJSon map data to render multiple maps on the page and overlay the maps. The z value of the map component is reduced in sequence, and the position is shifted downward and left in sequence. The shadow color and shadow size are set to present a 3D map effect.

[0020] S2, regularly obtains data from the background, and passes the obtained data and the method of determining data growth to the component;

[0021] S3. The map component filters out the names of regions with data growth based on the data obtained from the background and the method of judging data growth, and converts the region names into geographic coordinate points based on the corresponding table of region names and geographic coordinate points;

[0022] S4. According to each geographic coordinate point converted in step 3, use the geographic coordinate system component of Echarts to locate the page position;

[0023] S5. Create a fireworks component on the page, add three path map components, set the size of the first one to 3, no tail, white color, as the fireworks head 101 of the fireworks highlight 103, the second one to 6, the length of the special effect tail is 0.01, the color is random, as the fireworks head 101 of the fireworks, the third one to 3, the length of the special effect tail is 0.8, the color is the same as the head, as the fireworks tail 102 of the fireworks, the fireworks head 101 is located above the fireworks tail, the fireworks highlight 103 is located inside the fireworks head 101, the size of the fireworks highlight is smaller than the size of the fireworks head, and the three path map components form a fireworks effect component;

[0024] S6. Randomly select a positive integer within 10,000, and set the special effect animation delay time of the three path diagrams to this value, so that the display time of all the firework components is staggered.

[0025] The present invention is not limited to the described implementation modes, and anyone should be aware of the structural changes made under the enlightenment of the present invention. Any technical solutions that are the same or similar to the present invention fall within the protection scope of the present invention.

[0026] The techniques, shapes, and structural parts not described in detail in the present invention are all well-known techniques.

Claims

1. A method for implementing a map fireworks component based on Echarts, characterized by: include: Step 1: Rendering a 3D map. The method for rendering a 3D map is as follows: creating a map component, including GeoJSon map data and a corresponding table of region names and geographic location coordinates. The map component uses Echarts combined with GeoJSon map data to render multiple maps on the page, overlay the maps and add shadows. By adjusting the level, angle, position, direction and size of the shadows of each map, the map visually presents a 3D effect. Step 2: Get data from the background regularly; Step 3: Filter out the area with data growth; Step 4: Convert the region into coordinate points, set up a correspondence table between region names and geographic location coordinates, and convert the region names with data growth into corresponding geographic location coordinates; Step 5, traverse the geographic location coordinate list, use the geographic coordinate system of Echarts to locate the geographic location coordinates on the page, create a firework component for each coordinate point, the firework component includes three parts, namely, the firework head, the firework tail, and the firework highlight, use three Echarts path map components to display the firework highlight, the firework head, and the firework tail, the firework highlight is set in the firework head, the size of the firework highlight is smaller than the size of the firework head, no color, no tail, no shadow, the firework head has no tail, has shadow, and has color, the firework tail is set with tail, shadow, and color, and adjust the positions of the three to form a firework graphic; Step six, randomly set the delay time of the animation display of each firework component so that the animations of each coordinate point are staggered.

2. According to the method for realizing a map fireworks component based on Echarts in claim 1, it is characterized in that: When obtaining data from the background in the step 2, the background queries the data based on the region as the dimension.