Beispiel #1
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);
        }
Beispiel #2
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);
        }
        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 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);
        }
        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);
        }