示例#1
0
        public void CreateNotesChart()
        {
            for (int i = chartMain.AnnotationRepository.Count - 1; i >= 0; i--)
            {
                try
                {
                    if (chartMain.AnnotationRepository[i].Name.StartsWith("Annotation"))
                    {
                        chartMain.AnnotationRepository.RemoveAt(i);
                    }
                }
                catch (Exception)
                {
                    continue;
                }
            }

            if (m_IsShowNotes)
            {
                // 模拟参数曲线
                for (int ii = 0; ii < CETCManagerApp.Instance.m_pETETCStage.m_ETCNotes.Count; ii++)
                {
                    TextAnnotation pETNote = CETCManagerApp.Instance.m_pETETCStage.m_ETCNotes.ElementAtOrDefault(ii);
                    if (pETNote != null)
                    {
                        chartMain.AnnotationRepository.Add((TextAnnotation)pETNote.Clone());
                    }
                }
            }
        }
示例#2
0
        private void chartMain_MouseUp(object sender, MouseEventArgs e)
        {
            if (chartMain.Series.Count <= 0)
            {
                return;
            }


            switch (CETCManagerApp.Instance.ToolByttonNowStatu)
            {
            case ToolButtonDrawType.None:
                break;

            case ToolButtonDrawType.LABEL:
                if (e.Button == MouseButtons.Left)
                {
                    TextAnnotation     annotation = new TextAnnotation("Annotation" + (++CETCManagerApp.Instance.LabelCount).ToString(), "標籤" + (++CETCManagerApp.Instance.LabelIndex).ToString());
                    DiagramCoordinates point      = MainDiagram.PointToDiagram(e.Location);
                    annotation.AnchorPoint = new PaneAnchorPoint();
                    ((PaneAnchorPoint)annotation.AnchorPoint).AxisXCoordinate.AxisValue = point.NumericalArgument;
                    ((PaneAnchorPoint)annotation.AnchorPoint).AxisYCoordinate.AxisValue = point.NumericalValue;
                    annotation.ShapePosition = new FreePosition();
                    FreePosition position = annotation.ShapePosition as FreePosition;
                    position.InnerIndents.Left = e.X + 5;
                    position.InnerIndents.Top  = e.Y - annotation.Height - 5;
                    chartMain.AnnotationRepository.Add((TextAnnotation)annotation.Clone());
                    Main_Form.Instance.SetToolButtonStatu(ToolButtonDrawType.None);
                    CETCManagerApp.Instance.m_pETETCStage.m_ETCNotes.Add(annotation);
                }
                else if (e.Button == MouseButtons.Right)
                {
                }
                break;

            case ToolButtonDrawType.SLOP:
                if (e.Button == MouseButtons.Left)
                {
                    if (NowSeries == null)
                    {
                        var slope = new Series("Slope" + (++CETCManagerApp.Instance.SlopesCount).ToString(), ViewType.Line);

                        //slope.View.Color = Color.Red;
                        ((LineSeriesView)slope.View).LineStyle.Thickness = 2;
                        //((LineSeriesView)slope.View).ColorEach = true;
                        ((LineSeriesView)slope.View).MarkerVisibility = DefaultBoolean.True;

                        DiagramCoordinates point = MainDiagram.PointToDiagram(e.Location);

                        slope.Points.Add(new SeriesPoint(point.NumericalArgument, point.NumericalValue));
                        slope.Points.Add(new SeriesPoint(point.NumericalArgument, point.NumericalValue));
                        //slope.LabelsVisibility = DefaultBoolean.True;
                        slope.Label.Border.Visibility = DefaultBoolean.True;
                        slope.CrosshairEnabled        = DefaultBoolean.False;
                        slope.Visible         = true;
                        slope.Label.TextColor = Color.Black;
                        slope.ShowInLegend    = false;
                        slope.Points[0].Color = slope.View.Color;
                        slope.Points[0].Annotations.AddTextAnnotation(slope.Name, "12345");
                        slope.Points[1].Color = slope.View.Color;
                        slope.Tag             = new SuperTag()
                        {
                            SeriesIsDrawDown = true
                        };
                        CETCManagerApp.Instance.m_pETETCStage.m_ETCSlopes.Add(slope);
                        NowSlopeIndex = CETCManagerApp.Instance.m_pETETCStage.m_ETCSlopes.Count - 1;
                        var cloneSlope = (Series)slope.Clone();
                        cloneSlope.Points[0].Annotations.AddTextAnnotation(slope.Name, "12345");
                        basePoint     = cloneSlope.Points[0];
                        selectedPoint = cloneSlope.Points[1];
                        chartMain.Series.Add(cloneSlope);
                        NowSeries = cloneSlope;
                        //chartMain.CustomDrawSeriesPoint += chartMain_CustomDrawSeriesPoint;
                    }
                    else
                    {
                        CETCManagerApp.Instance.m_pETETCStage.m_ETCSlopes[NowSlopeIndex].Points.RemoveAt(1);
                        CETCManagerApp.Instance.m_pETETCStage.m_ETCSlopes[NowSlopeIndex].Points.Add(new SeriesPoint(selectedPoint.NumericalArgument, selectedPoint.Values[0]));
                        ((TextAnnotation)CETCManagerApp.Instance.m_pETETCStage.m_ETCSlopes[NowSlopeIndex].Points[0].Annotations[0]).Text = ((TextAnnotation)basePoint.Annotations[0]).Text;
                        ((SuperTag)CETCManagerApp.Instance.m_pETETCStage.m_ETCSlopes[NowSlopeIndex].Tag).SeriesLabelString = ((TextAnnotation)basePoint.Annotations[0]).Text;
                        ((SuperTag)NowSeries.Tag).SeriesIsDrawDown = false;
                        NowSeries     = null;
                        selectedPoint = null;
                        Main_Form.Instance.SetToolButtonStatu(ToolButtonDrawType.None);
                        //chartMain.CustomDrawSeriesPoint -= chartMain_CustomDrawSeriesPoint;
                    }
                }
                break;

            default:
                break;
            }
        }