Ejemplo n.º 1
0
        public bool ChartDrawEvent(ChartAxisDrawEventArgs e)
        {
            //No lock position set
            if (!_LockIndexSet)
            {
                return(false);
            }

            //Positions can only be recieved from orthagonal axis
            if (Orientation == e.Orientation)
            {
                return(false);
            }

            //Lcok mode is not enabled
            if (_LockAxisLabel == null)
            {
                return(false);
            }

            //Registered axis lable must match
            if (_LockAxisLabel.Text != e.AxisLabel.Text)
            {
                return(false);
            }

            //Move axis positoin to lock position
            if (LockIndex > e.MaxIndex + 1)
            {
                if (LockIndex == (int)AxisLock.eMiddle)
                {
                    LockIndex = e.MaxIndex / 2;
                }
                else
                {
                    LockIndex = e.MaxIndex + 1;
                }
            }

            //Lock index doesn't match
            if (e.Index == LockIndex)
            {
                if (_AxisLocation != e.Position)
                {
                    _AxisLocation = e.Position;
                }
            }

            return(true);
        }
Ejemplo n.º 2
0
        //Draws horozontal and vertical tick labels centred about the axis position
        void SendEvent(ref SKCanvas Can, SKColor Col, float Pos, int index, ChartAxisEventArgs.ChartAxisEventType EventType)
        {
            var args = new ChartAxisEventArgs(_Label, Can, Col, Pos, MinorTickDistance, Orientation, EventType);

            foreach (var registrant in AxisDataEvents)
            {
                if (registrant(args))
                {
                    break;
                }
            }

            if (EventType == ChartAxisEventArgs.ChartAxisEventType.DrawMajorTick)
            {
                var arg = new ChartAxisDrawEventArgs(_Label, Orientation, Pos, index, (int)MainTicks - 1);
                for (int i = 0; i < AxisDrawEvents.Count; i++)
                {
                    if (!AxisDrawEvents[i](arg))
                    {
                        AxisDrawEvents.RemoveAt(i);
                    }
                }
            }
        }