void SetupAxes()
        {
            var plotspace = graph.DefaultPlotSpace;

            plotspace.AllowsUserInteraction = true;

            var major = new CPTLineStyle()
            {
                LineWidth = .75f,
                LineColor = CPTColor.FromGenericGray(0.2f).ColorWithAlphaComponent(.75f)
            };

            var minor = new CPTLineStyle()
            {
                LineWidth = .25f,
                LineColor = CPTColor.WhiteColor.ColorWithAlphaComponent(0.1f)
            };

            var axisSet = (CPTXYAxisSet)graph.AxisSet;

            // Label x with a fixed interval policy
            var x = axisSet.XAxis;

            x.LabelingPolicy              = CPTAxisLabelingPolicy.Automatic;
            x.MinorTicksPerInterval       = 4;
            x.PreferredNumberOfMajorTicks = 8;
            x.MajorGridLineStyle          = major;
            x.MinorGridLineStyle          = minor;
            x.Title       = "X Axis";
            x.TitleOffset = -30;

            // Label y with an automatic label policy.
            var y = axisSet.YAxis;

            y.LabelingPolicy              = CPTAxisLabelingPolicy.Automatic;
            y.MinorTicksPerInterval       = 4;
            y.PreferredNumberOfMajorTicks = 8;
            y.MajorGridLineStyle          = major;
            y.MinorGridLineStyle          = minor;
            y.LabelOffset = 20;
            y.Title       = "Y Axis";
            y.TitleOffset = -30;
        }
Example #2
0
        void SetupAxes()
        {
            var plotspace = graph.DefaultPlotSpace;

            plotspace.AllowsUserInteraction = true;
            plotspace.Delegate = new MyBarDelegate();

            var major = new CPTLineStyle()
            {
                LineWidth = .75f,
                LineColor = CPTColor.FromGenericGray(0.2f).ColorWithAlphaComponent(.75f)
            };

            var minor = new CPTLineStyle()
            {
                LineWidth = .25f,
                LineColor = CPTColor.WhiteColor.ColorWithAlphaComponent(0.1f)
            };

            var axisSet = (CPTXYAxisSet)graph.AxisSet;

            // Label x with a fixed interval policy
            var x = axisSet.XAxis;

            x.LabelingPolicy = CPTAxisLabelingPolicy.None;
            x.Title          = "X Axis";
            x.TitleOffset    = 0;

            // Label y with an automatic label policy.
            var y = axisSet.YAxis;

            y.LabelingPolicy = CPTAxisLabelingPolicy.None;
            y.LabelOffset    = 0;
            y.Title          = "Y Axis";
            y.TitleOffset    = 0;
        }