示例#1
0
        /// <summary>
        /// public void SetAreaAxis TInvoker>(
        /// TInvoker Invoker,
        /// int index,
        /// AreaAxis aaxis,
        /// string title = null,
        /// StringAlignment? TitleAlignment = null,
        /// TextOrientation? TxtOrientation = null,
        /// LabelStyle LblStyle = null
        ///  ) where TInvoker : Control
        /// </summary>
        /// <typeparam name="TInvoker"></typeparam>
        /// <param name="Invoker"></param>
        /// <param name="index"></param>
        /// <param name="aaxis"></param>
        /// <param name="title"></param>
        /// <param name="TitleAlignment"></param>
        /// <param name="TxtOrientation"></param>
        /// <param name="LblStyle"></param>
        public void SetAreaAxis <TInvoker>(
            TInvoker Invoker,
            int index,
            AreaAxis aaxis,
            string title = null,
            StringAlignment?TitleAlignment = null,
            TextOrientation?TxtOrientation = null,
            LabelStyle LblStyle            = null
            ) where TInvoker : Control
        {
            if (Invoker != null)
            {
                //lock (Locker[ChartMain])
                Abbreviate.FormsControls.Invoke(Invoker, () => SetAreaAxis <TInvoker>(null, index, aaxis, title, TitleAlignment, TxtOrientation, LblStyle));
                UpdateTime.SetNow();
                return;
            }

            Axis axis = null;

            if (aaxis == AreaAxis.X)
            {
                axis = ChartMain.ChartAreas[index].AxisX;
            }
            else if (aaxis == AreaAxis.Y)
            {
                axis = ChartMain.ChartAreas[index].AxisY;
            }
            else if (aaxis == AreaAxis.X2)
            {
                axis = ChartMain.ChartAreas[index].AxisX2;
            }
            else if (aaxis == AreaAxis.Y2)
            {
                axis = ChartMain.ChartAreas[index].AxisY2;
            }


            if (title != null)
            {
                axis.Title = title;
            }
            if (TitleAlignment != null)
            {
                axis.TitleAlignment = (StringAlignment)TitleAlignment;
            }
            if (TxtOrientation != null)
            {
                axis.TextOrientation = (TextOrientation)TxtOrientation;
            }
            if (LblStyle != null)
            {
                axis.LabelStyle = LblStyle;
            }
        }
示例#2
0
        public void SetAreaAxisLabelStyle <TInvoker>(
            TInvoker Invoker,
            int index,
            AreaAxis aaxis,
            string Format = null
            ) where TInvoker : Control
        {
            if (Invoker != null)
            {
                //lock (Locker[ChartMain])
                Abbreviate.FormsControls.Invoke(Invoker, () => SetAreaAxisLabelStyle <TInvoker>(null, index, aaxis, Format));
                UpdateTime.SetNow();
                return;
            }

            Axis axis = null;



            if (aaxis == AreaAxis.X)
            {
                axis = ChartMain.ChartAreas[index].AxisX;
            }
            else if (aaxis == AreaAxis.Y)
            {
                axis = ChartMain.ChartAreas[index].AxisY;
            }
            else if (aaxis == AreaAxis.X2)
            {
                axis = ChartMain.ChartAreas[index].AxisX2;
            }
            else if (aaxis == AreaAxis.Y2)
            {
                axis = ChartMain.ChartAreas[index].AxisY2;
            }


            if (Format != null)
            {
                axis.LabelStyle.Format = Format;
            }
        }