/// <summary>
 /// LocationProperty property changed handler.
 /// </summary>
 /// <param name="oldValue">Old value.</param>
 /// <param name="newValue">New value.</param>        
 protected virtual void OnLocationPropertyChanged(AxisLocation oldValue, AxisLocation newValue)
 {
     if (this.LocationChanged != null)
     {
         this.LocationChanged(this, (AxisLocation)newValue);
     }
 }
Example #2
0
        public void DrawAxisTick(Cairo.Context cr, int x, int y, AxisLocation loc)
        {
            //cr.Color = CairoHelper.GetCairoColor (gtk_style.Foreground (state));
            cr.SetSourceRGBA(CairoHelper.GetCairoColor(gtk_style.Foreground(state)).R, CairoHelper.GetCairoColor(gtk_style.Foreground(state)).G, CairoHelper.GetCairoColor(gtk_style.Foreground(state)).B, CairoHelper.GetCairoColor(gtk_style.Foreground(state)).A);

            cr.LineWidth = 1.0f;

            switch (loc)
            {
            case AxisLocation.Left:
                cr.MoveTo(x, y + DEFUZZ);
                cr.LineTo(x + TICK_SIZE, y + DEFUZZ);
                break;

            case AxisLocation.Right:
                cr.MoveTo(x, y + DEFUZZ);
                cr.LineTo(x + TICK_SIZE, y + DEFUZZ);
                break;

            case AxisLocation.Top:
                cr.MoveTo(x + DEFUZZ, y);
                cr.LineTo(x + DEFUZZ, y - TICK_SIZE);
                break;

            case AxisLocation.Bottom:
                cr.MoveTo(x + DEFUZZ, y);
                cr.LineTo(x + DEFUZZ, y + TICK_SIZE);
                break;
            }

            cr.Stroke();
        }
Example #3
0
 /// <summary>
 /// LocationProperty property changed handler.
 /// </summary>
 /// <param name="oldValue">Old value.</param>
 /// <param name="newValue">New value.</param>        
 protected virtual void OnLocationPropertyChanged(AxisLocation oldValue, AxisLocation newValue)
 {
     RoutedPropertyChangedEventHandler<AxisLocation> handler = this.LocationChanged;
     if (handler != null)
     {
         handler(this, new RoutedPropertyChangedEventArgs<AxisLocation>(oldValue, newValue));
     }
 }
Example #4
0
        /// <summary>
        /// LocationProperty property changed handler.
        /// </summary>
        /// <param name="d">Axis that changed its Location.</param>
        /// <param name="e">Event arguments.</param>
        private static void OnLocationPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            Axis         source   = (Axis)d;
            AxisLocation oldValue = (AxisLocation)e.OldValue;
            AxisLocation newValue = (AxisLocation)e.NewValue;

            source.OnLocationPropertyChanged(oldValue, newValue);
        }
Example #5
0
        /// <summary>
        /// LocationProperty property changed handler.
        /// </summary>
        /// <param name="oldValue">Old value.</param>
        /// <param name="newValue">New value.</param>
        protected virtual void OnLocationPropertyChanged(AxisLocation oldValue, AxisLocation newValue)
        {
            RoutedPropertyChangedEventHandler <AxisLocation> handler = this.LocationChanged;

            if (handler != null)
            {
                handler(this, new RoutedPropertyChangedEventArgs <AxisLocation>(oldValue, newValue));
            }
        }
 public AxisLayout(AxisLocation axisLocation, Vector symbol, Range dataRange, Range visibleRange, Func<string, double, Axis, AxisLabelerOptions, Rect> computeLabelRect, Rect screen)
 {
     _options = new AxisLabelerOptions
     {
         AxisLocation = axisLocation,
         Symbol = symbol,
         DataRange = dataRange,
         VisibleRange = visibleRange,
         FontSize = AxisFontSize,
         ComputeLabelRect = computeLabelRect,
         Screen = screen
     };
 }
Example #7
0
        public void DrawAxisBoundingBox(Cairo.Context cr, int x, int y,
                                        int width, int height, AxisLocation loc)
        {
            cr.MoveTo(x, y);
            if (loc == AxisLocation.Bottom)
            {
                cr.RelMoveTo(width, 0);
            }
            else
            {
                cr.RelLineTo(width, 0);
            }

            if (loc == AxisLocation.Left)
            {
                cr.RelMoveTo(0, height);
            }
            else
            {
                cr.RelLineTo(0, height);
            }

            if (loc == AxisLocation.Top)
            {
                cr.RelMoveTo(-width, 0);
            }
            else
            {
                cr.RelLineTo(-width, 0);
            }

            if (loc == AxisLocation.Right)
            {
                cr.RelMoveTo(0, -height);
            }
            else
            {
                cr.RelLineTo(0, -height);
            }

            //cr.Color = CairoHelper.GetCairoColor (gtk_style.Foreground (state));
            cr.SetSourceRGBA(CairoHelper.GetCairoColor(gtk_style.Foreground(state)).R, CairoHelper.GetCairoColor(gtk_style.Foreground(state)).G, CairoHelper.GetCairoColor(gtk_style.Foreground(state)).B, CairoHelper.GetCairoColor(gtk_style.Foreground(state)).A);

            cr.LineWidth = 2.0f;
            cr.Stroke();
        }
Example #8
0
 /// <summary>
 /// Arranges the grid when the location property is changed.
 /// </summary>
 /// <param name="oldValue">The old location.</param>
 /// <param name="newValue">The new location.</param>
 protected override void OnLocationPropertyChanged(AxisLocation oldValue, AxisLocation newValue)
 {
     ArrangeAxisGrid();
     base.OnLocationPropertyChanged(oldValue, newValue);
 }
 /// <summary>
 /// Arranges the grid when the location property is changed.
 /// </summary>
 /// <param name="oldValue">The old location.</param>
 /// <param name="newValue">The new location.</param>
 protected override void OnLocationPropertyChanged(AxisLocation oldValue, AxisLocation newValue)
 {
     ArrangeAxisGrid();
     base.OnLocationPropertyChanged(oldValue, newValue);
 }
Example #10
0
        protected override void Redraw(Cairo.Context cr)
        {
            // no axes, or have we not been SizeAllocated yet?
            if (axis_requisitions.Count <= 0)
            {
                return;
            }

            // remember, Gdk.Rectangle is a ValueType.
            Gdk.Rectangle alloc = plot_alloc;

            // render the field
            style_prov.DrawField(cr, alloc.X, alloc.Y,
                                 alloc.Width, alloc.Height);

            Gdk.Rectangle inner_alloc = alloc;
            inner_alloc.X      += style_prov.FieldLineThickness;
            inner_alloc.Y      += style_prov.FieldLineThickness;
            inner_alloc.Width  -= (style_prov.FieldLineThickness * 2);
            inner_alloc.Height -= (style_prov.FieldLineThickness * 2);


            // create an ArrayList of axes for each location
            ArrayList[] axes_by_location = new ArrayList[4];
            foreach (IAxis axis in axes)
            {
                if (!axis.Visible)
                {
                    continue;
                }

                ArrayList list = axes_by_location[(int)axis.Location];
                if (list == null)
                {
                    list = new ArrayList();
                }

                list.Add(axis);

                axes_by_location[(int)axis.Location] = list;
            }

            for (int i = 0; i < 4; i++)
            {
                int x = 0, y = 0;

                AxisLocation l = (AxisLocation)i;
                switch (l)
                {
                case AxisLocation.Top:
                    y = alloc.Y;
                    break;

                case AxisLocation.Bottom:
                    y = alloc.Y + alloc.Height;
                    break;

                case AxisLocation.Left:
                    x = alloc.X;
                    break;

                case AxisLocation.Right:
                    x = alloc.X + alloc.Width;
                    break;
                }

                ArrayList list = axes_by_location[i];
                if (list == null)
                {
                    continue;
                }

                foreach (IAxis axis in list)
                {
                    if (!axis_requisitions.ContainsKey(axis))
                    {
                        // hasn't been size requested.  we'll get it next redraw
                        continue;
                    }

                    Requisition req = (Requisition)axis_requisitions[axis];

                    Gdk.Rectangle a = new Gdk.Rectangle();
                    switch ((AxisLocation)i)
                    {
                    case AxisLocation.Top:
                        a.X      = alloc.X;
                        a.Y      = y - req.Height;
                        a.Width  = alloc.Width;
                        a.Height = req.Height;

                        y -= a.Height;
                        break;

                    case AxisLocation.Bottom:
                        a.X      = alloc.X;
                        a.Y      = y;
                        a.Width  = alloc.Width;
                        a.Height = req.Height;

                        y += a.Height;
                        break;

                    case AxisLocation.Left:
                        a.X      = x - req.Width;
                        a.Y      = alloc.Y;
                        a.Width  = req.Width;
                        a.Height = alloc.Height;

                        x -= a.Width;
                        break;

                    case AxisLocation.Right:
                        a.X      = x;
                        a.Y      = alloc.Y;
                        a.Width  = req.Width;
                        a.Height = alloc.Height;

                        x += a.Width;
                        break;
                    }

                    if (a.Width > 0 && a.Height > 0)
                    {
                        cr.Rectangle(a.X, a.Y, a.Width, a.Height);
                        cr.Clip();

                        axis.DrawTicks(a, cr);

                        cr.ResetClip();
                    }

                    if (draw_grid_lines)
                    {
                        cr.Rectangle(inner_alloc.X - 0.5f, inner_alloc.Y - 0.5f,
                                     inner_alloc.Width + 0.5f, inner_alloc.Height + 0.5f);
                        cr.Clip();

                        axis.DrawGridLines(inner_alloc, cr);

                        cr.ResetClip();
                    }
                }
            }

            // clip drawing to plot_alloc
            cr.Rectangle(inner_alloc.X - 0.5f, inner_alloc.Y,
                         inner_alloc.Width, inner_alloc.Height);
            cr.Clip();

            // draw all plots
            foreach (IPlot plot in plots)
            {
                plot.SizeAllocate(plot_alloc);
                plot.Draw(cr);
            }

            // draw selection rect
            if (selection_started)
            {
                style_prov.DrawSelectionRectangle(cr, sel_rect.X,
                                                  sel_rect.Y,
                                                  sel_rect.Width,
                                                  sel_rect.Height);
            }

            cr.ResetClip();
        }
Example #11
0
 public ChartAxisViewModel()
 {
     _axisScaleDescriptors = new ObservableCollection<IScaleDescriptorAssignment>();
     _labelAlignment = TextAlignment.Center;
     _labelLocation = AxisLocation.OutsideBottom;
 }
Example #12
0
 public LabelAxis(int dimension, AxisLocation location, string title)
 {
     Dimension = dimension;
     Location  = location;
     Title     = title;
 }
Example #13
0
 public LinearAxis(int dimension, AxisLocation location)
 {
     Dimension = dimension;
     Location  = location;
 }
Example #14
0
 /* public methods */
 public DateTimeAxis(int dimension, AxisLocation location)
 {
     Dimension = dimension;
     Location  = location;
 }
        void axis_LocationChanged(object sender, AxisLocation e)
        {
            Axis.Axis axis = (Axis.Axis)sender;

            if (e == AxisLocation.Auto)
            {
                throw new InvalidOperationException(ModernUI.Toolkit.Data.Charting.Resources.Chart_AxisLocationChanged_CantBeChangedToAutoWhenHostedInsideOfASeriesHost);
            }

            SetEdge(axis);

            _edgeAxes.Remove(axis);
            _edgeAxes.Add(axis);

        }