Example #1
0
        void SetupPiePlots()
        {
            // Prepare a radial overlay gradient for shading/gloss
            var color = new CPTColor(new MonoTouch.CoreGraphics.CGColor(1f, 1f, 0f));

            var overlayGradient = new CPTGradient {
                GradientType = CPTGradientType.Radial
            };

            overlayGradient.AddColorStop(color.ColorWithAlphaComponent(0.7f), 1.0f);

            // Create a plot that uses the data source method
            var piePlot = new CPTPieChart {
                PieRadius       = 130.0f,
                Identifier      = (NSString)"Pie Chart 1",
                StartAngle      = (float)Math.PI / 4f, // 0.785398163397448309616f; //M_PI_4;
                SliceDirection  = CPTPieDirection.CounterClockwise,
                BorderLineStyle = CPTLineStyle.LineStyle
            };

            var inputData = new List <float> {
                60, 20, 40
            };

            piePlot.DataSource = new PieSourceData(inputData);

            graph.AddPlot(piePlot);
        }
Example #2
0
        void SetupPiePlots()
        {
            // Prepare a radial overlay gradient for shading/gloss
            CPTColor color = new CPTColor(new MonoTouch.CoreGraphics.CGColor(1f,1f,0f));

            CPTGradient overlayGradient = new CPTGradient() {
                GradientType = CPTGradientType.Radial
            };

            //overlayGradient.AddColorStop(CPTColor.BlackColor, 0.0f);
            //overlayGradient.AddColorStop(color.ColorWithAlphaComponent(0.3f), 0.9f);
            overlayGradient.AddColorStop (color.ColorWithAlphaComponent (0.7f), 1.0f);

            // Create a plot that uses the data source method
            var piePlot = new CPTPieChart (){
                PieRadius = 130.0f,
               				Identifier = (NSString)"Pie Chart 1",
                StartAngle = (float)Math.PI / 4f, // 0.785398163397448309616f; //M_PI_4;
                SliceDirection = CPTPieDirection.CounterClockwise,
                BorderLineStyle = CPTLineStyle.LineStyle,
                //SliceLabelOffset = 0.0f
            };

            //TODO: This is giving a white overlay??
            piePlot.OverlayFill = new CPTFill(overlayGradient);

            var inputData = new List<float> () {60, 20,40};
            piePlot.DataSource = new PieSourceData (inputData);

            graph.AddPlot (piePlot);
        }
        void SetupGraph()
        {
            var theme = CPTTheme.ThemeNamed("Plain Black");

            graph = new CPTXYGraph()
            {
                PaddingLeft   = 10,
                PaddingRight  = 10,
                PaddingTop    = 10,
                PaddingBottom = 10,
                Title         = "Click to Toggle Range Plot Style",

                TitleTextStyle = new CPTMutableTextStyle()
                {
                    FontSize = 18,
                    FontName = "Helvetica",
                    Color    = CPTColor.GrayColor
                },

                TitleDisplacement = new PointF(0, -20f)
            };
            graph.ApplyTheme(theme);

            // Store area fill for use later
            CPTColor transparentGreen = CPTColor.GreenColor;

            areaFill = new CPTFill(transparentGreen.ColorWithAlphaComponent(0.2f));

            graph.DefaultPlotSpace.ShouldHandlePointingDeviceUpEvent = delegate {
                CPTRangePlot rangePlot = (CPTRangePlot)graph.PlotWithIdentifier((NSString)"Date Plot");
                //TODO: instead of areaFillDefault -> null (see code below in comment
                rangePlot.AreaFill     = (rangePlot.AreaFill == areaFill ? areaFillDefault : areaFill);
                rangePlot.BarLineStyle = (rangePlot.BarLineStyle == barLineStyleDefault ? barLineStyle: barLineStyleDefault);
                return(false);
            };

//			graph.DefaultPlotSpace.ShouldHandlePointingDeviceUpEvent = delegate {
//				CPTRangePlot rangePlot = (CPTRangePlot)graph.PlotWithIdentifier((NSString)"Date Plot");
//				//TODO: instead of areaFillDefault -> null
//              rangePlot.AreaFill = (
//					rangePlot.AreaFill != null ? null : areaFill);
//              rangePlot.BarLineStyle = (
//					rangePlot.BarLineStyle != null ? null: barLineStyle);
//				return false;
//			};
        }
        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 #5
0
        void SetupPiePlots()
        {
            // Prepare a radial overlay gradient for shading/gloss
            var color = new CPTColor (new MonoTouch.CoreGraphics.CGColor (1f,1f,0f));

            var overlayGradient = new CPTGradient { GradientType = CPTGradientType.Radial };

            overlayGradient.AddColorStop (color.ColorWithAlphaComponent (0.7f), 1.0f);

            // Create a plot that uses the data source method
            var piePlot = new CPTPieChart {
                PieRadius = 130.0f,
                Identifier = (NSString) "Pie Chart 1",
                StartAngle = (float) Math.PI / 4f, // 0.785398163397448309616f; //M_PI_4;
                SliceDirection = CPTPieDirection.CounterClockwise,
                BorderLineStyle = CPTLineStyle.LineStyle
            };

            var inputData = new List<float> { 60, 20,40 };
            piePlot.DataSource = new PieSourceData (inputData);

            graph.AddPlot (piePlot);
        }
Example #6
0
        void SetupPiePlots()
        {
            // Prepare a radial overlay gradient for shading/gloss
            CPTColor color = new CPTColor(new MonoTouch.CoreGraphics.CGColor(1f, 1f, 0f));

            CPTGradient overlayGradient = new CPTGradient()
            {
                GradientType = CPTGradientType.Radial
            };

            //overlayGradient.AddColorStop(CPTColor.BlackColor, 0.0f);
            //overlayGradient.AddColorStop(color.ColorWithAlphaComponent(0.3f), 0.9f);
            overlayGradient.AddColorStop(color.ColorWithAlphaComponent(0.7f), 1.0f);

            // Create a plot that uses the data source method
            var piePlot = new CPTPieChart()
            {
                PieRadius       = 130.0f,
                Identifier      = (NSString)"Pie Chart 1",
                StartAngle      = (float)Math.PI / 4f,            // 0.785398163397448309616f; //M_PI_4;
                SliceDirection  = CPTPieDirection.CounterClockwise,
                BorderLineStyle = CPTLineStyle.LineStyle,
                //SliceLabelOffset = 0.0f
            };

            //TODO: This is giving a white overlay??
            piePlot.OverlayFill = new CPTFill(overlayGradient);

            var inputData = new List <float> ()
            {
                60, 20, 40
            };

            piePlot.DataSource = new PieSourceData(inputData);

            graph.AddPlot(piePlot);
        }
Example #7
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;
        }