Error drawing when missing column on timeline

Source: Internet
Author: User

If a column is missing on the timeline, a cycle-by-period drawing can cause errors, as shown in the following scenario:

According to normal drawing, you can see the following effect:

There is no point between 10-20, it is a jump change. This is the correct graph.

Problem one: As shown in the figure, 1, 3 columns missing a second column, when the periodic drawing, 20-30, that corresponds to the second column is a point, which is obviously unreasonable;

Question two: Another problem is that there will be jumps between each of the 10 points.

And the above two questions if there is no empty column between the first column and the last column, it will not appear, it is also puzzling. See figure below:

Some of the other problems that exist:

Here, at the second point in time began to put two signals, that is, 0-20, do not draw things, and 20-40 have, if according to the period to calculate, 40-60, is not also should not draw things, and not like map, according to the cycle of drawing out.

Workaround:

The code is as follows:

Private Voidtticker_tick (object sender, EventArgs e) {int yassemblycount = Yassembly.count;
                if (Yassemblycount > 0) {int index = xcount% Yassemblycount;
                int Cycleno = Xcount/yassemblycount; int oneroundnum = Calculatecycleno (xassembly);
                ①double XValue = (double) (xassembly[index]+ Cycleno * oneroundnum);
                Double yvalue = Yassembly[index];
                Seriespoint p = newseriespoint (Xvalue,yvalue);
                Updategraphdelegate upgraph = this.updategraph; This.
                BeginInvoke (Upgraph, p, 0);
               Swiftplotdiagram Xyaxis = (swiftplotdiagram) Chartcontrol1.diagram; Xyaxis.
               AxisX.Range.SetMinMaxValues (Xassembly[index] + Cycleno *oneroundnum-60, Xassembly[index] + Cycleno * oneroundnum + 60);
            xcount++;
                } else {tticker.stop (); MessagEbox.show ("No point can be drawn"); }
        }

There was a bit of a problem with the code at ①, and the previous function was written

Private Intcalculatecycleno (list<double> inputassembly)
        {
            int nocnt = 1;
            if (Inputassembly.count = = 1)
            {
               nocnt = 1;
            }
            else
            {for
                (int i = 1; i< inputassembly.count; i++)
                {
                   if (inputassembly[i]! = inputassembly[i-1]) 
  {
                       nocnt++
            ;
            }}} return nocnt;
        }

Now instead:

Private Intcalculatecycleno (list<double> inputassembly)
        {
            return (int) inputassembly[ INPUTASSEMBLY.COUNT-1];
        }

In this case, the above function returns the actual number of points on the x-coordinate, and after the modification it returns the last small mark, such as Array1 Array2 Array3 if the array2 is not filled in signal, then the modified function returns 20, and then returns the subscript of the last element after the modification. , that is, Array3 the last element, subscript is 30, so the drawing is 0-30,30-60,60-90 ...

Explain why the second picture of the phenomenon, because the pre-modification code returns the number of cycles is 20, then the first period 0-30 (as the first picture, 10-20 no draw point), and the second cycle begins, is 20-50, the third cycle 40-70, so that each cycle is overlapping, So the graph appears in a stalemate state.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.