Time axis drawing method, system and electronic device based on SVG graphics

The time axis drawing method based on SVG graphics solves the inflexible and unintuitive problems of traditional methods, provides an intuitive and easy-to-use interface and efficient time axis editing and management capabilities, and simplifies the database saving and display process.

CN116843790BActive Publication Date: 2024-10-22南京海泰医疗信息系统有限公司
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310640780.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-06-01
Publication Date
2024-10-22
Estimated Expiration
2043-06-01

AI Technical Summary

Technical Problem

The traditional time axis drawing method is not flexible and intuitive enough to meet the needs of clinical medical staff, and the complex program processing is not conducive to the maintenance of the management department.

Method used

Using the time axis drawing method based on SVG graphics, by obtaining the process events in the target process, using SVG to build a blank canvas, dragging and dropping node elements and text elements, determining the connection type according to the vertical distance, forming a complete time axis, and scaling and panning operations, saved to the database.

Benefits of technology

It provides an intuitive and easy-to-maintain interface, increases flexibility, simplifies the complex processing of traditional programs, and realizes WYSIWYG timeline editing and management.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116843790B_ABST
    Figure CN116843790B_ABST
Patent Text Reader

Abstract

The present invention discloses a timeline drawing method, system and electronic device based on SVG graphics, and relates to the technical field of timeline drawing. The method comprises: firstly, using SVG to construct a blank canvas for a target process; secondly, according to the target process, selecting corresponding node elements and text elements from an element library and adding them to the blank canvas; then determining the connection type of two node elements and performing connection operations to form a complete timeline; finally, performing overall scaling and overall translation operations on the timeline, and then saving the processed timeline to a database. The present invention can simplify the complex processing of traditional programs, and easily draw, edit and manage the timeline.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of timeline drawing, and in particular to a timeline drawing method, system and electronic equipment based on SVG graphics. Background Art

[0002] The traditional method of timeline drawing focuses on performing complex relationship processing on the data maintained in the server database before drawing and displaying it. That is, it only maintains the node information and connects the nodes with lines through the program. This method is not flexible and intuitive. At the same time, this model is not conducive to maintenance by the management department and is relatively unfriendly to clinical medical staff. Summary of the invention

[0003] In view of this, the present invention provides a timeline drawing method, system and electronic device based on SVG graphics.

[0004] To achieve the above object, the present invention provides the following solutions:

[0005] In a first aspect, the present invention provides a timeline drawing method based on SVG graphics, comprising:

[0006] Acquire a target process; the target process includes multiple process events and the event flow of each of the process events;

[0007] Use SVG to create a blank canvas for the target process;

[0008] According to the process event in the target process, select the corresponding node element and text element from the element library, and then use the mouse to drag the corresponding node element and text element into the blank canvas in sequence and place them at the corresponding position;

[0009] Determine the position information of each node element, and determine the longitudinal distance between any two node elements according to the position information of each node element, and then determine the connection type of the two node elements according to the longitudinal distance;

[0010] According to the connection type, the corresponding two node elements are connected to form a complete time axis, and the time axis is overall scaled and translated, and then the time axis after the overall scaling and translation operations is saved to the database.

[0011] Optionally, it also includes: using the addEventListener() method to add a listener for the mousemove event to the node element; the listener is used to automatically call the callback function when the user moves the mouse, automatically record the current mouse position each time the event is triggered, and calculate the distance between the current mouse position and the previous mouse position.

[0012] Optionally, determining the position information of each node element, determining the longitudinal distance between any two node elements according to the position information of each node element, and then determining the connection type between the two node elements according to the longitudinal distance, specifically includes:

[0013] According to the listener, determine the location information of each node element;

[0014] According to the position information of each node element, determine the longitudinal distance between any two node elements;

[0015] When the vertical distance is 0, the connection type between the corresponding two node elements is a straight line;

[0016] When the vertical distance is not 0, the connection type between the corresponding two node elements is a polyline.

[0017] Optionally, according to the connection type, a connection operation is performed on the corresponding two node elements to form a complete time axis, specifically including:

[0018] According to the connection type, use the d attribute value in the path element to connect the corresponding two node elements to form a complete timeline.

[0019] Optionally, the time axis is scaled as a whole, including:

[0020] Through the scale transformation function, the time axis is scaled as a whole.

[0021] Optionally, it also includes: adding a drag operation to the node element, deleting a node element, and changing the color of the node element;

[0022] Add a drag operation to the text element, delete a node element operation, and change the color of a node element.

[0023] In a second aspect, the present invention provides a timeline drawing system based on SVG graphics, comprising:

[0024] A target process acquisition module is used to acquire a target process; the target process includes a plurality of process events and an event flow direction of each of the process events;

[0025] A blank canvas creation module, which uses SVG to build a blank canvas for the target process;

[0026] A node text element adding module is used to select corresponding node elements and text elements from an element library according to a process event in the target process, and then drag the corresponding node elements and text elements into a blank canvas in sequence using a mouse and place them at corresponding positions;

[0027] A connection type determination module is used to determine the position information of each node element, and determine the longitudinal distance between any two node elements according to the position information of each node element, and then determine the connection type of the two node elements according to the longitudinal distance;

[0028] The time axis drawing and saving module is used to connect the two corresponding node elements according to the connection type to form a complete time axis, and perform overall scaling and overall translation operations on the time axis, and then save the time axis after the overall scaling and overall translation operations to the database.

[0029] In a third aspect, the present invention provides an electronic device, comprising a memory and a processor, wherein the memory is used to store a computer program, and the processor runs the computer program to enable the electronic device to execute the time axis drawing method based on SVG graphics according to the first aspect.

[0030] According to the specific embodiments provided by the present invention, the present invention discloses the following technical effects:

[0031] The present invention provides a very friendly maintenance interface, which allows clinical medical staff to easily draw, edit and manage timelines, which is intuitive and WYSIWYG. At the same time, in order to increase flexibility, multiple timelines can be maintained for different process events, and then directly saved in the database. When displaying, it only needs to be read from the database, which simplifies the complex processing of traditional programs. BRIEF DESCRIPTION OF THE DRAWINGS

[0032] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.

[0033] Figure 1 A schematic diagram of a flow chart of a timeline drawing method based on SVG graphics provided in an embodiment of the present invention;

[0034] Figure 2 An overall schematic diagram of a timeline drawing method based on SVG graphics provided in an embodiment of the present invention. DETAILED DESCRIPTION

[0035] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only 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.

[0036] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the present invention is further described in detail below with reference to the accompanying drawings and specific embodiments.

[0037] Embodiment 1

[0038] This embodiment provides a timeline drawing method based on SVG graphics. According to the basic attributes and graphic tags of SVG graphics, a complete process is converted into a timeline by graphic drawing to adapt to the dynamic changes of the process, and the dragging and scaling of the timeline are realized through relevant algorithms.

[0039] like Figure 1 and Figure 2 As shown, this embodiment provides a timeline drawing method based on SVG graphics, including the following steps.

[0040] Step 100: Obtain a target process; the target process includes multiple process events and the event flow of each of the process events.

[0041] In this embodiment, the target process is first analyzed to understand the process events and event flows contained therein, and then a timeline is drawn, wherein the timeline describes a complete process, including a series of process events and event flows, which are usually unfolded in a timeline.

[0042] Step 200: Use SVG (Scalable Vector Graphics) to build a blank canvas for the target process.

[0043] Step 300: According to the process event in the target process, select corresponding node elements and text elements from the element library, and then use the mouse to drag the corresponding node elements and text elements into the blank canvas in sequence and place them at corresponding positions.

[0044] In this embodiment, the element library refers to a collection of various element materials, mainly including: node elements and text elements.

[0045] Node elements represent a process event in the timeline. A process event refers to a specific step or operation that occurs in a process, such as application submission, approval, rejection, etc. These process events usually affect the overall progress and results of the process. Node elements are used to represent these events in flowcharts, which can help people understand and track the execution of a process more clearly.

[0046] The text element represents a description of a process event in the timeline. Select a text element from the element library and drag it into the canvas to write a text description of the process event.

[0047] Furthermore, since this embodiment is developed using the B / S architecture (i.e., the browser and server architecture model), all operations are completed in the browser, that is, after entering the page from the browser, select the node element or text element in the element library on the left, hold down the mouse and drag the node element or text element to the blank canvas, release the mouse, and the node element or text element will be placed in the canvas.

[0048] Since SVG graphics are used for implementation, the placement of node elements and text elements can only be within the set blank canvas, and the placement of each node element and text element is determined according to specific process events.

[0049] Step 400: Determine the position information of each node element, and determine the longitudinal distance between any two node elements according to the position information of each node element, and then determine the connection type between the two node elements according to the longitudinal distance.

[0050] In this embodiment, the position information of each node element is determined through a dragging operation, that is, the principle is to monitor the moving distance of the mouse.

[0051] In JavaScript, you can use the addEventListener() method to add a listener for the mousemove event to an element. The listener is used to automatically call the callback function when the user moves the mouse. Each time the event is triggered, the current mouse position is recorded and the distance between it and the previous position is calculated.

[0052] JavaScript is a scripting language that is commonly used for client-side scripting of Web pages. It can achieve dynamic effects and user interaction. This language is widely used in the development of various types of Web applications, desktop applications, and mobile applications. In Web development, the mousemove event is usually used to achieve mouse-related interactive effects, such as dragging, drawing, magnifying glass, etc.

[0053] The formula for calculating the horizontal and vertical distances is:

[0054] X = disX - x + eX;

[0055] Y = disY - y + eY;

[0056] disX represents the horizontal coordinate of the end point after the node element is dragged and moved, and x is the horizontal coordinate of the initial position of the node element. The difference between the two is the horizontal distance the node element moves. The same is true for disY and y. disY represents the vertical coordinate of the end point after the node element is dragged and moved, and y is the vertical coordinate of the initial position of the node element. The difference between the two is the vertical distance the node element moves. Since the coordinate position of the node element when the mouse is pressed during the dragging process will deviate from the actual center coordinate position of the node element, it is necessary to add the horizontal coordinate eX and vertical coordinate eY of the center position of the node element to avoid errors caused by the offset of the node element position after dragging.

[0057] By comparing the ordinate of the end point after the node element is dragged and moved with the ordinate of the initial position before the node element is dragged and moved, if the two are equal, it is a straight line, if they are not equal, it is a broken line;

[0058] Step 500: According to the connection type, connect the two corresponding node elements to form a complete timeline, perform overall scaling and overall translation operations on the timeline, and then save the timeline after the overall scaling and overall translation operations to the database.

[0059] A line can be connected between two node elements. The connecting line represents a flow direction between two process events. The implementation process uses the d attribute value in the path element to draw a straight line / polyline. The path element is a common SVG element used to define shapes. All basic shapes can be created using the path element. The d attribute represents the command used to define the drawing path. d is the abbreviation of draw, which means drawing. The d attribute can have four values, such as M11L22, or six values, such as M11L22L32. Two values ​​form a group, which is equivalent to a coordinate. M represents the starting point and L represents the end point.

[0060] The overall scaling of the light axis is performed during the operation, that is, the scaling is performed through the scale transformation function. The scale transformation function refers to specifying a proportional scaling operation through x and y. x represents the horizontal scaling factor, and y represents the vertical scaling factor. A scaling factor greater than 1 is a zoom-in, and a scaling factor less than 1 is a zoom-out. If y is not provided, it is assumed to be equal to x.

[0061] The time axis is translated as a whole. Based on the drag operation, the moving distance of all elements is calculated, and then the horizontal and vertical coordinates of each element are dynamically set.

[0062] X = disX - x + eX (1, ​​2, ...);

[0063] Y = disX - y + eX (1, ​​2, ...);

[0064] Finally, the entire canvas is stored in the database in HTML (HyperTextMarkupLanguage) format.

[0065] Furthermore, the method provided in this embodiment also includes: adding a drag operation to the node element, deleting a node element, and changing the color of a node element.

[0066] Add a drag operation to the text element, delete a node element, and change the color of a node element.

[0067] Embodiment 2

[0068] In order to execute the method corresponding to the first embodiment above to achieve corresponding functions and technical effects, a timeline drawing system based on SVG graphics is provided below.

[0069] The system comprises: a target process acquisition module, which is used to acquire a target process; the target process comprises a plurality of process events and an event flow direction of each of the process events.

[0070] The blank canvas creation module is used to use SVG to build a blank canvas for the target process.

[0071] The node text element adding module is used to select corresponding node elements and text elements from the element library according to the process events in the target process, and then drag the corresponding node elements and text elements into the blank canvas in sequence with the mouse and place them at corresponding positions.

[0072] The connection type determination module is used to determine the position information of each node element, determine the longitudinal distance between any two node elements according to the position information of each node element, and then determine the connection type of the two node elements according to the longitudinal distance.

[0073] The time axis drawing and saving module is used to connect the two corresponding node elements according to the connection type to form a complete time axis, and perform overall scaling and overall translation operations on the time axis, and then save the time axis after the overall scaling and overall translation operations to the database.

[0074] Embodiment 3

[0075] An embodiment of the present invention provides an electronic device including a memory and a processor, wherein the memory is used to store a computer program, and the processor runs the computer program to enable the electronic device to execute the time axis drawing method based on SVG graphics of the first embodiment.

[0076] Optionally, the above-mentioned electronic device may be a server.

[0077] The present invention provides a highly efficient and easy-to-operate maintenance method for clinical medical staff based on the method of drawing the time axis according to the SVG graphics for different process events, and what you see is what you get; this effect is achieved by using SVG (Scalable Vector Graphics) technology to draw the time axis graphics, and combining JavaScript and other technologies to achieve interactive and dynamic effects. The detailed implementation process is as follows:

[0078] (1) Use SVG to draw timeline graphics, including timeline, event nodes, text and other elements;

[0079] (2) Use JavaScript and other technologies to achieve dynamic changes in event nodes, such as a pop-up window showing detailed event information when the mouse hovers over the event node;

[0080] (3) Add an event handler to each event node to implement operations such as event modification and deletion;

[0081] (4) Save the timeline data in the backend database, and use technologies such as Ajax to achieve data interaction between the front and back ends, so as to achieve dynamic update and save modifications;

[0082] Through the above steps, you can achieve what you see is what you get, efficient and easy-to-operate time axis maintenance method.

[0083] When new changes occur in process events, the corresponding time axis can be adjusted through graphical drawing to adapt to the dynamic changes of the process, reflecting high availability and flexibility. This effect is achieved by:

[0084] (1) According to new process events or changes, the corresponding event nodes can be directly adjusted in the canvas, and the location and impact range of the changes can be marked in the flowchart;

[0085] (2) Make corresponding modifications and updates to the process steps, data, etc. involved;

[0086] (3) Review the modified flowchart and notify relevant personnel in a timely manner to ensure that they understand the changes and corresponding operating steps.

[0087] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the system disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.

[0088] The principles and implementation methods of the present invention are described in this article using specific examples. The description of the above embodiments is only used to help understand the method and core idea of ​​the present invention. At the same time, for those skilled in the art, according to the idea of ​​the present invention, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as limiting the present invention.

Claims

1. A timeline drawing method based on SVG graphics, It is characterized in that include: Get the target process; The target process includes multiple process events and the event flow of each of the process events; Use SVG to create a blank canvas for the target process; According to the process event in the target process, select the corresponding node element and text element from the element library, and then use the mouse to drag the corresponding node element and text element into the blank canvas in sequence and place them at the corresponding position; Determine the position information of each node element, and determine the longitudinal distance between any two node elements according to the position information of each node element, and then determine the connection type of the two node elements according to the longitudinal distance; According to the connection type, the corresponding two node elements are connected to form a complete time axis, and the time axis is scaled and translated as a whole, and then the time axis after the overall scaling and translation operations is saved to the database; the entire canvas is stored in the database in HTML format; The time axis drawing method based on SVG graphics also includes: using the addEventListener() method to add a listener for the mousemove event to the node element; the listener is used to automatically call the callback function when the user moves the mouse, automatically record the current mouse position each time the event is triggered, and calculate the distance between the current mouse position and the previous mouse position; The method of determining the position information of each node element, determining the longitudinal distance between any two node elements according to the position information of each node element, and then determining the connection type between the two node elements according to the longitudinal distance specifically includes: According to the listener, determine the location information of each node element; According to the position information of each node element, determine the longitudinal distance between any two node elements; When the vertical distance is 0, the connection type between the corresponding two node elements is a straight line; When the vertical distance is not 0, the connection type between the two corresponding node elements is a polyline; The formula for calculating the horizontal and vertical distance is: X = disX - x + eX; Y = disY - y + eY; disX represents the horizontal coordinate of the end point after the node element is dragged and moved, and x is the horizontal coordinate of the initial position of the node element. The difference between the two is the horizontal distance the node element moves; disY and y are the same. disY represents the vertical coordinate of the end point after the node element is dragged and moved, and y is the vertical coordinate of the initial position of the node element. The difference between the two is the vertical distance the node element moves; and because the coordinate position of the node element when the mouse is pressed during the dragging process will deviate from the actual center coordinate position of the node element, it is necessary to add the horizontal coordinate eX and vertical coordinate eY of the center position of the node element to avoid the error caused by the offset of the node element position after dragging.

2. A time axis drawing method based on SVG graphics according to claim 1, It is characterized in that According to the connection type, the corresponding two node elements are connected to form a complete time axis, which includes: According to the connection type, use the d attribute value in the path element to connect the corresponding two node elements to form a complete timeline.

3. A time axis drawing method based on SVG graphics according to claim 1, It is characterized in that Zoom the time axis as a whole, including: Through the scale transformation function, the time axis is scaled as a whole.

4. A time axis drawing method based on SVG graphics according to claim 1, It is characterized in that It also includes: adding a drag operation to the node element, deleting a node element, and changing the color of the node element; Add a drag operation to the text element, delete a node element operation, and change the color of a node element.

5. A timeline drawing system based on SVG graphics, It is characterized in that include: A target process acquisition module is used to acquire the target process; The target process includes multiple process events and the event flow of each of the process events; A blank canvas creation module, which uses SVG to build a blank canvas for the target process; A node text element adding module is used to select corresponding node elements and text elements from an element library according to a process event in the target process, and then drag the corresponding node elements and text elements into a blank canvas in sequence by using a mouse, and place them at corresponding positions; The connection type determination module is used to determine the position information of each node element, and determine the longitudinal distance between any two node elements according to the position information of each node element, and then determine the connection type of the two node elements according to the longitudinal distance, specifically including: determining the position information of each node element according to the listener; According to the position information of each node element, determine the vertical distance between any two node elements; when the vertical distance is 0, the connection type of the corresponding two node elements is a straight line; when the vertical distance is not 0, the connection type of the corresponding two node elements is a broken line; the formula for calculating the horizontal and vertical distances is: X = disX - x + eX; Y = disY - y + eY; disX represents the horizontal coordinate of the end point after the node element is dragged and moved, and x is the horizontal coordinate of the initial position of the node element. The difference between the two is the horizontal distance the node element moves; disY and y are similar. disY represents the vertical coordinate of the end point after the node element is dragged and moved, and y is the vertical coordinate of the initial position of the node element. The difference between the two is the vertical distance the node element moves; and because the coordinate position of the node element held by the mouse during the dragging process will deviate from the actual center coordinate position of the node element, it is necessary to add the horizontal coordinate eX and vertical coordinate eY of the center position of the node element to avoid the error caused by the position offset of the node element after dragging; The timeline drawing and saving module is used to connect the two corresponding node elements according to the connection type to form a complete timeline, and perform overall scaling and overall translation operations on the timeline, and then save the timeline after overall scaling and overall translation operations to the database; the entire canvas is stored in the database in HTML format.

6. An electronic device, It is characterized in that The electronic device comprises a memory and a processor, wherein the memory is used to store a computer program, and the processor runs the computer program to enable the electronic device to execute the time axis drawing method based on SVG graphics according to any one of claims 1 to 4.