Ejemplo n.º 1
0
 private void chartControl1_MouseDown(object sender, MouseEventArgs e)
 {
     if (CanMouseDown)
     {
         ChartHitInfo hitInfo = chartControl1.CalcHitInfo(chartControl1.PointToClient(new Point(Cursor.Position.X, Cursor.Position.Y)));
         if (hitInfo.SeriesPoint != null)
         {
             if (!hitInfo.SeriesPoint.IsEmpty)
             {
                 int    count = Convert.ToInt32(hitInfo.SeriesPoint.Values[0]);
                 string name  = "【" + hitInfo.SeriesPoint.Argument + "】" + hitInfo.Series.LegendText;
                 DynamicCreateSubDiagram(count, name);
             }
         }
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// chart钻取实现【在MouseClick事件中实现】
        /// </summary>
        /// <param name="chart">ChartControl</param>
        /// <param name="e">MouseEventArgs</param>
        /// <param name="backKeyWord">返回主Series的关键字</param>
        /// <param name="gotoHandler">向下钻取委托</param>
        /// <param name="backHandler">返回主Series的委托</param>
        public static void DrillDownHelper(this ChartControl chart, MouseEventArgs e, string backKeyWord, Action <SeriesPoint> gotoHandler, Action <SeriesPoint> backHandler)
        {
            //eg:
            //private void chartLh_MouseClick(object sender, MouseEventArgs e)
            //{
            //    ChartControl _curChart = sender as ChartControl;
            //    _curChart.DrillDownHelper(
            //        e,
            //        "返回",
            //        point =>
            //        {
            //            string _argument = point.Argument.ToString();
            //            if (_curChart.Series["pieSeries"].Visible)
            //            {
            //                _curChart.Series["pieSeries"].Visible = false;
            //                _curChart.SeriesTemplate.Visible = true;
            //                if (_curChart.SeriesTemplate.DataFilters.Count == 0)
            //                    _curChart.SeriesTemplate.AddDataFilter("categoryName", _argument, DataFilterCondition.Equal);
            //                else
            //                    _curChart.SeriesTemplate.DataFilters[0].Value = _argument;
            //                _curChart.Titles[1].Visible = true;
            //                _curChart.Titles[0].Visible = false;
            //            }
            //        },
            //        point =>
            //        {
            //            _curChart.Titles[0].Visible = true;
            //            _curChart.Series["pieSeries"].Visible = true;
            //            _curChart.SeriesTemplate.Visible = false;
            //        });
            //}
            ChartHitInfo _hitInfo = chart.CalcHitInfo(e.X, e.Y);
            SeriesPoint  _point   = _hitInfo.SeriesPoint;

            if (_point != null)
            {
                gotoHandler(_point);
            }
            ChartTitle link = _hitInfo.ChartTitle;

            if (link != null && link.Text.StartsWith(backKeyWord))
            {
                link.Visibility = DefaultBoolean.False;
                backHandler(_point);
            }
        }
Ejemplo n.º 3
0
        private void chartControl1_MouseMove(object sender, MouseEventArgs e)
        {
            try
            {
                chartControl1.Cursor = Cursors.Default;

                if (!_chartGenerated || _tradeRecords == null || !_tradeRecords.Any())
                {
                    return;
                }

                ChartHitInfo hitInfo = chartControl1.CalcHitInfo(e.Location);

                if (hitInfo.InDiagram)
                {
                    DiagramCoordinates dc = (chartControl1.Diagram as XYDiagram).PointToDiagram(e.Location);

                    if (!dc.IsEmpty && _currentDate.ToShortDateString() != dc.QualitativeArgument)
                    {
                        _currentDate = CommonHelper.StringToDateTime(dc.QualitativeArgument);
                        var currentDateRecords = _tradeRecords.Where(x => x.TradeDate == _currentDate).ToList();
                        this.gridControl1.DataSource = currentDateRecords;

                        esiProfitTitle.Text = $@"{_currentDate.ToShortDateString()} - {_tradeInfo.DisplayText}";

                        DataRow currentProfit = _positionProfit.AsEnumerable().SingleOrDefault(x => x.Field <DateTime>("TradeDate") == _currentDate);
                        if (currentProfit != null)
                        {
                            txtVolume.Text = CommonHelper.StringToDecimal(currentProfit["PositionVolume"].ToString()).ToString("N0");
                            txtValue.Text  = CommonHelper.StringToDecimal(currentProfit["PositionValue"].ToString()).ToString("N4");
                            txtProfit.Text = CommonHelper.StringToDecimal(currentProfit["DayProfit"].ToString()).ToString("N4");
                        }
                        else
                        {
                            txtVolume.Text = string.Empty;
                            txtValue.Text  = string.Empty;
                            txtProfit.Text = string.Empty;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                DXMessage.ShowError(ex.Message);
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 设置钻取
        /// </summary>
        /// <param name="chart">ChartControl</param>
        /// <param name="backKeyWord">返回主Series的关键字</param>
        /// <param name="gotoHandler">向下钻取委托;参数【SeriesPoint】</param>
        /// <param name="backHandler">返回主Series的委托;参数【SeriesPoint】</param>
        public static void SetDrillDown(this ChartControl chart, string backKeyWord, Action <SeriesPoint> gotoHandler, Action <SeriesPoint> backHandler)
        {
            //eg:
            // chartLh.SetDrillDown(
            // "返回",
            //  point =>
            //{
            //    string _argument = point.Argument.ToString();
            //    if (chartLh.Series["pieSeries"].Visible)
            //    {
            //        chartLh.Series["pieSeries"].Visible = false;
            //        chartLh.SeriesTemplate.Visible = true;
            //        if (chartLh.SeriesTemplate.DataFilters.Count == 0)
            //            chartLh.SeriesTemplate.AddDataFilter("categoryName", _argument, DataFilterCondition.Equal);
            //        else
            //            chartLh.SeriesTemplate.DataFilters[0].Value = _argument;
            //        chartLh.Titles[1].Visible = true;
            //        chartLh.Titles[0].Visible = false;
            //    }
            //},
            //  point =>
            //{
            //    chartLh.Titles[0].Visible = true;
            //    chartLh.Series["pieSeries"].Visible = true;
            //    chartLh.SeriesTemplate.Visible = false;
            //});
            chart.MouseClick += (sender, e) =>
            {
                ChartControl _curChart = sender as ChartControl;
                ChartHitInfo _hitInfo  = _curChart.CalcHitInfo(e.X, e.Y);
                SeriesPoint  _point    = _hitInfo.SeriesPoint;

                if (_point != null)
                {
                    gotoHandler(_point);
                }

                ChartTitle link = _hitInfo.ChartTitle;

                if (link != null && link.Text.StartsWith(backKeyWord))
                {
                    link.Visible = false;
                    backHandler(_point);
                }
            };
        }
        void Chart_MouseUp(object sender, MouseButtonEventArgs e)
        {
            ChartHitInfo hitInfo = Chart.CalcHitInfo(e.GetPosition(Chart));

            if (hitInfo == null || hitInfo.SeriesPoint == null || !IsClick(DateTime.Now))
            {
                return;
            }
            double     distance   = PieSeries.GetExplodedDistance(hitInfo.SeriesPoint);
            Storyboard storyBoard = new Storyboard();
            var        animation  = distance > 0 ? CollapseAnimation : ExpandAnimation;

            storyBoard.Children.Add(animation);
            Storyboard.SetTarget(animation, hitInfo.SeriesPoint);
            Storyboard.SetTargetProperty(animation, new PropertyPath(PieSeries.ExplodedDistanceProperty));
            storyBoard.Begin();
        }
Ejemplo n.º 6
0
        void chart_MouseUp(object sender, MouseButtonEventArgs e)
        {
            ChartHitInfo hitInfo = chart.CalcHitInfo(e.GetPosition(chart));

            if (hitInfo == null || hitInfo.SeriesPoint == null || PieSeries.GetExplodedDistance(hitInfo.SeriesPoint) > 0)
            {
                return;
            }
            foreach (SeriesPoint point in chart.Diagram.Series[0].Points)
            {
                if (PieSeries.GetExplodedDistance(point) > 0 && point != hitInfo.SeriesPoint)
                {
                    AnimateExploding(point, true);
                }
            }
            AnimateExploding(hitInfo.SeriesPoint, false);
            UpdateChargeInfo(hitInfo.SeriesPoint);
        }
        private void OnMouseMove(object sender, MouseEventArgs e)
        {
            ChartHitInfo hitInfo = chart.CalcHitInfo(e.X, e.Y);

            if (hitInfo.AxisTitle != null)
            {
                tooltipController.ShowHint(
                    String.Format(
                        "The pointer is over the {0} object.",
                        hitInfo.AxisTitle.GetType().ToString()
                        )
                    );
            }
            else
            {
                tooltipController.HideHint();
            }
        }
Ejemplo n.º 8
0
 /// <summary>
 /// ChartControl的Tooltip设置
 /// <para>举例</para>
 /// <code>
 /// <para> chartControl1.SetToolTip(toolTipController1, "交易详情", (agr, values) =></para>
 /// <para>{</para>
 /// <para> return string.Format("时间:{0}\r\n金额:{1}", agr, values[0]);</para>
 /// <para>});</para>
 /// </code>
 /// </summary>
 /// <param name="chart">ChartControl</param>
 /// <param name="tooltip">ToolTipController</param>
 /// <param name="tooltipTitle">ToolTip的Title</param>
 /// <param name="paramter">委托,参数『Argument,Values』</param>
 public static void SetToolTip(this ChartControl chart, ToolTipController tooltip, string tooltipTitle, System.Func <string, double[], string> paramter)
 {
     chart.MouseMove += (sender, e) =>
     {
         ChartControl _curChart = sender as ChartControl;
         ChartHitInfo _hitInfo  = _curChart.CalcHitInfo(e.X, e.Y);
         SeriesPoint  _point    = _hitInfo.SeriesPoint;
         if (_point != null)
         {
             string _msg = paramter(_point.Argument, _point.Values);
             tooltip.ShowHint(_msg, tooltipTitle);
         }
         else
         {
             tooltip.HideHint();
         }
     };
 }
Ejemplo n.º 9
0
        private void chartVehicleByTimeFrame_MouseMove(object sender, MouseEventArgs e)
        {
            try
            {
                // Obtain hit information under the test point.
                ChartHitInfo hi = this.chartTurnOverByTimeFrame.CalcHitInfo(e.X, e.Y);


                // Obtain the series point under the test point.
                SeriesPoint point = hi.SeriesPoint;

                // Check whether the series point was clicked or not.
                if (point != null)
                {
                    // Obtain the series point argument.
                    string argument = "Maand: " + point.Argument.ToString();

                    // Obtain series point values.

                    string values = "Omzet: " + Math.Round(point.Values[0], 0).ToString() + " €";
                    if (point.Values.Length > 1)
                    {
                        for (int i = 1; i < point.Values.Length; i++)
                        {
                            values = values + ", " + point.Values[i].ToString();
                        }
                    }

                    // Show the tooltip.
                    toolTipController2.ShowHint(argument + "\n" + values, "Omzet " + hi.Series.LegendText);
                }
                else
                {
                    // Hide the tooltip.
                    toolTipController2.HideHint();
                }
            }
            catch (System.Exception exception1)
            {
                Exception thisException = exception1;
                Management.ShowException(thisException);
            }
        }
Ejemplo n.º 10
0
        private void chartControl_MouseMove(object sender, MouseEventArgs e)
        {
            ChartHitInfo info = this.chartControl.CalcHitInfo(e.Location);

            try {
                if (info.SeriesPoint != null)
                {
                    DateTime     dt    = info.SeriesPoint.DateTimeArgument;
                    PropertyInfo pi    = Visual.Items[0].GetType().GetProperty("Time", BindingFlags.Instance | BindingFlags.Public);
                    int          index = Visual.Items.FindIndex(d => object.Equals(pi.GetValue(d), dt));
                    this.bsIndex.Caption = "Index = " + index;
                }
                else
                {
                    this.bsIndex.Caption = "";
                }
            }
            catch (Exception) {
            }
        }
        void AnimationEnd(object sender, Point e)
        {
            ChartHitInfo hitInfo = (sender as ChartControl).CalcHitInfo(e);

            rotate = false;
            if (hitInfo == null || hitInfo.SeriesPoint == null || !IsClick(DateTime.Now))
            {
                return;
            }
            double          distance   = PieSeries.GetExplodedDistance(hitInfo.SeriesPoint);
            Storyboard      storyBoard = new Storyboard();
            DoubleAnimation animation  = new DoubleAnimation();

            animation.Duration = new Duration(new TimeSpan(0, 0, 0, 0, 300));
            animation.To       = distance > 0 ? 0 : 0.3;
            storyBoard.Children.Add(animation);
            Storyboard.SetTarget(animation, hitInfo.SeriesPoint);
            Storyboard.SetTargetProperty(animation, new PropertyPath(PieSeries.ExplodedDistanceProperty));
            storyBoard.Begin();
        }
 private void chartTypeControl_MouseClick(object sender, MouseEventArgs e)
 {
     if (mousepoint != e.Location)
     {
         mousepoint = e.Location;
         ChartHitInfo hitInfo = this.chart_type.CalcHitInfo(e.Location);
         if (hitInfo.SeriesPoint != null)
         {
             // MessageBox.Show(hitInfo.SeriesPoint.Tag.ToString());
             //MyForm.BusinessDetails.OrderListForm orderListForm = new MyForm.BusinessDetails.OrderListForm();
             //orderListForm.orderListControl1.gridControl1.DataSource = dsa;
             //orderListForm.StartPosition = FormStartPosition.CenterScreen;
             //orderListForm.ShowDialog();
             MyForm.BusinessDetails.OrderDatilForm orderDatil = new MyForm.BusinessDetails.OrderDatilForm(hitInfo.Series.Tag);
             orderDatil.StartPosition = FormStartPosition.CenterScreen;
             orderDatil.WindowState   = FormWindowState.Maximized;
             orderDatil.ShowDialog();
         }
     }
 }
Ejemplo n.º 13
0
        private void chart1_MouseClick(object sender, MouseEventArgs e)
        {
            ChartHitInfo hi    = chart1.CalcHitInfo(new System.Drawing.Point(e.X, e.Y));
            SeriesPoint  point = hi.SeriesPoint;

            if (point != null)
            {
                // Obtain the series point argument.
                string   argument = point.Argument.ToString(); //DATE
                DateTime dt       = Convert.ToDateTime(argument);
                string   InDate   = dt.ToString("yyyy-MM-dd");
                lbSelDate.Text = InDate;
                LoadEQPDataBy1Date(InDate);
                // Obtain series point values.
                //string values = "Value(s): " + point.Values[0].ToString();
                //if (point.Values.Length > 1)
                //{
                //    for (int i = 1; i < point.Values.Length; i++)
                //    {
                //        values = values + ", " + point.Values[i].ToString();
                //    }
                //}
            }
            //Series hitArea = (Series)hi.HitTest.;
            //this.Text = hi.HitTest.ToString();
            //tooltip.Show("X=" + hi.HitTest.ToString(), this.chart1, e.Location.X, e.Location.Y - 15);
            //var pos = e.Location;
            //clickPosition = pos;
            //var results = chart1.HitTest(pos.X, pos.Y);
            //foreach (var result in results)
            //{
            //    if (result. == ChartElementType.PlottingArea)
            //    {
            //        var xVal = result.ChartArea.AxisX.PixelPositionToValue(pos.X);
            //        var yVal = result.ChartArea.AxisY.PixelPositionToValue(pos.Y);

            //        tooltip.Show("X=" + xVal + ", Y=" + yVal,
            //                     this.chart1, e.Location.X, e.Location.Y - 15);
            //    }
            //}
        }
        private void chartControl1_MouseMove(object sender, MouseEventArgs e)
        {
            ChartHitInfo  hitInfo = chartControl1.CalcHitInfo(e.Location);
            StringBuilder builder = new StringBuilder();

            if (hitInfo.SeriesPoint != null)
            {
                if (hitInfo.InSeries)
                {
                    string SeriesName = ((Series)hitInfo.Series).Name;
                    if (SeriesName == "Series 1")
                    {
                        decimal Values  = Convert.ToDecimal(hitInfo.SeriesPoint.Values[0].ToString());
                        decimal precent = Math.Round((Values / sum1 * 100), 2);
                        string  str     = "对应用户群菜品销量\n";
                        str += hitInfo.SeriesPoint.Argument.ToString();
                        str += ":";
                        str += hitInfo.SeriesPoint.Values[0].ToString();
                        str += "(";
                        str += precent.ToString();
                        str += "%";
                        str += ")";
                        toolTipController.ShowHint(str, chartControl1.PointToScreen(e.Location));
                    }
                    else if (SeriesName == "Series 2")
                    {
                        decimal Values  = Convert.ToDecimal(hitInfo.SeriesPoint.Values[0].ToString());
                        decimal precent = Math.Round((Values / sum2 * 100), 2);
                        string  str     = "顾客占比\n";
                        str += hitInfo.SeriesPoint.Argument.ToString();
                        str += ":";
                        str += hitInfo.SeriesPoint.Values[0].ToString();
                        str += "(";
                        str += precent.ToString();
                        str += "%";
                        str += ")";
                        toolTipController.ShowHint(str, chartControl1.PointToScreen(e.Location));
                    }
                }
            }
        }
        void chart_MouseMove(object sender, MouseEventArgs e)
        {
            Point        position = e.GetPosition(chart);
            ChartHitInfo hitInfo  = chart.CalcHitInfo(position);

            if (hitInfo != null && hitInfo.SeriesPoint != null)
            {
                ttContent.Text = string.Format("Year = {0}\nState = {1}\nGSP = {2}",
                                               hitInfo.SeriesPoint.Series.DisplayName, hitInfo.SeriesPoint.Argument,
                                               Math.Round(hitInfo.SeriesPoint.NonAnimatedValue, 2));
                pointTooltip.HorizontalOffset = position.X + toolTipOffset;
                pointTooltip.VerticalOffset   = position.Y + toolTipOffset;
                pointTooltip.IsOpen           = true;
                Cursor = Cursors.Hand;
            }
            else
            {
                pointTooltip.IsOpen = false;
                Cursor = Cursors.Arrow;
            }
        }
Ejemplo n.º 16
0
        private void chartControl1_MouseMove(object sender, MouseEventArgs e)
        {
            ChartHitInfo hitInfo = chartControl1.CalcHitInfo(e.GetPosition(chartControl1));

            if (hitInfo != null && hitInfo.SeriesPoint != null)
            {
                SeriesPoint point = hitInfo.SeriesPoint;

                tooltip_text.Text = string.Format("Series = {0}\nArgument = {1}\nValue = {2}",
                                                  point.Series.DisplayName, point.Argument, point.Value);
                tooltip1.Placement = PlacementMode.Mouse;

                tooltip1.IsOpen = true;
                Cursor          = Cursors.Hand;
            }
            else
            {
                tooltip1.IsOpen = false;
                Cursor          = Cursors.Arrow;
            }
        }
        private void chartControl3_MouseMove(object sender, MouseEventArgs e)
        {
            ChartHitInfo  hitInfo = chartControl3.CalcHitInfo(e.Location);
            StringBuilder builder = new StringBuilder();
            string        str     = "多角度分析图\n";

            if (hitInfo.SeriesPoint != null)
            {
                if (hitInfo.InSeries)
                {
                    DevExpress.XtraCharts.SeriesPointCollection seriesPoint = ((Series)hitInfo.Series).Points;
                    for (int i = 0; i < seriesPoint.Count; i++)
                    {
                        str += seriesPoint[i].Argument;
                        str += ":";
                        str += seriesPoint[i].Values[0].ToString();
                        str += "\n";
                    }
                    toolTipController.ShowHint(str, chartControl3.PointToScreen(e.Location));
                }
            }
        }
        /// <summary>
        /// 环形图左键放开事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void chart_MouseUp(object sender, MouseButtonEventArgs e)
        {
            ChartControl chartName = sender as ChartControl;
            ChartHitInfo hitInfo   = chartName.CalcHitInfo(e.GetPosition(chartName));

            if (hitInfo == null || hitInfo.SeriesPoint == null)
            {
                return;
            }
            double          distance   = PieSeries.GetExplodedDistance(hitInfo.SeriesPoint);
            Storyboard      storyBoard = new Storyboard();
            DoubleAnimation animation  = new DoubleAnimation();

            animation.Duration = new Duration(new TimeSpan(0, 0, 0, 0, 300));
            animation.To       = distance > 0 ? 0 : 0.3;
            storyBoard.Children.Add(animation);
            Storyboard.SetTarget(animation, hitInfo.SeriesPoint);
            Storyboard.SetTargetProperty(animation, new PropertyPath(PieSeries.ExplodedDistanceProperty));
            storyBoard.Begin();

            e.Handled = true;
        }
Ejemplo n.º 19
0
        void chart_MouseUp(object sender, MouseButtonEventArgs e)
        {
            isLeftMouseButtonReleased = true;
            if (!IsClick(e.Timestamp))
            {
                return;
            }
            ChartHitInfo hitInfo = chart.CalcHitInfo(e.GetPosition(chart));

            if (hitInfo == null || hitInfo.SeriesPoint == null)
            {
                return;
            }
            double            distance   = PieSeries.GetExplodedDistance(hitInfo.SeriesPoint);
            AnimationTimeline animation  = distance > 0 ? (AnimationTimeline)TryFindResource("CollapseAnimation") : (AnimationTimeline)TryFindResource("ExplodeAnimation");
            Storyboard        storyBoard = new Storyboard();

            storyBoard.Children.Add(animation);
            Storyboard.SetTarget(animation, hitInfo.SeriesPoint);
            Storyboard.SetTargetProperty(animation, new PropertyPath(PieSeries.ExplodedDistanceProperty));
            storyBoard.Begin();
        }
Ejemplo n.º 20
0
        //private Popup pop = new Popup();
        private void Chart_MouseUp(object sender, MouseButtonEventArgs e)
        {
            if (pop != null && pop.Child != null)
            {
                pop.Child  = null;
                pop.IsOpen = false;
                //tmp = null;
            }
            ChartControl chart = sender as ChartControl;

            if (chart.Name != "KGChart")
            {
                System.Windows.Point mouseposition = e.GetPosition(mainFrame);
                ChartHitInfo         hitInfo       = chart.CalcHitInfo(e.GetPosition(chart));
                if (!hitInfo.InSeries || hitInfo.InLegend)
                {
                    return;
                }
                //Popup pop = new Popup();
                pop.IsOpen = true;
                //pop.AllowsTransparency = true;

                pop.Placement        = System.Windows.Controls.Primitives.PlacementMode.RelativePoint;
                pop.PlacementTarget  = mainFrame;
                pop.HorizontalOffset = mouseposition.X + 1;
                pop.VerticalOffset   = mouseposition.Y;


                pop.Height = 350;
                pop.Width  = 700;
                pop.Child  = new RFullViewSizeSubPanel(hitInfo);
                pop.Effect = new System.Windows.Media.Effects.DropShadowEffect();
                //tmp = pop;


                //mainFrame.Children.Add(new RFullViewSizeSubPanel(hitInfo));
            }
        }
Ejemplo n.º 21
0
        void chart_MouseMove(object sender, MouseEventArgs e)
        {
            ChartControl orgchart = sender as ChartControl;
            Point        position = e.GetPosition(orgchart);
            ChartHitInfo hitInfo  = orgchart.CalcHitInfo(position);

            if (hitInfo != null && hitInfo.SeriesPoint != null)
            {
                ttContent.Text = string.Format("设备 = {0}\n数量 = {1}",
                                               hitInfo.SeriesPoint.Argument, Math.Round(hitInfo.SeriesPoint.NonAnimatedValue, 2));
                pointTooltip.Placement        = PlacementMode.RelativePoint;
                pointTooltip.PlacementTarget  = orgchart;
                pointTooltip.HorizontalOffset = position.X + 5;
                pointTooltip.VerticalOffset   = position.Y + 5;
                pointTooltip.IsOpen           = true;
                Cursor = Cursors.Hand;
            }
            else
            {
                pointTooltip.IsOpen = false;
                Cursor = Cursors.Arrow;
            }
        }
Ejemplo n.º 22
0
        private void chartControl1_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            try
            {
                if (e.Button == MouseButtons.Left)
                {
                    ChartHitInfo hitInfo = chartControl1.CalcHitInfo(e.Location);

                    if (hitInfo.InDiagram)
                    {
                        DiagramCoordinates dc = (chartControl1.Diagram as XYDiagram).PointToDiagram(e.Location);
                        if (!dc.IsEmpty)
                        {
                            ShowTimeSharingForm(dc.DateTimeArgument, _tradeInfo);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                DXMessage.ShowError(ex.Message);
            }
        }
Ejemplo n.º 23
0
        private void Chart_MouseDown(object sender, MouseButtonEventArgs e)
        {
            ChartControl chartControl = (ChartControl)sender;
            ChartHitInfo hitInfo      = chartControl.CalcHitInfo(e.GetPosition(chartControl));

            int         pointIndex = series.Points.IndexOf(hitInfo.SeriesPoint);
            SeriesPoint point      = hitInfo.SeriesPoint;

            double oldPointPercent = 0;

            CalcPointPercent(pointIndex, ref oldPointPercent);
            point.Value++;

            double newPointPercent = 0;

            CalcPointPercent(pointIndex, ref newPointPercent);

            series.Rotation += 360 * (oldPointPercent - newPointPercent);
            if (series.Rotation > 360)
            {
                series.Rotation %= 360;
            }
        }
Ejemplo n.º 24
0
        private void chartMain_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            //if (!CheckDataExist()) return;
            switch (CETCManagerApp.Instance.ToolByttonNowStatu)
            {
            case ToolButtonDrawType.None:
                if (e.Button == MouseButtons.Left)
                {
                    ChartHitInfo hi = this.chartMain.CalcHitInfo(e.Location);

                    if (hi.InAnnotation)
                    {
                        TextAnnotation an = (TextAnnotation)hi.Annotation;

                        IDD_DIALOG2 si = new IDD_DIALOG2("標籤屬性", an.Text);
                        if (si.ShowDialog() == DialogResult.OK)
                        {
                            if (an.Name.StartsWith("Annotation"))
                            {
                                TextAnnotation annotation =
                                    (TextAnnotation)chartMain.AnnotationRepository.GetElementByName(an.Name);
                                if (annotation != null)
                                {
                                    foreach (TextAnnotation t in CETCManagerApp.Instance.m_pETETCStage.m_ETCNotes)
                                    {
                                        if (t.Name == an.Name)
                                        {
                                            t.Text = si.InputText;
                                            break;
                                        }
                                    }
                                    annotation.Text = si.InputText;
                                }
                            }
                            else if (an.Name.StartsWith("Slope"))
                            {
                                TextAnnotation slope = (TextAnnotation)hi.Annotation;

                                if (slope != null)
                                {
                                    foreach (Series s2 in CETCManagerApp.Instance.m_pETETCStage.m_ETCSlopes)
                                    {
                                        if (s2.Name == slope.Name)
                                        {
                                            slope.Text = si.InputText;
                                            ((TextAnnotation)s2.Points[0].Annotations[0]).Text = si.InputText;
                                            //((SuperTag)s2.Tag).SeriesLabelString = si.InputText;
                                            break;
                                        }
                                    }
                                }
                            }
                        }
                    }

                    /*else if (hi.InSeriesLabel)
                     * {
                     *  Series s = (Series)hi.Series;
                     *  IDD_DIALOG2 si = new IDD_DIALOG2("標籤屬性", ((SuperTag)s.Tag)?.SeriesLabelString);
                     *  if (si.ShowDialog() == DialogResult.OK)
                     *  {
                     *      Series series = chartMain.Series[s.Name];
                     *      if (series != null)
                     *      {
                     *          foreach (Series s2 in CETCManagerApp.Instance.m_pETETCStage.m_ETCSlopes)
                     *          {
                     *              if (s2.Name == s.Name)
                     *              {
                     *                  //((TextAnnotation)s2.Points[0].Annotations[0]).Text = si.InputText;
                     *                  ((SuperTag)s2.Tag).SeriesLabelString = si.InputText;
                     *                  break;
                     *              }
                     *          }
                     *      }
                     *  }
                     * }*/
                }
                break;
            }
        }
Ejemplo n.º 25
0
        public void MouseLeftButtonUp(object eventArgs)
        {
            _mouseUpTime = DateTime.Now;
            var e = eventArgs as MouseButtonEventArgs;
            var sender = e.Source;

            ChartControl chart;
            if (sender is ChartControl)
                chart = sender as ChartControl;
            else
                chart = ((SimpleDiagram2D) sender).Parent as ChartControl;

            var hitInfo = chart.CalcHitInfo(e.GetPosition(chart));

            if (hitInfo?.SeriesPoint == null || (_mouseUpTime - _mouseDownTime).TotalMilliseconds > 180)
                return;

            if (_selectedHitInfo != null)
            {
                PieSeries.GetExplodedDistance(_selectedHitInfo.SeriesPoint);
                var selectedStoryBoard = new Storyboard();
                var selectedAnimation = new DoubleAnimation
                {
                    Duration = new Duration(new TimeSpan(0, 0, 0, 0, 400)),
                    To = 0
                };
                selectedStoryBoard.Children.Add(selectedAnimation);
                Storyboard.SetTarget(selectedAnimation, _selectedHitInfo.SeriesPoint);
                Storyboard.SetTargetProperty(selectedAnimation, new PropertyPath(PieSeries.ExplodedDistanceProperty));
                selectedStoryBoard.Begin();
            }

            var distance = PieSeries.GetExplodedDistance(hitInfo.SeriesPoint);
            var storyBoard = new Storyboard();
            var animation = new DoubleAnimation
            {
                Duration = new Duration(new TimeSpan(0, 0, 0, 0, 400)),
                To = distance > 0 ? 0 : 0.4
            };
            storyBoard.Children.Add(animation);
            Storyboard.SetTarget(animation, hitInfo.SeriesPoint);
            Storyboard.SetTargetProperty(animation, new PropertyPath(PieSeries.ExplodedDistanceProperty));
            storyBoard.Begin();

            _selectedHitInfo = hitInfo;
        }
Ejemplo n.º 26
0
 public RFullViewSizeSubPanel(ChartHitInfo info)
 {
     pHitInfo = info;
     InitializeComponent();
     InitPara();
 }
Ejemplo n.º 27
0
        private void _MouseMove(object sender, MouseEventArgs e)
        {
            ChartControl chartControl_current = null;
            ChartHitInfo hitInfo = null;

            foreach (Control c in xtraTabControl1.TabPages)
            {
                if (c is XtraTabPage && ((XtraTabPage)c).Name == "xtraTabPage3")
                {
                    foreach (Control b in c.Controls)
                    {
                        if (b is ChartControl && ((ChartControl)b).Equals(sender))
                        {
                            chartControl_current = ((ChartControl)b);
                            hitInfo = chartControl_current.CalcHitInfo(e.Location);
                        }
                    }
                }
            }
            foreach (Control c in xtraTabControl1.TabPages)
            {
                if (c is XtraTabPage && ((XtraTabPage)c).Name == "limitAverageXTP")
                {
                    foreach (Control b in c.Controls)
                    {
                        if (b is ChartControl && ((ChartControl)b).Equals(sender))
                        {
                            chartControl_current = ((ChartControl)b);
                            hitInfo = chartControl_current.CalcHitInfo(e.Location);
                        }
                    }
                }
            }
            if (hitInfo == null)
            {
                return;
            }
            StringBuilder builder = new StringBuilder();

            if (hitInfo.InDiagram)
            {
                builder.AppendLine("In diagram");
            }
            if (hitInfo.InNonDefaultPane)
            {
                builder.AppendLine("In non-default pane: " + hitInfo.NonDefaultPane.Name);
            }
            if (hitInfo.InAxis)
            {
                builder.AppendLine("In axis: " + hitInfo.Axis.Name);
                if (hitInfo.AxisLabelItem != null)
                {
                    builder.AppendLine("  Label item: " + hitInfo.AxisLabelItem.Text);
                }
                if (hitInfo.AxisTitle != null)
                {
                    builder.AppendLine("  Axis title: " + hitInfo.AxisTitle.Text);
                }
            }
            if (hitInfo.InChartTitle)
            {
                builder.AppendLine("In chart title: " + hitInfo.ChartTitle.Text);
            }
            if (hitInfo.InLegend)
            {
                builder.AppendLine("In legend");
            }
            if (hitInfo.InSeries)
            {
                builder.AppendLine("In series: " + ((Series)hitInfo.Series).Name);
            }
            if (hitInfo.InSeriesLabel)
            {
                builder.AppendLine("In series label");
                builder.AppendLine("  Series: " + ((Series)hitInfo.Series).Name);
            }
            if (hitInfo.SeriesPoint != null)
            {
                builder.AppendLine("  Argument: " + hitInfo.SeriesPoint.Argument);
                if (!hitInfo.SeriesPoint.IsEmpty)
                {
                    builder.AppendLine("  Value: " + hitInfo.SeriesPoint.Values[0]);
                }
            }
            if (builder.Length > 0)
            {
                toolTipController.ShowHint("AIO-testing results:\n" + builder.ToString(),
                                           chartControl_current.PointToScreen(e.Location));
            }
            else
            {
                toolTipController.HideHint();
            }
        }