CN115546345A - Gantt chart drawing method, apparatus, device, storage medium and program product - Google Patents

Gantt chart drawing method, apparatus, device, storage medium and program product Download PDF

Info

Publication number
CN115546345A
CN115546345A CN202211145876.6A CN202211145876A CN115546345A CN 115546345 A CN115546345 A CN 115546345A CN 202211145876 A CN202211145876 A CN 202211145876A CN 115546345 A CN115546345 A CN 115546345A
Authority
CN
China
Prior art keywords
data
drawn
time
identification information
gantt chart
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202211145876.6A
Other languages
Chinese (zh)
Inventor
何峰
张同虎
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
China Construction Bank Corp
Original Assignee
China Construction Bank Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by China Construction Bank Corp filed Critical China Construction Bank Corp
Priority to CN202211145876.6A priority Critical patent/CN115546345A/en
Publication of CN115546345A publication Critical patent/CN115546345A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T11/002D [Two Dimensional] image generation
    • G06T11/20Drawing from basic elements, e.g. lines or circles
    • G06T11/206Drawing of charts or graphs
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/01Input arrangements or combined input and output arrangements for interaction between user and computer
    • G06F3/048Interaction techniques based on graphical user interfaces [GUI]
    • G06F3/0484Interaction techniques based on graphical user interfaces [GUI] for the control of specific functions or operations, e.g. selecting or manipulating an object, an image or a displayed text element, setting a parameter value or selecting a range

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Human Computer Interaction (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

The application provides a Gantt chart drawing method, a Gantt chart drawing device, gantt chart drawing equipment, a storage medium and a program product, and relates to the field of data processing. The method comprises the following steps: receiving a file to be drawn uploaded by a user terminal, wherein the file to be drawn comprises data to be drawn; identifying all identification information and corresponding value data of each piece of data to be drawn; determining the data type of the corresponding value data according to each identification information; determining the time axis range of the Gantt chart according to the value data of which all data types are start time and the value data of which all data types are end time; drawing a time axis of the Gantt chart in a time axis range; drawing each project bar according to the height of the project bar, the identification information in each data to be drawn and the corresponding value data, which are acquired in advance; and taking the value data with the data type being the time period name in each data to be drawn as a project name, assigning the value data to a project bar to obtain a target Gantt chart, and sending the target Gantt chart to a terminal in a webpage form. The problem that the client occupies the storage space of the user terminal is solved.

Description

Gantt chart drawing method, apparatus, device, storage medium, and program product
Technical Field
The present application relates to the field of data processing technologies, and in particular, to a gantt chart drawing method, apparatus, device, storage medium, and program product.
Background
In the process of performing production operation or before performing production operation, it is necessary to clearly understand the start time, end time and sequence of each production process, and a gantt chart is generally used to more intuitively display the production operation flow at present.
In the prior art, a user generally needs to download a client capable of drawing a gantt chart at a terminal device, and then edit the gantt chart at the client.
However, the inventors found that the prior art has the following technical problems: the downloading client terminal can cause the problem that the storage space of the user terminal equipment occupies a large space.
Disclosure of Invention
The application provides a Gantt chart drawing method, a Gantt chart drawing device, gantt chart drawing equipment, a storage medium and a program product, and aims to solve the problem that a user terminal device occupies a large storage space.
In a first aspect, the present application provides a gantt chart drawing method, including:
receiving a file to be drawn uploaded by a user terminal, wherein the file to be drawn comprises at least one piece of data to be drawn; identifying all identification information and corresponding value data of each piece of data to be drawn in the file to be drawn; determining the data type of the corresponding value data according to each identification information, wherein the data type is any one of a start time, an end time and a time period name; determining the time axis range of the Gantt chart according to the value data of which all the data types are the starting time and the value data of which all the data types are the ending time; drawing a time axis of the Gantt chart in the time axis range; drawing the project bar corresponding to each data to be drawn according to the pre-acquired project bar height, the identification information in each data to be drawn and the corresponding value data; taking the value data of which the data type is the time period name in each data to be drawn as a corresponding project name, and assigning the project name to the project bar to obtain a target Gantt chart; and sending the target Gantt chart to the terminal in a webpage form.
In a possible implementation manner, the identifying all the identification information and corresponding value data of each piece of data to be rendered in the file to be rendered includes: searching a field which is the same as any standard field in a preset identification table in the file to be drawn to obtain the identification information; and determining adjacent fields of the identification information as the corresponding value data.
In one possible implementation manner, the determining the adjacent fields of the identification information as the corresponding value data includes: determining a field from any identification information in the file to be drawn to a field before another identification information as value data corresponding to the any identification information; or determining a field from before any identification information to after another identification information in the file to be drawn as value data corresponding to the any identification information.
In a possible implementation manner, the identifying all the identification information and corresponding value data of each piece of data to be rendered in the file to be rendered includes: adopting a natural language processing algorithm to segment the file to be drawn to obtain a plurality of fields to be determined; searching fields which are the same as any standard field in a preset identification table in all fields to be determined to obtain identification information; and determining adjacent fields to be determined of the identification information as the corresponding value data.
In a possible implementation manner, the determining a time axis range of the gantt chart according to the value data of which all data types are start times and the value data of which all data types are end times includes: determining a time axis starting point according to the value data with the minimum numerical value in the value data with the data type as the starting time in all the data to be drawn; determining a time axis terminal point according to the value data with the maximum numerical value in the value data with the data type as the end time in all the data to be drawn; and taking the time axis starting point and the time axis end point as the end points of the time axis range of the Gantt chart.
In a possible implementation manner, the drawing, according to the pre-obtained height of the project bar, the identification information in each data to be drawn, and the corresponding value data, the project bar corresponding to each data to be drawn includes: taking the data type in each data to be drawn as the data of the starting time as the corresponding starting time; taking the data type in each data to be drawn as the data of the end time as the corresponding end time; and sequentially drawing the project bars corresponding to the data to be drawn according to the height of the project bars, the starting time, the ending time, the time axis range of the Gantt chart and the preset size of the canvas, wherein the project bars correspond to the data to be drawn according to the sequence of the starting time.
In one possible implementation, the canvas size comprises a first length in a timeline direction; correspondingly, the sequentially drawing the item bars corresponding to the data to be drawn according to the pre-acquired item bar height, the start time, the end time, the time axis range of the gantt chart and the preset canvas size in the sequence of the start time includes: subtracting the starting endpoint value of the time axis range from the target starting time of any data to be drawn, and dividing the starting endpoint value by the difference value of the two endpoints of the time axis range to obtain the canvas occupying ratio of the target starting time; multiplying the ratio of the canvas occupation of the target starting time by the first length to obtain the starting time position of the item strip corresponding to any data to be drawn; subtracting the starting endpoint value of the time axis range from the target ending time of any data to be drawn, and dividing the starting endpoint value by the difference value of the two endpoints of the time axis range to obtain the canvas occupation ratio of the target ending time; multiplying the ratio of the canvas occupying the target end time by the first length to obtain the end time position of the item bar corresponding to any data to be drawn; taking the sequencing serial number of the starting time of any data to be drawn in the sequence as a target serial number; subtracting one from the target sequence number, and multiplying the target sequence number by the height of the pre-acquired item bar to obtain the initial graphic position of the item bar corresponding to any data to be drawn; multiplying the target sequence number by the height of the pre-acquired item bar to obtain the ending graph position of the item bar corresponding to any data to be drawn; and drawing a rectangle according to the starting time position, the starting graph position, the ending time position and the ending graph position to obtain a project bar corresponding to any data to be drawn.
In one possible implementation, the canvas size comprises a second length perpendicular to the direction of the timeline; correspondingly, the method further includes, in accordance with the pre-obtained height of the item bar, the start time, the end time, the time axis range of the gantt chart, and the preset size of the canvas, sequentially drawing, in the order of the start time, before the item bar corresponding to each data to be drawn, the item bar corresponding to each data to be drawn: receiving a project bar height value sent by the user terminal to obtain the project bar height; or dividing the second length by the number of the data to be drawn to obtain the project bar height.
In a possible implementation manner, after the sending the target gantt chart to the terminal in the form of a web page, the method further includes: and acquiring the position of a mouse pointer of a user in real time, and displaying the start time, the end time and the project name of any project bar if the position of the mouse pointer is within the graphic range of any project bar.
In a possible implementation manner, the obtaining a position of a mouse pointer of a user in real time, and if the position of the mouse pointer is within a graphic range of any item bar, displaying a start time, an end time, and an item name of the item bar includes: acquiring the mouse position of a user mouse pointer in a visual interface and the canvas position of a canvas in the visual interface in real time; subtracting the canvas position from the mouse position to obtain the mouse pointer position, wherein the mouse pointer position consists of a first abscissa and a first ordinate; acquiring two second horizontal coordinates and two second vertical coordinates of the diagonal point of any item bar; and if the first abscissa is in the range of the interval formed by the two second abscissas and the first ordinate is in the range of the interval formed by the two second ordinates, displaying the starting time, the ending time and the item name of any item bar.
In a second aspect, the present application provides a gantt chart drawing apparatus, including:
the file receiving module is used for receiving a file to be drawn uploaded by a user terminal, wherein the file to be drawn comprises at least one piece of data to be drawn; the data identification module is used for identifying all identification information and corresponding value data of each piece of data to be drawn in the file to be drawn; the first determining module is used for determining the data type of the corresponding value data according to each piece of identification information, wherein the data type is any one of start time, end time and time period name; the second determining module is used for determining the time axis range of the Gantt chart according to the value data of which all the data types are the starting time and the value data of which all the data types are the ending time; the first drawing module is used for drawing the time axis of the Gantt chart in the time axis range; the second drawing module is used for drawing the project bar corresponding to each data to be drawn according to the pre-acquired project bar height, the identification information in each data to be drawn and the corresponding value data; the target obtaining module is used for taking the value data of which the data type is the time period name in each data to be drawn as a corresponding project name, and assigning the project name to the project bar to obtain a target Gantt chart; and the graph sending module is used for sending the target Gantt graph to the terminal in a webpage form.
In a third aspect, the present application provides an electronic device, comprising: a processor, and a memory communicatively coupled to the processor; the memory stores computer-executable instructions; the processor executes computer-executable instructions stored by the memory, causing the processor to perform a gantt chart drawing method as described in the first aspect.
In a fourth aspect, the present application provides a computer-readable storage medium having stored therein computer-executable instructions for implementing the gantt chart rendering method as described in the first aspect when executed by a processor.
In a fifth aspect, the present application provides a computer program product comprising a computer program which, when executed by a processor, implements the gantt chart rendering method as described in the first aspect.
According to the Gantt chart drawing method, the Gantt chart drawing device, the Gantt chart drawing equipment, the storage medium and the program product, the file to be drawn uploaded by a user is received, the identification information and the value data in the file to be drawn are identified, the data type of the corresponding value data is determined according to the identification information, the time axis range of the Gantt chart is determined according to the value data of which all the data types are start time and the value data of which all the data types are end time, the time axis of the Gantt chart is drawn according to the time axis range, the item bar corresponding to the data to be drawn is drawn according to the pre-acquired item bar height, the identification information in the data to be drawn and the corresponding value data, the value data of which the data types are time period names in the data to be drawn are used as corresponding item names, the item names are assigned to the item bars, the target Gantt chart is obtained, and the target Gantt chart is sent to a user terminal in the form of a webpage. Because the Gantt chart is drawn on the webpage, the effect of reducing the storage space occupation of the user terminal equipment can be realized.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and together with the description, serve to explain the principles of the application.
Fig. 1 is a schematic view of an application scenario of a gantt chart drawing method provided in an embodiment of the present application;
fig. 2 is a schematic flow chart of a gantt chart drawing method provided in an embodiment of the present application;
fig. 3 is a schematic structural diagram of a gantt chart drawing apparatus provided in an embodiment of the present application;
fig. 4 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Specific embodiments of the present application have been shown by way of example in the drawings and will be described in more detail below. These drawings and written description are not intended to limit the scope of the inventive concepts in any manner, but rather to illustrate the inventive concepts to those skilled in the art by reference to specific embodiments.
Detailed Description
Reference will now be made in detail to the exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, like numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present application. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the application, as detailed in the appended claims.
Currently, when an enterprise performs production operation, staff at a work post is usually required to know the production flow. The production flow is usually shown in a Gantt chart drawing mode in order to more visually represent the production flow or steps.
In the prior art, a user generally needs to download a client for drawing a gantt chart from a terminal device, and input information and adjust the gantt chart at the client in a summary process of drawing the gantt chart. However, the method of downloading the client in the prior art may cause a problem of occupying the space of the user terminal device.
The method and the device are applied to scenes drawn by Gantt charts. In the technical scheme of the application, the collection, storage, use, processing, transmission, provision, disclosure and other processing of the related information such as financial data or user data and the like all accord with the regulations of related laws and regulations and do not violate the good custom of the public order.
Fig. 1 is a schematic view of an application scenario of a gantt chart rendering method provided in an embodiment of the present application. As in fig. 1, this scenario includes: a server 101 and a user terminal 102.
The server 101 may be replaced by a single server, or a cluster including a plurality of servers, and in some possible implementations, may also be replaced by an electronic device such as a mobile phone or a computer.
The user terminal 102 may be a device with data transmission and data reception functions, such as a mobile phone, a computer, a tablet computer, or a server.
The connection between the server 101 and the user terminal 102 may be through a wired connection or through a wireless network, wherein the network used for the wireless network connection may include various types of wired and wireless networks, such as but not limited to: the internet, local Area Networks, wireless Fidelity (WIFI), wireless Local Area Networks (WLAN), general Packet Radio Service (GPRS), code Division Multiple Access (CDMA), 2G/3G/4G/5G cellular Networks, satellite communication Networks, and so on.
In the specific implementation process, the first server 101 is configured to receive a file to be rendered sent by the user terminal 102, identify identification information and value data of each piece of data to be rendered in the file to be rendered, determine a data type of the corresponding value data according to the identification information, determine a time axis range of a gantt chart according to the value data of which the data type is a start time and the value data of which the data type is an end time, render a time axis of the gantt chart in the time axis range, render an item bar of each piece of data to be rendered according to a pre-acquired item bar height, the identification information in each piece of data to be rendered, and the corresponding value data, render a value data of which the data type is a time period name in each piece of data to be rendered as a corresponding item name, assign the item name to the item bar, obtain the gantt chart, and send the gantt chart to the user terminal 102 in a form of a web page.
It is to be understood that the illustrated structure of the embodiments of the present application does not specifically limit the method for drawing a gantt chart. In other possible embodiments of the present application, the architecture may include more or fewer components than those shown in the drawings, or combine some components, or split some components, or arrange different components, which may be determined according to an actual application scenario and is not limited herein. The components shown in fig. 1 may be implemented in hardware, software, or a combination of software and hardware.
The following describes the technical solutions of the present application and how to solve the above technical problems with specific embodiments. The following several specific embodiments may be combined with each other, and details of the same or similar concepts or processes may not be repeated in some embodiments. Embodiments of the present application will be described below with reference to the accompanying drawings.
Fig. 2 is a schematic flow chart diagram of a gantt chart rendering method provided in the embodiment of the present application. The execution subject in the embodiment of the present application may be the server 101 in fig. 1, or may be a computer and/or a mobile phone, and the present embodiment is not particularly limited thereto. As shown in fig. 2, the method includes:
s201: and receiving a file to be drawn uploaded by a user terminal, wherein the file to be drawn comprises at least one piece of data to be drawn.
In this step, the format of the file to be drawn may be a document format, a notepad format, a table format, and the like, and the format of the file to be drawn is not particularly limited in this application. The receiving of the file to be drawn can be through an interface of a webpage, and can also be received in other wired or wireless modes.
S202: and identifying all identification information and corresponding value data of each piece of data to be drawn in the file to be drawn.
In this step, identifying the identification information in the file to be drawn may be to search a preset character string in the file to be drawn, where the searched character string is the identification information, and a character string adjacent to the identification information or a character string between preset character strings adjacent to the identification information is used as the value data.
For example, if a preset "start time" character string is searched in the file to be drawn, the start time is the identification information, if the sentence in which the start time character string is located is "start time 20190201", then "20190201" is the value information, or if the sentence in which the start time character string is located is "start time (20190201)", then "20190201" is the value information, where "()" is a preset character string adjacent to the identification information.
S203: and determining the data type of the corresponding value data according to the identification information, wherein the data type is any one of the starting time, the ending time and the time period name.
In this step, the data type may be one in which the representation information is value information.
For example, in step S202, the data type of "20190201" is the start time. Similarly, if the sentence of the time period name is "time period name ABCD", then "ABCD" is the time period name.
Wherein, the start time, the end time and the time period name can be replaced by other character strings. For example, the start time may instead be "start time", "A", or "Atime", etc. The ending time may be replaced by a "terminal time", "B", or "Btime", etc. The time period name may be replaced with a "name", "period name", etc. The name of the data type is not particularly limited in this application.
S204: and determining the time axis range of the Gantt chart according to the value data of which all data types are start time and the value data of which all data types are end time.
In this step, the two endpoints of the gantt chart time axis may be determined based on the smallest value data among the value data of which all the data types are start times and the largest value data among the value data of which all the data types are end times. The value data of the minimum start time may be subtracted from a preset value to serve as a value of one endpoint, and the value data of the maximum end time may be added to the preset value to serve as a value of the other endpoint.
In one possible implementation manner, in this step, determining a time axis range of the gantt chart from the value data in which all the data types are start times and the value data in which all the data types are end times includes:
s2041: and determining a time axis starting point according to the value data with the minimum numerical value in the value data with the data type as the starting time in all the data to be drawn.
In this step, the value data having the smallest value among the value data of all the data types as the start times may be used as the time axis start point.
For example, if the current start times are 20120202, 20120506, and 20120703, respectively, the time axis start point is 20120202.
S2042: and determining the time axis end point according to the value data with the maximum numerical value in the value data with the data type as the end time in all the data to be drawn.
In this step, the data having the largest value among the data of all the data types as the end time may be used as the time axis end point.
For example, if the current end times are 20130202, 20130506, and 20130703, respectively, the time axis starting point is 20130703.
S2043: the time axis starting point and the time axis ending point are used as the end points of the time axis range of the Gantt chart.
In this step, the time axis starting point may be the origin of the time axis.
S205: the time axis of the gantt chart is plotted as a time axis range.
In this step, drawing the time axis according to the time axis range may be drawing the time axis by using a single canvas (drawing board). And, when drawing the time axis, can mark the scale, the interval of scale can be confirmed according to the scope of canvas size and time axis to have the pixel that is greater than the default after making the number of pixels along time axis length divide the number of scales in the canvas size, be convenient for the user to observe the scale.
For example, the minimum (earliest) start time value information and the maximum (latest) end time corresponding value information are 2020-01-01 and 2022-01-01, respectively, the width of the gantt chart is 1500 pixels, because this time includes 12 months of 2020 and 2021 and one month of 2022, then the total is 25 months, 1500 ÷ 25=60 pixels, so each patch of the scale is 60 pixels, it is determined that each patch gets pixels that are not less than 50 pixels, it is avoided that the position is too small to be recognized, and then the width of 60 pixels is reasonable and does not need to be recalculated; if 36 months exist, each grid of the scale is 1500 ÷ 36=41.7, is smaller than 50, and is smaller in width, the unit is calculated from month to quarter, and is 1500 ÷ 12=125, so that 125 pixels are reasonable and are displayed in a quarter mode.
S206: and drawing the project bar corresponding to each data to be drawn according to the height of the project bar, the identification information in each data to be drawn and the corresponding value data.
In this step, each piece of data to be drawn may be used to draw a corresponding item bar. The method comprises the steps of using value data with identification information as start time as the start time of an item bar, using value data with identification information as end time as the end time of the item bar, using the height of the item bar obtained in advance as the height of the item bar, and drawing a rectangular item bar, wherein the item bar can be in other shapes, such as a rectangle with round corners, and the like, and the method is not particularly limited in the application.
S207: and taking the value data of which the data type is the time period name in each data to be drawn as a corresponding project name, and assigning the project name to a project bar to obtain a target Gantt chart.
In this step, assigning the item name to the item bar may be establishing a mapping relationship between the item name and the item bar, or displaying the item name in the item bar. When drawing the item bar, a canvas may be used for drawing, and the canvas of the item bar and the canvas of the time axis may be independent.
S208: and sending the target Gantt chart to the terminal in a webpage form.
In this step, the format of the web page may be an HTML (Hyper Text Markup Language) format or an HTML5 format.
As can be known from the description of the above embodiment, in the embodiment of the present application, a file to be drawn uploaded by a user is received, identification information and value data in the file to be drawn are identified, a data type of corresponding value data is determined according to the identification information, a time axis range of a gantt chart is determined according to the value data in which all data types are start times and the value data in which all data types are end times, a time axis of the gantt chart is drawn according to the time axis range, an item bar corresponding to each data to be drawn is drawn according to a pre-acquired item bar height, the identification information in each data to be drawn and the corresponding value data, a value data in which a data type in each data to be drawn is a time period name is used as a corresponding item name, the item name is assigned to the item bar, an object gantt chart is obtained, and the object gantt chart is sent to a user terminal in a form of a web page. Because the Gantt chart is drawn on the webpage, the effect of reducing the storage space occupation of the user terminal equipment can be realized.
In addition, because canvas is used for drawing in the embodiment of the present application, the gantt chart can be obtained by using fewer dom (Document Object Model) tree structures, and memory usage can be saved.
In a possible implementation manner, in step S202, identifying all the identification information and corresponding value data of each piece of data to be rendered in the file to be rendered includes:
s2021: and searching a field which is the same as any standard field in the preset identification table in the file to be drawn to obtain identification information.
In this step, each standard field in the preset identification table may be sequentially searched. A preset identification table such as table 1.
Table 1 Preset identification Table (schematic)
Starting time End time Name of project Duration of the item
Starting time End time Name of the project When the project is used
S2022: adjacent fields of the identification information are determined as corresponding value data.
In one possible implementation manner, in this step, determining adjacent fields of the identification information as corresponding value data includes:
S2022A: and determining a field from any identification information in the file to be drawn to the field before another identification information as value data corresponding to any identification information. Or the like, or a combination thereof,
in this step, the value data is a field following any identification.
In a possible implementation manner, if there is no other identification information behind one identification information, a field behind the one identification information is value information of the one identification information.
For example, a sentence of the file to be drawn includes "start time 20210101 end time", where "start time" and "end time" are identification information, and "20210101" is value information corresponding to "start time". For another example, a sentence of the file to be rendered includes "end time 20210202 item name AAA", where "end time" and "item name time" are identification information, "20210202" is value information corresponding to "end time", and "AAA" is value information of the item name.
S2022B: and determining a field from before any identification information to after another identification information in the file to be drawn as value data corresponding to any identification information.
In this step, the value data is a field preceding any identification.
In a possible implementation manner, if there is no other identification information before an identification information, a field before the identification information is value information of the identification information.
For example, a sentence of the file to be rendered includes "20201113 start time 20210101 end time", where "start time" and "end time" are identification information, and "20211113" is value information corresponding to "start time", and "20210101" is value information of "end time". For another example, a sentence of the file to be rendered includes "20210202 end time BBB project name", where "end time" and "project name time" are identification information, "20210202" is value information corresponding to "end time", and "BBB" is value information corresponding to "project name".
In a possible implementation manner, in step S202, identifying all the identification information and corresponding value data of each piece of data to be rendered in the file to be rendered includes:
s2023: and segmenting the file to be drawn by adopting a natural language processing algorithm to obtain a plurality of fields to be determined.
In this step, natural language processing algorithms such as viterbi algorithm, hidden markov model, LAC (language technology platform), jieba participle, THULAC (chinese participle analysis tool at the university of qinghua).
S2024: and searching fields which are the same as any standard field in the preset identification table in all fields to be determined to obtain identification information.
This step is similar to step S202, and the search for the same field in the sentence in S202 is changed to search for the same field in multiple fields, which is not described herein again.
S2025: and determining adjacent fields to be determined of the identification information as corresponding value data.
In this step, the adjacency may be a preceding adjacency or a following adjacency, which is similar to the above steps S2022A and S2022B and is not described herein again.
As can be seen from the description of the above embodiment, in the embodiment of the present application, the field in the file to be drawn, which is the same as the standard field in the preset identification table, is used as the identification information, and the adjacent field of the identification information is determined as the corresponding value data, so that the effect of finding the identification information and the corresponding value field in the file to be drawn is achieved, and the subsequent drawing of the item bar and the time axis is facilitated.
In a possible implementation manner, in step S206, the drawing the item bar corresponding to each data to be drawn according to the height of the item bar, the identification information in each data to be drawn, and the corresponding value data, includes:
s2061: and taking the data type in each data to be drawn as the value data of the starting time as the corresponding starting time.
In this step, for example, if the data type of the value data "20210303" is the start time, the start time is 20210303, if the data type of the value data "20120404" is the start time, the start time is 20120404, and if the data type of the value data "2006050506" is the start time, the start time is 2006050506.
S2062: and taking the data type in each data to be drawn as the data of the end time as the corresponding end time.
This step is similar to step S2061, and is not described herein again.
S2063: and sequentially drawing the project bars corresponding to the data to be drawn according to the height of the project bars, the starting time, the ending time, the time axis range of the Gantt chart and the preset canvas size, wherein the preset canvas size is the same as the preset canvas size.
In this step, the time range of the item bar may be determined according to the start time and the end time of each piece of data to be drawn, the corresponding length of the item bar is obtained by multiplying the time range of the item bar in the time axis range of the gantt chart by the size of the canvas, and the size of the item bar is obtained according to the length of the item bar and the height of the item bar. When the item bars are drawn, the item bars can be drawn line by line in sequence according to the starting time of each item bar, and the item bars can also be drawn in the same line.
In a possible implementation manner, the step may also replace the data to be drawn as the second data to be drawn in the sequence of the start time. For example, if the data to be drawn a is the third piece of data to be drawn, the corresponding item bar may be drawn in the third row or the third line.
In one possible implementation, the canvas size includes a first length along a time axis.
The first length may be expressed in pixels, or may be expressed in distance units, such as centimeters, millimeters, inches, and the like.
Correspondingly, in step S2063, sequentially drawing the item bars corresponding to the data to be drawn according to the pre-obtained item bar height, the start time, the end time, the time axis range of the gantt chart and the preset canvas size in the sequence of the start time, including:
s20631: and subtracting the starting endpoint value of the time axis range from the target starting time of any data to be drawn, and dividing the starting endpoint value by the difference value of the two endpoints of the time axis range to obtain the canvas occupying ratio of the target starting time. And multiplying the ratio of the canvas occupied by the target starting time by the first length to obtain the starting time position of the item bar corresponding to any data to be drawn.
In this step, the target start time is the start time of any data to be rendered in this step. The two endpoints of the time axis range are the minimum of all start times and the maximum of all end times.
S20632: subtracting the starting endpoint value of the time axis range from the target ending time of any data to be drawn, and dividing the starting endpoint value by the difference value of the two endpoints of the time axis range to obtain the canvas occupation ratio of the target ending time; and multiplying the ratio of the canvas occupied by the target end time by the first length to obtain the end time position of the item bar corresponding to any data to be drawn.
In this step, this step is similar to step S20631 described above and will not be described here.
S20633: and taking the sequencing sequence number of the start time of any data to be drawn in the sequence from beginning to end as a target sequence number.
For example, if the starting time of the data to be drawn is after the starting time of the other 3 data to be drawn, the sequence number of the data to be drawn is 4; and if the starting time of the data to be drawn of B is after the starting time of the other 5 data to be drawn, the sequencing serial number of the data to be drawn of A is 6.
S20634: and subtracting one from the target sequence number, and multiplying the target sequence number by the height of the item bar to be obtained in advance to obtain the initial graphic position of the item bar corresponding to any data to be drawn.
In this step, the starting figure position may be a figure drawing start point perpendicular to the time axis direction or one boundary of the figure in the direction perpendicular to the time axis.
S20635: and multiplying the target serial number by the height of the item bar to be obtained to obtain the ending graph position of the item bar corresponding to any data to be drawn.
In this step, the end figure position may be a figure drawing end point perpendicular to the time axis direction or another boundary of the figure in the direction perpendicular to the time axis.
S20636: and drawing a rectangle according to the starting moment position, the starting graph position, the ending moment position and the ending graph position to obtain an item bar corresponding to any data to be drawn.
In this step, a first corner point may be formed by the start time position and the start graphic position, a second corner point may be formed by the start time position and the end graphic position, a third corner point may be formed by the end time position and the end graphic position, and a fourth corner point may be formed by the end time position and the start graphic position, and the four corner points are sequentially connected to obtain a project bar corresponding to data to be drawn.
By repeating the above steps S20631 to S20636, the item bars corresponding to all the data to be drawn can be obtained.
It can be known from the description of the embodiment that, in the embodiment of the present application, the start time and the end time of the item bar are obtained by using the value data of which the data types are the start time and the end time in each data to be drawn, and all the item bars are sequentially drawn according to the height of the pre-obtained item bar, the start time, the end time, the time axis range of the gantt chart, and the preset canvas size, so that an effect of adding the item bars in the gantt chart is achieved, the drawing of the main content of the gantt chart is completed, and the task flow is more intuitive.
In one possible implementation, the canvas size includes a second length perpendicular to the direction of the timeline.
The representation manner of the second length is similar to that of the first length, and is not described herein again.
Correspondingly, in step S2063, according to the pre-obtained height of the item bar, the start time, the end time, the time axis range of the gantt chart, and the preset size of the canvas, before the item bar corresponding to each piece of data to be drawn is drawn in sequence according to the sequence of the start time, the method further includes:
S2062A: and receiving the height value of the project bar sent by the user terminal to obtain the height of the project bar. Or the like, or a combination thereof,
in this step, the user may be a separately sent height value of the item bar, which is included in the web page input, or click a button in the web page, or may receive the height value of the item bar in the file to be drawn in the form of identification information and value information.
S2062B: and dividing the second length by the number of the data to be drawn to obtain the height of the project bar.
In the above embodiment, the number of the data to be drawn may be obtained by segmenting the file to be drawn in a preset manner, and counting the number of the data to be drawn. The predetermined pattern may be a period division, or a division with other characters or character strings. The unit of the item bar height may be the same as the unit of the second length.
As can be seen from the description of the above embodiment, in the embodiment of the present application, the height of the project bar is obtained by receiving the height value of the project bar sent by the user or dividing the second length by the number of the data to be drawn, so that the displayed project bar is more suitable for page display.
In a possible implementation manner, after the step S208 transmits the target gantt chart to the terminal in the form of a web page, the method further includes:
s209: and acquiring the position of a mouse pointer of a user in real time, and displaying the start time, the end time and the project name of any project bar if the position of the mouse pointer is within the graphic range of any project bar.
In this step, the real-time obtaining of the mouse pointer position of the user may be obtaining of the mouse pointer position through a preset function, for example, a function in canvas, specifically, for example, a canvas. The graphic range of any item bar may be determined by the positions of the four corner points in step S20636, or the coordinate of the mouse pointer position along the time axis direction is between the start time position and the end time position, and the coordinate of the mouse pointer position perpendicular to the time axis direction is between the start graphic position and the end graphic position.
In one possible implementation manner, in step S209, the step of obtaining the position of the mouse pointer of the user in real time, and if the position of the mouse pointer is within the graphic range of any item bar, displaying the start time, the end time, and the item name of any item bar includes:
s2091: and acquiring the mouse position of the mouse pointer of the user in the visual interface and the canvas position of the canvas in the visual interface in real time.
In this step, the mouse position of the mouse pointer in the visual interface may be obtained by obtaining the mouse position of the mouse pointer in the visual interface of the web page, and may be obtained by using e.offset height and e.offset hwidth functions, and the canvas position of the canvas in the visual interface may be obtained by using canvas. Obtaining the mouse position may also be accomplished using an interface, such as a webworker interface.
S2092: and subtracting the canvas position from the mouse position to obtain a mouse pointer position, wherein the mouse pointer position consists of a first abscissa and a first ordinate.
In this step, subtracting the canvas position from the mouse position may be subtracting the coordinate in the time axis direction of the canvas position from the coordinate in the time axis direction of the mouse position, and subtracting the coordinate in the vertical time axis direction of the canvas position from the coordinate in the time axis direction of the mouse position.
S2093: and acquiring two second horizontal coordinates and two second vertical coordinates of the diagonal point of any item bar.
In this step, the diagonal point may be a diagonal point formed by the first corner point and the third corner point in S20636, or a diagonal point formed by the second corner point and the fourth corner point. The abscissa is a coordinate along the time axis direction, the ordinate is a coordinate perpendicular to the time axis direction, and the abscissa is a coordinate perpendicular to the time axis direction, the ordinate is a coordinate along the time axis direction.
S2094: and if the first abscissa is in the range of the interval formed by the two second abscissas and the first ordinate is in the range of the interval formed by the two second ordinates, displaying the start time, the end time and the item name of any item bar.
In this step, the start time, end time, and item name of any item bar may be displayed by a separate canvas or may be displayed in the form of a floating window, and the position of the floating window may follow the position of the mouse pointer.
As can be seen from the above description of the embodiments, in the embodiments of the present application, by obtaining the mouse pointer position of the user, and if the mouse pointer position is within the graphic range of any item bar, the start time, the end time, and the item name of any item bar are displayed, so that an effect of displaying more detailed content in the gantt chart can be achieved. In addition, in the embodiment of the application, three different canvases can be adopted to display the floating window displayed in the time axis part of the Gantt chart, the item bar part of the Gantt chart and the mouse in the item bar, so that when the mouse moves, the whole canvases do not need to be redrawn for drawing the floating window, and the display speed of the floating window is increased. And when the mouse position is obtained, the mouse position can be obtained by adopting a mode of calling the interface, namely, a sub-thread is opened on the main thread and any operation of the main thread is not influenced, so that the situation that the main thread is blocked due to frequent calculation is avoided.
It will be understood by those skilled in the art that the units of start time or end time in the present application may be any of year, quarter, month, day, hour, minute, or second. The quantity of the data to be drawn can be obtained by dividing the file to be drawn in a preset mode to obtain the data to be drawn and counting the quantity of the data to be drawn. The predetermined pattern may be a period division, or a division with other characters or character strings.
Fig. 3 is a schematic structural diagram of a gantt chart drawing apparatus provided in an embodiment of the present application. As shown in fig. 3, the gantt chart drawing apparatus 300 includes: the system comprises a file receiving module 301, a data identification module 302, a first determination module 303, a second determination module 304, a first drawing module 305 and a second drawing module 306.
The file receiving module 301 is configured to receive a file to be drawn uploaded by a user terminal, where the file to be drawn includes at least one piece of data to be drawn.
The data identification module 302 is configured to identify all identification information and corresponding value data of each piece of data to be rendered in the file to be rendered.
A first determining module 303, configured to determine a data type of the corresponding value data according to each identification information, where the data type is any one of a start time, an end time, and a time period name.
The second determining module 304 is configured to determine a time axis range of the gantt chart according to the value data of which all data types are start times and the value data of which all data types are end times.
A first rendering module 305, configured to render the time axis of the gantt chart in the time axis range.
And the second drawing module 306 is configured to draw the project bar corresponding to each data to be drawn according to the height of the project bar, the identification information in each data to be drawn, and the corresponding value data.
And the target obtaining module 307 is configured to use the value data with the data type being the time period name in each data to be drawn as a corresponding project name, and assign the project name to the project bar to obtain a target gantt chart.
And the graph sending module 308 is configured to send the target gantt graph to the terminal in the form of a web page.
In a possible implementation manner, the data identification module 302 is specifically configured to search a field that is the same as any standard field in the preset identification table in the file to be drawn, so as to obtain the identification information. Adjacent fields of the identification information are determined as corresponding value data.
The apparatus provided in this embodiment may be used to implement the technical solutions of the above method embodiments, and the implementation principles and technical effects are similar, which are not described herein again.
In a possible implementation manner, the data identification module 302 is specifically configured to determine a field from after any identification information in a file to be drawn to before another identification information as value data corresponding to any identification information; or determining a field from before any identification information to after another identification information in the file to be drawn as value data corresponding to any identification information.
The apparatus provided in this embodiment may be used to implement the technical solutions of the above method embodiments, and the implementation principles and technical effects are similar, which are not described herein again.
In a possible implementation manner, the data identification module 302 is specifically configured to segment the file to be drawn by using a natural language processing algorithm to obtain a plurality of fields to be determined. And searching fields which are the same as any standard field in the preset identification table in all fields to be determined to obtain identification information. And determining adjacent fields to be determined of the identification information as corresponding value data.
The apparatus provided in this embodiment may be used to implement the technical solutions of the above method embodiments, and the implementation principles and technical effects are similar, which are not described herein again.
In a possible implementation manner, the second determining module 304 is specifically configured to determine the time axis starting point according to the value data with the smallest value in the value data with the data type as the starting time in all the data to be plotted. And determining the time axis end point according to the value data with the maximum numerical value in the value data with the data type as the end time in all the data to be drawn. The time axis starting point and the time axis ending point are used as the end points of the time axis range of the Gantt chart.
The apparatus provided in this embodiment may be used to implement the technical solutions of the above method embodiments, and the implementation principles and technical effects are similar, which are not described herein again.
In a possible implementation manner, the second drawing module 306 is specifically configured to use a data type in each data to be drawn as a start time value as a corresponding start time. And taking the data type in each data to be drawn as the data of the end time as the corresponding end time. And sequentially drawing the project bars corresponding to the data to be drawn according to the height of the project bars, the starting time, the ending time, the time axis range of the Gantt chart and the preset canvas size, wherein the preset canvas size is the same as the preset canvas size.
The apparatus provided in this embodiment may be used to implement the technical solutions of the above method embodiments, and the implementation principles and technical effects are similar, which are not described herein again.
In one possible implementation, the canvas size includes a first length along a timeline direction.
The second drawing module 306 is specifically configured to subtract an initial endpoint value of the time axis range from the target start time of any data to be drawn, and divide the initial endpoint value by a difference value of two endpoints of the time axis range to obtain a canvas occupying ratio of the target start time; and multiplying the ratio of the canvas occupied by the target starting time by the first length to obtain the starting time position of the item bar corresponding to any data to be drawn. Subtracting the starting endpoint value of the time axis range from the target ending time of any data to be drawn, and dividing the starting endpoint value by the difference value of the two endpoints of the time axis range to obtain the canvas occupation ratio of the target ending time; and multiplying the canvas occupying ratio of the target end time by the first length to obtain the end time position of the item bar corresponding to any data to be drawn. And taking the sequencing sequence number of the start time of any data to be drawn in the sequence from beginning to end as the target sequence number. And subtracting one from the target sequence number, and multiplying the target sequence number by the height of the item bar to be obtained in advance to obtain the initial graphic position of the item bar corresponding to any data to be drawn. And multiplying the target serial number by the height of the item bar to be obtained to obtain the ending graph position of the item bar corresponding to any data to be drawn. And drawing a rectangle according to the starting moment position, the starting graph position, the ending moment position and the ending graph position to obtain an item bar corresponding to any data to be drawn.
The apparatus provided in this embodiment may be used to implement the technical solutions of the above method embodiments, and the implementation principles and technical effects are similar, which are not described herein again.
In one possible implementation, the canvas size includes a second length perpendicular to the direction of the time axis;
the gantt chart drawing apparatus 300 further includes: a height obtaining module 309.
A height obtaining module 309, specifically configured to receive a height value of the item bar sent by the user terminal, to obtain a height of the item bar; or dividing the second length by the number of data to be drawn to obtain the project bar height.
The apparatus provided in this embodiment may be used to implement the technical solutions of the above method embodiments, and the implementation principles and technical effects are similar, which are not described herein again.
In a possible implementation manner, the gantt chart drawing apparatus 300 further includes: the data display module 310 is configured to obtain a position of a mouse pointer of a user in real time, and display a start time, an end time, and a project name of any project bar if the position of the mouse pointer is within a graphic range of any project bar.
The apparatus provided in this embodiment may be used to implement the technical solutions of the above method embodiments, and the implementation principles and technical effects are similar, which are not described herein again.
In one possible implementation, the data display module 310 is specifically configured to obtain, in real time, a mouse position of a mouse pointer of a user in the visual interface and a canvas position of a canvas in the visual interface. And subtracting the canvas position from the mouse position to obtain a mouse pointer position, wherein the mouse pointer position consists of a first abscissa and a first ordinate. And acquiring two second abscissa and two second ordinate of the diagonal point of any item bar. And if the first abscissa is in the range of the interval formed by the two second abscissas and the first ordinate is in the range of the interval formed by the two second ordinates, displaying the start time, the end time and the item name of any item bar.
The apparatus provided in this embodiment may be configured to implement the technical solutions of the method embodiments, and the implementation principles and technical effects are similar, which are not described herein again.
In order to realize the above embodiments, the embodiments of the present application further provide an electronic device.
Referring to fig. 4, a schematic structural diagram of an electronic device 400 suitable for implementing the embodiment of the present application is shown, where the electronic device 400 may be a terminal device or a server. Among them, the terminal Device may include, but is not limited to, a mobile terminal such as a mobile phone, a notebook computer, a Digital broadcast receiver, a Personal Digital Assistant (PDA), a tablet computer (PAD), a Portable Multimedia Player (PMP), a car terminal (e.g., car navigation terminal), etc., and a fixed terminal such as a Digital TV, a desktop computer, etc. The electronic device shown in fig. 4 is only an example, and should not bring any limitation to the functions and the use range of the embodiment of the present application.
As shown in fig. 4, the electronic device 400 may include a processing device (e.g., a central processing unit, a graphics processor, etc.) 401, which may perform various suitable actions and processes according to a program stored in a Read Only Memory (ROM) 402 or a program loaded from a storage device 408 into a Random Access Memory (RAM) 403. In the RAM 403, various programs and data necessary for the operation of the electronic apparatus 400 are also stored. The processing device 401, the ROM 402, and the RAM 403 are connected to each other through a bus 404. An input/output (I/O) interface 405 is also connected to bus 404.
Generally, the following devices may be connected to the I/O interface 405: input devices 406 including, for example, a touch screen, touch pad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, etc.; an output device 407 including, for example, a Liquid Crystal Display (LCD), a speaker, a vibrator, and the like; storage 408 including, for example, tape, hard disk, etc.; and a communication device 409. The communication device 409 may allow the electronic device 400 to communicate with other devices, either wirelessly or by wire, to exchange data. While fig. 4 illustrates an electronic device 400 having various means, it is to be understood that not all illustrated means are required to be implemented or provided. More or fewer devices may be alternatively implemented or provided.
In particular, according to embodiments of the present application, the processes described above with reference to the flow diagrams may be implemented as computer software programs. For example, embodiments of the present application include a computer program product comprising a computer program embodied on a computer-readable storage medium, the computer program comprising program code for performing the method illustrated by the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network via the communication device 409, or from the storage device 408, or from the ROM 402. The computer program, when executed by the processing device 401, performs the above-described functions defined in the methods of the embodiments of the present application.
It should be noted that the computer readable storage medium mentioned above in the present application may be a computer readable signal medium or a computer storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present application, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In this application, however, a computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable storage medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable storage medium may be transmitted using any appropriate medium, including but not limited to: electrical wires, optical cables, RF (radio frequency), etc., or any suitable combination of the foregoing.
The computer-readable storage medium may be included in the electronic device; or may exist separately without being assembled into the electronic device.
The computer-readable storage medium carries one or more programs which, when executed by the electronic device, cause the electronic device to perform the method shown in the above embodiments.
Computer program code for carrying out operations for aspects of the present application may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, smalltalk, C + +, and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the latter scenario, the remote computer may be connected to the user's computer through any type of Network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider).
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present application. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The modules described in the embodiments of the present application may be implemented by software or hardware. Where the name of a unit does not in some cases constitute a limitation of the module itself, for example, the second determination module may also be described as a "time axis range determination module".
The functions described herein above may be performed, at least in part, by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field Programmable Gate Arrays (FPGAs), application Specific Integrated Circuits (ASICs), application Specific Standard Products (ASSPs), system on a chip (SOCs), complex Programmable Logic Devices (CPLDs), and the like.
The present application further provides a computer-readable storage medium, where a computer execution instruction is stored in the computer-readable storage medium, and when a processor executes the computer execution instruction, the technical solution for implementing the gantt chart drawing method in any of the embodiments described above is implemented, and the implementation principle and the beneficial effects of the gantt chart drawing method are similar to those of the gantt chart drawing method, which can be referred to as the implementation principle and the beneficial effects of the gantt chart drawing method, and are not described herein again.
In the context of this application, a machine-readable medium may be a tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
The present application further provides a computer program product, including a computer program, where when the computer program is executed by a processor, the technical solution of the gantt chart drawing method in any of the embodiments is implemented, and the implementation principle and the beneficial effect of the computer program are similar to those of the gantt chart drawing method, which can be referred to as the implementation principle and the beneficial effect of the gantt chart drawing method, and are not described herein again.
The integrated module implemented in the form of a software functional module may be stored in a computer-readable storage medium. The software functional module is stored in a storage medium and includes several instructions to enable a computer device (which may be a personal computer, a server, or a network device) or a processor to execute some steps of the methods according to the embodiments of the present application.
It should be understood that the Processor may be a Central Processing Unit (CPU), other general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), etc. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. The steps of a method disclosed in connection with the present invention may be embodied directly in a hardware processor, or in a combination of hardware and software modules.
The memory may comprise a high speed RAM memory, and may further comprise a non-volatile storage NVM, such as at least one magnetic disk memory, and may also be a usb disk, a removable hard disk, a read-only memory, a magnetic or optical disk, or the like.
The bus may be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, an Extended ISA (EISA) bus, or the like. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, the buses in the figures of the present application are not limited to only one bus or one type of bus.
The storage medium may be implemented by any type or combination of volatile or non-volatile memory devices, such as Static Random Access Memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic or optical disks. A storage media may be any available media that can be accessed by a general purpose or special purpose computer.
An exemplary storage medium is coupled to the processor such the processor can read information from, and write information to, the storage medium. Of course, the storage medium may also be integral to the processor. The processor and the storage medium may reside in an Application Specific Integrated Circuits (ASIC). Of course, the processor and the storage medium may reside as discrete components in an electronic device or host device.
Those of ordinary skill in the art will understand that: all or a portion of the steps of implementing the above-described method embodiments may be performed by hardware associated with program instructions. The foregoing program may be stored in a computer-readable storage medium. When executed, the program performs steps comprising the method embodiments described above; and the aforementioned storage medium includes: various media that can store program codes, such as ROM, RAM, magnetic or optical disks.
Other embodiments of the present application will be apparent to those skilled in the art from consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the invention following, in general, the principles of the application and including such departures from the present disclosure as come within known or customary practice within the art to which the invention pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the application being indicated by the following claims.
It will be understood that the present application is not limited to the precise arrangements described above and shown in the drawings and that various modifications and changes may be made without departing from the scope thereof. The scope of the application is limited only by the appended claims.

Claims (14)

1. A Gantt chart drawing method is characterized by comprising the following steps:
receiving a file to be drawn uploaded by a user terminal, wherein the file to be drawn comprises at least one piece of data to be drawn;
identifying all identification information and corresponding value data of each piece of data to be drawn in the file to be drawn;
determining the data type of the corresponding value data according to each identification information, wherein the data type is any one of a start time, an end time and a time period name;
determining the time axis range of the Gantt chart according to the value data of which all the data types are the starting time and the value data of which all the data types are the ending time;
drawing a time axis of the Gantt chart in the time axis range;
drawing the project bar corresponding to each data to be drawn according to the pre-acquired project bar height, the identification information in each data to be drawn and the corresponding value data;
taking value data with a data type of a time period name in each data to be drawn as a corresponding project name, and assigning the project name to the project bar to obtain a target Gantt chart;
and sending the target Gantt chart to the terminal in a webpage form.
2. The method according to claim 1, wherein the identifying all the identification information and corresponding value data of each piece of data to be rendered in the file to be rendered comprises:
searching a field which is the same as any standard field in a preset identification table in the file to be drawn to obtain the identification information;
and determining adjacent fields of the identification information as the corresponding value data.
3. The method of claim 2, wherein said determining adjacent fields of said identification information as said corresponding value data comprises:
determining a field from any identification information in the file to be drawn to a field before another identification information as value data corresponding to the any identification information; or the like, or a combination thereof,
and determining a field from before any identification information to after another identification information in the file to be drawn as value data corresponding to any identification information.
4. The method according to claim 1, wherein the identifying all the identification information and corresponding value data of each piece of data to be rendered in the file to be rendered comprises:
adopting a natural language processing algorithm to segment the file to be drawn to obtain a plurality of fields to be determined;
searching fields which are the same as any standard field in a preset identification table in all fields to be determined to obtain identification information;
and determining adjacent fields to be determined of the identification information as the corresponding value data.
5. The method according to claim 1, wherein determining a time axis range of a gantt chart from the value data of which all data types are start times and the value data of which all data types are end times includes:
determining a time axis starting point according to the value data with the minimum numerical value in the value data with the data type as the starting time in all the data to be drawn;
determining a time axis terminal according to the data with the maximum value in the value data with the data type as the end time in all the data to be drawn;
and taking the time axis starting point and the time axis end point as the end points of the time axis range of the Gantt chart.
6. The method according to claim 1, wherein the step of drawing the project bar corresponding to each data to be drawn according to the height of the project bar, the identification information in each data to be drawn and the corresponding value data, which is pre-obtained, comprises:
taking the data type in each data to be drawn as the data of the starting time as the corresponding starting time;
taking the data type in each data to be drawn as the data of the end time as the corresponding end time;
and sequentially drawing the project bars corresponding to the data to be drawn according to the height of the project bars, the starting time, the ending time, the time axis range of the Gantt chart and the preset size of the canvas, wherein the project bars correspond to the data to be drawn according to the sequence of the starting time.
7. The method of claim 6, wherein the canvas size comprises a first length in a direction of a time axis;
correspondingly, the sequentially drawing the item bars corresponding to the data to be drawn according to the pre-acquired item bar height, the start time, the end time, the time axis range of the gantt chart and the preset canvas size in the sequence of the start time includes:
subtracting the starting endpoint value of the time axis range from the target starting time of any data to be drawn, and dividing the starting endpoint value by the difference value of the two endpoints of the time axis range to obtain the canvas occupation ratio of the target starting time; multiplying the ratio of the canvas occupation of the target starting time by the first length to obtain the starting time position of the item strip corresponding to any data to be drawn;
subtracting the starting endpoint value of the time axis range from the target ending time of any data to be drawn, and dividing the starting endpoint value by the difference value of the two endpoints of the time axis range to obtain the canvas occupying ratio of the target ending time; multiplying the ratio of the canvas occupation of the target end time by the first length to obtain the end time position of the item bar corresponding to any data to be drawn;
taking the sequencing sequence number of the starting time of any data to be drawn in the sequence as a target sequence number;
subtracting one from the target sequence number, and multiplying the target sequence number by the height of the pre-acquired item bar to obtain the initial graphic position of the item bar corresponding to any data to be drawn;
multiplying the target sequence number by the height of the pre-acquired item bar to obtain the ending graph position of the item bar corresponding to any data to be drawn;
and drawing a rectangle according to the starting time position, the starting graph position, the ending time position and the ending graph position to obtain a project bar corresponding to any data to be drawn.
8. The method of claim 6 or 7, wherein the canvas size comprises a second length perpendicular to the direction of the time axis;
correspondingly, the method further includes, in accordance with the pre-obtained height of the item bar, the start time, the end time, the time axis range of the gantt chart, and the preset size of the canvas, in order of the start time, before sequentially drawing the item bar corresponding to each data to be drawn, further including:
receiving a project bar height value sent by the user terminal to obtain the project bar height; or the like, or a combination thereof,
and dividing the second length by the number of the data to be drawn to obtain the height of the project bar.
9. The method as claimed in any one of claims 1 to 7, wherein after the sending the target Gantt chart to the terminal in the form of a web page, the method further comprises:
and acquiring the position of a mouse pointer of a user in real time, and displaying the start time, the end time and the project name of any project bar if the position of the mouse pointer is within the graphic range of any project bar.
10. The method of claim 9, wherein the obtaining a mouse pointer position of a user in real time, and if the mouse pointer position is within a graphic range of any item bar, displaying a start time, an end time, and an item name of the item bar comprises:
acquiring a mouse position of a user mouse pointer in a visual interface and a canvas position of a canvas in the visual interface in real time;
subtracting the canvas position from the mouse position to obtain the mouse pointer position, wherein the mouse pointer position consists of a first abscissa and a first ordinate;
acquiring two second horizontal coordinates and two second vertical coordinates of an opposite angle point of any item bar;
and if the first abscissa is in the range of the interval formed by the two second abscissas and the first ordinate is in the range of the interval formed by the two second ordinates, displaying the starting time, the ending time and the item name of any item bar.
11. A gantt chart drawing apparatus, comprising:
the file receiving module is used for receiving a file to be drawn uploaded by a user terminal, wherein the file to be drawn comprises at least one piece of data to be drawn;
the data identification module is used for identifying all identification information and corresponding value data of each piece of data to be drawn in the file to be drawn;
the first determining module is used for determining the data type of the corresponding value data according to each piece of identification information, wherein the data type is any one of start time, end time and time period name;
the second determining module is used for determining the time axis range of the Gantt chart according to the value data of which all the data types are the starting time and the value data of which all the data types are the ending time;
the first drawing module is used for drawing the time axis of the Gantt chart in the time axis range;
the second drawing module is used for drawing the project bar corresponding to each data to be drawn according to the height of the project bar, the identification information in each data to be drawn and the corresponding value data;
the target obtaining module is used for taking the value data of which the data type is the time period name in each data to be drawn as a corresponding project name, assigning the project name to the project bar and obtaining a target Gantt chart;
and the graph sending module is used for sending the target Gantt graph to the terminal in a webpage form.
12. An electronic device, comprising: a processor, and a memory communicatively coupled to the processor;
the memory stores computer-executable instructions;
the processor executing the memory-stored computer-executable instructions causing the processor to perform the gantt chart rendering method of any of claims 1 to 10.
13. A computer-readable storage medium having computer-executable instructions stored therein, which when executed by a processor, are configured to implement the gantt chart rendering method as claimed in any one of claims 1 to 10.
14. A computer program product, comprising a computer program which, when executed by a processor, implements the gantt chart rendering method of any one of claims 1 to 10.
CN202211145876.6A 2022-09-20 2022-09-20 Gantt chart drawing method, apparatus, device, storage medium and program product Pending CN115546345A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211145876.6A CN115546345A (en) 2022-09-20 2022-09-20 Gantt chart drawing method, apparatus, device, storage medium and program product

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211145876.6A CN115546345A (en) 2022-09-20 2022-09-20 Gantt chart drawing method, apparatus, device, storage medium and program product

Publications (1)

Publication Number Publication Date
CN115546345A true CN115546345A (en) 2022-12-30

Family

ID=84727219

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211145876.6A Pending CN115546345A (en) 2022-09-20 2022-09-20 Gantt chart drawing method, apparatus, device, storage medium and program product

Country Status (1)

Country Link
CN (1) CN115546345A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116630472A (en) * 2023-05-24 2023-08-22 浪潮智慧科技有限公司 Gantt chart generation method, device and medium based on data driving

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116630472A (en) * 2023-05-24 2023-08-22 浪潮智慧科技有限公司 Gantt chart generation method, device and medium based on data driving
CN116630472B (en) * 2023-05-24 2024-01-23 浪潮智慧科技有限公司 Gantt chart generation method, device and medium based on data driving

Similar Documents

Publication Publication Date Title
CN109857486B (en) Method, device, equipment and medium for processing program page data
CN111258483B (en) Image zooming display method and device, computer equipment and readable medium
CN109389365B (en) Multi-person collaborative document processing method and device and electronic equipment
CN110069191B (en) Terminal-based image dragging deformation implementation method and device
CN109446199B (en) Cell data processing method and device
CN115546345A (en) Gantt chart drawing method, apparatus, device, storage medium and program product
CN113282214A (en) Stroke rendering method, device, storage medium and terminal
CN114528816A (en) Collaborative editing information display method and device, electronic equipment and readable medium
CN110619028A (en) Map display method, device, terminal equipment and medium for house source detail page
CN111859883B (en) Program form creation method and device and electronic equipment
CN112256176B (en) Character display method and device, electronic equipment and computer readable storage medium
CN103943026B (en) A kind of impact point automatic placement method based on pixel distance
CN114238528A (en) Map loading method and device, electronic equipment and storage medium
KR100637739B1 (en) Geography information guidance system and the method which use the quality and a data of the electronic map , and the store device which records a method
CN115129278A (en) Image display control method, system, readable storage medium and electronic device
CN113506356A (en) Drawing method and device of area map, readable medium and electronic equipment
CN112948517A (en) Area position calibration method and device and electronic equipment
CN112711457A (en) Method and device for field drawing and electronic equipment
CN114442897B (en) Text processing method and device, electronic equipment and storage medium
CN111506185A (en) Method and device for operating document, electronic equipment and storage medium
CN114327188B (en) Form layout method, form layout device, electronic equipment and computer readable medium
CN112639713A (en) Local note selection method and device, electronic terminal and readable storage medium
CN115268917B (en) Node structure diagram construction method, device, equipment and medium
CN110602737B (en) Regional removal identification method and device, computer equipment and storage medium
CN109710355B (en) WEB interaction-based TIP display content processing method and device and electronic equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination