コード例 #1
0
        public PieChart(ChartView BaseChart)
        {
            pie1                 = new Pie();
            var                  = new Variables.Variables();
            this.BaseChart       = BaseChart;
            tool_dataPointSelect = new DataPointSelection(BaseChart);

            BaseChart.Chart.Header.Text = "Percentage of animals in the zoo (%)";
            BaseChart.Chart.Series.Add(pie1);
            BaseChart.Chart.Legend.Visible = true;

            pie1.SeriesColor         = var.GetPaletteBasic[0];
            pie1.Chart.Zoom.Allow    = false;
            pie1.Chart.Panning.Allow = ScrollModes.None;

            pie1.AutoCircleResize = true;
            pie1.RecalcOptions    = RecalcOptions.OnModify;
            pie1.DefaultNullValue = 0;
            pie1.Circled          = true;
            pie1.AutoPenColor     = false;
            pie1.DarkPen          = false;
            pie1.Pen.Width        = 3;
            pie1.Pen.Style        = DashStyle.Solid;
            pie1.Pen.Visible      = true;
            pie1.Pen.Color        = Color.White;
            pie1.VertAxis         = VerticalAxis.Both;
            pie1.HorizAxis        = HorizontalAxis.Both;

            pie1.CustomXRadius = BaseChart.Chart.Axes.Bottom.MaxXValue;
            for (int i = 0; i < var.GetValorPie1.Length; i++)
            {
                pie1.Add(var.GetValorPie1[i], var.GetPaletteBasic[i]);
            }

            pie1.Title = "pieAnimals";

            pie1.RotationAngle = 20;

            BaseChart.Chart.Axes.Left.SetMinMax(BaseChart.Chart.Axes.Left.MinYValue, BaseChart.Chart.Axes.Left.MaxYValue);
            BaseChart.Chart.Axes.Bottom.SetMinMax(BaseChart.Chart.Axes.Bottom.MinYValue, BaseChart.Chart.Axes.Bottom.MaxXValue);

            BaseChart.Chart.Axes.Bottom.Increment = 5;
            BaseChart.Chart.Axes.Left.Increment   = 5;

            BaseChart.Chart.Axes.Left.Visible         = true;
            BaseChart.Chart.Axes.Left.AxisPen.Visible = true;
            BaseChart.Chart.Axes.Left.Ticks           = new Axis.TicksPen {
                Width = 2, Visible = true, Color = Color.FromRgb(200, 200, 200), EndCap = PenLineCap.Flat, Style = DashStyle.Solid, Length = 10,
            };
            BaseChart.Chart.Axes.Bottom.Visible = true;

            BaseChart.Chart.Axes.Left.Title.Angle    = 90;
            BaseChart.Chart.Axes.Left.Grid.Visible   = false;
            BaseChart.Chart.Axes.Bottom.Grid.Visible = false;
            BaseChart.Chart.Legend.LegendStyle       = LegendStyles.Values;
            BaseChart.Chart.Legend.Alignment         = LegendAlignments.Bottom;
            BaseChart.Chart.Legend.AutoSize          = true;
            BaseChart.Chart.Legend.ResizeChart       = true;
            BaseChart.Chart.Legend.TextAlign         = TextAlignment.Center;
            BaseChart.Chart.Legend.Font.Size         = 13;

            BaseChart.Chart.Legend.Symbol.Position = LegendSymbolPosition.Right;

            // Themes Marks
            Themes.AplicarMarksTheme1(BaseChart);

            pie1.Marks.Pen.Visible                    = false;
            pie1.Marks.FollowSeriesColor              = false;
            pie1.Marks.Style                          = MarksStyles.Percent;
            pie1.AutoCircleResize                     = false;
            pie1.Marks.Brush.Transparency             = 100;
            pie1.MarksPie.VertCenter                  = true;
            pie1.Marks.Transparent                    = true;
            pie1.Marks.Frame.Transparency             = 100;
            BaseChart.Chart.Series[0].Marks.Font.Size = 18;
            pie1.MarksPie.InsideSlice                 = true;
            BaseChart.Chart.Panel.MarginLeft          = 5;
            pie1.MarksPie.LegSize                     = 20;
            pie1.MarksPie.VertCenter                  = true;

            BaseChart.Chart.ClickSeries += tool_dataPointSelect.PieChart_ClickSeries;
        }
コード例 #2
0
        public BubbleTransparencyChartFeatures(ChartView BaseChart)
        {
            bubble1              = new Bubble();
            this.BaseChart       = BaseChart;
            var                  = new Variables.Variables();
            tool_dataPointSelect = new DataPointSelection(BaseChart);

            BaseChart.Chart.Header.Text = "Market share study";
            BaseChart.Chart.Series.Add(bubble1);
            BaseChart.Chart.Legend.Visible = false;

            bubble1.SeriesColor         = var.GetPaletteBasic[0];
            bubble1.Chart.Zoom.Allow    = false;
            bubble1.Chart.Panning.Allow = ScrollModes.None;

            bubble1.RecalcOptions    = RecalcOptions.OnModify;
            bubble1.DefaultNullValue = 0;

            bubble1.ClickPointer  += tool_dataPointSelect.PointValue_Click;
            bubble1.GetSeriesMark += tool_dataPointSelect.Serie_GetSeriesMark;
            for (int i = 0; i < var.GetValorBubbleTrans1.Length; i++)
            {
                bubble1.Add(var.GetValorBubbleTransX[i], var.GetValorBubbleTrans1[i], var.GetValorBubbleTrans1[i] / 4, var.GetPaletteBasic[i]);
            }

            bubble1.Pointer.Brush.Color    = Color.FromArgb(255, 255, 0, 0);
            bubble1.Pointer.InflateMargins = false;
            bubble1.Pointer.Style          = PointerStyles.Circle;
            bubble1.Title = "bubble1";

            bubble1.Transparency = 50;
            bubble1.VertAxis     = VerticalAxis.Both;
            bubble1.HorizAxis    = HorizontalAxis.Both;

            BaseChart.Chart.Axes.Left.SetMinMax(BaseChart.Chart.Axes.Left.MinYValue - 5, BaseChart.Chart.Axes.Left.MaxYValue + 5);
            BaseChart.Chart.Axes.Bottom.SetMinMax(0, BaseChart.Chart.Axes.Bottom.MaxXValue + 3);

            BaseChart.Chart.Axes.Bottom.Increment = 5;
            BaseChart.Chart.Axes.Left.Increment   = 15;

            BaseChart.Chart.Axes.Left.Labels.ValueFormat   = "0";
            BaseChart.Chart.Axes.Bottom.Labels.ValueFormat = "0";
            BaseChart.Chart.Axes.Left.Title.AutoSize       = true;
            BaseChart.Chart.Axes.Left.Title.Font.Size      = 14;
            BaseChart.Chart.Axes.Bottom.Title.Font.Size    = 14;
            BaseChart.Chart.Axes.Left.Title.Alignment      = Xamarin.Forms.TextAlignment.Center;

            BaseChart.Chart.Axes.Left.Visible         = true;
            BaseChart.Chart.Axes.Left.AxisPen.Visible = true;
            BaseChart.Chart.Axes.Left.Ticks           = new Axis.TicksPen {
                Width = 2, Visible = true, Color = Color.FromArgb(200, 200, 200), EndCap = PenLineCap.Flat, Style = DashStyle.Solid, Length = 10,
            };
            BaseChart.Chart.Axes.Bottom.Visible = true;

            BaseChart.Chart.Axes.Left.Title.Angle  = 90;
            BaseChart.Chart.Axes.Left.Grid.Visible = false;

            BaseChart.Chart.Axes.Bottom.Title.Text = "Number of products";
            BaseChart.Chart.Axes.Left.Title.Text   = "Sales";

            BaseChart.Chart.ClickSeries -= Chart_ClickSeries;

            // Themes Marks
            Themes.AplicarMarksTheme1(BaseChart);

            bubble1.Marks.ArrowLength                   = (int)bubble1.Pointer.VertSize;
            bubble1.Marks.TextAlign                     = Xamarin.Forms.TextAlignment.Center;
            bubble1.Marks.Font.Color                    = Color.Black;
            bubble1.Marks.Font.Size                     = 19;
            bubble1.Marks.Frame.Width                   = 85;
            bubble1.Marks.Width                         = 85;
            bubble1.Marks.Frame.Visible                 = true;
            bubble1.Marks.Transparent                   = false;
            bubble1.Marks.Frame.Transparency            = 0;
            bubble1.Marks.BackColor                     = Color.White;
            bubble1.Marks.Pen.Visible                   = true;
            bubble1.Marks.Pen.Width                     = 2;
            bubble1.Marks.Pen.Color                     = Color.Black;
            BaseChart.Chart.Axes.Left.Labels.CustomSize = 0;
            BaseChart.Chart.Panel.MarginLeft            = 4;
        }
        // Constructor
        public StackAreaChartFeatures(ChartView BaseChart)
        {
            // Inicializar variables
            area1 = new Area();
            area2 = new Area();
            var   = new Variables.Variables();
            tool_dataPointSelect = new DataPointSelection(BaseChart);

            // Propiedades del "Chart" base
            BaseChart.Chart.Series.Add(area2);
            BaseChart.Chart.Series.Add(area1);
            BaseChart.Chart.Legend.Visible           = true;
            BaseChart.Chart.Header.Text              = "Mensual sells by two companies";
            BaseChart.Chart.Axes.Bottom.LabelsOnAxis = true;

            // Propiedades de la "area1"
            area1.Title                  = "Company 1";
            area1.SeriesColor            = var.GetPaletteBasic[0];
            area1.Chart.Zoom.Allow       = false;
            area1.Chart.Panning.Allow    = ScrollModes.None;
            area1.RecalcOptions          = RecalcOptions.OnModify;
            area1.DefaultNullValue       = 0;
            area1.ClickableLine          = true;
            area1.AreaLines.Visible      = false;
            area1.LinePen.Width          = 5;
            area1.Pointer.Visible        = true;
            area1.Pointer.Style          = PointerStyles.Nothing;
            area1.Pointer.InflateMargins = false;
            area1.LinePen.Style          = DashStyle.Solid;
            area1.LinePen.EndCap         = PenLineCap.Flat;
            area1.LinePen.DashCap        = PenLineCap.Flat;
            area1.LinePen.Color          = var.GetPaletteBasic[0].AddLuminosity(-0.2);
            area1.ClickTolerance         = 30;
            area1.ClickPointer          += tool_dataPointSelect.PointValue_Click;
            area1.GetSeriesMark         += tool_dataPointSelect.Serie_GetSeriesMark;
            for (int i = 0; i < var.GetValorArea1.Length; i++)
            {
                area1.Add(var.GetValorArea1[i], var.GetValorAreaX[i]);
            }
            area1.VertAxis    = VerticalAxis.Both;
            area1.HorizAxis   = HorizontalAxis.Both;
            area1.Marks.OnTop = true;

            // Propiedades de la "area2"
            area2.Title               = "Company 2";
            area2.SeriesColor         = var.GetPaletteBasic[1];
            area2.Chart.Zoom.Allow    = false;
            area2.Chart.Panning.Allow = ScrollModes.None;
            area2.RecalcOptions       = RecalcOptions.OnModify;
            area2.DefaultNullValue    = 0;
            area2.ClickableLine       = true;
            area2.ClickTolerance      = 30;
            area2.Pointer.Visible     = true;
            area2.Pointer.Style       = PointerStyles.Nothing;
            area2.LinePen.Style       = DashStyle.Solid;
            area2.LinePen.EndCap      = PenLineCap.Flat;
            area2.LinePen.DashCap     = PenLineCap.Flat;
            area2.LinePen.Color       = var.GetPaletteBasic[0].AddLuminosity(-0.2);
            area2.LinePen.Color       = var.GetPaletteBasic[1].AddLuminosity(-0.2);
            area2.AreaLines.Visible   = false;
            area2.LinePen.Width       = 5;
            area2.ClickPointer       += tool_dataPointSelect.PointValue_Click;
            area2.GetSeriesMark      += tool_dataPointSelect.Serie_GetSeriesMark;
            for (int i = 0; i < var.GetValorArea2.Length; i++)
            {
                area2.Add(var.GetValorArea2[i], var.GetValorAreaX[i]);
            }
            area2.VertAxis    = VerticalAxis.Both;
            area2.HorizAxis   = HorizontalAxis.Both;
            area2.Marks.OnTop = true;

            area1.Stacked    = CustomStack.Stack;
            area2.Stacked    = CustomStack.Stack;
            area1.StackGroup = 1;
            area2.StackGroup = 1;

            // Propieades de los ejes del "Chart" base
            BaseChart.Chart.Axes.Left.SetMinMax(BaseChart.Chart.Axes.Left.MinYValue, BaseChart.Chart.Axes.Left.MaxYValue + 20);
            BaseChart.Chart.Axes.Bottom.SetMinMax(BaseChart.Chart.Axes.Bottom.MinXValue, BaseChart.Chart.Axes.Bottom.MaxXValue);
            BaseChart.Chart.Axes.Left.Labels.ValueFormat   = "0";
            BaseChart.Chart.Axes.Bottom.Labels.ValueFormat = "0";
            BaseChart.Chart.Axes.Bottom.Labels.TextAlign   = Xamarin.Forms.TextAlignment.Start;
            BaseChart.Chart.Axes.Left.Visible       = true;
            BaseChart.Chart.Axes.Left.Increment     = 20;
            BaseChart.Chart.Axes.Left.Title.Visible = false;
            BaseChart.Chart.Axes.Left.Ticks         = new Axis.TicksPen {
                Width = 2, Visible = true, Color = Color.FromArgb(200, 200, 200), EndCap = PenLineCap.Flat, Style = DashStyle.Solid, Length = 10
            };
            BaseChart.Chart.Axes.Left.LabelsOnAxis = true;

            BaseChart.Chart.Axes.Left.Labels.CustomSize = 10;
            BaseChart.Chart.Axes.Bottom.Title.Visible   = false;
            BaseChart.Chart.Axes.Left.AxisPen.Visible   = true;
            BaseChart.Chart.Axes.Left.Grid.Visible      = false;
            BaseChart.Chart.Axes.Bottom.Grid.Visible    = false;
            BaseChart.Chart.Legend.LegendStyle          = LegendStyles.Series;
            BaseChart.Chart.Panel.MarginRight           = 5;
            BaseChart.Chart.ClickSeries     += null;
            BaseChart.Chart.Panel.MarginLeft = 4;

            // Themes Marks
            Themes.AplicarMarksTheme1(BaseChart);
            area1.Marks.Width = 82;
            area2.Marks.Width = 82;
            //area2.Marks.
            //area1.Marks.ZPosition = 1;
        }
コード例 #4
0
        // Constructor del "LineChart"
        public LineChart(ChartView BaseChart)
        {
            // Variables
            line1                = new Line();
            line2                = new Line();
            var                  = new Variables.Variables();
            this.BaseChart       = BaseChart;
            tool_dataPointSelect = new DataPointSelection(BaseChart);

            // Modificación del "Chart" base
            BaseChart.Chart.ClickSeries   += null;
            BaseChart.Chart.BeforeDraw    += Chart_BeforeDraw;
            BaseChart.Chart.Legend.Visible = true;
            BaseChart.Chart.Header.Text    = "Deaths and Births in Spain";
            BaseChart.Chart.Series.Add(line1);
            BaseChart.Chart.Series.Add(line2);

            line1.Add(var.GetValorLineX, var.GetValorLine1, true);
            line2.Add(var.GetValorLineX, var.GetValorLine2, true);

            // Propiedades de la "line1"

            line1.LinePen.Width = 6;
            line1.LinePen.Color = var.GetPaletteBasic[0];

            line1.Pointer.Color          = var.GetPaletteBasic[0];
            line1.Pointer.InflateMargins = true;
            line1.Pointer.Visible        = true;
            line1.Pointer.HorizSize      = 11;
            line1.Pointer.VertSize       = 11;
            line1.Pointer.Pen.EndCap     = PenLineCap.Round;
            line1.Pointer.Pen.Color      = Color.White;
            line1.Pointer.Pen.Width      = 5;
            line1.Pointer.Style          = PointerStyles.Sphere;

            line1.SeriesColor         = var.GetPaletteBasic[0];
            line1.Chart.Zoom.Allow    = false;
            line1.Chart.Panning.Allow = ScrollModes.None;
            line1.LineHeight          = 25;
            line1.ClickableLine       = true;
            line1.ClickPointer       += tool_dataPointSelect.PointValue_Click;
            line1.GetSeriesMark      += tool_dataPointSelect.Serie_GetSeriesMark;
            line1.ClickTolerance      = 30;
            line1.RecalcOptions       = RecalcOptions.OnModify;
            line1.Title            = "Births";
            line1.DefaultNullValue = 0;
            line1.VertAxis         = VerticalAxis.Both;
            line1.HorizAxis        = HorizontalAxis.Both;

            // Propiedades de la "line2"
            line2.LinePen = new ChartPen {
                Width = 6, Color = var.GetPaletteBasic[1],
            };
            line2.Pointer = new SeriesPointer(BaseChart.Chart, line2)
            {
                Color = var.GetPaletteBasic[1], InflateMargins = true, HorizSize = 11, VertSize = 11, Pen = new ChartPen {
                    EndCap = PenLineCap.Round, Color = Xamarin.Forms.Color.White, Width = 5
                }, Style = PointerStyles.Sphere
            };
            line2.SeriesColor         = var.GetPaletteBasic[1];
            line2.Chart.Zoom.Allow    = false;
            line2.Chart.Panning.Allow = ScrollModes.None;
            line2.LineHeight          = 25;
            line2.ClickableLine       = true;
            line2.ClickPointer       += tool_dataPointSelect.PointValue_Click;
            line2.GetSeriesMark      += tool_dataPointSelect.Serie_GetSeriesMark;
            line2.ClickTolerance      = 30;
            line2.RecalcOptions       = RecalcOptions.OnModify;
            line2.Title     = "Deaths";
            line2.VertAxis  = VerticalAxis.Both;
            line2.HorizAxis = HorizontalAxis.Both;

            // Características de los ejes del "Chart" base
            BaseChart.Chart.Axes.Left.SetMinMax(BaseChart.Chart.Axes.Left.MinYValue - 10, BaseChart.Chart.Axes.Left.MaxYValue + 10);
            BaseChart.Chart.Axes.Bottom.SetMinMax(BaseChart.Chart.Axes.Bottom.MinXValue, BaseChart.Chart.Axes.Bottom.MaxXValue);
            BaseChart.Chart.Axes.Left.Labels.ValueFormat   = "0K";
            BaseChart.Chart.Axes.Bottom.Labels.ValueFormat = "0";
            BaseChart.Chart.Axes.Bottom.Increment          = 1;
            BaseChart.Chart.Axes.Left.Increment            = 10;
            BaseChart.Chart.Axes.Left.Visible         = true;
            BaseChart.Chart.Axes.Left.Title           = null;
            BaseChart.Chart.Axes.Bottom.Title         = null;
            BaseChart.Chart.Axes.Left.AxisPen.Visible = false;
            BaseChart.Chart.Axes.Left.Ticks.Visible   = false;
            BaseChart.Chart.Axes.Left.Grid.Visible    = true;
            BaseChart.Chart.Legend.LegendStyle        = LegendStyles.Series;
            BaseChart.Chart.Axes.Bottom.Grid.Visible  = false;
            BaseChart.Chart.Panel.MarginLeft          = 5;

            // Themes Marks
            Themes.AplicarMarksTheme1(BaseChart);
            BaseChart.Chart.Series[0].Marks.Font.Size = 18;
            BaseChart.Chart.Series[1].Marks.Font.Size = 18;
        }
コード例 #5
0
        public HorizontalAreaChart(ChartView BaseChart)
        {
            horizArea1           = new HorizArea();
            var                  = new Variables.Variables();
            tool_dataPointSelect = new DataPointSelection(BaseChart);

            BaseChart.Chart.Header.Text = "People in different countries";
            BaseChart.Chart.Series.Add(horizArea1);
            BaseChart.Chart.Legend.Visible = false;

            horizArea1.SeriesColor         = var.GetPaletteBasic[0];
            horizArea1.Chart.Zoom.Allow    = false;
            horizArea1.Chart.Panning.Allow = ScrollModes.None;

            horizArea1.RecalcOptions     = RecalcOptions.OnModify;
            horizArea1.DefaultNullValue  = 0;
            horizArea1.AreaLines.Visible = false;
            horizArea1.Pointer.Visible   = true;
            horizArea1.ClickableLine     = true;
            horizArea1.LinePen.Width     = 5;
            horizArea1.ClickPointer     += tool_dataPointSelect.PointValue_Click;
            horizArea1.GetSeriesMark    += tool_dataPointSelect.Serie_GetSeriesMark;

            horizArea1.Pointer.Style          = PointerStyles.Nothing;
            horizArea1.Pointer.InflateMargins = false;
            horizArea1.ClickTolerance         = 30;
            horizArea1.LinePen.Style          = DashStyle.Solid;
            horizArea1.LinePen.EndCap         = PenLineCap.Flat;
            horizArea1.LinePen.DashCap        = PenLineCap.Flat;
            horizArea1.LinePen.Color          = var.GetPaletteBasic[0].AddLuminosity(-0.2);
            horizArea1.VertAxis  = VerticalAxis.Both;
            horizArea1.HorizAxis = HorizontalAxis.Both;

            for (int i = 0; i < var.GetValorHorizArea1.Length; i++)
            {
                horizArea1.Add(var.GetValorHorizArea1[i], var.GetValorHorizAreaX[i]);
            }

            BaseChart.Chart.Axes.Left.SetMinMax(BaseChart.Chart.Axes.Left.MinYValue - 0.001, BaseChart.Chart.Axes.Left.MaxYValue + 0.01);
            BaseChart.Chart.Axes.Bottom.SetMinMax(0, BaseChart.Chart.Axes.Bottom.MaxXValue + 20000);

            BaseChart.Chart.Axes.Bottom.Increment = 30000;

            BaseChart.Chart.Axes.Left.Labels.ValueFormat   = "0";
            BaseChart.Chart.Axes.Bottom.Labels.ValueFormat = "0K";
            BaseChart.Chart.Axes.Left.Title.Pen            = new ChartPen {
                Color = Color.Black, Width = 15
            };

            BaseChart.Chart.Axes.Left.Visible         = true;
            BaseChart.Chart.Axes.Left.AxisPen.Visible = true;
            BaseChart.Chart.Axes.Left.Ticks           = new Axis.TicksPen {
                Width = 2, Visible = true, Color = Color.FromArgb(200, 200, 200), EndCap = PenLineCap.Flat, Style = DashStyle.Solid, Length = 10,
            };
            BaseChart.Chart.Axes.Bottom.Visible = true;

            BaseChart.Chart.Axes.Left.Title.Angle       = 90;
            BaseChart.Chart.Axes.Left.Grid.Visible      = false;
            BaseChart.Chart.Axes.Bottom.Grid.Visible    = false;
            BaseChart.Chart.Axes.Left.Title.Text        = "Countries";
            BaseChart.Chart.Axes.Bottom.Title.Text      = "People (K)";
            BaseChart.Chart.Axes.Left.Title.Font.Size   = 14;
            BaseChart.Chart.Axes.Bottom.Title.Font.Size = 14;
            BaseChart.Chart.Axes.Left.Title.CustomSize  = 50;
            BaseChart.Chart.Axes.Left.LabelsOnAxis      = true;
            BaseChart.Chart.Axes.Left.Labels.AutoSize   = true;
            BaseChart.Chart.Title.AutoSize          = true;
            BaseChart.Chart.Axes.Left.StartPosition = 1;
            BaseChart.Chart.ClickSeries            += null;
            BaseChart.Chart.Panel.MarginLeft        = 6;
            BaseChart.Chart.Axes.Left.Title.Visible = false;

            Themes.AplicarMarksTheme1(BaseChart);

            BaseChart.Chart.Series[0].Marks.Height    = 35;
            BaseChart.Chart.Series[0].Marks.Width     = 110;
            BaseChart.Chart.Series[0].Marks.Font.Size = 12;
        }