Exemplo n.º 1
0
        void SetupTChartTools()
        {
            tChart1.Tools.Clear();

            // format nearest point
            Steema.TeeChart.Tools.NearestPoint nearestPoint1 = new Steema.TeeChart.Tools.NearestPoint(tChart1.Chart);
            nearestPoint1.Direction   = Steema.TeeChart.Tools.NearestPointDirection.Horizontal;
            nearestPoint1.Pen.Color   = System.Drawing.Color.Black;
            nearestPoint1.Brush.Color = System.Drawing.Color.Black;
            nearestPoint1.Size        = 0;
            nearestPoint1.Style       = Steema.TeeChart.Tools.NearestPointStyles.Circle;
            nearestPoint1.DrawLine    = false;
            tChart1.Tools.Add(nearestPoint1);

            // set tool-tip pop-up for the FC-Ops added series
            for (int i = (tChart1.Series.Count - 5); i < tChart1.Series.Count; i++)
            {
                tChart1.Series[i].GetSeriesMark += Form1_GetSeriesMark;
            }

            // Add point tooltips
            Steema.TeeChart.Tools.MarksTip marksTip1 = new Steema.TeeChart.Tools.MarksTip(tChart1.Chart);
            marksTip1.Style       = Steema.TeeChart.Styles.MarksStyles.XY;
            marksTip1.Active      = true;
            marksTip1.MouseDelay  = 0;
            marksTip1.HideDelay   = 999999;
            marksTip1.MouseAction = Steema.TeeChart.Tools.MarksTipMouseAction.Move;
            marksTip1.BackColor   = Color.LightSteelBlue;
            marksTip1.ForeColor   = Color.Black;
            tChart1.Tools.Add(marksTip1);
        }
Exemplo n.º 2
0
        void SetupTChartNearestPointTool()
        {
            this.tChart1.Tools.Clear();

            if (annotation1.Active)
            {
                // set tool-tip pop-up for the FC-Ops added series
                for (int i = 0; i < this.tChart1.Series.Count; i++)
                {
                    Steema.TeeChart.Tools.NearestPoint nearestPoint2 = new Steema.TeeChart.Tools.NearestPoint(this.tChart1[i]);
                    nearestPoint2.Direction   = Steema.TeeChart.Tools.NearestPointDirection.Horizontal;
                    nearestPoint2.Pen.Color   = this.tChart1[i].Color;
                    nearestPoint2.Brush.Color = this.tChart1[i].Color;
                    nearestPoint2.Size        = 5;
                    nearestPoint2.Style       = Steema.TeeChart.Tools.NearestPointStyles.Circle;
                    nearestPoint2.DrawLine    = false;
                    this.tChart1.Tools.Add(nearestPoint2);

                    this.tChart1.Series[i].GetSeriesMark += Form1_GetSeriesMark;
                }

                // Add point tooltips
                Steema.TeeChart.Tools.MarksTip marksTip1 = new Steema.TeeChart.Tools.MarksTip(this.tChart1.Chart);
                marksTip1.Style       = Steema.TeeChart.Styles.MarksStyles.XY;
                marksTip1.Active      = true;
                marksTip1.MouseDelay  = 0;
                marksTip1.HideDelay   = 999999;
                marksTip1.MouseAction = Steema.TeeChart.Tools.MarksTipMouseAction.Move;
                marksTip1.BackColor   = Color.LightSteelBlue;
                marksTip1.ForeColor   = Color.Black;
                //this.tChart1.Tools.Add(marksTip1);
            }
        }
Exemplo n.º 3
0
        public TimeSeriesHydrographEditor(TimeInterval db)
        {
            InitializeComponent();

#if SpreadsheetGear
            var uc = new TimeSeriesSpreadsheetSG();
#else
            var uc = new TimeSeriesSpreadsheet();
#endif
            uc.Parent = this.panelGraphTable;
            uc.Dock   = DockStyle.Fill;
            uc.BringToFront();

            timeSeriesSpreadsheet1 = uc;

            m_db = db;
            //SetupTimeSelector(db);

            this.checkBoxShowPoints.Checked = UserPreference.Lookup("ShowPoints") == "True";


            annotation1 = new Steema.TeeChart.Tools.Annotation(tChart1.Chart);

            originalDataXmlFilename = Path.Combine(FileUtility.GetTempPath(), db.ToString() + DateTime.Now.Ticks + "_download.xml");

            checkBoxShowBadData.Visible = false;

            Logger.WriteLine(m_db.ToString(), "ui");
            if (m_db == TimeInterval.Daily)
            {
                BackColor = Color.Lavender;
            }


            dragPoint1            = new Steema.TeeChart.Tools.DragPoint();
            this.dragPoint1.Style = Steema.TeeChart.Tools.DragPointStyles.Y;
            this.tChart1.Tools.Add(this.dragPoint1);
            this.dragPoint1.Drag += new Steema.TeeChart.Tools.DragPointEventHandler(this.dragPoint1_Drag);


            tChart1.MouseMove += new MouseEventHandler(tChart1_MouseMove);
            var nearest = new Steema.TeeChart.Tools.NearestPoint(tChart1.Chart);

            LoadSiteList();
            this.comboBoxInputs.Text = UserPreference.Lookup("Inputs" + m_db.ToString());


            this.dragPoint1.Active = false;
            this.dragPoint1.Series = null;
            //    HydrometEdits.Progress += new ProgressEventHandler(HydrometEdits_Progress);

            timeSeriesSpreadsheet1.UpdateCompleted += new EventHandler <EventArgs>(timeSeriesSpreadsheet1_UpdateCompleted);
        }
 /// <summary>
 /// Required method for Designer support - do not modify
 /// the contents of this method with the code editor.
 /// </summary>
 private void InitializeComponent()
 {
     System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Tools_Nearest));
     this.pointSeries1  = new Steema.TeeChart.Styles.Points();
     this.nearestPoint1 = new Steema.TeeChart.Tools.NearestPoint();
     this.label1        = new System.Windows.Forms.Label();
     this.comboBox1     = new System.Windows.Forms.ComboBox();
     this.checkBox1     = new System.Windows.Forms.CheckBox();
     this.checkBox2     = new System.Windows.Forms.CheckBox();
     this.button1       = new System.Windows.Forms.Button();
     this.panel1.SuspendLayout();
     this.chartContainer.SuspendLayout();
     this.SuspendLayout();
     //
     // textBox1
     //
     this.textBox1.Size = new System.Drawing.Size(466, 63);
     this.textBox1.Text = resources.GetString("textBox1.Text");
     //
     // panel1
     //
     this.panel1.Controls.Add(this.button1);
     this.panel1.Controls.Add(this.checkBox2);
     this.panel1.Controls.Add(this.checkBox1);
     this.panel1.Controls.Add(this.comboBox1);
     this.panel1.Controls.Add(this.label1);
     this.panel1.Location = new System.Drawing.Point(0, 63);
     this.panel1.Size     = new System.Drawing.Size(466, 41);
     //
     // tChart1
     //
     //
     //
     //
     this.tChart1.Aspect.View3D  = false;
     this.tChart1.Aspect.ZOffset = 0;
     //
     //
     //
     //
     //
     //
     this.tChart1.Axes.Bottom.MaximumOffset = 5;
     this.tChart1.Axes.Bottom.MinimumOffset = 5;
     //
     //
     //
     this.tChart1.Axes.Left.MaximumOffset = 5;
     this.tChart1.Axes.Left.MinimumOffset = 5;
     //
     //
     //
     this.tChart1.Header.Alignment = System.Drawing.StringAlignment.Near;
     this.tChart1.Header.Lines     = new string[] {
         "Nearest tool example"
     };
     //
     //
     //
     //
     //
     //
     this.tChart1.Panel.Brush.Color = System.Drawing.Color.FromArgb(((int)(((byte)(254)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))));
     //
     //
     //
     this.tChart1.Panel.Brush.Gradient.EndColor   = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(0)))));
     this.tChart1.Panel.Brush.Gradient.StartColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(224)))), ((int)(((byte)(192)))));
     this.tChart1.Panel.Brush.Gradient.UseMiddle  = false;
     this.tChart1.Series.Add(this.pointSeries1);
     this.tChart1.Size = new System.Drawing.Size(466, 182);
     this.tChart1.Tools.Add(this.nearestPoint1);
     //
     //
     //
     //
     //
     //
     this.tChart1.Walls.Back.Visible = false;
     //
     // chartContainer
     //
     this.chartContainer.Location = new System.Drawing.Point(0, 104);
     this.chartContainer.Size     = new System.Drawing.Size(466, 182);
     //
     // pointSeries1
     //
     this.pointSeries1.Color     = System.Drawing.Color.Red;
     this.pointSeries1.ColorEach = false;
     //
     //
     //
     //
     //
     //
     this.pointSeries1.Marks.Callout.ArrowHead     = Steema.TeeChart.Styles.ArrowHeadStyles.None;
     this.pointSeries1.Marks.Callout.ArrowHeadSize = 8;
     //
     //
     //
     this.pointSeries1.Marks.Callout.Brush.Color = System.Drawing.Color.Black;
     this.pointSeries1.Marks.Callout.Distance    = 0;
     this.pointSeries1.Marks.Callout.Draw3D      = false;
     this.pointSeries1.Marks.Callout.Length      = 0;
     this.pointSeries1.Marks.Callout.Style       = Steema.TeeChart.Styles.PointerStyles.Rectangle;
     this.pointSeries1.Marks.Callout.Visible     = false;
     this.pointSeries1.Marks.Visible             = true;
     //
     //
     //
     //
     //
     //
     this.pointSeries1.Pointer.Brush.Color = System.Drawing.Color.Red;
     this.pointSeries1.Pointer.Style       = Steema.TeeChart.Styles.PointerStyles.Rectangle;
     this.pointSeries1.Title = "pointSeries1";
     //
     //
     //
     this.pointSeries1.XValues.DataMember = "X";
     this.pointSeries1.XValues.Order      = Steema.TeeChart.Styles.ValueListOrder.Ascending;
     //
     //
     //
     this.pointSeries1.YValues.DataMember = "Y";
     //
     // nearestPoint1
     //
     //
     //
     //
     this.nearestPoint1.Pen.Color = System.Drawing.Color.White;
     this.nearestPoint1.Series    = this.pointSeries1;
     //
     // label1
     //
     this.label1.AutoSize  = true;
     this.label1.Location  = new System.Drawing.Point(7, 9);
     this.label1.Name      = "label1";
     this.label1.Size      = new System.Drawing.Size(33, 13);
     this.label1.TabIndex  = 0;
     this.label1.Text      = "&Style:";
     this.label1.TextAlign = System.Drawing.ContentAlignment.TopRight;
     //
     // comboBox1
     //
     this.comboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
     this.comboBox1.Items.AddRange(new object[] {
         "None",
         "Circle",
         "Rectangle",
         "Diamond"
     });
     this.comboBox1.Location              = new System.Drawing.Point(47, 7);
     this.comboBox1.Name                  = "comboBox1";
     this.comboBox1.Size                  = new System.Drawing.Size(100, 21);
     this.comboBox1.TabIndex              = 1;
     this.comboBox1.SelectedIndexChanged += new System.EventHandler(this.comboBox1_SelectedIndexChanged);
     //
     // checkBox1
     //
     this.checkBox1.Checked         = true;
     this.checkBox1.CheckState      = System.Windows.Forms.CheckState.Checked;
     this.checkBox1.FlatStyle       = System.Windows.Forms.FlatStyle.Flat;
     this.checkBox1.Location        = new System.Drawing.Point(160, 7);
     this.checkBox1.Name            = "checkBox1";
     this.checkBox1.Size            = new System.Drawing.Size(67, 21);
     this.checkBox1.TabIndex        = 2;
     this.checkBox1.Text            = "&Active";
     this.checkBox1.CheckedChanged += new System.EventHandler(this.checkBox1_CheckedChanged);
     //
     // checkBox2
     //
     this.checkBox2.Checked         = true;
     this.checkBox2.CheckState      = System.Windows.Forms.CheckState.Checked;
     this.checkBox2.FlatStyle       = System.Windows.Forms.FlatStyle.Flat;
     this.checkBox2.Location        = new System.Drawing.Point(227, 7);
     this.checkBox2.Name            = "checkBox2";
     this.checkBox2.Size            = new System.Drawing.Size(85, 21);
     this.checkBox2.TabIndex        = 3;
     this.checkBox2.Text            = "&Draw Line";
     this.checkBox2.CheckedChanged += new System.EventHandler(this.checkBox2_CheckedChanged);
     //
     // button1
     //
     this.button1.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
     this.button1.Location  = new System.Drawing.Point(320, 6);
     this.button1.Name      = "button1";
     this.button1.Size      = new System.Drawing.Size(75, 23);
     this.button1.TabIndex  = 4;
     this.button1.Text      = "&Edit...";
     this.button1.Click    += new System.EventHandler(this.button1_Click);
     //
     // Tools_Nearest
     //
     this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
     this.ClientSize        = new System.Drawing.Size(466, 286);
     this.Name  = "Tools_Nearest";
     this.Load += new System.EventHandler(this.Tool_Nearest_Load);
     this.panel1.ResumeLayout(false);
     this.panel1.PerformLayout();
     this.chartContainer.ResumeLayout(false);
     this.ResumeLayout(false);
     this.PerformLayout();
 }
Exemplo n.º 5
0
        internal void Fcplot(Series actual, Series required, Series alternateRequiredContent,
                             Series alternateActualContent, SeriesList ruleCurves, DateTime[] labelDates,
                             String RequiredLegend, SeriesList userInput, bool greenLines, bool dashed, bool useFB = false)
        {
            tChart1.Zoom.Undo();
            this.tChart1.Series.RemoveAllSeries();
            this.tChart1.Tools.Clear();
            tChart1.Axes.Bottom.Labels.Style = Steema.TeeChart.AxisLabelStyle.Value;

            if (labelDates.Length != ruleCurves.Count)
            {
                throw new Exception("Error: The number of label dates " + labelDates.Length
                                    + " must match the number of forecast levels " + ruleCurves.Count);
            }

            //add green lines
            if (greenLines && !useFB)
            {
                AddRuleCurves(ruleCurves, labelDates, dashed);
            }

            Color[] colors = { Color.DodgerBlue, Color.DarkOrange, Color.DarkKhaki, Color.Teal,
                               Color.Aqua,       Color.Olive,      Color.BurlyWood, Color.MediumSpringGreen,
                               Color.CadetBlue,  Color.Chartreuse, Color.Chocolate, Color.Coral, Color.CornflowerBlue };

            for (int i = 0; i < userInput.Count; i++)
            {
                if (i <= colors.Length)
                {
                    var s = Reclamation.TimeSeries.Math.ShiftToYear(userInput[i], required[0].DateTime.Year);
                    CreateSeries(colors[i], userInput[i].Name, s, "right");
                }
                else
                {
                    var s = Reclamation.TimeSeries.Math.ShiftToYear(userInput[i], required[0].DateTime.Year);
                    CreateSeries(colors[i - colors.Length], userInput[i].Name, s, "right");
                }
            }

            //add alternative lines
            if (alternateRequiredContent.Count > 0) //&& required.Count >0)
            {
                var s = new Series();
                if (!useFB)
                {
                    s = Reclamation.TimeSeries.Math.ShiftToYear(alternateRequiredContent, required[0].DateTime.Year);
                    CreateSeries(Color.BlueViolet, alternateRequiredContent.Name + " " + RequiredLegend, s, "left");
                }
                s = Reclamation.TimeSeries.Math.ShiftToYear(alternateActualContent, required[0].DateTime.Year);
                CreateSeries(Color.LightSkyBlue, alternateActualContent.Name, s, "left");
            }

            //add lines
            if (!useFB)
            {
                CreateSeries(Color.Red, required.Name + " " + RequiredLegend, required, "left", true, 2);
                CreateSeries(Color.Blue, actual.Name + " Storage", actual, "left", false, 2);
            }
            else
            {
                CreateSeries(Color.Blue, actual.Name + " Elevation", actual, "left", false, 2);
                var sDummy = new Series();
                for (DateTime i = actual.MinDateTime; i < ruleCurves[0].MaxDateTime; i = i.AddDays(1))
                {
                    sDummy.Add(i, actual.Values.Average());
                }
                CreateSeries(Color.Transparent, "Dummy", sDummy, "left", false, 0);
            }

            // zoom out a little..
            double min = 0, max = 0;

            tChart1.Axes.Left.Automatic = true;
            tChart1.Axes.Left.CalcMinMax(ref min, ref max);
            if (useFB)
            {
                tChart1.Axes.Left.Maximum = max + (max - min) * 0.1;
                tChart1.Axes.Left.Minimum = min - (max - min) * 0.1;
            }
            else
            {
                tChart1.Axes.Left.Maximum = max * 1.01;
                tChart1.Axes.Left.Minimum = 0;// min - 1000;
            }
            tChart1.Axes.Left.Automatic = false;
            //tChart1.Axes.Bottom.in
            //tChart1.Zoom.ZoomPercent(10);

            // format nearest point
            for (int i = 0; i < tChart1.Series.Count; i++)
            {
                if (tChart1.Series[i].ToString().Any(x => char.IsLetter(x)))
                {
                    Steema.TeeChart.Tools.NearestPoint nearestPoint1 = new Steema.TeeChart.Tools.NearestPoint(tChart1[i]);
                    nearestPoint1.Direction   = Steema.TeeChart.Tools.NearestPointDirection.Horizontal;
                    nearestPoint1.Pen.Color   = tChart1[i].Color;
                    nearestPoint1.Brush.Color = tChart1[i].Color;
                    nearestPoint1.Size        = 5;
                    nearestPoint1.Style       = Steema.TeeChart.Tools.NearestPointStyles.Circle;
                    nearestPoint1.DrawLine    = false;
                    tChart1.Tools.Add(nearestPoint1);

                    // set tool-tip text
                    tChart1[i].GetSeriesMark += Form1_GetSeriesMark;
                }
            }

            // Add point tooltips
            Steema.TeeChart.Tools.MarksTip marksTip1 = new Steema.TeeChart.Tools.MarksTip(tChart1.Chart);
            marksTip1.Style       = Steema.TeeChart.Styles.MarksStyles.XY;
            marksTip1.Active      = true;
            marksTip1.MouseDelay  = 0;
            marksTip1.HideDelay   = 999999;
            marksTip1.MouseAction = Steema.TeeChart.Tools.MarksTipMouseAction.Move;
            marksTip1.BackColor   = Color.LightSteelBlue;
            marksTip1.ForeColor   = Color.Black;
            tChart1.Tools.Add(marksTip1);
        }