Chart component arrangement method, device, equipment, storage medium and program product
By listening to chart drag events and exchanging relative positions, the problem of time-consuming adjustment of chart components is solved, and the rapid automatic adjustment and efficient arrangement of chart components are achieved.
Patent Information
- Application Number
- CN202110897457.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-08-05
- Publication Date
- 2025-03-28
- Estimated Expiration
- 2041-08-05
AI Technical Summary
In the case of many chart components, it takes a lot of time to adjust the position of each chart component separately, resulting in huge labor consumption.
By listening to the chart drag event, the first chart component currently dragged is obtained, and according to its drag direction, it determines whether it can be exchanged relative positions with the second chart component in the drag direction. If possible, it will be exchanged to achieve rapid automatic adjustment of the chart component.
The rapid automatic adjustment of chart components is realized, reducing manual adjustment time, improving efficiency, and improving component arrangement density and performance through automatic ceiling and canvas adaptive adjustment.
Smart Images

Figure CN113805781B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a chart component arrangement method, device, equipment, storage medium and program product. Background Art
[0002] In many application scenarios, the positions of chart components need to be adjusted and arranged. If there are too many chart components, it will take a lot of time to arrange them. For example, if 100 chart components have been arranged, and you need to add a new chart component on the top, you need to adjust the positions of all chart components downwards in order to free up the space at the top to put in the new chart component.
[0003] Therefore, when there are many chart components, a lot of time is required to adjust the position of each chart component individually, which consumes a huge amount of manpower. Summary of the invention
[0004] To solve the problems in the prior art, the present invention provides a chart component arrangement method, device, equipment, storage medium and program product.
[0005] The present invention provides a method for arranging chart components, comprising: monitoring a chart dragging event, and obtaining a first chart component currently being dragged according to the chart dragging event; judging, according to the dragging direction of the first chart component, whether the first chart component can be relatively positionally exchanged with at least one second chart component in the dragging direction after movement; if so, relatively exchanging the at least one second chart component with the first chart component; wherein the real-time position information of each chart component is known.
[0006] According to a method for arranging chart components provided by the present invention, the method also includes: when the dragging direction is left-right dragging, if the first chart component cannot be relatively exchanged with at least one second chart component in the dragging direction after moving, the second chart component adjacent to the first chart component in the dragging direction is adjusted in a preset manner, and the chart component that intersects with the coordinates of the second chart component that is undergoing the position adjustment is adjusted at the same time; or, when the dragging direction is up-down dragging, if the first chart component cannot be relatively exchanged with at least one second chart component in the dragging direction after moving, the first chart component is returned to the initial position when the chart dragging event occurs.
[0007] According to a method for arranging chart components provided by the present invention, the position of the second chart component adjacent to the first chart component in the dragging direction is adjusted in a preset manner, and the chart component whose coordinates intersect with the coordinates of the second chart component undergoing the position adjustment is adjusted, comprising: when the dragging direction is dragging to the right / left, the second chart component adjacent to the first chart component in the dragging direction is pushed to the right / left, and the chart component whose coordinates intersect with the coordinates of the second chart component undergoing the position adjustment is pushed to the right / left; preferably, if the right / left side border of the chart component undergoing the right / left movement reaches the right / left cutoff line, the chart component that reaches the right / left cutoff line is pushed downward along the right / left cutoff line; wherein the right / left cutoff line is a preset distance from the right / left edge of the canvas.
[0008] According to a method for arranging chart components provided by the present invention, the method further includes: during the dragging process of the first chart component, if the right border / left border of the first chart component exceeds the right cutoff line / left cutoff line, adjusting the first chart component to be within the right cutoff line / left cutoff line; and / or, obtaining the position of the chart component located at the bottom in real time, and automatically adjusting the canvas length according to the position of the chart component located at the bottom.
[0009] According to a method for arranging chart components provided by the present invention, after adjusting the position of the second chart component adjacent to the first chart component in the dragging direction in a preset manner and adjusting the chart component whose coordinates intersect with the coordinates of the second chart component undergoing the position adjustment, the method further includes: traversing the chart components that have not moved after the end of the chart dragging event in a preset order, determining whether there is a blank space above the chart components that have not moved; if so, moving the chart component up to the corresponding blank space.
[0010] According to a chart component arrangement method provided by the present invention, after obtaining the first chart component currently being dragged according to the chart drag event, the method further includes: determining whether the pixel width covered by the overlapping part of the first chart component and the chart component in the dragging direction is greater than a preset pixel width; if not, ignoring the chart drag event.
[0011] The present invention also provides a chart component arrangement device, comprising: a monitoring module, used to: monitor a chart dragging event, and obtain a first chart component currently being dragged according to the chart dragging event; an arrangement module, used to: determine, according to the dragging direction of the first chart component, whether the first chart component can be relatively exchanged with at least one second chart component in the dragging direction after moving; if so, the at least one second chart component and the first chart component are relatively exchanged; wherein the real-time position information of each chart component is known.
[0012] The present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the steps of any of the above-mentioned chart component arrangement methods are implemented.
[0013] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the steps of any of the above-mentioned chart component arrangement methods are implemented.
[0014] The present invention also provides a computer program product, comprising a computer program / instruction, characterized in that when the computer program / instruction is executed by a processor, the steps of any of the above-mentioned chart component arrangement methods are implemented.
[0015] The chart component arrangement method, device, equipment, storage medium and program product provided by the present invention monitor the chart drag event, obtain the first chart component currently being dragged according to the chart drag event, and judge whether the first chart component can be relatively exchanged with at least one second chart component in the dragging direction after moving according to the dragging direction of the first chart component. If so, the relative position of at least one second chart component and the first chart component is exchanged, thereby realizing rapid and automatic adjustment of the chart components. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0017] Figure 1 It is a flow chart of the method for arranging chart components provided by the present invention;
[0018] Figure 2 It is one of the display schematic diagrams of the chart components in the chart component arrangement method provided by the present invention;
[0019] Figure 3 This is the second display schematic diagram of the chart components in the chart component arrangement method provided by the present invention;
[0020] Figure 4 This is the third display schematic diagram of the chart components in the chart component arrangement method provided by the present invention;
[0021] Figure 5 This is the fourth display schematic diagram of the chart components in the chart component arrangement method provided by the present invention;
[0022] Figure 6 It is a structural schematic diagram of the chart component arrangement device provided by the present invention;
[0023] Figure 7 An example physical structure diagram of an electronic device is provided. DETAILED DESCRIPTION
[0024] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0025] Chart components are mainly used for data visualization, such as charts in reports. Different chart components can be used to display different types of charts, such as bar charts, line charts, scatter charts, etc. Chart components are different from images. The position, size and other information of chart components can be obtained in real time, and the position of chart components can be automatically controlled. Therefore, using chart components can not only meet display requirements, but also realize automatic position arrangement control of chart components.
[0026] Combine the following Figure 1-Figure 7 The present invention describes a method, device, apparatus, storage medium and program product for arranging chart components.
[0027] Figure 1 This is a flow chart of the method for arranging chart components provided by the present invention. Figure 1 As shown, the method includes:
[0028] Step 101: monitor a chart drag event, and obtain the first chart component currently being dragged according to the chart drag event.
[0029] The chart dragging event can be triggered by dragging the chart component with the mouse. The chart component arrangement device can monitor the chart dragging event and obtain the information of the first chart component currently being dragged. The information of the first chart component includes the coordinates of the chart component (which can be represented by the coordinates of the upper left corner), the size (including the length and width information), the dragging direction and other information.
[0030] Step 102: determine, based on the dragging direction of the first chart component, whether the first chart component can be relatively interchanged with at least one second chart component in the dragging direction after movement; if so, interchange the relative positions of the at least one second chart component and the first chart component; wherein the real-time position information of each chart component is known.
[0031] According to the dragging direction of the first chart component, it is determined whether the first chart component can be relatively interchanged with at least one second chart component in the dragging direction after it moves. There may be multiple chart components along the dragging direction of the first chart component. The sizes of these chart components may be different. For example, they may be the same size as the first chart component, or they may be smaller than the first chart component, or they may be larger than the first chart component. Then, after monitoring the drag event of the first chart component, according to the dragging direction of the first chart component, it is determined whether the first chart component can be relatively interchanged with at least one second chart component in the dragging direction after it moves, that is, according to the blank area that can be formed after the first chart component moves, how many second chart components in the dragging direction can be moved to the blank area formed after the first chart component moves. If there is at least one second chart component in the dragging direction that can be relatively interchanged with the first chart component, the at least one second chart component is relatively interchanged with the first chart component, so as to realize the rapid position adjustment of the chart component. The relative position relationship between the entirety of at least one second chart component and the first chart component is interchanged, and the relative position relationship between these second chart components before and after the movement remains unchanged. According to the different sizes of the chart components, the first chart component can be relatively interchanged with one or more second chart components.
[0032] Figure 2 It is one of the display schematic diagrams of the chart components in the chart component arrangement method provided by the present invention. Figure 3 This is the second display schematic diagram of the chart components in the chart component arrangement method provided by the present invention. Figure 4 This is the third display schematic diagram of the chart components in the chart component arrangement method provided by the present invention. Figure 3 yes Figure 2Schematic diagram of the display after the chart component 1 in FIG. is moved downward. Since the blank area formed after the chart component 1 is moved downward can only accommodate the chart component 2, only the relative positions of the chart component 2 and the chart component 3 are interchanged. Figure 4 yes Figure 2 Schematic diagram of the display after the chart component 3 in the figure moves downward. Since the blank area formed after the chart component 3 moves downward can accommodate the chart component 4 and the chart component 5, but is not enough to accommodate the chart component 4, the chart component 5 and the chart component 6, only the relative position of the chart component 3 is interchanged with the chart component 4 and the chart component 5. In addition, the chart component 4 and the chart component 5 are interchanged with the chart component 3 as a whole, and the relative position relationship between the chart component 4 and the chart component 5 remains unchanged before and after the movement.
[0033] It should be noted that the position movement of the chart component is reflected in the up-down movement or the left-right movement. The relative position exchange between the chart components refers to the relative position exchange of up-down or left-right, and does not require a strict exchange of coordinates. In addition, the position adjustment of the chart component can be performed during the dragging process of the chart component. For example, if a chart drag event of moving the first chart component downward is monitored, the size of the blank area that can be formed after the first chart component moves downward is calculated, and the size of the space occupied by at least one second chart component in the dragging direction of the first chart component is calculated, and it is determined that the first chart component can be relatively exchanged with several second chart components. If the first chart component can be relatively exchanged with at least one second chart component in the dragging direction after moving, the first chart component is moved downward and the at least one second chart component is moved upward, thereby realizing the relative position exchange of at least one second chart component and the first chart component. If a chart drag event of moving the first chart component to the right is monitored, the size of the blank area that can be formed after the first chart component moves to the right is calculated, and the size of the space occupied by at least one second chart component in the dragging direction of the first chart component is calculated, and it is determined that the first chart component can be relatively interchanged with several second chart components. If the first chart component can be relatively interchanged with at least one second chart component in the dragging direction after moving, the first chart component is moved to the right and at least one second chart component is moved to the left, thereby realizing the relative position interchange of at least one second chart component and the first chart component. When the chart component arrangement method provided by the present invention is used to solve the problem of adding a new chart component to the top of multiple arranged chart components, the method is as follows: the initial position of the newly created chart component is placed at the bottom by default, and then the newly created chart component is dragged upward with the mouse. During the upward movement, it is determined in turn whether it can be relatively interchanged with at least one chart component above. If so, the newly created chart component is relatively interchanged with at least one chart component above, thereby automatically moving the newly created chart component to the top by dragging the chart component.
[0034] The chart component arrangement method provided by the present invention monitors the chart dragging event, obtains the first chart component currently being dragged according to the chart dragging event, and determines whether the first chart component can be relatively exchanged with at least one second chart component in the dragging direction after moving according to the dragging direction of the first chart component. If so, the relative positions of at least one second chart component and the first chart component are exchanged, thereby realizing rapid and automatic adjustment of the chart components.
[0035] According to a method for arranging chart components provided by the present invention, the method also includes: when the dragging direction is left-right dragging, if the first chart component cannot be relatively exchanged with at least one second chart component adjacent to the dragging direction after moving, the second chart component adjacent to the first chart component in the dragging direction is position adjusted in a preset manner, and the chart component that intersects with the coordinates of the second chart component that is undergoing the position adjustment is adjusted at the same time; or, when the dragging direction is up-down dragging, if the first chart component cannot be relatively exchanged with at least one second chart component in the dragging direction after moving, the first chart component is returned to the initial position when the chart dragging event occurs.
[0036] According to the dragging direction of the first chart component, it is determined whether the first chart component can be relatively exchanged with at least one second chart component in the dragging direction after it is moved. If the blank space formed after the first chart component is moved is not large enough, the first chart component may not be relatively exchanged with any second chart component in the dragging direction after it is moved. In this case, two situations are distinguished and handled:
[0037] If the dragging direction is left-right dragging, then if the first chart component cannot be relatively exchanged with at least one second chart component in the dragging direction after being moved, the second chart component adjacent to the first chart component in the dragging direction is adjusted in a preset manner, and the chart components affected in the position adjustment process of the second chart component adjacent to the first chart component in the dragging direction are adjusted in conjunction with the adjustment, and the affected chart components are the chart components that intersect with the coordinates of the second chart component that is being adjusted in position. That is, if the dragging direction is left-right dragging, even if the first chart component cannot be relatively exchanged with at least one second chart component in the dragging direction after being moved, the first chart component is still adjusted in position in the dragging direction, and the second chart component adjacent to the first chart component is adjusted in a preset manner, and other chart components affected in the position adjustment process of the second chart component adjacent to the first chart component are adjusted in conjunction with the adjustment.
[0038] If the dragging direction is up and down dragging, if the first chart component cannot be relatively exchanged with at least one second chart component in the dragging direction after moving, the first chart component will be returned to its original position, and the original position is the initial position of the first chart component when the chart dragging event occurs. That is, if the dragging direction is up and down dragging, if the first chart component cannot be relatively exchanged with at least one second chart component in the dragging direction after moving, the first chart component will no longer be adjusted in position according to the dragging direction, but will be returned to its original position.
[0039] It should be noted that there may be multiple second chart components adjacent to the first chart component in the dragging direction.
[0040] The chart component arrangement method provided by the present invention improves the orderliness of the position adjustment of the chart components by performing different operations according to different dragging directions when the first chart component cannot be relatively interchanged with at least one second chart component in the dragging direction after being moved.
[0041] According to the method for arranging chart components provided by the present invention, the position of the second chart component adjacent to the first chart component in the dragging direction is adjusted in a preset manner, and the chart component whose coordinates intersect with the coordinates of the second chart component undergoing the position adjustment is adjusted at the same time, including: when the dragging direction is dragging to the right / left, the second chart component adjacent to the first chart component in the dragging direction is pushed to the right / left, and the chart component whose coordinates intersect with the coordinates of the second chart component undergoing the position adjustment is pushed to the right / left; preferably, if the right / left side border reaches the right / left cutoff line during the movement of the chart component undergoing the right / left cutoff line, the chart component that reaches the right / left cutoff line is pushed downward along the right / left cutoff line; wherein the right / left cutoff line is a preset distance from the right / left edge of the canvas.
[0042] When the dragging direction is dragging to the right, the second chart component adjacent to the first chart component is pushed to the right, and other chart components adjacent to the second chart component adjacent to the first chart component are driven to move to the right together. If the right side frame of the second chart component adjacent to the first chart component and / or the chart component adjacent to the second chart component adjacent to the first chart component reaches the right side cutoff line during the process of moving to the right, the chart component reaching the right side cutoff line is pushed downward along the right side cutoff line; wherein the right side cutoff line is a preset distance from the right side edge of the canvas; if the dragging direction is dragging to the left, the second chart component adjacent to the first chart component is pushed to the left, and other chart components adjacent to the second chart component adjacent to the first chart component are driven to move to the left. If the left side frame of the second chart component adjacent to the first chart component and / or the chart component adjacent to the second chart component adjacent to the first chart component reaches the left side cutoff line during the process of moving to the left, the chart component reaching the left side cutoff line is pushed downward along the left side cutoff line; wherein the left side cutoff line is a preset distance from the left side edge of the canvas.
[0043] When the second chart component adjacent to the first chart component is adjusted in a preset manner, and other chart components affected during the position adjustment process of the second chart component adjacent to the first chart component are adjusted, if the dragging direction is to the right, the second chart component adjacent to the first chart component is pushed to the right, and other adjacent chart components are driven to move to the right. That is, after the first chart component moves to the right, it will "occupy" the position of the adjacent second chart component. At this time, the second chart component adjacent to the first chart component will also move to the right, continue to "occupy" the position of other chart components, and other chart components continue to move to the right, and continue to "occupy" the position of other chart components on the right. Since the canvas has a certain size, the chart component cannot move to the right without limit. If the right side frame of the second chart component adjacent to the first chart component and / or other adjacent chart components reaches the right side cutoff line during the process of moving to the right, the chart component that reaches the right side cutoff line will be pushed down along the right side cutoff line. Among them, the right side cutoff line has a preset distance from the right edge of the canvas. The preset distance can be set to 0 or other values.
[0044] Similarly, when the second chart component adjacent to the first chart component is adjusted in a preset manner, and other chart components affected during the position adjustment process of the second chart component adjacent to the first chart component are adjusted, if the dragging direction is to the left, the second chart component adjacent to the first chart component is moved to the left, and other adjacent chart components are driven to move to the left. That is, after the first chart component moves to the left, it will "occupy" the position of the adjacent second chart component. At this time, the second chart component adjacent to the first chart component will also move to the left, continue to "occupy" the position of other chart components, and other chart components continue to move to the left, and continue to "occupy" the position of other chart components on the left. Since the canvas has a certain size, the chart component cannot move to the left without limit. If the left border of the second chart component adjacent to the first chart component and / or other adjacent chart components reaches the left cutoff line during the process of moving to the left, the chart component that reaches the left cutoff line will be pushed down along the left cutoff line. Among them, the left cutoff line has a preset distance from the left edge of the canvas. The preset second distance can be set to 0 or other values.
[0045] The method for arranging chart components provided by the present invention further improves the orderliness of component arrangement by first moving the chart components left and right when dragging them left and right, and then moving them up and down when they cannot move left and right.
[0046] According to a method for arranging chart components provided by the present invention, the method further includes: during the dragging process of the first chart component, if the right border / left border of the first chart component exceeds the right cutoff line / left cutoff line, the first chart component is adjusted to be within the right cutoff line / left cutoff line.
[0047] When dragging the first chart component left or right, in order to ensure that the first chart component does not exceed a reasonable range, if it is known that the right border of the first chart component exceeds the right cutoff line, the first chart component is adjusted to be within the right cutoff line; if it is known that the left border of the first chart component exceeds the left cutoff line, the first chart component is adjusted to be within the left cutoff line.
[0048] The position of the chart component located at the bottom is obtained in real time, and the length of the canvas is automatically adjusted according to the position of the chart component located at the bottom.
[0049] When the first chart component is dragged downward, the chart components below the first chart component may move downward with the first chart component. In order to accommodate all the chart components, the canvas length is adaptively adjusted as the chart components move downward, that is, the canvas length is automatically adjusted according to the position of the chart component at the bottom. The canvas length adjustment supports cross-page.
[0050] Figure 5 This is the fourth display diagram of the chart components in the chart component arrangement method provided by the present invention. Figure 5 As shown in the figure, if the dragging position of the chart component exceeds the right cutoff line of the canvas, the chart component will be automatically adjusted to within the right cutoff line.
[0051] The chart component arrangement method provided by the present invention further improves the performance of fast component arrangement by adjusting the first chart component to within the left cutoff line or the right cutoff line when the first chart component exceeds the left cutoff line or the right cutoff line, and by adaptively adjusting the canvas length.
[0052] According to a method for arranging chart components provided by the present invention, after adjusting the position of the first second chart component adjacent to the first chart component in the dragging direction in a preset manner and adjusting the chart component whose coordinates intersect with the coordinates of the second chart component undergoing the position adjustment, the method further includes: traversing the chart components that have not moved after the end of the chart dragging event in a preset order, determining whether there is a blank space above the chart components that have not moved; if so, moving the chart component up to the corresponding blank space.
[0053] After the second chart component adjacent to the first chart component is position-adjusted in a preset manner, and other chart components affected in the position-adjustment process of the second chart component adjacent to the first chart component are adjusted, blank space may be generated due to the movement of the chart components. Therefore, the chart components that have not moved after the end of this chart dragging event are traversed in a preset order (for example, from top to bottom and from left to right) to determine whether there is blank space above the chart components that have not moved. If so, the corresponding chart components are moved up to the corresponding blank space to achieve a ceiling-mounted effect.
[0054] Whether the chart drag event ends can be determined based on whether the first chart component continues to move. If the first chart component continues to move, the chart drag event of the first chart component continues. If the first chart component stops moving, the chart drag event of the first chart component ends. It can be understood that after one drag ends, the chart drag event of the first chart component can continue to be triggered.
[0055] The chart component arrangement method provided by the present invention can achieve a ceiling effect and improve the density of the chart component arrangement by moving the chart components that have not been moved to the upper blank space after the dragging is completed.
[0056] According to a chart component arrangement method provided by the present invention, after obtaining the first chart component currently being dragged according to the chart drag event, the method further includes: determining whether the pixel width covered by the overlapping part of the first chart component and the chart component in the dragging direction is greater than a preset pixel width; if not, ignoring the chart drag event.
[0057] When monitoring the chart drag event (at this time, the drag event may be in progress, the first chart component has moved to a certain extent, and may overlap with one or more chart components depending on the movement amplitude and the size of the chart component), first perform fault tolerance processing to determine whether the pixel width covered by the overlapping part of the first chart component and the chart component in the dragging direction is greater than the preset pixel width; if not, ignore the chart drag event. For example, if the dragged chart overlaps with other charts by less than 50px, it is considered that the user does not really want to operate the chart, to prevent the reaction from being too sensitive and affecting the user experience.
[0058] The chart component arrangement method provided by the present invention improves fault tolerance by ignoring the chart dragging event when it is determined that the pixel width covered by the overlapping part of the first chart component and other charts in the dragging direction is not greater than the preset pixel width.
[0059] The method for arranging chart components provided by the present invention may include the following steps:
[0060] 1. Calculate the landing position based on the user's drag. The landing position varies depending on the direction. For example, if you drag downward, the landing position is below the initial position. The specific landing position needs to be determined based on the blank area formed after the chart moves, so that it can be interchanged with several charts in the dragging direction.
[0061] 2. Determine which charts need to be adjusted based on the landing position. Once the landing position is determined, the charts that need to be adjusted are those that can be swapped with the dragged chart. Swap the corresponding charts with the dragged chart.
[0062] 3. Adjust the chart that needs to be adjusted. You may need to adjust the positions of other charts during the process. For example, when moving left / right, you need to adjust the chart adjacent to the chart being dragged, and then you need to adjust other charts adjacent to the chart adjacent to the chart being dragged.
[0063] 4. After all charts are adjusted, put the charts that need to be fixed to the ceiling. The charts that need to be fixed to the ceiling are the charts with blank space above.
[0064] The chart component arrangement method provided by the present invention can achieve the following technical effects:
[0065] 1. Components are mutually exclusive and cannot overlap. During the dragging process, the chart will automatically adjust its position, solving the problem of multiple operations caused by multiple charts. The present invention can automatically adjust the position of chart components, and after the adjustment is completed, there will be no overlap between chart components (the overlap at the beginning of dragging is only a brief moment in the implementation process).
[0066] 2. Components automatically move to the ceiling to maintain a dense arrangement. After the drag event is completed, the chart components that have not moved are traversed, and the components with empty space above are automatically adjusted to the empty space, thereby achieving the ceiling effect.
[0067] 3. The canvas size is adaptive and does not require manual adjustment by the user. The canvas size can be automatically adjusted according to the position of the bottom chart component.
[0068] The chart component arrangement device provided by the present invention is described below. The chart component arrangement device described below and the chart component arrangement method described above can be referenced to each other.
[0069] Figure 6 Schematic diagram of the structure of the diagram component arrangement device provided by the present invention. Figure 6As shown, the device includes a monitoring module 10 and an arrangement module 20, wherein: the monitoring module 10 is used to: monitor the chart dragging event, and obtain the first chart component currently being dragged according to the chart dragging event; the arrangement module 20 is used to: determine whether the first chart component can be relatively exchanged with at least one second chart component in the dragging direction after moving according to the dragging direction of the first chart component; if it can be exchanged, the at least one second chart component and the first chart component are relatively exchanged; wherein the real-time position information of each chart component is known.
[0070] The chart component arrangement device provided by the present invention monitors the chart dragging event, obtains the first chart component currently being dragged according to the chart dragging event, and determines whether the first chart component can be relatively exchanged with at least one second chart component in the dragging direction after moving according to the dragging direction of the first chart component. If so, the relative positions of at least one second chart component and the first chart component are exchanged, thereby realizing rapid and automatic adjustment of the chart components.
[0071] According to a chart component arrangement device provided by the present invention, the arrangement module 20 is also used for: when the dragging direction is left-right dragging, if the first chart component cannot be relatively exchanged with at least one second chart component in the dragging direction after moving, then the second chart component adjacent to the first chart component in the dragging direction is position adjusted in a preset manner, and the chart component that intersects with the coordinates of the second chart component that is undergoing the position adjustment is adjusted at the same time; or, when the dragging direction is up-down dragging, if the first chart component cannot be relatively exchanged with at least one second chart component in the dragging direction after moving, then the first chart component is returned to the initial position when the chart dragging event occurs.
[0072] The chart component arrangement device provided by the present invention improves the orderliness of the position adjustment of the chart components by performing different operations according to different dragging directions when the first chart component cannot be relatively interchanged with at least one second chart component in the dragging direction after being moved.
[0073] According to a chart component arrangement device provided by the present invention, the arrangement module 20 is used to adjust the position of the second chart component adjacent to the first chart component in the dragging direction in a preset manner, and at the same time adjust the chart component whose coordinates intersect with the second chart component undergoing the position adjustment. Specifically, when the dragging direction is dragging to the right / left, the second chart component adjacent to the first chart component in the dragging direction is pushed to the right / left, and the chart component whose coordinates intersect with the second chart component undergoing the position adjustment is pushed to the right / left; preferably, if the right / left side border reaches the right / left cutoff line during the movement of the chart component undergoing the right / left cutoff line, the chart component that reaches the right / left cutoff line is pushed downward along the right / left cutoff line; wherein the right / left cutoff line is a preset distance from the right / left edge of the canvas.
[0074] The chart component arrangement device provided by the present invention further improves the orderliness of component arrangement by first moving the chart component left and right when dragging it left and right, and then moving it up and down when it cannot move left and right.
[0075] According to a chart component arrangement device provided by the present invention, the arrangement module 20 is also used for: during the dragging process of the first chart component, if the right border / left border of the first chart component exceeds the right cutoff line / left cutoff line, adjusting the first chart component to be within the right cutoff line / left cutoff line; and / or, obtaining the position of the chart component located at the bottom in real time, and automatically adjusting the canvas length according to the position of the chart component located at the bottom.
[0076] The chart component arrangement device provided by the present invention further improves the performance of fast component arrangement by adjusting the first chart component to within the left cutoff line or the right cutoff line when the first chart component exceeds the left cutoff line or the right cutoff line, and by adaptively adjusting the canvas length.
[0077] According to a chart component arrangement device provided by the present invention, the arrangement module 20 is used to adjust the position of the first second chart component adjacent to the first chart component in the dragging direction in a preset manner, and at the same time adjust the chart component that intersects with the coordinates of the second chart component that is undergoing the position adjustment. The arrangement module 20 is also used to: traverse the chart components that have not moved after the end of the chart dragging event in a preset order, and determine whether there is a blank space above the chart components that have not moved; if so, move the chart component up to the corresponding blank space.
[0078] The chart component arrangement device provided by the present invention can achieve a ceiling suction effect and improve the density of the chart component arrangement by moving the chart components that have not been moved to the upper blank space after the dragging is completed.
[0079] According to a chart component arrangement device provided by the present invention, after being used to obtain the first chart component currently being dragged according to the chart drag event, the monitoring module 10 is also used to: determine whether the pixel width covered by the overlapping part of the first chart component and the chart component in the dragging direction is greater than a preset pixel width; if not, ignore the chart drag event.
[0080] The chart component arrangement device provided by the present invention improves fault tolerance by ignoring chart dragging events when it is determined that the pixel width covered by the overlapping parts of the first chart component and other charts is not greater than a preset pixel width.
[0081] Figure 7 An example of a physical structure diagram of an electronic device is shown in FIG. Figure 7 As shown, the electronic device may include: a processor 610, a communication interface 620, a memory 630 and a communication bus 660, wherein the processor 610, the communication interface 620 and the memory 630 communicate with each other through the communication bus 660. The processor 610 may call the logic instructions in the memory 630 to execute the chart component arrangement method, which includes: monitoring the chart drag event, obtaining the first chart component currently dragged according to the chart drag event; judging whether the first chart component can be relatively interchanged with at least one second chart component in the drag direction after moving according to the drag direction of the first chart component; if it can be interchanged, the at least one second chart component and the first chart component are relatively interchanged; wherein the real-time position information of each chart component is known.
[0082] In addition, the logic instructions in the above-mentioned memory 630 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program codes.
[0083] On the other hand, the present invention also provides a computer program product, which includes a computer program stored on a non-transitory computer-readable storage medium, and the computer program includes program instructions. When the program instructions are executed by a computer, the computer can execute the chart component arrangement method provided by the above-mentioned methods, and the method includes: listening to a chart dragging event, and obtaining a first chart component currently being dragged according to the chart dragging event; judging whether the first chart component can be relatively exchanged with at least one second chart component in the dragging direction after moving according to the dragging direction of the first chart component; if they can be exchanged, the at least one second chart component and the first chart component are relatively exchanged; wherein the real-time position information of each chart component is known.
[0084] On the other hand, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, is implemented to execute the above-mentioned chart component arrangement methods, the methods comprising: monitoring a chart drag event, and obtaining a first chart component currently being dragged according to the chart drag event; judging, according to the dragging direction of the first chart component, whether the first chart component can be relatively exchanged with at least one second chart component in the dragging direction after moving; if they can be exchanged, then relatively exchange the at least one second chart component with the first chart component; wherein the real-time position information of each chart component is known.
[0085] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.
[0086] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0087] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for arranging chart components, characterized in that: include: Listen to a chart drag event, and obtain the first chart component currently being dragged according to the chart drag event; Determining, according to the dragging direction of the first chart component, whether the first chart component can be relatively interchanged with at least one second chart component in the dragging direction after it is moved; if the blank area formed after the first chart component is moved can accommodate at least one second chart component in the dragging direction, then the first chart component can be relatively interchanged with the at least one second chart component after it is moved; If they are interchangeable, the relative positions of the at least one second chart component and the first chart component are interchanged; wherein the real-time position information of each chart component is known; wherein, when dragging left or right, the at least one second chart component is adjacent to the first chart component as a whole; The method further comprises: When the dragging direction is left-right dragging, if the first chart component cannot be relatively interchanged with at least one second chart component in the dragging direction after being moved, the second chart component adjacent to the first chart component in the dragging direction is position-adjusted in a preset manner, and the chart component whose coordinates intersect with the coordinates of the second chart component undergoing the position adjustment is adjusted at the same time; or, When the dragging direction is up and down dragging, if the first chart component cannot be relatively exchanged with at least one second chart component in the dragging direction after moving, the first chart component is returned to the initial position when the chart dragging event occurs; The step of adjusting the position of the second chart component adjacent to the first chart component in the dragging direction according to a preset method, and adjusting the chart component whose coordinates intersect with the coordinates of the second chart component undergoing the position adjustment, comprises: When the dragging direction is to the right / left, the second chart component adjacent to the first chart component in the dragging direction is moved to the right / left, and the chart component intersecting with the coordinates of the second chart component undergoing the position adjustment is moved to the right / left.
2. The method for arranging chart components according to claim 1, characterized in that: The method of adjusting the position of the second chart component adjacent to the first chart component in the dragging direction in a preset manner and adjusting the chart component whose coordinates intersect with the coordinates of the second chart component undergoing the position adjustment also includes: If the right / left border reaches the right / left cutoff line during the movement of the chart component that is moved to the right / left, the chart component that reaches the right / left cutoff line is pushed downward along the right / left cutoff line; wherein the right / left cutoff line has a preset distance from the right / left edge of the canvas.
3. The method for arranging chart components according to claim 2, characterized in that: The method further comprises: During the dragging process of the first chart component, if the right border / left border of the first chart component exceeds the right cutoff line / left cutoff line, the first chart component is adjusted to be within the right cutoff line / left cutoff line; and / or, The position of the chart component located at the bottom is obtained in real time, and the length of the canvas is automatically adjusted according to the position of the chart component located at the bottom.
4. The method for arranging chart components according to claim 1, characterized in that: After adjusting the position of the first second chart component adjacent to the first chart component in the dragging direction in a preset manner and adjusting the chart components whose coordinates intersect with the coordinates of the second chart component undergoing the position adjustment, the method further includes: The chart components that have not been moved after the chart dragging event ends are traversed in a preset order to determine whether there is a blank space above the chart components that have not been moved; if so, the chart components are moved up to the corresponding blank space.
5. The method for arranging chart components according to claim 1, characterized in that: After acquiring the first chart component currently being dragged according to the chart dragging event, the method further includes: It is determined whether the pixel width covered by the overlapping portion of the first chart component and the chart component in the dragging direction is greater than a preset pixel width; if not, the chart dragging event is ignored.
6. A chart component arrangement device, characterized in that: include: A monitoring module, used to: monitor a chart dragging event, and obtain a first chart component currently being dragged according to the chart dragging event; an arrangement module, for determining, according to the dragging direction of the first chart component, whether the first chart component can be relatively interchanged with at least one second chart component adjacent to the dragging direction after it is moved; if the blank area formed after the first chart component is moved can accommodate at least one second chart component in the dragging direction, then the first chart component can be relatively interchanged with the at least one second chart component after it is moved; If they are interchangeable, the relative positions of the at least one second chart component and the first chart component are interchanged; wherein the real-time position information of each chart component is known; wherein, when dragging left or right, the at least one second chart component is adjacent to the first chart component as a whole; The arrangement module is also used for: When the dragging direction is left-right dragging, if the first chart component cannot be relatively interchanged with at least one second chart component in the dragging direction after being moved, the second chart component adjacent to the first chart component in the dragging direction is position-adjusted in a preset manner, and the chart component whose coordinates intersect with the coordinates of the second chart component undergoing the position adjustment is adjusted at the same time; or, When the dragging direction is up and down dragging, if the first chart component cannot be relatively exchanged with at least one second chart component in the dragging direction after moving, the first chart component is returned to the initial position when the chart dragging event occurs; When the arrangement module is used to adjust the position of the second chart component adjacent to the first chart component in the dragging direction according to a preset method, and at the same time adjust the chart component whose coordinates intersect with the coordinates of the second chart component undergoing the position adjustment, it is specifically used to: When the dragging direction is to the right / left, the second chart component adjacent to the first chart component in the dragging direction is moved to the right / left, and the chart component intersecting with the coordinates of the second chart component undergoing the position adjustment is moved to the right / left.
7. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the steps of the chart component arrangement method according to any one of claims 1 to 5 are implemented.
8. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method for arranging chart components according to any one of claims 1 to 5 are implemented.
9. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instructions are executed by a processor, the steps of the method for arranging chart components as claimed in any one of claims 1 to 5 are implemented.
Citation Information
Patent Citations
Mobile terminal touch screen view layout adjustment method based on Android system
CN103440131A
Method for adjusting photo position
CN105224205A
Position adjusting method of application icons and mobile terminal
CN107329656A