예제 #1
0
        /// <summary>
        /// called when the load section link is pressed
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void loadSectionLink_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            //on click assgin the current data to the selected data
            drawMarkers       = true;
            dv.MarkerSelected = true;
            Marker[] temp = dv.MarkerList1.ToArray();
            temp[markerIndex].Selected = true;
            dv.MarkerList1             = temp.ToList();
            Console.WriteLine("We have loaded");
            // chunkData.Show();
            //this.Invalidate();



            dv.SetData(data);
            dv.AddGraphs();
        }
예제 #2
0
        /// <summary>
        /// Called when button to split the data is pressed
        /// checks for the number of chunbks wanted and if it is a valid integer
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void chunkButton_Click(object sender, EventArgs e)
        {
            int numberChunks = 0;

            try
            {
                numberChunks = Convert.ToInt32(chunkNum.Text);
                //if it works then we can add data on here
                //we need to pass back where the markers are needed
                //first we need to split the data up into a number chunks
            }
            catch (Exception e1)
            {
                MessageBox.Show("Error", "Data entered is not in correct format", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly);
            }


            int chunkSize = data[0].Count / numberChunks;
            //we can then go through and ge thte start and end points or create markers
            Marker m     = new Marker();
            XDate  start = new XDate(2018, 10, 10, 0, 0, 0);

            m.Min = start;
            bool startBool = false;
            int  x         = 0;

            for (int i = 0; i < data[0].Count; i++)
            {
                if (startBool)
                {
                    m.GenColour();
                    markers.Add(m);
                    m = new Marker();
                    XDate temp = new XDate(2018, 10, 10, 0, 0, 0);
                    temp.AddSeconds(i * interval);
                    m.Min     = temp;
                    startBool = false;
                }
                if (x == chunkSize - 1)
                {
                    if (i == numberChunks - 1)
                    {
                        //means final chunk add rest if odd number
                        startBool = true;
                        XDate temp = new XDate(2018, 10, 10, 0, 0, 0);
                        temp.AddSeconds(data[0].Count / interval);
                        m.Max = temp;
                        x     = 0;
                    }
                    else
                    {
                        startBool = true;
                        XDate temp = new XDate(2018, 10, 10, 0, 0, 0);
                        temp.AddSeconds(i * interval);
                        m.Max = temp;
                        x     = 0;
                    }
                }



                x += 1;
            }



            //we need to pass the markers back and then generate the summaries
            //we need a control type thing to edit........



            Console.WriteLine("We have " + markers.Count + " chunks");

            //we then need the markers to be drawn

            dv.AddMarkers(markers);
            dv.AddGraphs();

            this.Close();
        }