CN109656652B - Webpage chart drawing method, device, computer equipment and storage medium - Google Patents

Webpage chart drawing method, device, computer equipment and storage medium Download PDF

Info

Publication number
CN109656652B
CN109656652B CN201811388815.6A CN201811388815A CN109656652B CN 109656652 B CN109656652 B CN 109656652B CN 201811388815 A CN201811388815 A CN 201811388815A CN 109656652 B CN109656652 B CN 109656652B
Authority
CN
China
Prior art keywords
chart
hand
information
request instruction
sample
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.)
Active
Application number
CN201811388815.6A
Other languages
Chinese (zh)
Other versions
CN109656652A (en
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.)
Ping An Technology Shenzhen Co Ltd
Original Assignee
Ping An Technology Shenzhen Co Ltd
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 Ping An Technology Shenzhen Co Ltd filed Critical Ping An Technology Shenzhen Co Ltd
Priority to CN201811388815.6A priority Critical patent/CN109656652B/en
Publication of CN109656652A publication Critical patent/CN109656652A/en
Application granted granted Critical
Publication of CN109656652B publication Critical patent/CN109656652B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/451Execution arrangements for user interfaces

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Human Computer Interaction (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • User Interface Of Digital Computer (AREA)
  • Processing Or Creating Images (AREA)

Abstract

The present application relates to the field of page design technologies, and in particular, to a method, an apparatus, a computer device, and a storage medium for drawing a web page chart. Receiving a request instruction for drawing a chart, and extracting chart parameter information in the request instruction; inputting the chart parameter information into a chart function for operation, and obtaining a chart sample of the chart after parameter outputting; acquiring a hand-drawn trace input by a user, comparing the hand-drawn trace with the chart sample, and correcting the chart sample according to a comparison result to obtain a standard image corresponding to the hand-drawn trace; collecting standard images corresponding to all the hand-drawn marks, and establishing a chart sample set; and acquiring a new chart drawing request instruction to draw a chart. The application realizes the custom modification of the webpage chart by improving the icon drawing mode.

Description

Webpage chart drawing method, device, computer equipment and storage medium
Technical Field
The present application relates to the field of page design technologies, and in particular, to a method, an apparatus, a computer device, and a storage medium for drawing a web page chart.
Background
The data chart is a graphic structure which is displayed in the display equipment and can intuitively display statistical information attributes (timeliness, quantity and the like) and plays a key role in knowledge mining and information visual and vivid feeling, and is a means for intuitively and vividly visualizing object attribute data. In the prior art, once a foreground of a website is manufactured and formed, a graph display mode of the foreground is basically shaped, the website requests to load a corresponding drawing frame template from a server according to the access requirement of a client at a PC end, and then a graph presented in a browser at the PC end is rendered and displayed.
However, the limitations of the application of such display forms are: some special chart forms or user-defined presentation of personalized chart forms cannot be implemented. The user cannot see the habit or favorite chart data at the browser end, so that the user experience is reduced. The disadvantages are particularly pointed out in the following aspects:
1. once the foreground of a website is manufactured and molded, the graph display mode is basically shaped, is single and cannot be changed;
2. applications of some special chart forms or user-defined personalized chart forms cannot be implemented.
Disclosure of Invention
In view of this, it is necessary to provide a method, apparatus, computer device and storage medium for drawing a web page chart, which solve the problem that the chart content cannot be changed by user definition when drawing the web page chart at present.
A webpage chart drawing method comprises the following steps:
receiving a request instruction for drawing a chart, and extracting chart parameter information in the request instruction;
inputting the chart parameter information into a chart function for operation, and obtaining a chart sample of the chart after parameter outputting;
acquiring a hand-drawn trace input by a user, comparing the hand-drawn trace with the chart sample, and correcting the chart sample according to a comparison result to obtain a standard image corresponding to the hand-drawn trace;
collecting standard images corresponding to all the hand-drawn marks, and establishing a chart sample set;
and acquiring a new chart drawing request instruction, comparing the chart drawing information corresponding to the request instruction with a standard image in the chart sample set, taking the standard image as a drawing chart corresponding to the new chart drawing request instruction if the comparison is consistent, and extracting parameter information in the new chart drawing request instruction if the comparison is inconsistent, so as to establish a new chart sample.
In one embodiment, the receiving a request instruction for drawing a chart, extracting chart parameter information in the request instruction includes:
receiving a request instruction for drawing a chart, and dividing the request instruction for drawing the chart into a plurality of statement units according to a preset statement rule;
inquiring the chart size information contained in the statement unit, extracting the chart size information, and then carrying out unit normalization processing to obtain unit normalized chart size information;
and extracting pattern contour information contained in the statement unit, and summarizing the pattern contour information and the unit normalized chart size information to obtain the chart parameter information.
In one embodiment, the step of inputting the chart parameter information into a drawing function to perform operation, and obtaining a chart sample of the chart after taking out the parameters includes:
acquiring an execution statement for executing the drawing function, and extracting function call information contained in the execution statement;
obtaining the cartographic function version information of the webpage adaptation according to the function call information;
according to the drawing function version information, obtaining an image drawing function and an image drawing function under the version;
and respectively inputting the chart parameter information into the image drawing function and the image drawing function, and summarizing a parameter result to obtain a chart sample of the chart.
In one embodiment, the obtaining the hand-drawn trace input by the user, comparing the hand-drawn trace with the chart sample, and correcting the chart sample according to the comparison result to obtain the standard image corresponding to the hand-drawn trace includes:
acquiring a hand-drawn trace input by a user, and forming a hand-drawn chart according to the hand-drawn trace;
dividing the hand drawing table into a plurality of drawing areas, wherein any drawing area contains at least one piece of color information which is different from the background color of the page;
calculating the proportion and the position of each drawing area in the hand-drawn chart, and displaying the text information corresponding to the proportion and the position in the drawing area;
extracting an original chart corresponding to the text information from the chart sample according to the text information;
and carrying out pixel point correction on the original chart according to the color information of the drawing area, and obtaining the standard image after correction.
In one embodiment, the assembling all standard images corresponding to the hand-drawn traces to create a chart sample set includes:
version information of the drawing function corresponding to each standard image is obtained;
packaging the standard images obtained by the drawing function of the same version into a standard image group, and endowing the standard image group with an identification number according to the version of the drawing function;
acquiring a first character of the identification number, establishing a main index of the chart sample set according to the first character, and sequentially acquiring second to nth characters of the identification number, wherein N is more than or equal to 2, so as to obtain a slave index of the chart sample set, and superposing the main index and the slave index to form an index catalog of the chart sample;
and writing the chart sample into a sample file according to the index catalog, wherein the sample file is the chart sample set.
In one embodiment, the obtaining a new chart drawing request instruction, comparing the chart drawing information corresponding to the request instruction with a standard image in the chart sample set, if the comparison is consistent, using the standard image as a drawing chart corresponding to the new chart drawing request instruction, if the comparison is inconsistent, extracting parameter information in the new chart drawing request instruction, and establishing a new chart sample, including:
acquiring a new chart drawing request instruction, and extracting chart type information contained in the new chart drawing request instruction;
extracting all standard images consistent with the chart type from the chart sample set to form a comparison image group;
acquiring color information in the new drawing request instruction, and comparing the color information with pixel points of standard images in the comparison image group;
if the comparison result error of a certain standard image is within a preset error threshold, taking the standard image in the comparison image group as a drawing chart corresponding to a new chart drawing request instruction;
if the comparison result errors of all the standard images are beyond a preset error threshold, a hand-drawing instruction is sent to a user, the hand-drawing trace of the user is received, and a new chart sample is established according to the hand-drawing trace.
In one embodiment, the acquiring the hand-drawn trace input by the user, forming a hand-drawn chart according to the hand-drawn trace includes:
acquiring a part of a hand-drawn trace input by a user, which is positioned in a preset chart outline, extracting any horizontal line segment in the part in the preset chart outline, and judging whether the length of the horizontal line segment is greater than half of the length of a horizontal edge contained in the preset chart;
if the length of the horizontal line segment is greater than half of the length of the horizontal side of the preset chart, displaying a horizontal grid line in the preset chart outline according to the position of the hand-drawn trace;
if the length of the horizontal line segment is not more than half of the length of the preset horizontal edge of the chart, the hand-drawn trace is removed;
extracting any one of the vertical line segments in the part in the outline of the preset chart, and judging whether the length of the vertical line segment is greater than half of the length of the vertical edge contained in the preset chart;
if the length of the vertical line segment is greater than half of the length of the vertical line of the preset chart, displaying a vertical grid line in the preset chart outline according to the position of the hand-drawn trace;
if the length of the vertical line segment is not more than half of the length of the preset vertical line of the chart, eliminating the hand-drawn trace;
and summarizing all the horizontal grid lines and the vertical grid lines to form the hand-drawn chart.
A web page chart drawing device, comprising the following modules:
the chart parameter acquisition module is used for receiving a chart drawing request instruction and extracting chart parameter information in the request instruction;
the chart sample generation module is used for inputting the chart parameter information into a chart function for operation, and obtaining a chart sample of the chart after taking out the parameters;
the standard image generation module is used for acquiring a hand-drawn trace input by a user, comparing the hand-drawn trace with the chart sample, and correcting the chart sample according to a comparison result to obtain a standard image corresponding to the hand-drawn trace;
the chart sample set module is used for collecting standard images corresponding to all the hand-drawn marks and establishing a chart sample set;
the chart drawing module is used for obtaining a new chart drawing request instruction, comparing chart drawing information corresponding to the request instruction with standard images in the chart sample set, taking the standard images as drawing charts corresponding to the new chart drawing request instruction if the comparison is consistent, and extracting parameter information in the new chart drawing request instruction if the comparison is inconsistent, so as to establish a new chart sample.
A computer device comprising a memory and a processor, the memory having stored therein computer readable instructions which, when executed by the processor, cause the processor to perform the steps of the webpage chart drawing method described above.
A storage medium storing computer readable instructions that, when executed by one or more processors, cause the one or more processors to perform the steps of the webpage chart drawing method described above.
The method, the device, the computer equipment and the storage medium for drawing the webpage chart comprise the steps of receiving a request instruction for drawing the chart and extracting chart parameter information in the request instruction; inputting the chart parameter information into a chart function for operation, and obtaining a chart sample of the chart after parameter outputting; acquiring a hand-drawn trace input by a user, comparing the hand-drawn trace with the chart sample, and correcting the chart sample according to a comparison result to obtain a standard image corresponding to the hand-drawn trace; collecting standard images corresponding to all the hand-drawn marks, and establishing a chart sample set; and acquiring a new chart drawing request instruction, comparing the chart drawing information corresponding to the request instruction with a standard image in the chart sample set, taking the standard image as a drawing chart corresponding to the new chart drawing request instruction if the comparison is consistent, and extracting parameter information in the new chart drawing request instruction if the comparison is inconsistent, so as to establish a new chart sample. According to the technical scheme, aiming at the problem that the webpage chart cannot be drawn in a timely and self-defined mode after being drawn and molded, the efficiency of drawing images in a self-defined mode is improved through comparison of an input drawing instruction and a chart sample set.
Drawings
Various other advantages and benefits will become apparent to those of ordinary skill in the art upon reading the following detailed description of the preferred embodiments. The drawings are only for purposes of illustrating the preferred embodiments and are not to be construed as limiting the application.
FIG. 1 is a general flow chart of a method of drawing a web page chart in one embodiment of the application;
FIG. 2 is a schematic diagram of a standard image generation process in a method for drawing a web page chart according to an embodiment of the present application;
FIG. 3 is a schematic diagram of a process for generating a chart sample set in a web page chart drawing method according to an embodiment of the application;
fig. 4 is a block diagram of a web page drawing apparatus according to an embodiment of the present application.
Detailed Description
The present application will be described in further detail with reference to the drawings and examples, in order to make the objects, technical solutions and advantages of the present application more apparent. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the application.
As used herein, the singular forms "a", "an", "the" and "the" are intended to include the plural forms as well, unless expressly stated otherwise, as understood by those skilled in the art. It will be further understood that the terms "comprises" and/or "comprising," when used in this specification, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof.
Fig. 1 is an overall flowchart of a method for drawing a web page chart according to an embodiment of the present application, as shown in fig. 1, comprising the following steps:
s1, receiving a request instruction for drawing a chart, and extracting chart parameter information in the request instruction;
specifically, the request instruction for drawing the chart may be a request for drawing a general form and a special form, wherein the chart of the special form includes a perspective table diagram or the like; when drawing the parameter information of the chart from the request instruction, firstly drawing the digital information in the request instruction, then identifying the text information before and after the digital information, comparing the text information content identified with the attribute information content of the parameter preset in the database, and determining the category of the digital information after the comparison is consistent, so as to obtain the parameter information of the chart.
S2, inputting the chart parameter information into a chart function for operation, and obtaining a chart sample of the chart after taking out the chart;
specifically, the drawing function used in the step can adopt a function contained in a javascript, is a script development language developed by LiveScript of Netscape, and mainly aims to solve the problem of speed left by server terminal language. In this step, the script function included in the javascript may be further optimized: analyzing the optimization mark of the JavaScript function to generate an optimization weight corresponding to the optimization mark, and optimizing the JavaScript function by utilizing the optimization weight.
S3, acquiring a hand-drawn trace input by a user, comparing the hand-drawn trace with the chart sample, and correcting the chart sample according to a comparison result to obtain a standard image corresponding to the hand-drawn trace;
specifically, the hand-drawn trace input by the user can be left by drawing on the capacitive screen by adopting an electronic pen, or can be input into the system by photographing after drawing on other paper; when comparing the hand-drawn trace with the standard chart sample, the method can further comprise the process of error correction of the hand-drawn trace, for example, the hand-drawn trace is a straight line, the straight line is bent due to certain factors, and if the bending amplitude is smaller than a preset bending threshold value, the hand-drawn trace is corrected to be the straight line.
S4, collecting standard images corresponding to all the hand-drawn marks, and establishing a chart sample set;
specifically, when all hand-drawn marks are collected, firstly verifying the identity of the attribution of the hand-drawn marks, then judging the drawing habit of the attribution of the hand-drawn marks by utilizing a handwriting identification mode, determining a standard image according to a judging result, and establishing a chart sample set.
S5, acquiring a new chart drawing request instruction, comparing chart drawing information corresponding to the request instruction with a standard image in the chart sample set, taking the standard image as a drawing chart corresponding to the new chart drawing request instruction if the comparison is consistent, and extracting parameter information in the new chart drawing request instruction if the comparison is inconsistent, so as to establish a new chart sample.
Specifically, in this step, when comparing, the parameter information in the new drawing request instruction is first input into the error correction model for correction, the parameters may be corrected by using the two-step method of the angle-Granger or the direct estimation method, and then the corrected parameters are compared with the parameters of the standard image.
In the embodiment, the standard image is established, and then the chart information to be drawn, which is input by the user, is compared with the standard image, so that the time for the user to draw the chart in a self-defined manner is saved.
In one embodiment, the receiving the request instruction for drawing the chart, extracting the chart parameter information in the request instruction includes:
receiving a request instruction for drawing a chart, and dividing the request instruction for drawing the chart into a plurality of statement units according to a preset statement rule;
specifically, when dividing the request instruction for drawing the chart, the following may be adopted: special punctuation marks such as ", and the like are used as dividing symbols to divide the request instruction, and a plurality of statement units are formed after dividing.
Inquiring the chart size information contained in the statement unit, extracting the chart size information, and then carrying out unit normalization processing to obtain unit normalized chart size information;
the unit normalization processing means that some of the size information is in metric units, and some of the size information is in english, and all of the size information is converted into metric data in millimeters.
And extracting pattern contour information contained in the statement unit, and summarizing the pattern contour information and the unit normalized chart size information to obtain the chart parameter information.
According to the method and the device, the chart parameter information is unified more through analysis and normalization processing of the icon drawing request information, and the chart identification efficiency is improved.
In one embodiment, the step of inputting the chart parameter information into a drawing function to perform operation, and obtaining a chart sample of the chart after taking out the parameters includes:
acquiring an execution statement for executing the drawing function, and extracting function call information contained in the execution statement;
the execution statement comprises function call information, execution time and the like.
Obtaining the cartographic function version information of the webpage adaptation according to the function call information;
specifically, when drawing function version information is acquired, the use condition of each interface of the drawing function in the system is acquired, the same independent variable in each interface is acquired firstly, then the parameter output result obtained by operation of the independent variable is recorded, if the parameter output results are consistent, the drawing function versions at the two interfaces are consistent, if the parameter output results are inconsistent, the drawing function versions at the two interfaces are inconsistent, the parameter output results are obtained through statistics of each interface, and the version corresponding to one result with the largest occurrence number in the parameter output results is used as the drawing function version.
According to the drawing function version information, obtaining an image drawing function and an image drawing function under the version;
and respectively inputting the chart parameter information into the image drawing function and the image drawing function, and summarizing a parameter result to obtain a chart sample of the chart.
In this embodiment, the scope of the applicable system version of the chart sample can be determined by judging the chart function version information.
Fig. 2 is a schematic diagram of a standard image generating process in a web page chart drawing method according to an embodiment of the present application, as shown in the drawing, the step of obtaining a hand-drawn trace input by a user, comparing the hand-drawn trace with the chart sample, and obtaining a standard image corresponding to the hand-drawn trace after correcting the chart sample according to a comparison result, where the step includes:
s301, acquiring a hand-drawn trace input by a user, and forming a hand-drawn chart according to the hand-drawn trace;
specifically, when the hand-drawn trace input by the user is obtained, error correction is performed on the hand-drawn trace, then the corrected trace pattern is sent to the user, an instruction determined by the user is received, and if the user considers that the correction result is inconsistent with the input hand-drawn trace, the hand-drawn trace is input again.
S302, dividing the hand drawing table into a plurality of drawing areas, wherein any drawing area contains at least one piece of color information different from the background color of the page;
specifically, when dividing the drawing area, a standard rectangle may be set first, then the drawing area is divided into a plurality of sub-blocks according to the size of the standard rectangle, if any one of the sub-blocks has no color information different from the background color of the page, the area of the sub-block is extended to the periphery until the color different from the background color of the page appears, and meanwhile, the area of the adjacent sub-block is reduced.
S303, calculating the proportion and the position of each drawing area in the hand-drawn chart, and displaying the text information corresponding to the proportion and the position in the drawing area;
specifically, when converting the ratio and the position into text information, a right-angle coordinate system can be established by taking the lower left corner of the whole drawing area as the origin of coordinates, then the coordinates of the lower left corner and the upper right corner of each drawing area are recorded, the position and the ratio of the drawing area are determined according to the two coordinates, and then the drawing area is displayed in a text form.
S304, extracting an original chart corresponding to the text information from the chart sample according to the text information;
specifically, the information of the original chart is stored in a chart file in a database in a text form, and the extracted text information is compared with the pre-stored information of the original chart to obtain the corresponding style of the original chart.
And S305, carrying out pixel point correction on the original chart according to the color information of the drawing area, and obtaining the standard image after correction.
According to the embodiment, the character information is extracted from the hand-painted trace, so that the checking speed of the chart corresponding to the hand-painted trace is increased.
Fig. 3 is a schematic diagram of a process of generating a chart sample set in a web page chart drawing method according to an embodiment of the present application, as shown in the drawing, the step of collecting standard images corresponding to all the hand-drawn traces, and establishing a chart sample set includes:
s401, obtaining version information of drawing functions corresponding to the standard images;
specifically, interface information of each drawing function used by the system is obtained, and the version of the drawing function is determined according to the parameter entering and exiting information of the drawing function at each interface and parameter entering and exiting information of other functions.
S402, packaging the standard images obtained by the drawing function of the same version into a standard image group, and endowing the standard image group with an identification number according to the version of the drawing function;
when the identification number is given, the version number may be used as the main identification number, then the generation time of the standard image group may be used as the sub-identification number, and then the main identification number and the sub-identification number may be spliced to obtain the standard identification number.
S403, acquiring a first character of the identification number, establishing a main index of the chart sample set according to the first character, and sequentially acquiring second to nth characters of the identification number, wherein N is more than or equal to 2, so as to obtain a slave index of the chart sample set, and superposing the main index and the slave index to form an index catalog of the chart sample;
specifically, when the index catalogue is overlapped, one slave index can be set under different master indexes, and the number of times of occurrence of the slave index can be recorded for repeated slave indexes, so that statistics is facilitated.
S404, writing the chart sample into a sample file according to the index catalog, wherein the sample file is the chart sample set.
Specifically, when writing the chart sample into the sample file, firstly, the master index is queried, then the slave index is queried, and finally, the chart sample is written into the sample file according to the tree structure of the index.
In this embodiment, the new chart instruction is conveniently compared with the standard image through the chart sample set.
In one embodiment, the obtaining a new chart drawing request instruction, comparing the chart drawing information corresponding to the request instruction with a standard image in the chart sample set, if the comparison is consistent, using the standard image as a drawing chart corresponding to the new chart drawing request instruction, if the comparison is inconsistent, extracting parameter information in the new chart drawing request instruction, and establishing a new chart sample, including:
acquiring a new chart drawing request instruction, and extracting chart type information contained in the new chart drawing request instruction;
the chart type information refers to a histogram, a pie chart, a graph and the like, and different standard images are selected according to different chart types.
Extracting all standard images consistent with the chart type from the chart sample set to form a comparison image group;
specifically, the image type information in the chart sample set is subjected to text extraction, and then text contents are compared with the type text contents of the chart sample to form a comparison image group.
Acquiring color information in the new drawing request instruction, and comparing the color information with pixel points of standard images in the comparison image group;
specifically, in the process of pixel point comparison, an RGB matrix can be established, then color information in a drawing request instruction is converted into a first pixel matrix, a second pixel matrix is established for the pixel points in a standard image, normalization processing is performed on the first pixel matrix and the second pixel matrix, and elements of the two matrixes after normalization processing are compared.
If the comparison result error of a certain standard image is within a preset error threshold, taking the standard image in the comparison image group as a drawing chart corresponding to a new chart drawing request instruction;
if the comparison result errors of all the standard images are beyond a preset error threshold, a hand-drawing instruction is sent to a user, the hand-drawing trace of the user is received, and a new chart sample is established according to the hand-drawing trace.
In the embodiment, by comparing the hand drawing image with the standard image, whether the hand drawing image belongs to the standard image is determined, so that the speed of image retrieval is improved.
In one embodiment, the acquiring the hand-drawn trace input by the user, forming a hand-drawn chart according to the hand-drawn trace includes:
acquiring a part of a hand-drawn trace input by a user, which is positioned in a preset chart outline, extracting any horizontal line segment in the part in the preset chart outline, and judging whether the length of the horizontal line segment is greater than half of the length of a horizontal edge contained in the preset chart;
the outline of the preset icon is generally rectangular or circular;
if the length of the horizontal line segment is greater than half of the length of the horizontal side of the preset chart, displaying a horizontal grid line in the preset chart outline according to the position of the hand-drawn trace;
if the length of the horizontal line segment is not more than half of the length of the preset horizontal edge of the chart, the hand-drawn trace is removed;
specifically, when the length measurement is performed, the length of the outline of the chart is recorded first and then the length of the horizontal grid line is compared with the length of the horizontal edge by using a scale provided by an image drawing tool.
Extracting any one of the vertical line segments in the part in the outline of the preset chart, and judging whether the length of the vertical line segment is greater than half of the length of the vertical edge contained in the preset chart;
if the length of the vertical line segment is greater than half of the length of the vertical line of the preset chart, displaying a vertical grid line in the preset chart outline according to the position of the hand-drawn trace;
if the length of the vertical line segment is not more than half of the length of the preset vertical line of the chart, eliminating the hand-drawn trace;
specifically, when the length measurement is performed, the measurement can be performed by using a scale provided by an image drawing tool, then the length of the outline of the chart is recorded, and then the length of the vertical grid line is compared with the length of the vertical edge.
And summarizing all the horizontal grid lines and the vertical grid lines to form the hand-drawn chart.
According to the embodiment, the accuracy of identifying the hand drawing table can be improved by accurately judging the style of the hand drawing table.
In one embodiment, a webpage chart drawing device is provided, as shown in fig. 4, and includes the following modules:
the chart parameter acquisition module is used for receiving a chart drawing request instruction and extracting chart parameter information in the request instruction;
the chart sample generation module is used for inputting the chart parameter information into a chart function for operation, and obtaining a chart sample of the chart after taking out the parameters;
the standard image generation module is used for acquiring a hand-drawn trace input by a user, comparing the hand-drawn trace with the chart sample, and correcting the chart sample according to a comparison result to obtain a standard image corresponding to the hand-drawn trace;
the chart sample set module is used for collecting standard images corresponding to all the hand-drawn marks and establishing a chart sample set;
the chart drawing module is used for obtaining a new chart drawing request instruction, comparing chart drawing information corresponding to the request instruction with standard images in the chart sample set, taking the standard images as drawing charts corresponding to the new chart drawing request instruction if the comparison is consistent, and extracting parameter information in the new chart drawing request instruction if the comparison is inconsistent, so as to establish a new chart sample.
A computer device comprising a memory and a processor, the memory having stored therein computer readable instructions which, when executed by the processor, cause the processor to perform the steps of the webpage chart drawing method described above.
A storage medium storing computer readable instructions that, when executed by one or more processors, cause the one or more processors to perform the steps of the webpage chart drawing method described above. The storage medium may be a non-volatile storage medium.
Those of ordinary skill in the art will appreciate that all or part of the steps in the various methods of the above embodiments may be implemented by a program to instruct related hardware, the program may be stored in a computer readable storage medium, and the storage medium may include: read Only Memory (ROM), random access Memory (RAM, random Access Memory), magnetic or optical disk, and the like.
The technical features of the above-described embodiments may be arbitrarily combined, and all possible combinations of the technical features in the above-described embodiments are not described for brevity of description, however, as long as there is no contradiction between the combinations of the technical features, they should be considered as the scope of the description.
The above-described embodiments represent only some exemplary embodiments of the application, in which the description is more specific and detailed, but should not be construed as limiting the scope of the application. It should be noted that it will be apparent to those skilled in the art that several variations and modifications can be made without departing from the spirit of the application, which are all within the scope of the application. Accordingly, the scope of protection of the present application is to be determined by the appended claims.

Claims (8)

1. A method for drawing a web page chart, comprising:
receiving a request instruction for drawing a chart, and extracting chart parameter information in the request instruction, wherein the chart parameter information comprises pattern contour information and chart size information;
the chart parameter information is input into a chart function for operation, and chart samples of the chart are obtained after the parameters are output;
acquiring a hand-drawn trace input by a user, comparing the hand-drawn trace with the chart sample, and correcting the chart sample according to a comparison result to obtain a standard image corresponding to the hand-drawn trace;
collecting standard images corresponding to all the hand-drawn marks, and establishing a chart sample set;
acquiring a new chart drawing request instruction, comparing chart drawing information corresponding to the request instruction with a standard image in the chart sample set, taking the standard image as a drawing chart corresponding to the new chart drawing request instruction if the comparison is consistent, and extracting parameter information in the new chart drawing request instruction if the comparison is inconsistent, so as to establish a new chart sample;
and the chart parameter information is input into a chart function for operation, and chart samples of the chart are obtained after the parameter information is output, wherein the chart sample comprises the following components:
acquiring an execution statement for executing the drawing function, and extracting function call information contained in the execution statement;
obtaining the cartographic function version information of the webpage adaptation according to the function call information;
acquiring an image drawing function of each interface under the version according to the drawing function version information;
respectively inputting the chart parameter information into each interface image drawing function, and summarizing a parameter result to obtain a chart sample of the chart;
the step of obtaining a new chart drawing request instruction, comparing the chart drawing information corresponding to the request instruction with a standard image in the chart sample set, if the comparison is consistent, using the standard image as a drawing chart corresponding to the new chart drawing request instruction, if the comparison is inconsistent, extracting parameter information in the new chart drawing request instruction, and establishing a new chart sample, wherein the step of including:
acquiring a new chart drawing request instruction, and extracting chart type information contained in the new chart drawing request instruction;
extracting all standard images consistent with the chart type from the chart sample set to form a comparison image group;
acquiring color information in the new chart drawing request instruction, and comparing the color information with pixel points of standard images in the comparison image group;
if the comparison result error of a certain standard image is within a preset error threshold, taking the standard image in the comparison image group as a drawing chart corresponding to a new chart drawing request instruction;
if the comparison result errors of all the standard images are beyond a preset error threshold, a hand-drawing instruction is sent to a user, the hand-drawing trace of the user is received, and a new chart sample is established according to the hand-drawing trace.
2. The method for drawing a web page chart according to claim 1, wherein the step of receiving a request command for drawing a chart and extracting chart parameter information in the request command includes:
receiving a request instruction for drawing a chart, and dividing the request instruction for drawing the chart into a plurality of statement units according to a preset statement rule;
inquiring the chart size information contained in the statement unit, extracting the chart size information, and then carrying out unit normalization processing to obtain unit normalized chart size information;
and extracting pattern contour information contained in the statement unit, and summarizing the pattern contour information and the unit normalized chart size information to obtain the chart parameter information.
3. The method for drawing a web page chart according to claim 1, wherein the step of obtaining a hand-drawn trace input by a user, comparing the hand-drawn trace with the chart sample, and correcting the chart sample according to a comparison result to obtain a standard image corresponding to the hand-drawn trace comprises:
acquiring a hand-drawn trace input by a user, and forming a hand-drawn chart according to the hand-drawn trace;
dividing the hand drawing table into a plurality of drawing areas, wherein any drawing area contains at least one piece of color information which is different from the background color of the page;
calculating the proportion and the position of each drawing area in the hand-drawn chart, and displaying the text information corresponding to the proportion and the position in the drawing area;
extracting an original chart corresponding to the text information from the chart sample according to the text information;
and carrying out pixel point correction on the original chart according to the color information of the drawing area, and obtaining the standard image after correction.
4. The method for drawing a web page chart according to claim 1, wherein the assembling all standard images corresponding to the hand-drawn trace, and creating a chart sample set, includes:
version information of the drawing function corresponding to each standard image is obtained;
packaging the standard images obtained by the drawing function of the same version into a standard image group, and endowing the standard image group with an identification number according to the version of the drawing function;
acquiring a first character of the identification number, establishing a main index of the chart sample set according to the first character, and sequentially acquiring second to nth characters of the identification number, wherein N is more than or equal to 2, so as to obtain a slave index of the chart sample set, and superposing the main index and the slave index to form an index catalog of the chart sample;
and writing the chart sample into a sample file according to the index catalog, wherein the sample file is the chart sample set.
5. The web page chart drawing method according to claim 3, wherein the obtaining the hand-drawn trace input by the user, forming a hand-drawn chart according to the hand-drawn trace, comprises:
acquiring a part of a hand-drawn trace input by a user, which is positioned in a preset chart outline, extracting any horizontal line segment in the part in the preset chart outline, and judging whether the length of the horizontal line segment is greater than half of the length of a horizontal edge contained in the preset chart;
if the length of the horizontal line segment is greater than half of the length of the horizontal side of the preset chart, displaying a horizontal grid line in the preset chart outline according to the position of the hand-drawn trace;
if the length of the horizontal line segment is not more than half of the length of the preset horizontal edge of the chart, the hand-drawn trace is removed;
extracting any one of the vertical line segments in the part in the outline of the preset chart, and judging whether the length of the vertical line segment is greater than half of the length of the vertical edge contained in the preset chart;
if the length of the vertical line segment is greater than half of the length of the vertical line of the preset chart, displaying a vertical grid line in the preset chart outline according to the position of the hand-drawn trace;
if the length of the vertical line segment is not more than half of the length of the preset vertical line of the chart, eliminating the hand-drawn trace;
and summarizing all the horizontal grid lines and the vertical grid lines to form the hand-drawn chart.
6. A web page chart drawing apparatus, comprising:
the chart parameter acquisition module is used for receiving a chart drawing request instruction and extracting chart parameter information in the request instruction, wherein the chart parameter information comprises pattern contour information and chart size information;
the chart sample generation module is used for inputting the chart parameter information into a chart function for operation, and obtaining a chart sample of a chart after taking out the parameters;
the standard image generation module is used for acquiring a hand-drawn trace input by a user, comparing the hand-drawn trace with the chart sample, and correcting the chart sample according to a comparison result to obtain a standard image corresponding to the hand-drawn trace;
the chart sample set module is used for collecting standard images corresponding to all the hand-drawn marks and establishing a chart sample set;
the chart drawing module is used for acquiring a new chart drawing request instruction, comparing chart drawing information corresponding to the request instruction with a standard image in the chart sample set, taking the standard image as a drawing chart corresponding to the new chart drawing request instruction if the comparison is consistent, and extracting parameter information in the new chart drawing request instruction if the comparison is inconsistent, so as to establish a new chart sample;
the chart sample generation module is specifically configured to acquire an execution statement for executing the drawing function and extract function call information contained in the execution statement;
obtaining the cartographic function version information of the webpage adaptation according to the function call information;
acquiring an image drawing function of each interface under the version according to the drawing function version information;
respectively inputting the chart parameter information into each interface image drawing function, and summarizing a parameter result to obtain a chart sample of the chart;
the chart drawing module is specifically configured to acquire a new chart drawing request instruction, and extract chart type information contained in the new chart drawing request instruction;
extracting all standard images consistent with the chart type from the chart sample set to form a comparison image group;
acquiring color information in the new chart drawing request instruction, and comparing the color information with pixel points of standard images in the comparison image group;
if the comparison result error of a certain standard image is within a preset error threshold, taking the standard image in the comparison image group as a drawing chart corresponding to a new chart drawing request instruction;
if the comparison result errors of all the standard images are beyond a preset error threshold, a hand-drawing instruction is sent to a user, the hand-drawing trace of the user is received, and a new chart sample is established according to the hand-drawing trace.
7. A computer device comprising a memory and a processor, the memory having stored therein computer readable instructions which, when executed by the processor, cause the processor to perform the steps of the webpage chart drawing method of any of claims 1 to 5.
8. A storage medium storing computer readable instructions which, when executed by one or more processors, cause the one or more processors to perform the steps of the webpage chart drawing method of any one of claims 1 to 5.
CN201811388815.6A 2018-11-21 2018-11-21 Webpage chart drawing method, device, computer equipment and storage medium Active CN109656652B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811388815.6A CN109656652B (en) 2018-11-21 2018-11-21 Webpage chart drawing method, device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811388815.6A CN109656652B (en) 2018-11-21 2018-11-21 Webpage chart drawing method, device, computer equipment and storage medium

Publications (2)

Publication Number Publication Date
CN109656652A CN109656652A (en) 2019-04-19
CN109656652B true CN109656652B (en) 2023-10-20

Family

ID=66112109

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811388815.6A Active CN109656652B (en) 2018-11-21 2018-11-21 Webpage chart drawing method, device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN109656652B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112579066A (en) * 2019-09-30 2021-03-30 北京国双科技有限公司 Chart display method and device, storage medium and equipment
CN113487698B (en) * 2021-07-27 2023-12-12 深圳赛安特技术服务有限公司 Form generation method and device based on two-channel neural network model

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2011103065A (en) * 2009-11-11 2011-05-26 1St Holdings Inc Chart drawing device and chart drawing method
CN106095740A (en) * 2016-06-03 2016-11-09 中国南方电网有限责任公司 Page map-integrated OA generates method and system
CN106293436A (en) * 2015-05-27 2017-01-04 仁宝电脑工业股份有限公司 Chart Drawing Method
CN107463677A (en) * 2017-08-04 2017-12-12 网易(杭州)网络有限公司 Graph making method, system, medium and computing device

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2011103065A (en) * 2009-11-11 2011-05-26 1St Holdings Inc Chart drawing device and chart drawing method
CN106293436A (en) * 2015-05-27 2017-01-04 仁宝电脑工业股份有限公司 Chart Drawing Method
CN106095740A (en) * 2016-06-03 2016-11-09 中国南方电网有限责任公司 Page map-integrated OA generates method and system
CN107463677A (en) * 2017-08-04 2017-12-12 网易(杭州)网络有限公司 Graph making method, system, medium and computing device

Also Published As

Publication number Publication date
CN109656652A (en) 2019-04-19

Similar Documents

Publication Publication Date Title
US10915788B2 (en) Optical character recognition using end-to-end deep learning
JP2019520615A (en) Character recognition method, device, server and storage medium of claim document for damages
US20130004087A1 (en) Method and system for webpage regression testing
CN112507806B (en) Intelligent classroom information interaction method and device and electronic equipment
CN109697414B (en) Text positioning method and device
US10049095B2 (en) In-context editing of output presentations via automatic pattern detection
CN111240669B (en) Interface generation method and device, electronic equipment and computer storage medium
CN110990010A (en) Software interface code generation method and device
CN109656652B (en) Webpage chart drawing method, device, computer equipment and storage medium
CN112487883A (en) Intelligent pen writing behavior characteristic analysis method and device and electronic equipment
CN106776994B (en) Application method and system of engineering symbols in engineering report forms and web pages
CN112015634A (en) Page structure information generation method and device and electronic equipment
CN110633251B (en) File conversion method and equipment
CN112486337A (en) Handwriting graph analysis method and device and electronic equipment
CN112084103B (en) Interface test method, device, equipment and medium
CN112417826A (en) PDF online editing method and device, electronic equipment and readable storage medium
CN115935917A (en) Data processing method, device and equipment for visual chart and storage medium
CN112487897B (en) Handwriting content evaluation method and device and electronic equipment
WO2022105004A1 (en) Method and apparatus for electronizing written form, and electronic device
CN112800373A (en) Webpage resource data generation method and device, computer equipment and storage medium
CN109658485B (en) Webpage animation drawing method, device, computer equipment and storage medium
CN111046096B (en) Method and device for generating graphic structured information
CN114138214B (en) Method and device for automatically generating print file and electronic equipment
CN111338941B (en) Information processing method and device, electronic equipment and storage medium
CN110209336B (en) Content display method and device

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
GR01 Patent grant
GR01 Patent grant