CN109147000B - Data stream combined waveform diagram drawing method and system, electronic equipment and storage medium - Google Patents

Data stream combined waveform diagram drawing method and system, electronic equipment and storage medium Download PDF

Info

Publication number
CN109147000B
CN109147000B CN201811014194.5A CN201811014194A CN109147000B CN 109147000 B CN109147000 B CN 109147000B CN 201811014194 A CN201811014194 A CN 201811014194A CN 109147000 B CN109147000 B CN 109147000B
Authority
CN
China
Prior art keywords
axis
determining
label
display
drawing area
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
CN201811014194.5A
Other languages
Chinese (zh)
Other versions
CN109147000A (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.)
Shenzhen Launch Technology Co Ltd
Original Assignee
Shenzhen Launch Technology 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 Shenzhen Launch Technology Co Ltd filed Critical Shenzhen Launch Technology Co Ltd
Priority to CN201811014194.5A priority Critical patent/CN109147000B/en
Publication of CN109147000A publication Critical patent/CN109147000A/en
Application granted granted Critical
Publication of CN109147000B publication Critical patent/CN109147000B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

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

Landscapes

  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Controls And Circuits For Display Device (AREA)

Abstract

The application discloses a method and a system for drawing a data stream combined oscillogram, an electronic device and a computer readable storage medium, wherein the method comprises the following steps: when data streams to be displayed are received, determining the display width of a Y-axis label corresponding to each data stream to be displayed, and determining the position of the Y-axis label according to all the display widths; determining a drawing area according to the position of the Y-axis label and the display width of the Y-axis label; wherein the width of a display area outside the drawing area is greater than or equal to the sum of the display widths of the Y-axis labels; and drawing the Y-axis label according to the position and the display width of the Y-axis label, and correspondingly drawing the data stream to be displayed according to the Y-axis label in the drawing area. The drawing area is completely separated from the display area of the Y-axis label, the label close to the display area of the oscillogram can be displayed on the outer side of the oscillogram, and all the Y-axis labels cannot be overlapped with the oscillogram, so that all the Y-axis labels can be clearly displayed.

Description

Data flow combined oscillogram drawing method and system, electronic equipment and storage medium
Technical Field
The present application relates to the field of data flow technologies, and in particular, to a method and a system for drawing a data flow combined waveform diagram, an electronic device, and a computer-readable storage medium.
Background
A data stream is a sequence of data that is read once in a defined order, and in general, a data stream can be viewed as a dynamic collection of data that grows indefinitely as time goes on. In the prior art, for the display of the data stream, as shown in fig. 1, a fixed width Y-axis display area is respectively set up on the left and right sides of the waveform diagram display area according to the number of data streams, and in order to make the waveform diagram area as wide as possible, a Y-axis label close to the waveform diagram display area is displayed inside the waveform diagram area.
In this way, since the two Y-axis labels close to the oscillogram display area are displayed in the oscillogram area, it is inevitable that the oscillogram display area overlaps with the two Y-axis labels, and the display is unclear. In addition, a fixed width is allocated for drawing the Y-axis label, when the actual display area of the Y-axis label is smaller than the set fixed width, the oscillogram display area is wasted, and when the actual display area of the Y-axis label is larger than the fixed width, the display of the Y-axis label is incomplete, and the Y-axis display width cannot be dynamically allocated as required.
Therefore, how to clearly display the Y-axis label of the data stream is a problem to be solved by those skilled in the art.
Disclosure of Invention
The invention aims to provide a data stream combined waveform drawing method, a data stream combined waveform drawing system, an electronic device and a computer readable storage medium, which can clearly display Y-axis labels of data streams.
In order to achieve the above object, the present application provides a method for drawing a data stream combined waveform diagram, including:
when data streams to be displayed are received, determining the display width of a Y-axis label corresponding to each data stream to be displayed, and determining the position of the Y-axis label according to all the display widths;
determining a drawing area according to the position of the Y-axis label and the display width of the Y-axis label; wherein the width of a display area outside the drawing area is greater than or equal to the sum of the display widths of the Y-axis labels;
and drawing the Y-axis label according to the position and the display width of the Y-axis label, and correspondingly drawing the data stream to be displayed according to the Y-axis label in the drawing area.
Determining the display width of the Y-axis label corresponding to each data stream to be displayed comprises the following steps:
calculating the maximum width of the Y-axis label under a preset font size, and judging whether the maximum width is larger than a preset width;
if not, taking the maximum width as the display width;
and if so, taking the preset width as the display width.
If the maximum width is greater than the preset width, drawing the Y-axis label at the position of the Y-axis label, including:
determining the corresponding target font size when all data of the Y-axis label can be displayed within the preset width, and judging whether the target font size is smaller than the preset minimum font size;
if yes, setting all the data to be the minimum font size, determining that target data which are incompletely displayed within the preset width are determined, and displaying the target data in a rolling mode within the preset width on the position of the Y-axis label;
if not, setting all the data to be the target font size, and displaying all the data within the preset width of the position of the Y-axis label.
All the Y-axis labels are symmetrically distributed on two sides of the drawing area; the distance between the starting position of the left end of the drawing area and the left end of the screen is larger than or equal to the sum of the display widths of all the Y-axis labels on the left side of the drawing area, and the distance between the starting position of the right end of the drawing area and the right end of the screen is larger than or equal to the sum of the display widths of all the Y-axis labels on the right side of the drawing area.
Wherein determining the position of the Y-axis label according to all the display widths comprises:
determining a first position relation between the Y-axis label and a corresponding Y-axis, and determining a second position relation between each Y-axis and the drawing area;
when the Y axis is on the left side of the drawing area, determining a first distance between the Y axis and the left end of the screen according to the display widths of all Y axis labels on the left side of the Y axis, and determining the position of the Y axis label according to the first position relation and the first distance;
when the Y axis is on the right side of the drawing area, determining a second distance between the Y axis and the right end of the screen according to the display widths of all Y axis labels on the right side of the Y axis, and determining the position of the Y axis label according to the first position relation and the second distance.
Wherein determining a first positional relationship of the Y-axis tag with a corresponding Y-axis comprises:
determining an mth Y axis corresponding to the nth Y axis label according to a Y axis determination formula; wherein the Y-axis determination formula is:
Figure BDA0001785753540000031
when the m-th Y-axis is at the left side of the rendering region and
Figure BDA0001785753540000032
when no remainder exists, the nth Y-axis label is to the left of the mth Y-axis;
when the m-th Y axis is at the left side of the drawing area
Figure BDA0001785753540000033
When a remainder exists, the nth Y-axis label is to the right of the mth Y-axis;
when the m-th Y-axis is at the right side of the drawing area
Figure BDA0001785753540000034
When a remainder exists, the nth Y-axis label is to the left of the mth Y-axis;
when the m-th Y-axis is at the right side of the rendering region
Figure BDA0001785753540000035
When no remainder is present, the nth Y-axis label is to the right of the mth Y-axis.
Wherein determining a second positional relationship of each of the Y-axes to the drawing area comprises:
determining the number of Y axes by using a Y axis number determination formula; the Y-axis number determination formula is as follows:
Figure BDA0001785753540000036
wherein M is the number of the Y axes, and N is the number of the data streams to be displayed;
and distributing the M Y axes to two sides of the drawing area according to a preset rule.
To achieve the above object, the present application provides a data stream combination waveform drawing system, including:
the device comprises a first determining module, a second determining module and a display module, wherein the first determining module is used for determining the display width of a Y-axis label corresponding to each data stream to be displayed when the data streams to be displayed are received, and determining the position of the Y-axis label according to all the display widths;
the second determining module is used for determining a drawing area according to the position of the Y-axis label and the display width of the Y-axis label; wherein the width of a display area outside the drawing area is greater than or equal to the sum of the display widths of the Y-axis labels;
and the drawing module is used for drawing the Y-axis label according to the position and the display width of the Y-axis label and correspondingly drawing the data stream to be displayed according to the Y-axis label in the drawing area.
Wherein the first determining module comprises:
the Y-axis label display width determining submodule is used for calculating the maximum width of the Y-axis label under the preset font size and judging whether the maximum width is larger than the preset width or not; if not, taking the maximum width as the display width; and if so, taking the preset width as the display width.
And the Y-axis label position determining submodule is used for determining the position of the Y-axis label according to all the display widths.
Wherein, if the maximum width is greater than a preset width, the drawing module comprises:
a target font size determining unit, configured to determine a corresponding target font size when all data of the Y-axis tag can be displayed within the preset width, and determine whether the target font size is smaller than a preset minimum font size; if yes, starting the working process of the first font size setting unit; if not, starting the working process of the second font size setting unit;
the first font size setting unit is configured to set all the data to the minimum font size, determine target data that is incompletely displayed within the preset width, and scroll-display the target data within the preset width at the position of the Y-axis label;
the second font size setting unit is configured to set the all data to the target font size, and display the all data within the preset width at the position of the Y-axis label.
All the Y-axis labels are symmetrically distributed on two sides of the drawing area; the distance between the starting position of the left end of the drawing area and the left end of the screen is larger than or equal to the sum of the display widths of all the Y-axis labels on the left side of the drawing area, and the distance between the starting position of the right end of the drawing area and the right end of the screen is larger than or equal to the sum of the display widths of all the Y-axis labels on the right side of the drawing area.
Wherein the determine Y-axis tag location submodule comprises:
a position relation determining unit, configured to determine a first position relation between the Y-axis tag and a corresponding Y-axis, and determine a second position relation between each Y-axis and the drawing area;
a first determining unit, configured to determine, when the Y-axis is on the left side of the drawing area, a first distance between the Y-axis and the left end of the screen according to display widths of all Y-axis labels on the left side of the Y-axis, and determine a position of the Y-axis label according to the first positional relationship and the first distance;
and the second determining unit is used for determining a second distance between the Y axis and the right end of the screen according to the display widths of all Y axis labels on the right side of the Y axis when the Y axis is on the right side of the drawing area, and determining the position of the Y axis label according to the first position relation and the second distance.
Wherein the determining the positional relationship unit includes:
the Y-axis determining subunit is used for determining an m-th Y axis corresponding to the n-th Y-axis label according to a Y-axis determining formula; wherein the Y-axis determination formula is:
Figure BDA0001785753540000051
a first determining subunit for determining whether the m-th Y-axis is on the left side of the rendering region
Figure BDA0001785753540000052
When no remainder exists, the nth Y-axis label is to the left of the mth Y-axis;
a second determining subunit, configured to determine whether the m-th Y-axis is on the left side of the drawing area
Figure BDA0001785753540000053
When a remainder exists, the nth Y-axis label is to the right of the mth Y-axis;
a third determining subunit, configured to determine whether the m-th Y-axis is on the right side of the drawing area
Figure BDA0001785753540000054
When a remainder exists, the nth Y-axis label is to the left of the mth Y-axis;
a fourth determining subunit, configured to determine whether the m-th Y-axis is on the right side of the drawing area
Figure BDA0001785753540000055
When no remainder is present, the nth Y-axis label is to the right of the mth Y-axis.
Wherein the determining the positional relationship unit includes:
a Y-axis number determining subunit, configured to determine the number of Y axes by using a Y-axis number determining formula; the Y-axis number determination formula is as follows:
Figure BDA0001785753540000056
wherein M is the number of the Y axes, and N is the number of the data streams to be displayed;
and the distribution subunit is used for distributing the M Y axes to two sides of the drawing area according to a preset rule.
To achieve the above object, the present application provides an electronic device including:
a memory for storing a computer program;
and the processor is used for realizing the steps of the data flow combined waveform drawing method when executing the computer program.
To achieve the above object, the present application provides a computer-readable storage medium, on which a computer program is stored, and the computer program, when executed by a processor, implements the steps of the data stream combination waveform drawing method as described above.
According to the above scheme, the method for drawing the data stream combined waveform diagram provided by the application comprises the following steps: when data streams to be displayed are received, determining the display width of a Y-axis label corresponding to each data stream to be displayed, and determining the position of the Y-axis label according to all the display widths; determining a drawing area according to the position of the Y-axis label and the display width of the Y-axis label; wherein the width of a display area outside the drawing area is greater than or equal to the sum of the display widths of the Y-axis labels; and drawing the Y-axis label according to the position and the display width of the Y-axis label, and correspondingly drawing the data stream to be displayed according to the Y-axis label in the drawing area.
According to the data stream combined oscillogram drawing method, the left end and the right end starting position of the drawing area are determined by the actual width of the Y-axis label, specifically, the distance between the left end starting position of the drawing area and the left end of the screen is larger than or equal to the sum of the widths of all the Y-axis labels on the left side of the drawing area, and the distance between the right end starting position of the drawing area and the right end of the screen is larger than or equal to the sum of the widths of all the Y-axis labels on the right side of the drawing area. The display area of the drawing area and the display area of the Y-axis label are completely separated, the label close to the display area of the oscillogram can be displayed on the outer side of the oscillogram, and all the Y-axis labels cannot be overlapped with the oscillogram, so that all the Y-axis labels can be clearly displayed. The application also discloses a data stream combined oscillogram drawing system, an electronic device and a computer readable storage medium, which can also realize the technical effects.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings used in the embodiments or the prior art descriptions will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative efforts.
FIG. 1 is a waveform diagram of a data stream in the prior art;
fig. 2 is a flowchart of a method for drawing a waveform diagram of a data stream combination disclosed in an embodiment of the present application;
FIG. 3 is a flow chart of another method for generating a combined waveform for a data stream according to an embodiment of the present disclosure;
FIG. 4 is a waveform diagram of a data stream disclosed in an embodiment of the present application;
fig. 5 is a block diagram of a data stream combination waveform drawing system disclosed in an embodiment of the present application;
FIG. 6 is a block diagram of an electronic device according to an embodiment of the disclosure;
fig. 7 is a block diagram of another electronic device disclosed in the embodiments of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be described clearly and completely with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only some embodiments of the present application, and not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
In the prior art, two Y-axis labels close to the oscillogram display area are displayed in the oscillogram area, so that the oscillogram display area overlaps with the two Y-axis labels, and the Y-axis note display is unclear. Therefore, in the present application, the waveform drawing area is determined by the display width of each Y-axis label, and the drawing area is completely separated from the display area of the Y-axis label, thereby effectively avoiding the overlap of the Y-axis label and the waveform diagram.
The embodiment of the application discloses a data stream combined oscillogram drawing method for clearly displaying a Y-axis label of a data stream.
Referring to fig. 2, a flowchart of a data stream combination waveform diagram drawing method disclosed in an embodiment of the present application is shown in fig. 2, and includes:
s201: when data streams to be displayed are received, determining the display width of a Y-axis label corresponding to each data stream to be displayed, and determining the position of the Y-axis label according to all the display widths;
in this step, the display width of the Y-axis label is the actual width of all the Y-axis labels, and each data stream has the same width. A predetermined fixed width is used in the prior art, and in the present embodiment, the display width is determined by the width of all Y-axis tags of the data stream.
Specifically, determining the display width of the Y-axis label corresponding to each data stream to be displayed includes: calculating the maximum width of the Y-axis label under a preset font size, and judging whether the maximum width is larger than a preset width; if not, taking the maximum width as the display width; and if so, taking the preset width as the display width.
In a specific implementation, first, a preset font size and a preset width of the Y-axis label are set, as in the prior art. And calculating the widths of all the Y-axis labels in the data stream under the preset font size, and comparing the maximum value of the widths, namely whether the maximum width is greater than the preset width. If not, the display width of the Y-axis label of the data stream is the maximum width, and if the display width of the Y-axis label of the data stream is larger than the maximum width, the display width of the Y-axis label of the data stream is a preset width. How to completely display all the Y-axis labels within the preset width will be described in detail in the following embodiments.
It can be understood that, in order to ensure that the Y-axis labels of all data streams do not overlap, the position of each Y-axis label needs to be determined according to the display width of the respective Y-axis labels. For determining the position of the Y-axis label, the embodiment defines a specific manner, for example, the position of the Y-axis corresponding to each Y-axis label may be determined first, that is, the position relationship between the Y-axis and the drawing area (located on the left side or the right side of the drawing area) and the distance from the screen boundary, and the embodiment does not specifically define the position relationship between each Y-axis and the drawing area, that is, all the Y-axes may be located on one side of the drawing area, or may be distributed on both sides of the drawing area, as a preferred embodiment, all the Y-axes are symmetrically distributed on both sides of the drawing area. Of course, the Y-axis notes may be first allocated to both sides of the drawing area, the distance between each Y-axis label and the screen boundary is determined according to the display width of the Y-axis label, and finally the position of the corresponding Y-axis label is determined.
For the first case in the above example, the specific steps are as follows: determining a first position relation between the Y-axis label and a corresponding Y-axis, and determining a second position relation between each Y-axis and the drawing area; when the Y axis is on the left side of the drawing area, determining a first distance between the Y axis and the left end of the screen according to the display widths of all Y axis labels on the left side of the Y axis, and determining the position of the Y axis label according to the first position relation and the first distance; when the Y axis is on the right side of the drawing area, determining a second distance between the Y axis and the right end of the screen according to the display widths of all Y axis labels on the right side of the Y axis, and determining the position of the Y axis label according to the first position relation and the second distance.
That is, when the Y-axis label is located on the left side of the drawing area (i.e., when the Y-axis corresponding to the Y-axis label is located on the left side of the drawing area), the distance between the Y-axis label and the left end of the screen is equal to or greater than the sum of the Y-axis label display widths of all the data streams on the left side of the Y-axis label, and when the Y-axis label is located on the right side of the drawing area (i.e., when the Y-axis corresponding to the Y-axis label is located on the right side of the drawing area), the distance between the Y-axis label and the right end of the screen is equal to or greater than the sum of the Y-axis label display widths of all the data streams on the right side of the Y-axis label.
S202: determining a drawing area according to the position of the Y-axis label and the display width of the Y-axis label; wherein the width of a display area outside the drawing area is greater than or equal to the sum of the display widths of the Y-axis labels;
in a specific implementation, in order to ensure that the Y-axis labels of all data streams do not overlap with the rendering area, the position of the rendering area, that is, the distance between the rendering area and both sides of the screen, needs to be determined according to the position and the display width of each Y-axis label. The specific determination step is similar to the determination step of the Y-axis label introduced in the previous step, and as long as the width of the display area outside the drawing area is greater than or equal to the sum of the display widths of the Y-axis label, it can be ensured that the drawing area and the display area of the Y-axis label are completely separated and do not overlap.
As a preferred embodiment, when all the Y-axis labels are symmetrically distributed on both sides of the drawing area, the distance between the starting position of the left end of the drawing area and the left end of the screen is greater than or equal to the sum of the display widths of all the Y-axis labels on the left side of the drawing area, and the distance between the starting position of the right end of the drawing area and the right end of the screen is greater than or equal to the sum of the display widths of all the Y-axis labels on the right side of the drawing area, so that the drawing area and the display area of the Y-axis labels are completely separated and do not overlap.
S203: and drawing the Y-axis label according to the position and the display width of the Y-axis label, and correspondingly drawing the data stream to be displayed according to the Y-axis label in the drawing area.
In specific implementation, the Y-axis labels of all the data streams to be displayed are drawn according to the positions of the Y-axis labels determined in the above steps, and all the data streams to be displayed are drawn within the range of the drawing area determined in the above steps.
According to the data stream combined oscillogram drawing method provided by the embodiment of the application, the left end and the right end initial position of the drawing area are determined by the actual width of the Y-axis label, specifically, the distance between the left end initial position of the drawing area and the left end of the screen is greater than or equal to the sum of the widths of all the Y-axis labels on the left side of the drawing area, and the distance between the right end initial position of the drawing area and the right end of the screen is greater than or equal to the sum of the widths of all the Y-axis labels on the right side of the drawing area. The drawing area is completely separated from the display area of the Y-axis label, the label close to the display area of the oscillogram can be displayed on the outer side of the oscillogram, and all the Y-axis labels cannot be overlapped with the oscillogram, so that all the Y-axis labels can be clearly displayed.
The specific steps for drawing the Y-axis label provided in the embodiments of the present application are described below. It can be understood that the Y-axis label that can be completely displayed within the preset width in the preset font size may be directly displayed, and the embodiment mainly introduces the drawing step of the Y-axis label that cannot be completely displayed within the preset width. Specifically, the method comprises the following steps:
referring to fig. 3, a flowchart of another data flow combination waveform diagram drawing method disclosed in the embodiment of the present application is shown in fig. 3, and includes:
s301: if the maximum width of the Y-axis label under the preset font size is larger than the preset width, determining the corresponding target font size when all data of the Y-axis label can be displayed within the preset width;
s302: judging whether the target font size is smaller than a preset minimum font size or not; if yes, entering S303; if not, entering S304;
in a specific implementation, if all the Y-axis tags of the data stream cannot be completely displayed within a preset width under a preset font size, the fonts of the Y-axis tags are reduced until all the Y-axis tags of the data stream can be displayed within the preset width, and the font size at this time is taken as a target font size. In order to prevent the Y-axis label from being too small and causing unclear display, the minimum font size that the preset width can withstand needs to be set, and when the target font size is not smaller than the minimum font size, the process proceeds to S304; if less than, the process proceeds to S303.
S303: setting all the data as the minimum font size, determining target data which is incompletely displayed within the preset width, and displaying the target data in a rolling manner within the preset width on the position of the Y-axis label;
when the target font size is smaller than the minimum font size, the font size of the Y-axis label is set to be the minimum font, and for data which is incompletely displayed, a rolling display mode can be adopted within a preset width, so that the Y-axis label is dynamically displayed.
S304: and setting all the data as the target font size, and displaying all the data within the preset width at the position of the Y-axis label.
On the basis of the foregoing embodiment, as a preferred implementation, determining the first positional relationship between the Y-axis tag and the corresponding Y-axis includes:
determining an mth Y axis corresponding to the nth Y axis label according to a Y axis determination formula; wherein the Y-axis determination formula is:
Figure BDA0001785753540000101
when the m-th Y-axis is at the left side of the rendering region and
Figure BDA0001785753540000111
when no remainder exists, the nth Y-axis label is to the left of the mth Y-axis;
when the m-th Y axis is at the left side of the drawing area
Figure BDA0001785753540000112
When a remainder exists, the nth Y-axis label is to the right of the mth Y-axis; />
When the m-th Y-axis is at the right side of the drawing area
Figure BDA0001785753540000113
When a remainder exists, the nth Y-axis label is to the left of the mth Y-axis;
when the m-th Y-axis is at the right side of the drawing area
Figure BDA0001785753540000114
When no remainder is present, the nth Y-axis label is to the right of the mth Y-axis.
On the basis of the foregoing embodiment, as a preferred implementation, the determining the second positional relationship between each Y axis and the rendering area includes:
determining the number of Y axes by using a Y axis number determination formula; the Y-axis number determination formula is as follows:
Figure BDA0001785753540000115
wherein M is the number of the Y axes, and N is the number of the data streams to be displayed;
and distributing the M Y axes to two sides of the drawing area according to a preset rule.
In this embodiment, in order to reduce the width of the Y-axis label display area, reasonably and fully every Y-axis, the Y-axis labels of the two data streams share one Y-axis, that is, the Y-axis labels of the two data streams are respectively located on two sides of one Y-axis. Firstly, the number of Y axes is determined by using a Y axis number determination formula, for example, when the number of data streams to be displayed is 1 or 2, the number of Y axes is 1, and when the number of data streams is 3 or 4, the number of Y axes is 2.
After the number of Y axes is determined, the Y axes are allocated to two sides of the drawing area according to a preset rule, which is not specifically limited in this embodiment, for example, the Y axes may be alternately placed on the left and right sides of the waveform drawing area according to symmetry. For example, when there are 1Y axis, the Y axis is placed on the left side of the drawing area, when there are 2Y axes, 1 is placed on each of the left and right sides of the drawing area, and when there are 3Y axes, two are placed on the left side of the drawing area, and one is placed on the right side.
For the positions of two groups of Y-axis labels of the same Y-axis, the mode of placing the Y-axis labels on the left side of the drawing area is left and right, namely the left side of the Y-axis is placed first, and if a second label exists, the second label is placed on the right side of the Y-axis; and in the Y axis on the right side of the drawing area, the mode of placing the Y-axis label is right-left, namely the right side of the Y axis is placed firstly, and if a second label exists, the Y-axis label is placed on the left side of the Y axis. In a specific implementation, each group of Y-axis labels and each Y-axis may be numbered, and the position relationship between the Y-axis label and the corresponding Y-axis may be determined according to the correspondence between the numbers (i.e., the calculation result of the above-mentioned Y-axis determination formula). For example, the value of n of the 1 st group Y-axis label is 1, the corresponding Y-axis number (i.e., m value) is 1, and since the 1 st Y-axis is on the left side of the rendering area and there is no remainder in the calculation of the above-described Y-axis determination formula, all the 1 st group Y-axis labels are on the left side of the 1 st Y-axis.
The following description discloses an embodiment of applying a data flow combined oscillogram drawing method to automobile data flow drawing, wherein the data flow truly reflects the working voltage and the state of each sensor and each actuator, and a basis is provided for automobile fault diagnosis. The data stream can only be read by a dedicated diagnostic instrument and varies with time and operating conditions. The data is transmitted as queued, one to the diagnostic instrument via the data line.
If there are 8 car data streams to be displayed for combination, if the 8 car data streams are symmetrically distributed on both sides of the drawing area, and 1Y axis represents 2Y axis labels, there are 4Y axes, and there are two on each of the left and right sides of the drawing area. If L represents the left side and R represents the right side, the widths of the display regions required for the left two Y axes are L1L, L1R, L2L, L R in this order, and the widths of the display regions required for the right two Y axes are R1L, R1R, R2L, R R in this order. The positions of the left two Y-axes can thus be found as: the first Y axis is located at a distance L1L from the left side of the screen, and the second Y axis is located at a distance L1L + L1R + L2L from the left side of the screen. The two right Y-axis positions are: the first Y axis is located at a distance R2R + R2L + R1R from the right side of the screen, and the second Y axis is located at a distance R2R from the right side of the screen. The left starting point of the drawing area is at a distance of L1L + L1R + L2L + L2R from the left side of the screen, the right starting point is at a distance of R1L + R1R + R2L + R2R from the right side of the screen, and the final display result is as shown in fig. 4.
The data flow combination oscillogram drawing method disclosed by the application can also be applied to network monitoring, namely the data flow to be displayed is a time-varying curve of network flow data. Also assuming that there are 8 network traffic data streams to be displayed, with 1Y-axis representing 2Y-axis labels, there are 4Y-axes, unlike the previous embodiment, all Y-axes are located to the left of the drawing area. The widths of the display areas of 8Y-axis labels corresponding to 4Y axes are L1L, L1R, L2L, L R, L L, L3R, L L, L R in sequence. It can be seen that the Y-axis from left to right of the screen is located at a distance of L1L, L L + L1R + L2L, L L + L1R + L2L + L2R + L3L, L L + L1R + L2L + L2R + L3L + L3R + L4L from the left side of the screen. Of course, the data flow combination oscillogram drawing method disclosed in the present application may also be applied to a plurality of technical fields such as satellite cloud picture monitoring and stock market trend analysis, which are not listed herein.
A data stream combined waveform drawing system provided in an embodiment of the present application is introduced below, and a data stream combined waveform drawing system described below and a data stream combined waveform drawing method described above may be referred to each other.
Referring to fig. 5, a structure diagram of a data stream combination waveform chart drawing system provided in an embodiment of the present application is shown in fig. 5, and includes:
a first determining module 501, configured to determine, when a data stream to be displayed is received, a display width of a Y-axis tag corresponding to each data stream to be displayed, and determine a position of the Y-axis tag according to all the display widths;
a second determining module 502, configured to determine a drawing area according to the position of the Y-axis label and the display width of the Y-axis label; wherein the width of a display area outside the drawing area is greater than or equal to the sum of the display widths of the Y-axis labels;
and a drawing module 503, configured to draw the Y-axis label according to the position and the display width of the Y-axis label, and draw the data stream to be displayed in the drawing area according to the Y-axis label.
The data flow combined oscillogram drawing system provided by the embodiment of the application has the advantages that the left end and the right end starting position of the drawing area are determined by the actual width of the Y-axis label, specifically, the distance between the left end starting position of the drawing area and the left end of the screen is greater than or equal to the sum of the widths of all the Y-axis labels on the left side of the drawing area, and the distance between the right end starting position of the drawing area and the right end of the screen is greater than or equal to the sum of the widths of all the Y-axis labels on the right side of the drawing area. The display area of the drawing area and the display area of the Y-axis label are completely separated, the label close to the display area of the oscillogram can be displayed on the outer side of the oscillogram, and all the Y-axis labels cannot be overlapped with the oscillogram, so that all the Y-axis labels can be clearly displayed.
On the basis of the foregoing embodiment, as a preferred implementation, the first determining module 501 includes:
the Y-axis label display width determining submodule is used for calculating the maximum width of the Y-axis label under the preset font size and judging whether the maximum width is larger than the preset width or not; if not, taking the maximum width as the display width; and if so, taking the preset width as the display width.
And the Y-axis label position determining submodule is used for determining the position of the Y-axis label according to all the display widths.
On the basis of the foregoing embodiment, as a preferred implementation manner, if the maximum width is greater than a preset width, the drawing module 503 includes:
a target font size determining unit, configured to determine a corresponding target font size when all data of the Y-axis tag can be displayed within the preset width, and determine whether the target font size is smaller than a preset minimum font size; if yes, starting the working process of the first font size setting unit; if not, starting the working process of the second font size setting unit;
the first font size setting unit is configured to set all the data to the minimum font size, determine target data that is incompletely displayed within the preset width, and scroll-display the target data within the preset width at the position of the Y-axis label;
the second font size setting unit is configured to set the all data to the target font size, and display the all data within the preset width at the position of the Y-axis label.
On the basis of the foregoing embodiment, as a preferred implementation manner, the sub-module for determining the position of the Y-axis tag includes:
a position relation determining unit, configured to determine a first position relation between the Y-axis tag and a corresponding Y-axis, and determine a second position relation between each Y-axis and the drawing area;
a first determining unit, configured to determine, when the Y-axis is on the left side of the drawing area, a first distance between the Y-axis and the left end of the screen according to display widths of all Y-axis labels on the left side of the Y-axis, and determine a position of the Y-axis label according to the first positional relationship and the first distance;
and the second determining unit is used for determining a second distance between the Y axis and the right end of the screen according to the display widths of all Y axis labels on the right side of the Y axis when the Y axis is on the right side of the drawing area, and determining the position of the Y axis label according to the first position relation and the second distance.
On the basis of the foregoing embodiment, as a preferred implementation, the unit for determining a position relationship includes:
the Y-axis determining subunit is used for determining an m-th Y axis corresponding to the n-th Y-axis label according to a Y-axis determining formula; wherein the Y-axis determination formula is:
Figure BDA0001785753540000141
a first determining subunit, configured to determine whether the m-th Y-axis is on the left side of the drawing area
Figure BDA0001785753540000142
When no remainder exists, the nth Y-axis label is to the left of the mth Y-axis;
a second determining subunit, configured to determine whether the m-th Y-axis is on the left side of the drawing area
Figure BDA0001785753540000151
When a remainder exists, the nth Y-axis label is to the right of the mth Y-axis;
a third determining subunit, configured to determine whether the m-th Y-axis is on the right side of the drawing area
Figure BDA0001785753540000152
When a remainder exists, the nth Y-axis label is to the left of the mth Y-axis;
a fourth determining subunit, for determining if the mth Y-axis is at the right side of the rendering area
Figure BDA0001785753540000153
When no remainder is present, the nth Y-axis label is to the right of the mth Y-axis.
On the basis of the foregoing embodiment, as a preferred implementation, the unit for determining a position relationship includes:
a Y-axis number determining subunit, configured to determine the number of Y axes by using a Y-axis number determining formula; the Y-axis number determination formula is as follows:
Figure BDA0001785753540000154
wherein M is the number of the Y axes, and N is the number of the data streams to be displayed;
and the distribution subunit is used for distributing the M Y axes to two sides of the drawing area according to a preset rule.
The present application further provides an electronic device, referring to fig. 6, a structure diagram of an electronic device provided in an embodiment of the present application, as shown in fig. 6, includes:
a memory 100 for storing a computer program;
the processor 200, when executing the computer program, may implement the steps provided by the above embodiments.
Specifically, the memory 100 includes a nonvolatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and computer-readable instructions, and the internal memory provides an environment for the operating system and the computer-readable instructions in the non-volatile storage medium to run. The processor 200 provides computing and control capabilities for the electronic device, and when executing the computer program stored in the memory 100, the steps of the data stream combination waveform drawing method provided by any of the above embodiments may be implemented.
The left end and the right end initial position of the drawing area are determined by the actual width of the Y-axis label, specifically, the distance between the left end initial position of the drawing area and the left end of the screen is greater than or equal to the sum of the widths of all the Y-axis labels on the left side of the drawing area, and the distance between the right end initial position of the drawing area and the right end of the screen is greater than or equal to the sum of the widths of all the Y-axis labels on the right side of the drawing area. The display area of the drawing area and the display area of the Y-axis label are completely separated, the label close to the display area of the oscillogram can be displayed on the outer side of the oscillogram, and all the Y-axis labels cannot be overlapped with the oscillogram, so that all the Y-axis labels can be clearly displayed.
On the basis of the above embodiment, as a preferred implementation, referring to fig. 7, the electronic device further includes:
and an input interface 300 connected to the processor 200, for acquiring computer programs, parameters and instructions imported from the outside, and storing the computer programs, parameters and instructions into the memory 100 under the control of the processor 200. The input interface 300 may be connected to an input device for receiving parameters or instructions manually input by a user. The input device may be a touch layer covered on a display screen, or may be a key, a track ball or a touch pad arranged on a terminal housing, or may be a keyboard, a touch pad or a mouse, etc.
And a display unit 400 connected to the processor 200 for displaying data transmitted by the processor 200. The display unit 400 may be a display screen on a PC, a liquid crystal display screen, or an electronic ink display screen. Specifically, in the present embodiment, the drawn waveform diagram may be displayed through the display unit 400.
And a network port 500 connected to the processor 200 for performing communication connection with each external terminal device. The communication technology adopted by the communication connection can be a wired communication technology or a wireless communication technology, such as a mobile high definition link (MHL) technology, a Universal Serial Bus (USB), a High Definition Multimedia Interface (HDMI), a wireless fidelity (WiFi), a bluetooth communication technology, a low power consumption bluetooth communication technology, an ieee802.11 s-based communication technology, and the like. Specifically, in this embodiment, a data stream to be displayed or the like may be imported to the processor 200 through the network port 500.
The video collector 600 is connected to the processor 200, and configured to obtain video data, and then send the video data to the processor 200 for data analysis and processing, and the subsequent processor 200 may send a processing result to the display unit 400 for display, or transmit the processing result to the processor 100 for storage, or send the processing result to a preset data receiving terminal through the network port 500.
The present application also provides a computer-readable storage medium, which may include: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, an optical disk, or other various media capable of storing program codes. The storage medium stores thereon a computer program, which when executed by a processor implements the steps of the data stream combination waveform drawing method provided by any of the above embodiments.
The embodiments are described in a progressive manner in the specification, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments are referred to each other. For the system disclosed by the embodiment, the description is relatively simple because the system corresponds to the method disclosed by the embodiment, and the relevant points can be referred to the method part for description. It should be noted that, for those skilled in the art, without departing from the principle of the present application, the present application can also make several improvements and modifications, and those improvements and modifications also fall into the protection scope of the claims of the present application.
It should also be noted that, in this specification, relational terms such as first and second, and the like are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising a … …" does not exclude the presence of another identical element in a process, method, article, or apparatus that comprises the element.

Claims (7)

1. A method for drawing a data stream combined waveform diagram is characterized by comprising the following steps:
when data streams to be displayed are received, determining the display width of a Y-axis label corresponding to each data stream to be displayed, and determining the position of the Y-axis label according to all the display widths;
determining a drawing area according to the position of the Y-axis label and the display width of the Y-axis label; wherein the width of a display area outside the drawing area is greater than or equal to the sum of the display widths of the Y-axis labels;
drawing the Y-axis label according to the position and the display width of the Y-axis label, and correspondingly drawing the data stream to be displayed according to the Y-axis label in the drawing area;
wherein determining the position of the Y-axis label according to all the display widths comprises:
determining a first position relation between the Y-axis label and a corresponding Y-axis, and determining a second position relation between each Y-axis and the drawing area;
when the Y axis is on the left side of the drawing area, determining a first distance between the Y axis and the left end of the screen according to the display widths of all Y axis labels on the left side of the Y axis, and determining the position of the Y axis label according to the first position relation and the first distance;
when the Y axis is on the right side of the drawing area, determining a second distance between the Y axis and the right end of the screen according to the display widths of all Y axis labels on the right side of the Y axis, and determining the position of the Y axis label according to the first position relation and the second distance;
wherein determining a first positional relationship of the Y-axis tag with a corresponding Y-axis comprises:
determining an mth Y axis corresponding to the nth Y axis label according to a Y axis determination formula; wherein the Y-axis determination formula is:
Figure FDA0004066006430000011
when the m-th Y axis is at the left side of the drawing area
Figure FDA0004066006430000012
When no remainder exists, the nth Y-axis label is to the left of the mth Y-axis;
when the m-th Y axis is at the left side of the drawing area
Figure FDA0004066006430000013
When a remainder exists, the nth Y-axis label is to the right of the mth Y-axis;
when the m-th Y-axis is at the right side of the rendering region
Figure FDA0004066006430000014
When a remainder exists, the nth Y-axis label is to the left of the mth Y-axis;
when the m-th Y-axis is at the right side of the drawing area
Figure FDA0004066006430000021
When no remainder is present, the nth Y-axis label is to the right of the mth Y-axis;
wherein determining a second positional relationship of each of the Y-axes to the drawing area comprises:
determining the number of Y axes by using a Y axis number determination formula; the Y-axis number determination formula is as follows:
Figure FDA0004066006430000022
wherein M is the number of the Y axes, and N is the number of the data streams to be displayed;
and distributing the M Y axes to two sides of the drawing area according to a preset rule.
2. The method for drawing the data stream combined waveform diagram according to claim 1, wherein determining the display width of the Y-axis label corresponding to each data stream to be displayed comprises:
calculating the maximum width of the Y-axis label under a preset font size, and judging whether the maximum width is larger than a preset width;
if not, taking the maximum width as the display width;
and if so, taking the preset width as the display width.
3. The method for drawing a data stream combined waveform map according to claim 2, wherein if the maximum width is greater than a preset width, drawing the Y-axis label at the position of the Y-axis label includes:
determining the corresponding target font size when all data of the Y-axis label can be displayed within the preset width, and judging whether the target font size is smaller than the preset minimum font size;
if yes, setting all the data to be the minimum font size, determining that target data which are incompletely displayed within the preset width are determined, and displaying the target data in a rolling mode within the preset width on the position of the Y-axis label;
and if not, setting all the data as the target font size, and displaying all the data within the preset width at the position of the Y-axis label.
4. The method for drawing a data stream combined waveform map according to claim 1, wherein all the Y-axis labels are symmetrically distributed on both sides of the drawing area; the distance between the starting position of the left end of the drawing area and the left end of the screen is larger than or equal to the sum of the display widths of all the Y-axis labels on the left side of the drawing area, and the distance between the starting position of the right end of the drawing area and the right end of the screen is larger than or equal to the sum of the display widths of all the Y-axis labels on the right side of the drawing area.
5. A data stream combination waveform drawing system, comprising:
the device comprises a first determining module, a second determining module and a display module, wherein the first determining module is used for determining the display width of a Y-axis label corresponding to each data stream to be displayed when the data streams to be displayed are received, and determining the position of the Y-axis label according to all the display widths;
the second determining module is used for determining a drawing area according to the position of the Y-axis label and the display width of the Y-axis label; wherein the width of a display area outside the drawing area is greater than or equal to the sum of the display widths of the Y-axis labels;
the drawing module is used for drawing the Y-axis label according to the position and the display width of the Y-axis label and correspondingly drawing the data stream to be displayed according to the Y-axis label in the drawing area;
the determine Y-axis tag location sub-module includes:
a position relation determining unit, configured to determine a first position relation between the Y-axis tag and a corresponding Y-axis, and determine a second position relation between each Y-axis and the drawing area;
a first determining unit, configured to determine, when the Y axis is on the left side of the drawing area, a first distance between the Y axis and the left end of the screen according to display widths of all Y axis tags on the left side of the Y axis, and determine a position of the Y axis tag according to the first positional relationship and the first distance;
a second determining unit, configured to determine, when the Y axis is on the right side of the drawing area, a second distance between the Y axis and the right end of the screen according to display widths of all Y axis labels on the right side of the Y axis, and determine a position of the Y axis label according to the first positional relationship and the second distance;
wherein the determining the positional relationship unit includes:
the Y-axis determining subunit is used for determining an m-th Y axis corresponding to the n-th Y-axis label according to a Y-axis determining formula; wherein the Y-axis determination formula is:
Figure FDA0004066006430000031
a first determining subunit for determining whether the m-th Y-axis is on the left side of the rendering region
Figure FDA0004066006430000032
When no remainder exists, the nth Y-axis label is to the left of the mth Y-axis;
a second determining subunit, configured to determine whether the m-th Y-axis is on the left side of the drawing area
Figure FDA0004066006430000033
When a remainder exists, the nth Y-axis label is to the right of the mth Y-axis;
a third determining subunit for determining if the m-th Y-axis is at the right side of the rendering region
Figure FDA0004066006430000041
When a remainder exists, the nth Y-axis label is to the left of the mth Y-axis;
a fourth determining subunit, configured to determine whether the m-th Y-axis is on the right side of the drawing area
Figure FDA0004066006430000042
When no remainder exists, the nth Y-axis label is to the right of the mth Y-axis;
wherein the determining the positional relationship unit includes:
a Y-axis number determining subunit, configured to determine the number of Y axes by using a Y-axis number determining formula; the Y-axis number determination formula is as follows:
Figure FDA0004066006430000043
wherein M is the number of the Y axes, and N is the number of the data streams to be displayed;
and the distribution subunit is used for distributing the M Y axes to two sides of the drawing area according to a preset rule.
6. An electronic device, comprising:
a memory for storing a computer program;
a processor for implementing the steps of the data stream combined waveform drawing method as claimed in any one of claims 1 to 4 when executing said computer program.
7. A computer-readable storage medium, having stored thereon a computer program which, when being executed by a processor, carries out the steps of the data stream combined waveform map rendering method according to any one of claims 1 to 4.
CN201811014194.5A 2018-08-31 2018-08-31 Data stream combined waveform diagram drawing method and system, electronic equipment and storage medium Active CN109147000B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811014194.5A CN109147000B (en) 2018-08-31 2018-08-31 Data stream combined waveform diagram drawing method and system, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811014194.5A CN109147000B (en) 2018-08-31 2018-08-31 Data stream combined waveform diagram drawing method and system, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN109147000A CN109147000A (en) 2019-01-04
CN109147000B true CN109147000B (en) 2023-04-07

Family

ID=64826227

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811014194.5A Active CN109147000B (en) 2018-08-31 2018-08-31 Data stream combined waveform diagram drawing method and system, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN109147000B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114138893B (en) * 2022-01-29 2022-05-20 杭州广立微电子股份有限公司 Chart display method and chart label display system

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101408878A (en) * 2007-10-12 2009-04-15 齐营股份有限公司 Data group graph notation and apparatus thereof
CN108446087A (en) * 2018-03-20 2018-08-24 深圳市元征科技股份有限公司 Data flow display methods, device, electronic equipment and storage medium

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP4959473B2 (en) * 2007-08-30 2012-06-20 インターナショナル・ビジネス・マシーンズ・コーポレーション System that protects computer screen information

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101408878A (en) * 2007-10-12 2009-04-15 齐营股份有限公司 Data group graph notation and apparatus thereof
CN108446087A (en) * 2018-03-20 2018-08-24 深圳市元征科技股份有限公司 Data flow display methods, device, electronic equipment and storage medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
贸易地图标签绘制的并行解决方案与实现;王树伟等;《计算机科学》;20090315(第03期);全文 *

Also Published As

Publication number Publication date
CN109147000A (en) 2019-01-04

Similar Documents

Publication Publication Date Title
CN110188299B (en) Response type page processing method and device and electronic equipment
WO2022016654A1 (en) Dot-matrix writing content recording method and apparatus, and electronic device
US20150178782A1 (en) Privilege providing device and privilege providing method
CN103492998A (en) Multi-input gestures in hierarchical regions
CN112487883B (en) Intelligent pen writing behavior feature analysis method and device and electronic equipment
CN112507806A (en) Intelligent classroom information interaction method and device and electronic equipment
CN112487871A (en) Handwriting data processing method and device and electronic equipment
US20240119223A1 (en) Method, apparatus and electronic device for field merging
CN109147000B (en) Data stream combined waveform diagram drawing method and system, electronic equipment and storage medium
CN115328429A (en) Display method, display device, electronic apparatus, and storage medium
CN102196028B (en) Flexible vehicle display
CN113238688B (en) Form display method, device, equipment and medium
CN112486337B (en) Handwriting graph analysis method and device and electronic equipment
CN112492399B (en) Information display method and device and electronic equipment
WO2023207912A1 (en) Split-screen rendering method and apparatus, device, and storage medium
CN109308862B (en) Signal control method, control device, processing device and signal control equipment
CN110852042A (en) Character type conversion method and device
CN112487774B (en) Writing form electronization method and device and electronic equipment
CN111798591B (en) Method and device for determining total mileage of vehicle, computer equipment and storage medium
CN112256176A (en) Character display method and device, electronic equipment and computer readable storage medium
CN110868697A (en) Interconnection method and device for vehicle machine and multiple mobile devices and storage medium
CN114322985B (en) Electronic map recommendation point display method, device, equipment and storage medium
CN112492381B (en) Information display method and device and electronic equipment
CN115858401B (en) Page detection method and device, electronic equipment and storage medium
CN112487881B (en) Handwriting content analysis 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
GR01 Patent grant
GR01 Patent grant