private void chartControl1_CustomDrawCrosshair(object sender, CustomDrawCrosshairEventArgs e)
        {
            try
            {
                var ShowText   = "";
                var SelTime    = new DateTime();
                var SelTimeNow = new DateTime();
                var index      = 0;
                foreach (var element in e.CrosshairElements)
                {
                    var point = element.SeriesPoint;
                    SelTime = DateTime.Parse(point.ArgumentSerializable);

                    var analysis = analysisLogList.FirstOrDefault(q => q.AnalysisTime.ToString("yyyy-MM-dd HH:mm:ss").Equals(SelTime.ToString("yyyy-MM-dd HH:mm:ss")));
                    foreach (var element1 in e.CrosshairAxisLabelElements)
                    {
                        SelTimeNow = DateTime.Parse(element1.AxisValue.ToString());
                    }
                    if (index == 0)
                    {
                        element.LabelElement.HeaderText = SelTimeNow.ToString();
                    }
                    ShowText = string.Format("{0}:{1}", element.Series.Name, analysis == null ? "" : analysis.StatusDescription);
                    element.LabelElement.Text = ShowText;
                    index++;
                }
            }
            catch (Exception ex)
            {
                LogHelper.Error("CurvilinearQuery>>chartControl1_CustomDrawCrosshair。 Message: " + ex.Message + ex.StackTrace);
            }
        }
Example #2
0
        /// <summary>
        ///     曲线鼠标移动获取游标的值
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void chart_CustomDrawCrosshair(object sender, CustomDrawCrosshairEventArgs e)
        {
            try
            {
                var       ShowText   = "";
                var       value      = "";
                DataRow[] drs        = null;
                var       SelTime    = "";
                var       SelTimeNow = new DateTime();

                foreach (var element in e.CrosshairElements)
                {
                    var point = element.SeriesPoint;
                    foreach (var element1 in e.CrosshairAxisLabelElements)
                    {
                        SelTimeNow = DateTime.Parse(element1.AxisValue.ToString());
                    }
                    SelTime = SelTimeNow.ToString("yyyy-MM-dd") + " " + SelTimeNow.Hour.ToString("00") + ":00:00";
                    drs     = dt_line.Select("timer='" + SelTime + "' ");
                    if (drs.Length > 0)
                    {
                        ShowText += "测点号:" + element.Series.Name + "\n";
                        ShowText += "开机率:" + double.Parse(drs[0]["A"].ToString()).ToString("0.00") + "%" + "\n";
                        ShowText += "开机时间:" + drs[0]["B"] + "\n";
                        ShowText += "开停次数:" + drs[0]["C"];
                    }
                    element.LabelElement.Text = ShowText; //显示要显示的文字
                }
            }
            catch (Exception ex)
            {
                LogHelper.Error("Kgl_StateBar_chart_CustomDrawCrosshair" + ex.Message +
                                ex.StackTrace);
            }
        }
 private void OnCustomDrawCrosshair(object sender, CustomDrawCrosshairEventArgs e)
 {
     foreach (CrosshairElementGroup group in e.CrosshairElementGroups)
     {
         if (group.CrosshairElements[0] != null)
         {
             group.HeaderElement.Text = String.Format("Sales in {0:yyyy}", group.CrosshairElements[0].SeriesPoint.DateTimeArgument);
         }
         foreach (CrosshairElement element in group.CrosshairElements)
         {
             Bitmap image;
             if (!bitmapCache.TryGetValue(element.Series.Name, out image))
             {
                 image = new Bitmap(totalWidth, totalHeight);
                 using (Graphics graphics = Graphics.FromImage(image)) {
                     using (SolidBrush brush = new SolidBrush(element.LabelElement.MarkerColor)) {
                         graphics.FillRectangle(brush, totalRect);
                     }
                     Image photo;
                     if (photoCache.TryGetValue(element.Series.Name, out photo))
                     {
                         graphics.DrawImage(photo, photoRect);
                     }
                 }
                 bitmapCache.Add(element.Series.Name, image);
             }
             element.LabelElement.MarkerImage = image;
             element.LabelElement.MarkerSize  = new Size(totalWidth, totalHeight);
         }
     }
 }
Example #4
0
 private void chart_CustomDrawCrosshair(object sender, CustomDrawCrosshairEventArgs e)
 {
     foreach (CrosshairElement element in e.CrosshairElements)
     {
         SeriesPoint point = element.SeriesPoint;
         label1.Text = point.Argument.ToString();//显示要显示的文字
     }
 }
Example #5
0
        /// <summary>
        ///     曲线鼠标移动获取游标的值
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void chart_CustomDrawCrosshair(object sender, CustomDrawCrosshairEventArgs e)
        {
            try
            {
                var       ShowText   = "";
                var       value      = "";
                DataRow[] drs        = null;
                string    SelTime    = "";
                var       SelTimeNow = new DateTime();

                foreach (var element in e.CrosshairElements)
                {
                    var point = element.SeriesPoint;
                    //foreach (CrosshairAxisLabelElement element1 in e.CrosshairAxisLabelElements)
                    //{
                    //    SelTimeNow = DateTime.Parse(element1.AxisValue.ToString());
                    //    //大于300毫秒或有组件显示或隐藏才进行重绘
                    //    TimeSpan mouseMoveTimeStep = System.DateTime.Now - lastMouseMoveTime;
                    //    if (mouseMoveTimeStep.TotalMilliseconds >= 2000)
                    //    {
                    //        lastMouseMoveTime = System.DateTime.Now;

                    //        ChartGridDis(SelTimeNow);
                    //        _isScale = false;
                    //    }
                    //}
                    //label1.Text = point.Argument.ToString();//显示要显示的文字
                    SelTime = DateTime.Parse(point.ArgumentSerializable).ToString("yyyy-MM-dd HH:mm:ss.fff");
                    drs     = dt_line.Select("sTimer='" + SelTime + "' ");
                    if (drs.Length > 0)
                    {
                        if (drs[0]["C"].ToString() == "0.00001")
                        {
                            value = "未记录";
                        }
                        else
                        {
                            value = drs[0]["stateName"].ToString();
                        }
                        ShowText += "测点号:" + element.Series.Name + "\n";
                        ShowText += "起止时刻:" + Convert.ToDateTime(drs[0]["sTimer"]).ToString("yyyy-MM-dd HH:mm:ss.fff")
                                    + "-" + Convert.ToDateTime(drs[0]["eTimer"]).ToString("yyyy-MM-dd HH:mm:ss.fff") + "\n";
                        ShowText += "报警及断电状态:" + value + "\n";
                        if (InterfaceClass.QueryPubClass_.GetPointIsBindControl(element.Series.Name))
                        {
                            ShowText += "馈电状态:" + drs[0]["D"] + "\n";
                        }
                        ShowText += "处理措施:" + drs[0]["E"];
                    }
                    element.LabelElement.Text = ShowText; //显示要显示的文字
                }
            }
            catch (Exception ex)
            {
                LogHelper.Error("Kgl_StateLine_chart_CustomDrawCrosshair" + ex.Message +
                                ex.StackTrace);
            }
        }
Example #6
0
 private void CountryChart_CustomDrawCrosshair(object sender, CustomDrawCrosshairEventArgs e)
 {
     foreach (CrosshairElement element in e.CrosshairElements)
     {
         SeriesPoint point = element.SeriesPoint;
         element.LabelElement.MarkerImageSizeMode = ChartImageSizeMode.Stretch;
         element.LabelElement.MarkerSize          = new Size(10, 10); // 大小
         element.LabelElement.Text = point.Values[0].ToString();      //显示要显示的文字
     }
 }
        private void chartControl1_CustomDrawCrosshair(object sender, CustomDrawCrosshairEventArgs e)
        {
            if (!handleCustomDraw)
            {
                return;
            }

            // Specify the crosshair argument line color, dash style and thickness.
            e.CrosshairLineElement.Brush = Brushes.Aqua;
            e.CrosshairLineElement.LineStyle.DashStyle = DashStyles.DashDot;
            e.CrosshairLineElement.LineStyle.Thickness = 3;

            // Specify  the back color for crosshair argument label.
            foreach (CrosshairAxisLabelElement axisLabelElement in e.CrosshairAxisLabelElements)
            {
                axisLabelElement.Background = Brushes.Blue;
            }

            foreach (CrosshairElementGroup group in e.CrosshairElementGroups)
            {
                CrosshairElement element = group.CrosshairElements[0];

                // Specify the color, dash style and thickness for the crosshair value lines.
                element.LineElement.Brush = Brushes.DarkViolet;
                element.LineElement.LineStyle.DashStyle = DashStyles.Dash;
                element.LineElement.LineStyle.Thickness = 2;

                // Specify the  font size and background for the crosshair value labels.
                element.AxisLabelElement.FontSize   = 14;
                element.AxisLabelElement.Background = Brushes.Red;

                // Specify the foreground and  font size for the crosshair  cursor label that shows series.
                if (element.SeriesPoint.Value > 50)
                {
                    element.LabelElement.Foreground = Brushes.Green;
                    element.LabelElement.FontSize   = 14;
                }
            }

            foreach (CrosshairElementGroup group in e.CrosshairElementGroups)
            {
                CrosshairGroupHeaderElement groupHeaderElement = group.HeaderElement;

                // Specify the text, text color and font for the crosshair group header element.
                groupHeaderElement.Text       = "Custom draw";
                groupHeaderElement.Foreground = Brushes.Red;
                groupHeaderElement.FontSize   = 15;
            }
        }
Example #8
0
 private void inventoryChart_CustomDrawCrosshair(object sender, CustomDrawCrosshairEventArgs e)
 {
     foreach (CrosshairElement element in e.CrosshairElements)
     {
         SeriesPoint currentPoint = element.SeriesPoint;
         if (currentPoint.Tag.GetType() == typeof(InventoryChart.BO.CategoryItem))
         {
             InventoryChart.BO.CategoryItem       currentCategory      = (InventoryChart.BO.CategoryItem)currentPoint.Tag;
             List <InventoryChart.BO.ProductItem> productItems         = ((BO)this.bOBindingSource.DataSource).ProductItems;
             InventoryChart.BO.ProductItem        mostExpensiveProduct = productItems.Where(p => p.CategoryID == currentCategory.CategoryID).OrderByDescending(p => p.ProductPrice).First() as InventoryChart.BO.ProductItem;
             element.LabelElement.Text += string.Format("\nMost expensive product:\n{0} : {1:c}",
                                                        mostExpensiveProduct.ProductName,
                                                        mostExpensiveProduct.ProductPrice);
         }
     }
 }
Example #9
0
        protected internal void GetArgumentValue(object sender, CustomDrawCrosshairEventArgs e)
        {
            if (e.CrosshairElementGroups.Count > 0)
            {
                foreach (CrosshairElement element in e.CrosshairElementGroups[0].CrosshairElements)
                {
                    element.LabelElement.Text =
                        Data.Single(d => d.Date.Date == element.SeriesPoint.DateTimeArgument.Date && d.Id ==
                                    Convert.ToInt32(element.Series.DisplayName)).Name + ": " + element.SeriesPoint.Value;
                }

                SelectedDate = e.CrosshairElementGroups[0].CrosshairElements[0].SeriesPoint.DateTimeArgument;
                e.CrosshairElementGroups[0].HeaderElement.Text = ((DateTime)SelectedDate).ToString("yyyy. MM. dd.", CultureInfo.CurrentCulture);
            }
            else
            {
                SelectedDate = null;
            }
        }
        private void chartControl1_CustomDrawCrosshair(object sender, CustomDrawCrosshairEventArgs e)
        {
            if (!handleCustomDraw)
            {
                return;
            }

            // Specify the crosshair argument line color and thickness.
            e.CrosshairLineElement.Brush = Brushes.Red;
            e.CrosshairLineElement.LineStyle.Thickness = 3;

            // Specify  the background  and font size for the crosshair argument label.
            foreach (CrosshairAxisLabelElement axisLabelElement in e.CrosshairAxisLabelElements)
            {
                axisLabelElement.Background = Brushes.Blue;
                axisLabelElement.FontSize   = 14;
            }

            foreach (CrosshairElement element in e.CrosshairElements)
            {
                // Specify the color and thickness for the crosshair value lines.
                element.LineElement.Brush = Brushes.Blue;
                element.LineElement.LineStyle.Thickness = 2;

                // Specify the  font size and background for the crosshair value labels.
                element.AxisLabelElement.FontSize   = 14;
                element.AxisLabelElement.Background = Brushes.Red;

                // Specify the foreground and  font size for the crosshair  cursor label that shows series.
                element.LabelElement.Foreground = Brushes.Red;
                element.LabelElement.FontSize   = 14;
            }

            foreach (CrosshairGroupHeaderElement groupHeaderElement in e.CrosshairGroupHeaderElements)
            {
                //  Specify the font style, foreground and font size for the crosshair group header element.
                groupHeaderElement.FontStyle  = FontStyles.Italic;
                groupHeaderElement.Foreground = Brushes.Red;
                groupHeaderElement.FontSize   = 15;
            }
        }
Example #11
0
        private void OnChartControlCustomDrawCrosshair(object sender, CustomDrawCrosshairEventArgs e)
        {
            // Specify the crosshair argument line color, dash style and thickness.
            e.CrosshairLineElement.Color = Color.Green;
            e.CrosshairLineElement.LineStyle.DashStyle = DashStyle.DashDot;
            e.CrosshairLineElement.LineStyle.Thickness = 3;

            // Specify the back color for the crosshair argument axis label.
            foreach (CrosshairAxisLabelElement axisLabelElement in e.CrosshairAxisLabelElements)
            {
                axisLabelElement.BackColor = Color.Blue;
            }

            foreach (CrosshairElementGroup group in e.CrosshairElementGroups)
            {
                CrosshairGroupHeaderElement groupHeaderElement = group.HeaderElement;

                // Specify the text, text color and font for the crosshair group header element.
                groupHeaderElement.Text      = "Custom draw";
                groupHeaderElement.TextColor = Color.Green;
                groupHeaderElement.Font      = SystemFonts.DefaultFont;

                // Obtain the first series.
                CrosshairElement element = group.CrosshairElements[0];

                // Specify the color, dash style and thickness for the crosshair value lines.
                element.LineElement.Color = Color.DarkViolet;
                element.LineElement.LineStyle.DashStyle = DashStyle.Dash;
                element.LineElement.LineStyle.Thickness = 2;

                // Specify the text color and back color for the crosshair value labels.
                element.AxisLabelElement.TextColor = Color.Red;
                element.AxisLabelElement.BackColor = Color.Yellow;

                // Format the text shown for the series in the crosshair cursor label. Specify the text color and marker size.
                element.LabelElement.TextColor  = Color.Red;
                element.LabelElement.MarkerSize = new Size(15, 15);
                element.LabelElement.Text       = string.Format("{0}: A={1}; V={2}", element.Series.Name, element.SeriesPoint.Argument, element.SeriesPoint.Values[0]);
            }
        }
Example #12
0
        protected void Mychart_CustomCrosshairsPoint(object sender, CustomDrawCrosshairEventArgs e)
        {
            e.CrosshairLineElement.Color = Color.Green;
            e.CrosshairLineElement.LineStyle.DashStyle = DashStyle.DashDot;
            e.CrosshairLineElement.LineStyle.Thickness = 3;

            // Specify  the back color for crosshair argument label.
            foreach (CrosshairAxisLabelElement axisLabelElement in e.CrosshairAxisLabelElements)
            {
                axisLabelElement.BackColor = Color.Blue;
            }

            foreach (CrosshairElementGroup group in e.CrosshairElementGroups)
            {
                CrosshairElement element = group.CrosshairElements[0];

                // Specify the color, dash style and thickness for the crosshair value lines.
                element.LineElement.Color = Color.DarkViolet;
                element.LineElement.LineStyle.DashStyle = DashStyle.Dash;
                element.LineElement.LineStyle.Thickness = 2;

                // Specify the  text color and back color for the crosshair value labels.
                element.AxisLabelElement.TextColor = Color.Red;
                element.AxisLabelElement.BackColor = Color.Yellow;

                // Specify the text color and marker size for the crosshair  cursor label that shows series.
                element.LabelElement.TextColor  = Color.Red;
                element.LabelElement.MarkerSize = new Size(15, 15);
            }

            foreach (CrosshairElementGroup group in e.CrosshairElementGroups)
            {
                CrosshairGroupHeaderElement groupHeaderElement = group.HeaderElement;

                // Specify the text, text color and font for the crosshair group header element.
                groupHeaderElement.Text      = "Custom draw";
                groupHeaderElement.TextColor = Color.Green;
                //groupHeaderElement.Font = new Font(this.Font, FontStyle.Bold);
            }
        }
Example #13
0
 private void chartControl1_CustomDrawCrosshair(object sender, CustomDrawCrosshairEventArgs e)
 {
 }
Example #14
0
        /// <summary>
        ///     曲线鼠标移动获取游标的值
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void chart_CustomDrawCrosshair(object sender, CustomDrawCrosshairEventArgs e)
        {
            try
            {
                var       ShowText = "";
                var       SelTime  = new DateTime();
                DataRow[] drs      = null;
                var       index    = 0;

                foreach (var element in e.CrosshairElements)
                {
                    var point = element.SeriesPoint;
                    //label1.Text = point.Argument.ToString();//显示要显示的文字
                    SelTime = DateTime.Parse(point.ArgumentSerializable);
                    //if (index == 0)
                    //{
                    //    if (element.Series.Name != "密采值")
                    //    {
                    //        //大于300毫秒或有组件显示或隐藏才进行重绘
                    //        TimeSpan mouseMoveTimeStep = System.DateTime.Now - lastMouseMoveTime;
                    //        if (mouseMoveTimeStep.TotalMilliseconds >= 2000)
                    //        {
                    //            lastMouseMoveTime = System.DateTime.Now;

                    //            ChartGridDis(SelTime);

                    //            _isScale = false;
                    //        }
                    //    }
                    //}
                    if (element.Series.Name.Contains("最大值") || element.Series.Name.Contains("最小值") || element.Series.Name.Contains("平均值"))
                    {
                        drs = dt_line.Select("Timer='" + SelTime.ToString("yyyy-MM-dd HH:mm") + ":00' ");
                        if (drs.Length > 0)
                        {
                            if (point.Values[0].ToString() == "1E-05")
                            {
                                ShowText = element.Series.Name + ":" + "未记录";
                            }
                            else
                            {
                                ShowText = element.Series.Name + ":" + point.Values[0].ToString("f2") + PointDw;
                            }
                        }
                    }
                    else
                    {
                        ShowText = element.Series.Name + ":" + point.Values[0].ToString("f2");
                    }
                    if (index == 0)
                    {
                        element.LabelElement.HeaderText = "时间:" + SelTime.ToString("yyyy-MM-dd HH:mm") + "\n";
                    }


                    element.LabelElement.Text = ShowText; //显示要显示的文字
                    index++;
                }
            }
            catch (Exception ex)
            {
                LogHelper.Error("Mnl_DayZdzLine_chart_CustomDrawCrosshair" + ex.Message + ex.StackTrace);
            }
        }