Exemple #1
0
        private void CrearPie(Pie pie, int position)
        {
            double[] arrayValues;

            BaseChart.Chart.Series.Add(pie);

            pie.MultiPie             = MultiPies.Automatic;
            pie.CustomXRadius        = (App.ScreenWidth / 2) - (App.ScreenWidth / 5);
            pie.CustomYRadius        = (App.ScreenHeight / 2) - (App.ScreenHeight / 3);
            pie.MarksPie.InsideSlice = true;
            pie.Chart.Zoom.Allow     = false;
            pie.Chart.Panning.Allow  = ScrollModes.None;
            pie.MultiPie             = MultiPies.Automatic;
            pie.AutoCircleResize     = true;
            pie.RecalcOptions        = RecalcOptions.OnModify;
            pie.DefaultNullValue     = 0;
            pie.AutoPenColor         = false;
            pie.DarkPen            = false;
            pie.Pen.Width          = 3;
            pie.Pen.Style          = DashStyle.Solid;
            pie.Pen.Visible        = true;
            pie.Pen.Color          = Color.White;
            pie.DefaultNullValue   = 0;
            pie.VertAxis           = VerticalAxis.Both;
            pie.HorizAxis          = HorizontalAxis.Both;
            pie.UniqueCustomRadius = true;

            // Encuentra el array con los valores que debe usar para cada pie
            switch (position)
            {
            case 0:
                arrayValues = var.GetValorMultiPie1;
                break;

            case 1:
                arrayValues = var.GetValorMultiPie2;
                break;

            case 2:
                arrayValues = var.GetValorMultiPie3;
                break;

            default:
                arrayValues = var.GetValorMultiPie4;
                break;
            }

            for (int i = 0; i < 3; i++)
            {
                if (arrayValues[i] != 0)
                {
                    pie.Add(position, arrayValues[i], var.GetValorMultiPieItems[i], var.GetPaletteBasic[i]);
                }
                ;
            }

            pie.Title = "House " + (position + 1);
            MarksAplicar(pie);
        }
        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;
        }
        private void InitializeChart()
        {
            Charts = new List <TChart>();
            Charts.Add(tChart1);
            Charts.Add(tChart2);
            Charts.Add(tChart3);
            Charts.Add(tChart4);
            Charts.Add(tChart5);
            Charts.Add(tChart6);
            Charts.Add(tChart7);

            foreach (var item in Charts)
            {
                item.Aspect.View3D                = false;
                item.Header.Font.Color            = Utils.HexToColor("FFFFFFFF");
                item.Header.Font.Size             = 18;
                item.Header.Alignment             = TextAlignment.Left;
                item.Panel.Gradient.Visible       = false;
                item.Walls.Visible                = false;
                item.Legend.Visible               = false;
                item.Aspect.GestureOptions        = Steema.TeeChart.Store.Drawing.Aspect.Gestures.None;
                item.Axes.Bottom.Visible          = false;
                item.Axes.Left.AxisPen.Visible    = false;
                item.Axes.Left.Labels.Font.Color  = Utils.HexToColor("FFFFFFFF");
                item.Axes.Left.Grid.Color         = Utils.HexToColor("FFFFFFFF");
                item.Axes.Left.Ticks.Visible      = false;
                item.Axes.Left.MinorTicks.Visible = false;
            }

            tChart1.Panel.Color = Utils.HexToColor("FF66CDAA");
            tChart2.Panel.Color = Utils.HexToColor("FF0066CC");
            tChart3.Panel.Color = Utils.HexToColor("FFDC143C");
            tChart4.Panel.Color = Utils.HexToColor("FFFFA500");
            tChart5.Panel.Color = Utils.HexToColor("FFFF69B4");
            tChart6.Panel.Color = Utils.HexToColor("FFBA55D3");
            tChart7.Panel.Color = Utils.HexToColor("FF66CDAA");

            Bar bar = new Bar(tChart1.Chart);

            bar.Gradient.Visible     = true;
            bar.Gradient.StartColor  = Utils.HexToColor("FFFFFFFF");
            bar.Gradient.EndColor    = Colors.Transparent;
            bar.Pen.Visible          = false;
            bar.RoundSize            = 8;
            bar.BarRound             = BarRounding.AtValue;
            bar.BarStyle             = BarStyles.RoundRectangle;
            bar.Marks.Arrow.Visible  = false;
            bar.Marks.Brush.Color    = bar.Gradient.StartColor;
            bar.Marks.Pen.Visible    = false;
            bar.Marks.Font.Color     = tChart1.Panel.Color;
            bar.Marks.Shadow.Visible = false;
            bar.Marks.ShapeStyle     = Steema.TeeChart.Store.Drawing.TextShapeStyle.RoundRectangle;
            bar.FillSampleValues();
            Line line = new Line(tChart1.Chart);

            line.Color = Utils.HexToColor("FFFFFFFF");
            line.FillSampleValues();
            line.Smoothed = true;

            tChart1.Header.Text = "Lines and Bars";

            ActivityGauge world = new ActivityGauge(tChart2.Chart);
            Random        rnd   = new Random();

            tChart2.Panel.Color            = Colors.White;
            tChart2.Panel.Gradient.Visible = false;
            world.BackColor = Colors.White;
            world.Add(rnd.Next(100), Utils.FromArgb(135, 206, 250));
            world.Add(rnd.Next(100), Utils.FromArgb(102, 205, 170));
            world.Add(rnd.Next(100), Utils.FromArgb(220, 20, 60));
            world.Add(rnd.Next(100), Utils.FromArgb(255, 105, 180));
            world.Add(rnd.Next(100), Utils.FromArgb(186, 85, 211));

            tChart2.Header.Text       = "Gauges";
            tChart2.Header.Font.Color = Utils.FromArgb(186, 85, 211);


            CircularGauge gauge = new CircularGauge(tChart4.Chart);

            gauge.Frame.Visible = false;
            gauge.FaceBrush.Gradient.Visible    = false;
            gauge.FaceBrush.Color               = tChart4.Panel.Color;
            gauge.GreenLine.Pen.Visible         = false;
            gauge.GreenLine.Gradient.EndColor   = Utils.HexToColor("FFFDFDFD");
            gauge.GreenLine.Gradient.StartColor = Utils.HexToColor("FFC4C4C4");
            gauge.RedLine.Gradient.StartColor   = Utils.HexToColor("FFC4C4C4");
            gauge.RedLine.Gradient.EndColor     = Utils.HexToColor("FF848484");
            gauge.RedLine.Pen.Visible           = false;
            gauge.Ticks.Gradient.Visible        = false;
            gauge.Ticks.Color                 = Utils.HexToColor("FFFFFFFF");
            gauge.Ticks.Pen.Color             = Utils.HexToColor("FFFFFFFF");
            gauge.MinorTicks.Gradient.Visible = false;
            gauge.MinorTicks.Color            = Utils.HexToColor("FFFFFFFF");
            gauge.MinorTicks.Pen.Color        = Utils.HexToColor("FFFFFFFF");
            gauge.Hand.Gradient.Visible       = false;
            gauge.Hand.Color             = Utils.HexToColor("FFFDFDFD");
            gauge.Hand.Shadow.Visible    = false;
            gauge.Center.Shadow.Visible  = false;
            gauge.Axis.Labels.Font.Size  = 8;
            gauge.Axis.Labels.Font.Color = Utils.HexToColor("FFFFFFFF");
            gauge.Axis.AxisPen.Visible   = true;
            gauge.Axis.AxisPen.Color     = Utils.HexToColor("FFFFFFFF");
            gauge.FillSampleValues();
            tChart4.Header.Text = "Gauges";

            Bubble bubble = new Bubble(tChart5.Chart);

            bubble.ColorEach = false;
            bubble.Pointer.Gradient.Visible     = true;
            bubble.Pointer.Pen.Visible          = false;
            bubble.Pointer.Gradient.StartColor  = Utils.HexToColor("FFFFFFFF");
            bubble.Pointer.Gradient.EndColor    = Colors.Transparent;
            tChart5.Axes.Left.Labels.Font.Color = Colors.Transparent;
            bubble.Add(1, 1, 1);
            bubble.Add(2, 2, 10);
            bubble.Add(3, 3, 5);
            bubble.Add(4, 4, 3);
            bubble.Add(5, 5, 7);
            tChart5.Header.Text = "Bubbles and Gantt";

            Area area = new Area(tChart6.Chart);

            area.LinePen.Color       = Utils.HexToColor("FFFFFFFF");
            area.Gradient.Visible    = true;
            area.Gradient.StartColor = Utils.HexToColor("FFFFFFFF");
            area.Gradient.EndColor   = Colors.Transparent;
            area.Smoothed            = true;
            area.FillSampleValues();
            Area area1 = new Area(tChart6.Chart);

            area1.LinePen.Color       = Utils.HexToColor("FFFFFFFF");
            area1.Gradient.Visible    = true;
            area1.Gradient.StartColor = Utils.HexToColor("FFFFFFFF");
            area1.Gradient.EndColor   = Colors.Transparent;
            area1.Smoothed            = true;
            area1.FillSampleValues();
            tChart6.Axes.Left.Visible              = false;
            tChart6.Axes.Bottom.Visible            = true;
            tChart6.Header.Text                    = "Areas and Points";
            tChart6.Axes.Bottom.AxisPen.Visible    = false;
            tChart6.Axes.Bottom.Labels.Font.Color  = Utils.HexToColor("FFFFFFFF");
            tChart6.Axes.Bottom.Grid.Color         = Utils.HexToColor("FFFFFFFF");
            tChart6.Axes.Bottom.Ticks.Visible      = false;
            tChart6.Axes.Bottom.MinorTicks.Visible = false;
            tChart6.Axes.Bottom.Increment          = 10;
            tChart6.Axes.Bottom.Labels.Font.Size   = 10;

            Pie pie = new Pie(tChart3.Chart);

            pie.ColorEach = false;
            pie.Add(2, "Tables", Utils.HexToColor("FFFFFFFF"));
            pie.Add(1, "Chairs", Utils.HexToColor("FFF2F2F2"));
            pie.Add(1, "Sofas", Utils.HexToColor("FFDFDFDF"));
            pie.Add(1, "Cupboards", Utils.HexToColor("FFD7D7D7"));
            pie.AutoPenColor        = false;
            pie.Pen.Color           = tChart3.Panel.Color;
            pie.Pen.Width           = 3;
            pie.Circled             = true;
            pie.Marks.Brush.Visible = false;
            pie.Marks.Pen.Visible   = false;
            pie.Marks.Font.Color    = tChart3.Panel.Color;
            pie.Marks.Font.Size     = 6;
            pie.Marks.ArrowLength   = -20;
            pie.Marks.Arrow.Visible = false;
            pie.AutoCircleResize    = false;
            pie.BeforeDrawValues   += Pie_BeforeDrawValues;

            Donut donut = new Donut(tChart3.Chart);

            donut.ColorEach = false;
            donut.Circled   = true;
            donut.Add(2, "Tables", Utils.HexToColor("FFFFFFFF"));
            donut.Add(1, "Chairs", Utils.HexToColor("FFF2F2F2"));
            donut.Add(1, "Sofas", Utils.HexToColor("FFDFDFDF"));
            donut.Add(1, "Cupboards", Utils.HexToColor("FFD7D7D7"));
            donut.MarksPie.LegSize    = 10;
            donut.Marks.Brush.Visible = false;
            donut.Marks.Pen.Visible   = false;
            donut.Marks.Font.Color    = Utils.HexToColor("FFFFFFFF");
            donut.Marks.Font.Size     = 6;
            donut.Marks.Arrow.Color   = Utils.HexToColor("FFFFFFFF");
            donut.AutoPenColor        = false;
            donut.Pen.Color           = tChart3.Panel.Color;
            donut.Pen.Width           = 3;
            donut.AutoCircleResize    = false;
            donut.BeforeDrawValues   += Donut_BeforeDrawValues;
            tChart3.Header.Text       = "Pies and Donuts";


            Calendar calendar = new Calendar(tChart7.Chart);

            calendar.NextMonthButton.Visible     = false;
            calendar.PreviousMonthButton.Visible = false;
            tChart7.Header.Text = "Calendars";
        }