コード例 #1
1
        protected internal void drawChartPie1(WebChartControl viewer, String title)
        {
            PieChart c = new PieChart(900, 380);

            // Set the center of the pie at (300, 140) and the radius to 120 pixels
            c.setPieSize(450, 140, 160);

            c.set3D(20);

            c.addTitle(title);

            // Set label format to display sector label, value and percentage in two lines
            c.setLabelFormat("<*block,width=200*> {label}<*br*>{value|0} ({percent}%)");
            c.setLabelLayout(Chart.SideLayout);

            // Set label style to 10 pts Arial Bold Italic font. Set background color to the
            // same as the sector color, with reduced-glare glass effect and rounded corners.
            ChartDirector.TextBox t = c.setLabelStyle("Arial Bold Italic", 10);
            t.setBackground(Chart.SameAsMainColor, Chart.Transparent, Chart.glassEffect(
                Chart.ReducedGlare));
            t.setRoundedCorners();

            // Use side label layout method
            c.setLabelLayout(Chart.SideLayout);

            String[] labels = new String[viewer.Items.Length];
            double[] data = new double[viewer.Items.Length];
            // Set the pie data and the pie labels
            int i = 0;
            double sum =0;
            foreach (ChartDataLayer item in viewer.Items)
            {
                item.subDataSetSize(item.Count);
                item.subDataGetTable();
                data[i] = item.subDataAverage;
                sum+= item.subDataAverage;
                labels[i++] = item.Text;
            }

            c.setData(data, labels);

            c.addText(700, 320, "Σύνολο:" + sum, "Arial Bold Italic", 12);

            c.setTransparentColor(0xffffff);
            viewer.Image = c.makeWebImage(Chart.PNG);

            viewer.ImageMap = (c.getHTMLImageMap("#", "{label}", "title='{label}: {value|0}({percent}%)'")).Replace("href=\"#?", "href=\"#");
        }
コード例 #2
0
ファイル: StudentListDetails.cs プロジェクト: dansalan/DCFIv5
 private void btnGenerate_Click(object sender, EventArgs e)
 {
     switch (cmbReportType.Text)
     {
         case "Grid":
             GridReport gR = new GridReport();
             gR.setVars(cmbGroupBy.Text, cmbSY.Text);
             gR.Show();
             break;
         case "Bar Chart":
             BarChart bC = new BarChart();
             bC.setVars(cmbGroupBy.Text, cmbSY.Text);
             bC.Show();
             break;
         case "Line Chart":
             LineChart lC = new LineChart();
             lC.setVars(cmbGroupBy.Text, cmbSY.Text);
             lC.Show();
             break;
         case "Pie Chart":
             PieChart pC = new PieChart();
             pC.setVars(cmbGroupBy.Text, cmbSY.Text);
             pC.Show();
             break;
     }
 }
コード例 #3
0
 // =================================================        SetPieChart
 private void SetPieChart ()
 {
     fVal = Auxi_Common .RandomArray (1000, nValues);
     piechart = new PieChart (this, ptCenter, nRadius, fVal);
     piechart .StartingAngle = Math .PI;
     piechart .SectorCommentsVisibility = false;
     piechart .Colors = Auxi_Colours .SmoothColorsList (fVal .Length, clrStart, clrEnd);
     TextsSource txtsource = (TextsSource) comboTexts .SelectedIndex;
     switch (txtsource)
     {
         case TextsSource .Alphabet:
             piechart .SectorTexts = Auxi_Common .strAlphabet;
             break;
         case TextsSource .Days:
             piechart .SectorTexts = Auxi_Common .strDays;
             break;
         case TextsSource .ElvishSong:
             piechart .SectorTexts = Auxi_Common .strElvishSong;
             break;
         case TextsSource .Months:
             piechart .SectorTexts = Auxi_Common .strMonths;
             break;
         case TextsSource .Names:
             piechart .SectorTexts = Auxi_Common .strNames;
             break;
         case TextsSource .Undefined:
             // all texts were set to "Undefined" by default
             break;
     }
     listValues .Items .Clear ();
     foreach (double val in fVal)
     {
         listValues .Items .Add (Convert .ToInt32 (val) .ToString ());
     }
 }
コード例 #4
0
 public UIView GetViewForHeader(UITableView tableView, int section)
 {
     if (typeof(SecuritiesViewModel).Equals (viewModel.GetType ())) {
         RectangleF rect = new RectangleF (0, 0, SecuritiesTableView.Frame.Size.Width, this.SecuritiesTableView.Frame.Height / 2);
         PieChart chart = new PieChart (rect);
         return chart;
     } else {
         return new UIView (RectangleF.Empty);
     }
 }
コード例 #5
0
    protected void Page_Load(object sender, EventArgs e)
    {
        // We will generate random values everyt time this page is requested
        Random rnd = new Random();

        PieChart pc = new PieChart();
        pc.Items.Add(new PieChartDataItem("Men", rnd.Next(30, 70)));
        pc.Items.Add(new PieChartDataItem("Women", rnd.Next(30, 70)));

        Response.Write(pc.GetDataXml().OuterXml);
    }
コード例 #6
0
        public string get_widgets_messagetypeperminutetypecompare_WidgetSettingId(MessageTypePerMinuteModel input)
        {
            //TODO: Change so that we get the settings from raven
            //var widgetSetting = _session.Load<MessageTypePerMinuteTypeCompare>(input.WidgetSettingId);

            IList<Guid> messageTypes = new List<Guid>
                                           {
                                               Guid.NewGuid(),
                                               Guid.NewGuid()
                                           };

            var widgetSetting = new MessageTypePerMinuteTypeCompare
                                    {
                                        ForMinutesInThePast = 10,
                                        MessageTypeId = messageTypes
                                    };

            DateTime from = DateTime.Now.AddMinutes(widgetSetting.ForMinutesInThePast * -1);

            //TODO: Change so that we call the raven index
            //var messageTypePerMinuteIndexData =
            //    _session.Query<MessageTypePerMinuteIndexData, PhysicalMonitoring.Index.MessageTypePerMinute>().Where(
            //        x => widgetSetting.MessageTypeId.Contains(x.MessageTypeId) && x.Minute >= from).ToList();

            var messageTypePerMinuteIndexData = new List<MessageTypePerMinuteIndexData>
                                                    {
                                                        new MessageTypePerMinuteIndexData
                                                            {
                                                                MessageTypeId = messageTypes.First(),
                                                                Minute = DateTime.Now.AddMinutes(-5),
                                                                Count = 10
                                                            },
                                                        new MessageTypePerMinuteIndexData
                                                            {
                                                                MessageTypeId = messageTypes[1],
                                                                Minute = DateTime.Now,
                                                                Count = 7
                                                            }
                                                    };

            var pieChart = new PieChart();

            foreach (var typePerMinuteIndexData in messageTypePerMinuteIndexData)
            {
                pieChart.Item.Add(new PieChartItem
                                      {
                                          Label = typePerMinuteIndexData.MessageTypeId.ToString(),
                                          Value = typePerMinuteIndexData.Count.ToString(CultureInfo.InvariantCulture)
                                      });
            }

            return JsonConvert.SerializeObject(pieChart);
        }
コード例 #7
0
    private void PlotGraphs()
    {
        try
        {
            ChartID idSelected;
            IChart chartToLoad;

            foreach (Control control in Page.Master.FindControl("MainContent").Controls)
            {
                if (control.GetType().Name == "ChartLiteral")
                {
                    SandlerControls.ChartLiteral literalControl = control as SandlerControls.ChartLiteral;
                    literalControl.Text = "";

                    idSelected = (ChartID)Enum.Parse(typeof(ChartID), literalControl.ID, true);

                    ChartRepository cR = new ChartRepository();
                    SandlerModels.TBL_CHART dbChart = cR.GetAll().Where(c => c.ChartID == literalControl.ID && c.IsActive == true).SingleOrDefault();

                    if (dbChart.TypeOfChart == "Chart")
                    {
                        chartToLoad = new Chart() { BGAlpha = dbChart.BgAlpha, BGColor = dbChart.BgColor, CanvasBGAlpha = dbChart.CanvasBgAlpha, CanvasBGColor = dbChart.CanvasBgColor, Caption = dbChart.Caption, SWF = dbChart.SWFile, NumberSuffix = dbChart.NumberSuffix, PieRadius = dbChart.PieRadius, showLabels = dbChart.ShowLabels, showLegend = dbChart.ShowLegend, XaxisName = dbChart.XaxisName, YaxisName = dbChart.YaxisName, Id = idSelected, enableRotation = dbChart.EnableRotation, DrillChartIds = (string.IsNullOrEmpty(dbChart.DrillLevelChartIDs)) ? "" : dbChart.DrillLevelChartIDs };
                        chartToLoad.LoadChart(CurrentUser);
                        chartToLoad.CreateChart();
                        literalControl.Text = FusionCharts.RenderChart(@"FusionChartLib/" + ((Chart)chartToLoad).SWF, "", ((Chart)chartToLoad).ChartXML, literalControl.ID, literalControl.Width, literalControl.Height, false, true);
                    }
                    else if (dbChart.TypeOfChart == "PieChart")
                    {
                        chartToLoad = new PieChart() { BGAlpha = dbChart.BgAlpha, BGColor = dbChart.BgColor, CanvasBGAlpha = dbChart.CanvasBgAlpha, CanvasBGColor = dbChart.CanvasBgColor, Caption = dbChart.Caption, SWF = dbChart.SWFile, NumberSuffix = dbChart.NumberSuffix, PieRadius = dbChart.PieRadius, showLabels = dbChart.ShowLabels, showLegend = dbChart.ShowLegend, XaxisName = dbChart.XaxisName, YaxisName = dbChart.YaxisName, Id = idSelected, enableRotation = dbChart.EnableRotation, DrillChartIds = (string.IsNullOrEmpty(dbChart.DrillLevelChartIDs)) ? "" : dbChart.DrillLevelChartIDs };
                        ((PieChart)chartToLoad).LoadChart(CurrentUser);
                        ((PieChart)chartToLoad).CreateChart();

                        literalControl.Text = FusionCharts.RenderChart(@"FusionChartLib/" + ((PieChart)chartToLoad).SWF, "", ((PieChart)chartToLoad).ChartXML, literalControl.ID, literalControl.Width, literalControl.Height, false, true);
                    }
                    else if (dbChart.TypeOfChart == "BarChart")
                    {
                        chartToLoad = new BarChart() { BGAlpha = dbChart.BgAlpha, BGColor = dbChart.BgColor, CanvasBGAlpha = dbChart.CanvasBgAlpha, CanvasBGColor = dbChart.CanvasBgColor, Caption = dbChart.Caption, SWF = dbChart.SWFile, NumberSuffix = dbChart.NumberSuffix, PieRadius = dbChart.PieRadius, showLabels = dbChart.ShowLabels, showLegend = dbChart.ShowLegend, XaxisName = dbChart.XaxisName, YaxisName = dbChart.YaxisName, Id = idSelected, enableRotation = dbChart.EnableRotation, DrillChartIds = (string.IsNullOrEmpty(dbChart.DrillLevelChartIDs)) ? "" : dbChart.DrillLevelChartIDs };
                        ((BarChart)chartToLoad).LoadChart(CurrentUser);
                        ((BarChart)chartToLoad).CreateChart();
                        literalControl.Text = FusionCharts.RenderChart(@"FusionChartLib/" + ((BarChart)chartToLoad).SWF, "", ((BarChart)chartToLoad).ChartXML, literalControl.ID, literalControl.Width, literalControl.Height, false, true); ;
                    }

                }
            }

        }
        catch (Exception ex)
        {
            throw ex;
        }
    }
コード例 #8
0
        public static bool Generate(string filename)
        {
            Document document = new Document(PageSize.A4, 0f, 0f, 0f, 0f);
            PdfWriter writer = PdfWriter.GetInstance(document, new FileStream(filename, FileMode.Create));
            document.Open();

            PdfContentByte canvas = writer.DirectContent;

            Font font = FontFactory.GetFont(FontFactory.HELVETICA_BOLD, 10);

            string[] captions = { "ATM", "CASH", "WEB", "MOBILE" };
            //double[] values = { 2, 60, 20, 18 };
            double[] values = { 5, 60, 35, 0 };
            PieChart chart = new PieChart(values, captions);
            canvas.DrawPieChart(chart, 110, 730, 100);
            canvas.DrawPieChart(chart, 410, 730, 60);

            string[] captions2 = { "CAPTION 1", "CAPTION 2", "CAPTION 3", "CAPTION 4", "CAPTION 5", "CAPTION 6", "CAPTION 7", "CAPTION 8", "CAPTION 9", "CAPTION 10" };
            double[] values2 = { 100, 80, 60, 40, 50, 60, 30, 0, 90, 40 };
            chart = new PieChart(values2, captions2);
            canvas.DrawPieChart(chart, 110, 520, 100, font);
            canvas.DrawPieChart(chart, 410, 520, 60);

            //string[] captions3 = { "CAPTION 1", "CAPTION 2", "CAPTION 3" };
            //double[] values3 = { 100, 80, 60 };
            //System.Drawing.Color[] colors = new System.Drawing.Color[] { System.Drawing.Color.Black,
            //    System.Drawing.Color.CornflowerBlue,
            //    System.Drawing.Color.Brown };

            //chart = new PieChart(values3, captions3, colors);
            //canvas.DrawPieChart(chart, 110, 300, 100, font);
            //canvas.DrawPieChart(chart, 410, 300, 60);

            string[] captions4 = { "CAPTION 1", "CAPTION 2", "CAPTION 3", "CAPTION 4", "CAPTION 5" };
            double[] values4 = { 100, 80, 60, 50, 50 };
            BaseColor pantome376 = new BaseColor(130, 197, 91);
            BaseColor pantone369 = new BaseColor(95, 182, 85);
            BaseColor pantonecool = new BaseColor(88, 89, 91);
            BaseColor pantone447 = new BaseColor(67, 66, 61);
            BaseColor pantonecoolLight = new BaseColor(173, 216, 230);
            BaseColor[] colors4 = { pantome376, pantone369, pantonecool, pantone447, pantonecoolLight };
            chart = new PieChart(values4, captions4, colors4);
            canvas.DrawPieChart(chart, 110, 300, 100, font);
            canvas.DrawPieChart(chart, 410, 300, 60);

            document.Close();
            return true;
        }
コード例 #9
0
ファイル: Form_Main.cs プロジェクト: enildne/zest
        // -------------------------------------------------        OnLoad
        private void OnLoad (object sender, EventArgs e)
        {
            Auxi_Colours .VisibleFrame (this);

            plot = new MSPlot (this, new Rectangle (50, 60, 350, 290), Side .S, 0.0, 4 * Math .PI, GridOrigin .ByStep, Math .PI,
                                                                       Side .E, 1.0, -1.0, GridOrigin .ByStep, 0.5);
            plot .AddComment (0.5, -14, "Sin (x) * Cos (12x)", 
                              new Font ("Times New Roman", 11, FontStyle .Bold | FontStyle .Italic), 0, Color .Blue);

            piechart = new PieChart (this, new Point (500, 330), 140, Auxi_Common .RandomArray (1000, Auxi_Common .strDays .Length));
            piechart .SectorTexts = Auxi_Common .strDays;

            Font fnt = new Font ("Times New Roman", 14, FontStyle.Bold | FontStyle.Italic);
            house9 = new ApartmentHouse (new Rectangle (690, 110, 120, 210));
            house9 .HouseColor = Color .White;
            house9 .RoofColor = Color .Red;
            house9 .DoorColor = Color .Brown;
            house9 .WindowColor = Color .Cyan;

            house23 = new ApartmentHouse (new Rectangle (580, 90, 130, 110));
            house23 .HouseColor = Color .Yellow;
            house23 .RoofColor = Color .Green;

            Point ptC = new Point (100, 440);
            int radius = 50;
            Color [] clrs = Auxi_Colours .SmoothChangedColors (4, Auxi_Colours .ColorPredefined (4), Auxi_Colours .ColorPredefined (5));
            poly4 = new ChatoyantPolygon (Auxi_Geometry .RegularPolygon (4, ptC, radius, 0), ptC, clrs, Auxi_Colours .ColorPredefined (6));
            ptC = new Point (260, 460);
            radius = 75;
            clrs = Auxi_Colours .SmoothChangedColors (7, Auxi_Colours .ColorPredefined (7), Auxi_Colours .ColorPredefined (8));
            poly7 = new ChatoyantPolygon (Auxi_Geometry .RegularPolygon (7, ptC, radius, 0), ptC, clrs, Auxi_Colours .ColorPredefined (9));

            info = new TextM (this, new Point (plot .MainArea .Area .Right + 30, Convert .ToInt32 (poly4 .Center .Y) + 20), strInfo);
            info .BackColor = Color .FromArgb (255, 255, 128);

            ClientSize = new Size (Math .Max (info .Area .Right, house9 .Area .Right) + 20, info .Area .Bottom + 12);

            timerStart .Enabled = true;
            timerStart .Start ();

            RenewMover ();
        }
コード例 #10
0
    public static void DrawPieChart(this PdfContentByte canvas,
        PieChart chart,
        float x0,
        float y0,
        float r = 50f,
        Font font = null,
        bool showCaption = true)
    {
        if (chart.Values.Length != chart.Captions.Length) {
            return;
        }

        if (font == null) {
            font = FontFactory.GetFont(FontFactory.TIMES, 8);
        }

        canvas.SetLineWidth(0f);

        double _x1, _y1, _x2, _y2;
        float x1, y1, x2, y2;

        canvas.SetLineWidth(1f);
        float cRadius = (float)(r + 0.5);
        canvas.Circle(x0, y0, cRadius);
        canvas.SetColorStroke(BaseColor.GRAY);
        canvas.Stroke();

        canvas.SetLineWidth(0f);
        float rectX1 = x0 - r;
        float rectY1 = y0 - r;

        float xPoint = x0 + r;
        float yPoint = y0 + r;

        //canvas.Rectangle(rectX1, rectY1, 2 * r, 2 * r);
        //canvas.Stroke();

        double _startAngle = 0;
        double _endAngle = 0;

        float startAngle = 0;
        float endAngle = 0;

        float captionY = y0 + (chart.Values.Length - 1) * 6;
        double _percentage;
        string percentage;

        for (int counter = 0; counter < chart.Values.Length; counter++) {
            if (chart.TotalValues > 0)
                _percentage = chart.Angles[counter] * 100 / 360;
            else
                _percentage = 0;

            if (showCaption) {
                //captions from here
                canvas.SetColorStroke(chart.ChartColors[counter]);
                canvas.SetColorFill(chart.ChartColors[counter]);
                canvas.Rectangle(x0 + r + 10, captionY, 7, 7);
                canvas.ClosePathFillStroke();

                percentage = string.Format("{0:N}", _percentage);
                ColumnText text2 = new ColumnText(canvas);
                Phrase phrase = new Phrase(string.Format("{0} ({1}%)", chart.Captions[counter], percentage), font);
                text2.SetSimpleColumn(phrase, x0 + r + 20, captionY, x0 + r + 200, captionY, 0f, 0);
                text2.Go();

                captionY -= 12;
                if (_percentage == 0) {
                    continue;
                }
                //end of caption
            }

            if (chart.TotalValues <= 0)
                continue;

            if (_percentage <= 50) {
                //get coordinate on circle
                _x1 = x0 + r * Math.Cos(_startAngle * Math.PI / 180);
                _y1 = y0 + r * Math.Sin(_startAngle * Math.PI / 180);
                x1 = (float)_x1;
                y1 = (float)_y1;

                _endAngle += chart.Angles[counter];
                _x2 = x0 + r * Math.Cos(_endAngle * Math.PI / 180);
                _y2 = y0 + r * Math.Sin(_endAngle * Math.PI / 180);
                x2 = (float)_x2;
                y2 = (float)_y2;

                startAngle = (float)_startAngle;
                endAngle = (float)_endAngle;

                //set the colors to be used
                canvas.SetColorStroke(chart.ChartColors[counter]);
                canvas.SetColorFill(chart.ChartColors[counter]);

                //draw the triangle within the circle
                canvas.MoveTo(x0, y0);
                canvas.LineTo(x1, y1);
                canvas.LineTo(x2, y2);
                canvas.LineTo(x0, y0);
                canvas.ClosePathFillStroke();
                //draw the arc
                canvas.Arc(rectX1, rectY1, xPoint, yPoint, startAngle, (float)chart.Angles[counter]);
                canvas.ClosePathFillStroke();
                _startAngle += chart.Angles[counter];
            }
            else {
                //DO THE FIRST PART
                //get coordinate on circle
                _x1 = x0 + r * Math.Cos(_startAngle * Math.PI / 180);
                _y1 = y0 + r * Math.Sin(_startAngle * Math.PI / 180);
                x1 = (float)_x1;
                y1 = (float)_y1;

                _endAngle += 180;
                _x2 = x0 + r * Math.Cos(_endAngle * Math.PI / 180);
                _y2 = y0 + r * Math.Sin(_endAngle * Math.PI / 180);
                x2 = (float)_x2;
                y2 = (float)_y2;

                startAngle = (float)_startAngle;
                endAngle = (float)_endAngle;

                //set the colors to be used
                canvas.SetColorStroke(chart.ChartColors[counter]);
                canvas.SetColorFill(chart.ChartColors[counter]);

                //draw the triangle within the circle
                canvas.MoveTo(x0, y0);
                canvas.LineTo(x1, y1);
                canvas.LineTo(x2, y2);
                canvas.LineTo(x0, y0);
                canvas.ClosePathFillStroke();
                //draw the arc
                canvas.Arc(rectX1, rectY1, xPoint, yPoint, startAngle, 180);
                canvas.ClosePathFillStroke();

                //DO THE SECOND PART
                //get coordinate on circle
                _x1 = x0 + r * Math.Cos((_startAngle + 180) * Math.PI / 180);
                _y1 = y0 + r * Math.Sin((_startAngle + 180) * Math.PI / 180);
                x1 = (float)_x1;
                y1 = (float)_y1;

                _endAngle += chart.Angles[counter] - 180;
                _x2 = x0 + r * Math.Cos(_endAngle * Math.PI / 180);
                _y2 = y0 + r * Math.Sin(_endAngle * Math.PI / 180);
                x2 = (float)_x2;
                y2 = (float)_y2;

                startAngle = (float)_startAngle;
                endAngle = (float)_endAngle;

                //set the colors to be used
                canvas.SetColorStroke(chart.ChartColors[counter]);
                canvas.SetColorFill(chart.ChartColors[counter]);

                //draw the triangle within the circle
                canvas.MoveTo(x0, y0);
                canvas.LineTo(x1, y1);
                canvas.LineTo(x2, y2);
                canvas.LineTo(x0, y0);
                canvas.ClosePathFillStroke();
                //draw the arc
                canvas.Arc(rectX1, rectY1, xPoint, yPoint, startAngle + 180, (float)(chart.Angles[counter] - 180));
                canvas.ClosePathFillStroke();

                _startAngle += chart.Angles[counter];
            }

        }
    }
コード例 #11
0
        private View CreateUserListStatusView(IReadOnlyList <AniListStatusDistribution> statusDistribution)
        {
            var detailView      = LayoutInflater.Inflate(Resource.Layout.View_AniListObjectDetail, null);
            var detailContainer = detailView.FindViewById <LinearLayout>(Resource.Id.AniListObjectDetail_InnerContainer);

            detailView.FindViewById <TextView>(Resource.Id.AniListObjectDetail_Name).Text = "User Lists";
            detailContainer.Orientation = Orientation.Horizontal;

            var chartHeight  = Resources.GetDimensionPixelSize(Resource.Dimension.Details_ChartHeight);
            var legendMargin = Resources.GetDimensionPixelSize(Resource.Dimension.Details_MarginSmall);

            var chartContainer = new LinearLayout(this)
            {
                LayoutParameters = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, chartHeight, 1)
            };

            var legendContainer = new LinearLayout(this)
            {
                LayoutParameters =
                    new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, chartHeight, 1)
                {
                    RightMargin = legendMargin,
                    LeftMargin  = legendMargin
                },
                Orientation = Orientation.Vertical
            };

            var typedColorArray = Resources.ObtainTypedArray(Resource.Array.Chart_Colors);
            var colorList       = new List <int>();

            for (var i = 0; i < typedColorArray.Length(); i++)
            {
                colorList.Add(typedColorArray.GetColor(i, 0));
            }

            var statusChart = new PieChart(this)
            {
                LayoutParameters =
                    new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent)
            };
            var slices = statusDistribution.Select(x => new PieEntry(x.Amount, x.Status.DisplayValue)
            {
                Data = x.Status.DisplayValue
            }).ToList();
            var dataSet = new PieDataSet(slices, "Status")
            {
                SliceSpace = 1,
            };

            dataSet.SetDrawValues(false);
            dataSet.SetColors(colorList.ToArray(), 255);
            var data = new PieData(dataSet);

            statusChart.TransparentCircleRadius = 0;
            statusChart.HoleRadius = 0;
            statusChart.Data       = data;
            statusChart.SetDrawEntryLabels(false);
            statusChart.Description.Enabled = false;
            statusChart.Legend.Enabled      = false;
            statusChart.RotationEnabled     = false;

            chartContainer.AddView(statusChart);

            for (var i = 0; i < statusDistribution.Count; i++)
            {
                var cell   = LayoutInflater.Inflate(Resource.Layout.View_ChartLegendCell, legendContainer, false);
                var status = statusDistribution[i];
                cell.SetBackgroundColor(new Color(colorList[i % 10]));
                cell.FindViewById <TextView>(Resource.Id.ChartLegendCell_Count).Text = status.Amount.ToTruncatedString();
                cell.FindViewById <TextView>(Resource.Id.ChartLegendCell_Text).Text  = status.Status.DisplayValue;
                cell.Tag = status.Status.DisplayValue;
                legendContainer.AddView(cell);
            }

            detailContainer.AddView(chartContainer);
            detailContainer.AddView(legendContainer);

            return(detailView);
        }
コード例 #12
0
    /// <summary>
    /// draw the eligibility pie chart
    /// </summary>
    /// <param name="c"></param>
    /// <param name="g"></param>
    /// <param name="r"></param>
    private Graphics DrawEligibilityPieChart(Graphics g, Rectangle r)
    {
        float CoursesTotal = 0;
        if (CoursesTotal == 0) return g;  //division by 0 error
        Int16 intSlices = 0;

        PieChart[] pieChart = new PieChart[intSlices];

        //insert code here

        return DrawPieChart(pieChart, g);
    }
コード例 #13
0
ファイル: Form_Medley.cs プロジェクト: enildne/zest
 // -------------------------------------------------
 public SingleElem (PieChart pie)
 {
     rotelem = MedleyElem .PieChart;
     piechart = pie;
     ringset = null;
     barchart = null;
 }
コード例 #14
0
ファイル: TestdataHelper.cs プロジェクト: northshoreab/Hygia
        public static PieChart GetPieChart()
        {
            var pieChart = new PieChart();

            pieChart.Item.Add(new PieChartItem
                                  {
                                      Colour = ColorToHexString(Color.Blue),
                                      Label = "Order placed",
                                      Value = "500"
                                  });

            pieChart.Item.Add(new PieChartItem
                                  {
                                      Colour = ColorToHexString(Color.Green),
                                      Label = "Order paid",
                                      Value = "300"
                                  });
            pieChart.Item.Add(new PieChartItem
                                  {
                                      Colour = ColorToHexString(Color.Yellow),
                                      Label = "Order delivered",
                                      Value = "200"
                                  });

            return pieChart;
        }
コード例 #15
0
ファイル: Form_PieCharts.cs プロジェクト: enildne/zest
 // -------------------------------------------------        Click_btnAddChart
 private void Click_btnAddChart (object sender, EventArgs e)
 {
     int nSector = Convert .ToInt32 (numericUD_Sectors .Value);
     double [] fRandVal = Auxi_Common .RandomArray (1000, nSector);
     PieChart chart = new PieChart (this, Auxi_Geometry .Middle (ClientRectangle), 
                                    Math .Max (ClientRectangle .Width, ClientRectangle .Height) / 4, fRandVal);
     chart .SectorTexts = Auxi_Common .strMonths;
     chart .Colors = Auxi_Colours .SmoothColorsList (nSector, clrStart, clrEnd);
     chart .AddComment (0, 0, DateTime .Now .ToShortTimeString (),
                        new Font ("Times New Roman", 12, FontStyle .Bold | FontStyle .Italic), 0, Color .Blue);
     piecharts .Insert (0, chart);
     RenewMover ();
     Invalidate ();
 }
コード例 #16
0
ファイル: ChartsDrawer.cs プロジェクト: BloodyBlade/Fairytale
 /// <summary>
 /// Получить круговую диаграмму "Доходы от игр в разрезе по источникам информации".
 /// </summary>
 /// <returns>Возвращает круговую диаграмму "Доходы от игр в разрезе по источникам информации".</returns>
 public static PieChart GetGamesCountByInformationSourcesPie(IList<DetailedStatistics> detailedStatistics)
 {
     var gamesRevenuesByInformationSourcesPie = new PieChart();
       var pieData = new List<SimpleData>();
       var allReports = detailedStatistics.SelectMany(s => s.Reports).ToList();
       var informationSources = allReports.Select(r => r.InformationSource).Distinct().ToList();
       foreach (var informationSource in informationSources)
       {
     var simpleData = new SimpleData()
     {
       Value = allReports.Where(r => r.InformationSourceId == informationSource.Id).Count(),
       Label = informationSource.Name,
       Color = Colors.NextColor
     };
     pieData.Add(simpleData);
       }
       gamesRevenuesByInformationSourcesPie.Data = pieData;
       gamesRevenuesByInformationSourcesPie.ChartConfiguration.SegmentShowStroke = true;
       gamesRevenuesByInformationSourcesPie.ChartConfiguration.Responsive = true;
       return gamesRevenuesByInformationSourcesPie;
 }
コード例 #17
0
    /// <summary>
    /// draw the graduation tracking pie chart
    /// </summary>
    /// <param name="c"></param>
    /// <param name="g"></param>
    /// <param name="r"></param>
    private Graphics DrawGradTrackingPieChart(Graphics g, Rectangle r)
    {
        float CoursesTotal = CoursesAchieved + CoursesPlanned + CoursesRequired;
        if (CoursesTotal == 0.0) return g;  //division by 0 error

        PieChart[] pieChart = new PieChart[3];
        pieChart[0] = new PieChart(CoursesRequired, CoursesTotal, _colourRequired);
        pieChart[1] = new PieChart(CoursesAchieved, CoursesTotal, _colourAchieved);
        pieChart[2] = new PieChart(CoursesPlanned, CoursesTotal, _colourPlanned);

        return DrawPieChart(pieChart, g);
    }
コード例 #18
0
    private Graphics DrawPieChart(PieChart[] p, Graphics g)
    {
        Int16 intStartAngle = 0;
        Int16 intSweepAngle = 0;

        foreach (PieChart slice in p)
        {
            intSweepAngle = CalculateSweepAngle(slice.Count, slice.Total);
            intStartAngle = AddPieSlice(slice.SliceBrush, ref g, intStartAngle, intSweepAngle);
        }

        return g;
    }
コード例 #19
0
 private void Awake()
 {
     chart = transform.GetComponent <PieChart>();
     chart.ClearData();
 }
コード例 #20
0
ファイル: Form_Medley.cs プロジェクト: enildne/zest
        // -------------------------------------------------        DefaultView
        private void DefaultView ()
        {
            ClientSize = new Size (811, 690);

            Font fntTitle = new Font ("Times New Roman", 12, FontStyle .Bold | FontStyle .Italic);
            Font fntSectors = new Font ("Times New Roman", 12);
            double angleTitle = 0;
            Color clrTitle = Color .Blue;

            RingSet rs = new RingSet (this, new Point (ClientRectangle .Width / 4, ClientRectangle .Height / 4),
                                            30, 80, new double [] { 1, 2, 4, 8, 16 });
            rs .Rings [0] .SectorTexts = Auxi_Common .strDays;
            int newInner = rs .OuterMostRadius;
            rs .AddRing (newInner, newInner + 50, Math .PI / 3, new double [] { 3, 7, 2, 9, 4 });
            newInner = rs .OuterMostRadius;
            double [] fVal = new double [] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
            RingArea ring = new RingArea (this, new Point (0, 0), newInner, newInner + 75, fVal);
            ring .Colors = Auxi_Colours .SmoothColorsList (fVal .Length, Color .Yellow, Color .Blue);
            ring .SectorTexts = Auxi_Common .strMonths;
            rs .AddRing (ring);
            elems .Add (new SingleElem (rs));

            double [] fRandVal = Auxi_Common .RandomArray (1000, Auxi_Common .strDays .Length);
            PieChart chart = new PieChart (this, new Point (ClientRectangle .Width / 5, ClientRectangle .Height * 2 / 3),
                                           Math .Max (ClientRectangle .Width, ClientRectangle .Height) / 4, fRandVal);
            chart .SectorTexts = Auxi_Common .strDays;
            for (int i = 0; i < chart .Colors .Count; i++)
            {
                chart .ChangeColor (i, Auxi_Colours .ColorPredefined (i));
            }
            int nDifViews = Enum .GetNames (typeof (RoundPlotTextView)) .Length;
            for (int i = 0; i < chart .Sectors; i++)
            {
                chart .SectorComments [i] .TextView = (RoundPlotTextView) (Enum .GetValues (typeof (RoundPlotTextView)) .GetValue (i % nDifViews));
                chart .SectorComments [i] .Font = fntSectors;
            }
            chart .AddComment (-90, 0.2, DateTime .Now .ToShortTimeString (), fntTitle, angleTitle, clrTitle);
            elems .Insert (0, new SingleElem (chart));

            int nSector = 21;
            fRandVal = Auxi_Common .RandomArray (1000, nSector);
            rs = new RingSet (this, new Point (ClientRectangle .Width * 3 / 4, ClientRectangle .Height / 3),
                              40, Convert .ToInt32 (chart .Radius * 1.1), fRandVal);
            rs .Rings [0] .Colors = Auxi_Colours .SmoothColorsList (nSector, Color .White, Color .LightBlue);
            rs .AddComment (90, 0.3, "People", fntTitle, angleTitle, clrTitle);
            for (int i = 0; i < rs .Rings [0] .Sectors; i++)
            {
                rs .Rings [0] .Comments [i] .Text = Auxi_Common .StringOfText (Auxi_Common .strNames, i);
                rs .Rings [0] .Comments [i] .TextView = RoundPlotTextView .Text;
                rs .Rings [0] .Comments [i] .Angle = rs .Rings [0] .Comments [i] .AngleToCenter;
                rs .Rings [0] .Comments [i] .Font = fntSectors;
            }
            rs .Rings [0] .FixedSectorTextsAngles = false;
            rs .Rings [0] .EasyToReadOnRotation = true;
            elems .Insert (0, new SingleElem (rs));

            // barchart
            //
            int nSegment = Auxi_Common .strDays .Length - 2;
            int nSet = 4;
            double [,] fVals = new double [nSet, nSegment];
            for (int i = 0; i < nSet; i++)
            {
                for (int j = 0; j < nSegment; j++)
                {
                    fVals [i, j] = rand .Next (nSeed) % 1000;
                }
            }
            Rectangle rc = new Rectangle (ClientRectangle .Width / 2, ClientRectangle .Height / 2,
                                          ClientRectangle .Width * 3 / 7, ClientRectangle .Height * 2 / 5);
            BarChart barchart = new BarChart (this, rc, fVals, Side .S, Auxi_Common .strDays, TextsDrawingDirection .LTtoRB,
                                                               Side .E, 1000.0, 0.0, GridOrigin .ByStep, 200.0);
            barchart .FillCoefficients (0, 0.85);
            barchart .NumScale .ValuesFormat = "F0";
            barchart .AddComment (0.5, 0.1, "Default BarChart", new Font ("Times New Roman", 11, FontStyle .Bold), 0, Color .Red);
            elems .Insert (0, new SingleElem (barchart));
        }
コード例 #21
0
ファイル: Form_Medley.cs プロジェクト: enildne/zest
 // -------------------------------------------------
 public SingleElem (BarChart bc)
 {
     rotelem = MedleyElem .BarChart;
     piechart = null;
     ringset = null;
     barchart = bc;
 }
コード例 #22
0
ファイル: Form_Medley.cs プロジェクト: enildne/zest
 // -------------------------------------------------
 public SingleElem (RingSet rs)
 {
     rotelem = MedleyElem .RingSet;
     piechart = null;
     ringset = rs;
     barchart = null;
 }
コード例 #23
0
		protected void SetQuestionData(ChartEngine engine, PieChart pieChart)
		{
			try
			{
				DateTime startDate = Information.IsDate(Request["StartDate"]) ?
					DateTime.Parse(Request["StartDate"]) : new DateTime(1900,1,1),
					endDate = Information.IsDate(Request["EndDate"]) ?
					DateTime.Parse(Request["EndDate"]) : new DateTime(2100,1,1);

				_dataSource = new Questions().GetQuestionResults(_questionId, _filterId, _sortOrder, 
					Request["LanguageCode"], startDate, endDate);
			}
			catch (QuestionNotFoundException)
			{
				return;
			}

			QuestionResultsData.AnswersRow[] answers = _dataSource.Questions[0].GetAnswersRows();

			// Set-up question text
			engine.Title  = new ChartText();
			engine.Title.ForeColor = Color.FromArgb(255, 255, 255);
			engine.Title.Font = new Font("Tahoma", 9, FontStyle.Bold);

			// Do we need to show the parent question text for matrix based child questions
			if (!_dataSource.Questions[0].IsParentQuestionIdNull() && _dataSource.Questions[0].ParentQuestionText != null) 
			{
				String questionText = String.Format("{0} - {1}", 
					_dataSource.Questions[0].ParentQuestionText, 
					_dataSource.Questions[0].QuestionText);

				// Show parent and child question text
				engine.Title.Text = Server.HtmlDecode(questionText);
			} 
			else 
			{
				// Show question text
				engine.Title.Text = Server.HtmlDecode(_dataSource.Questions[0].QuestionText);
			}

			SetAnswerData(answers, GetVotersTotal(answers), engine, pieChart);
		}
コード例 #24
0
		private void Page_Load(object sender, System.EventArgs e)
		{
		
			_questionId = 
				Information.IsNumeric(Request["QuestionId"]) ? int.Parse(Request["QuestionId"]) : -1;
			_filterId = 
				Information.IsNumeric(Request["FilterId"]) ? int.Parse(Request["FilterId"]) : -1;
			_sortOrder =
				Request["SortOrder"] == null ? "ans" : Request["SortOrder"];

			if (_questionId == -1)
			{
				Response.End();
			}
			else if (!NSurveyUser.Identity.IsAdmin &&
				!NSurveyUser.Identity.HasAllSurveyAccess)
			{
				if (!new Question().CheckQuestionUser(_questionId, NSurveyUser.Identity.UserId))
				{
					Response.End();
				}
			}

			ChartEngine engine = new ChartEngine();
			ChartCollection charts = new ChartCollection(engine);
			engine.Size = new Size(700, 500);
			engine.Charts = charts;
			
			
			PieChart pie = new PieChart();
			//pie.Colors = new Color[]{ Color.Red};

			ChartLegend legend = new ChartLegend();
			legend.Position = LegendPosition.Right;
			legend.Width = 200;
			legend.Background.Color = Color.FromArgb(245,249,251);
			
			pie.DataLabels.NumberFormat ="0.00";
			pie.Explosion = 6; 
			pie.Shadow.Visible = true; 
			pie.Shadow.Color=Color.LightGray; 
			pie.Shadow.OffsetY = 5; 
			engine.HasChartLegend = true;
			engine.Legend = legend;
			engine.GridLines = GridLines.None;


			SetQuestionData(engine, pie);
			SetMoreProperties(engine);

			charts.Add(pie);


			// send chart to browser
			Bitmap bmp;
			System.IO.MemoryStream memStream = new System.IO.MemoryStream();
			bmp = engine.GetBitmap();
			bmp.Save(memStream, System.Drawing.Imaging.ImageFormat.Png);
			memStream.WriteTo(Response.OutputStream);
			Response.End();

		}
コード例 #25
0
ファイル: MultiPieChart.cs プロジェクト: wshanshan/DDD
        public override void UpdateVisualization()
        {
            List<string>[] chartLabels = null;
            int dataPos = 0;
            string tooltipString;
            double[] scalingDataArray = null;

            // Get the Factor Labels
            chartLabels = GetConfigDisplayLabels();
            if (chartLabels == null)
            {
                return;
            }

            // Obtain grid of pie charts
            if ((configDisplayPanel.Children == null) || (configDisplayPanel.Children.Count != 1) ||
                (!(configDisplayPanel.Children[0] is Grid)))
            {
                return;
            }
            Grid pieGrid = configDisplayPanel.Children[0] as Grid;

            // Clear the pie grid image children
            List<UIElement> removalList = new List<UIElement>();
            foreach (UIElement child in pieGrid.Children)
            {
                if (child is Image)
                {
                    removalList.Add(child);
                }
            }
            if (removalList.Count > 0)
            {
                foreach (UIElement child in removalList)
                {
                    pieGrid.Children.Remove(child);
                }
            }

            // Get the ratio data values for scaling the pie charts
            GetConfigDisplayData(chartLabels[0].Count * chartLabels[1].Count, ref scalingDataArray);

            // Add the individual charts to the Grid
            for (int i = 0; i < chartLabels[0].Count; i++)
            {
                for (int j = 0; j < chartLabels[1].Count; j++)
                {
                    double[] dataArray = null;

                    // Create a PieChart object of size 180 x 160 pixels
                    PieChart c = new PieChart(180, 160);
                    Image img = new Image();
                    //Border border = new Border();
                    //border.BorderBrush = Brushes.Black;
                    //border.BorderThickness = new Thickness(0, 1, 0, 0);

                    // Set the center of the pie at (90, 80) and the radius to 60 pixels
                    c.setPieSize(90, 80, 60);

                    // Set the border color of the sectors to black
                    c.setLineColor(0x000000);

                    // Set the background color of the sector label to pale yellow (ffffc0) with a
                    // black border (000000)
                    //c.setLabelStyle().setBackground(0xffffc0, 0x000000);


                    // Set the title, data and colors according to which pie to draw
                    tooltipString = "";
                    if (GetConfigDisplayData(dataPos, ref dataArray))
                    {
                        c.setData(dataArray);
                        for (int z = 0; z < chartLabels[2].Count - 1; z++)
                        {
                            tooltipString += chartLabels[2][z] + " = " + dataArray[z].ToString() +
                                "\n";
                        }
                    }

                    c.setColors2(Chart.DataColor, pieChartColors);
                    c.setLabelStyle().setFontColor(0xFFFFFF);

                    // Generate an image of the chart
                    System.Drawing.Image imgWinForms = c.makeImage();
                    BitmapImage bi = new BitmapImage();

                    bi.BeginInit();

                    MemoryStream ms = new MemoryStream();

                    // Save to a memory stream...

                    imgWinForms.Save(ms, ImageFormat.Bmp);

                    // Rewind the stream...

                    ms.Seek(0, SeekOrigin.Begin);

                    // Tell the WPF image to use this stream...

                    bi.StreamSource = ms;

                    bi.EndInit();
                    img.Source = bi;
                    img.Margin = new Thickness(1);
                    //border.Child = img;
                    if ((tooltipString != null) && (tooltipString.Length > 0))
                    {
                        img.ToolTip = tooltipString;
                    }

                    Grid.SetColumn(img, i + 1);
                    Grid.SetRow(img, j + 2);

                    // Scale the pie chart image by the ratio
                    if ((scalingDataArray != null) && (scalingDataArray.Length > dataPos))
                    {
                        if (scalingDataArray[dataPos] == 0.0)
                        {
                            img.Width = 1;
                            img.Height = 1;
                        }
                        else if (double.IsNaN(scalingDataArray[dataPos]))
                        {
                            img.Width = pieGrid.ColumnDefinitions[i + 1].ActualWidth;
                            img.Height = pieGrid.RowDefinitions[j + 2].ActualHeight;
                        }
                        else
                        {
                            double scaleFactor = ((1.0 - MINSCALE) * scalingDataArray[dataPos]) + MINSCALE;
                            img.Width = pieGrid.ColumnDefinitions[i + 1].ActualWidth * scaleFactor;
                            img.Height = pieGrid.RowDefinitions[j + 2].ActualHeight * scaleFactor;
                        }
                    }
                    dataPos++;
                    pieGrid.Children.Add(img);

                }
            }

        }
コード例 #26
0
ファイル: Form_PieCharts.cs プロジェクト: enildne/zest
        // -------------------------------------------------        DefaultView
        private void DefaultView ()
        {
            ClientSize = new Size (840, 650);

            // piechart_A
            //
            int nSector = Auxi_Common .strDays .Length;
            double [] fRandVal = Auxi_Common .RandomArray (1000, nSector);
            PieChart piechart_A = new PieChart (this, new Point (250, 210), 230, fRandVal);
            piechart_A .AddComment (-90, 20, "PieChart_A",
                                    new Font ("Times New Roman", 12, FontStyle .Bold | FontStyle .Italic), 0, Color .Blue);
            int nDifViews = Enum .GetNames (typeof (RoundPlotTextView)) .Length;
            for (int i = 0; i < piechart_A .Sectors; i++)
            {
                piechart_A .SectorComments [i] .Text = Auxi_Common .StringOfText (Auxi_Common .strDays, i);
                piechart_A .SectorComments [i] .TextView =
                                    (RoundPlotTextView) (Enum .GetValues (typeof (RoundPlotTextView)) .GetValue (i % nDifViews));
            }
            piecharts .Insert (0, piechart_A);

            // piechart_B
            //
            nSector = Auxi_Common .strMonths .Length;
            fRandVal = new double [nSector];
            for (int i = 0; i < nSector; i++)
            {
                fRandVal [i] = rand .Next (nSeed) % 1000;
            }
            PieChart piechart_B = new PieChart (this, new Point (550, 420), 150, fRandVal);
            piechart_B .AddComment (70, 20, "PieChart_B",
                                    new Font ("Times New Roman", 11, FontStyle .Bold | FontStyle .Italic), -20, Color .Red);
            for (int i = 0; i < nSector; i++)
            {
                piechart_B .Colors [i] = Auxi_Colours .IntermediateClr (i, nSector, Color .White, Color .Blue);
                piechart_B .SectorComments [i] .Text = Auxi_Common .StringOfText (Auxi_Common .strMonths, i);
            }
            piecharts .Insert (0, piechart_B);
        }
コード例 #27
0
ファイル: PieChartLegend.cs プロジェクト: Zolniu/DigitalRune
        private void OnPieChartChanged(DependencyObject source)
        {
            // Unsubscribe from previous collection.
            if (_pieChartSubscription != null)
            {
                _pieChartSubscription.Dispose();
                _pieChartSubscription = null;
            }

            // Get pie chart from source.
            if (source != null)
                _pieChart = source.GetVisualSubtree().OfType<PieChart>().FirstOrDefault();

            if (_pieChart != null)
            {
                // Bind legend title to pie chart title.
                SetBinding(TitleProperty, new Binding("Title") { Source = _pieChart });

                // Subscribe to changes in pie chart using weak event pattern.
                _pieChartSubscription =
                    WeakEventHandler<EventArgs>.Register(
                        _pieChart,
                        this,
                        (sender, handler) => sender.Updated += handler,
                        (sender, handler) => sender.Updated -= handler,
                        (listener, sender, eventArgs) => listener.Update());
            }
            else
            {
                // Reset legend title.
                ClearValue(TitleProperty);
            }

            Update();
        }
コード例 #28
0
        public void AddLevel3Control(Point p)
        {
            switch (ControlTag)
            {
            case 31:
            {
                PieChart pieChart = new PieChart();
                pieChart.Width  = 400;
                pieChart.Height = 300;

                pieChart.LegendLocation = LegendLocation.Bottom;

                PieSeries pieSeries = new PieSeries();
                pieSeries.Values = new ChartValues <int> {
                    5
                };
                pieSeries.Title      = "A";
                pieSeries.DataLabels = true;

                PieSeries pieSeries2 = new PieSeries();
                pieSeries2.Values = new ChartValues <int> {
                    3
                };
                pieSeries2.Title      = "B";
                pieSeries2.DataLabels = true;

                PieSeries pieSeries3 = new PieSeries();
                pieSeries3.Values = new ChartValues <int> {
                    6
                };
                pieSeries3.Title      = "C";
                pieSeries3.DataLabels = true;

                pieChart.Series.Add(pieSeries);
                pieChart.Series.Add(pieSeries2);
                pieChart.Series.Add(pieSeries3);
                pieChart.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));

                Panel.SetZIndex(pieChart, 0);
                Canvas.SetLeft(pieChart, p.X - pieChart.DesiredSize.Width / 2);
                Canvas.SetTop(pieChart, p.Y - pieChart.DesiredSize.Height / 2);

                AddEvents(pieChart);
                DesignCanvas.Children.Add(pieChart);
            }

            break;

            case 32:
            {
                CartesianChart cartesianChart = new CartesianChart();
                cartesianChart.Width  = 400;
                cartesianChart.Height = 300;

                cartesianChart.LegendLocation = LegendLocation.Bottom;

                ColumnSeries columnSeries = new ColumnSeries();
                columnSeries.Values = new ChartValues <int> {
                    5
                };
                columnSeries.Title      = "A";
                columnSeries.DataLabels = true;

                ColumnSeries columnSeries2 = new ColumnSeries();
                columnSeries2.Values = new ChartValues <int> {
                    3
                };
                columnSeries2.Title      = "B";
                columnSeries2.DataLabels = true;

                ColumnSeries columnSeries3 = new ColumnSeries();
                columnSeries3.Values = new ChartValues <int> {
                    6
                };
                columnSeries3.Title      = "C";
                columnSeries3.DataLabels = true;

                cartesianChart.Series.Add(columnSeries);
                cartesianChart.Series.Add(columnSeries2);
                cartesianChart.Series.Add(columnSeries3);

                cartesianChart.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));

                Panel.SetZIndex(cartesianChart, 0);
                Canvas.SetLeft(cartesianChart, p.X - cartesianChart.DesiredSize.Width / 2);
                Canvas.SetTop(cartesianChart, p.Y - cartesianChart.DesiredSize.Height / 2);

                AddEvents(cartesianChart);
                DesignCanvas.Children.Add(cartesianChart);
            }
            break;

            case 33:
            {
                CartesianChart cartesianChart = new CartesianChart();
                cartesianChart.Width  = 400;
                cartesianChart.Height = 300;

                cartesianChart.LegendLocation = LegendLocation.Bottom;

                StackedColumnSeries columnSeries = new StackedColumnSeries();
                columnSeries.Values = new ChartValues <int> {
                    5, 6, 5
                };
                columnSeries.Title      = "A";
                columnSeries.DataLabels = true;

                StackedColumnSeries columnSeries2 = new StackedColumnSeries();
                columnSeries2.Values = new ChartValues <int> {
                    3, 4, 2
                };
                columnSeries2.Title      = "B";
                columnSeries2.DataLabels = true;

                StackedColumnSeries columnSeries3 = new StackedColumnSeries();
                columnSeries3.Values = new ChartValues <int> {
                    6, 3, 3
                };
                columnSeries3.Title      = "C";
                columnSeries3.DataLabels = true;

                cartesianChart.Series.Add(columnSeries);
                cartesianChart.Series.Add(columnSeries2);
                cartesianChart.Series.Add(columnSeries3);

                cartesianChart.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));

                Panel.SetZIndex(cartesianChart, 0);
                Canvas.SetLeft(cartesianChart, p.X - cartesianChart.DesiredSize.Width / 2);
                Canvas.SetTop(cartesianChart, p.Y - cartesianChart.DesiredSize.Height / 2);

                AddEvents(cartesianChart);
                DesignCanvas.Children.Add(cartesianChart);
            }
            break;

            case 34:
            {
                CartesianChart cartesianChart = new CartesianChart();
                cartesianChart.Width  = 400;
                cartesianChart.Height = 300;

                cartesianChart.LegendLocation = LegendLocation.Bottom;

                RowSeries CarSeries = new RowSeries();
                CarSeries.Values = new ChartValues <int> {
                    5
                };
                CarSeries.Title      = "A";
                CarSeries.DataLabels = true;

                RowSeries CarSeries2 = new RowSeries();
                CarSeries2.Values = new ChartValues <int> {
                    3
                };
                CarSeries2.Title      = "B";
                CarSeries2.DataLabels = true;

                RowSeries CarSeries3 = new RowSeries();
                CarSeries3.Values = new ChartValues <int> {
                    6
                };
                CarSeries3.Title      = "C";
                CarSeries3.DataLabels = true;

                cartesianChart.Series.Add(CarSeries);
                cartesianChart.Series.Add(CarSeries2);
                cartesianChart.Series.Add(CarSeries3);

                cartesianChart.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));

                Panel.SetZIndex(cartesianChart, 0);
                Canvas.SetLeft(cartesianChart, p.X - cartesianChart.DesiredSize.Width / 2);
                Canvas.SetTop(cartesianChart, p.Y - cartesianChart.DesiredSize.Height / 2);

                AddEvents(cartesianChart);
                DesignCanvas.Children.Add(cartesianChart);
            }
            break;

            case 35:
            {
                CartesianChart cartesianChart = new CartesianChart();
                cartesianChart.Width  = 400;
                cartesianChart.Height = 300;

                cartesianChart.LegendLocation = LegendLocation.Bottom;

                StackedRowSeries columnSeries = new StackedRowSeries();
                columnSeries.Values = new ChartValues <int> {
                    5, 6, 5
                };
                columnSeries.Title      = "A";
                columnSeries.DataLabels = true;

                StackedRowSeries columnSeries2 = new StackedRowSeries();
                columnSeries2.Values = new ChartValues <int> {
                    3, 4, 2
                };
                columnSeries2.Title      = "B";
                columnSeries2.DataLabels = true;

                StackedRowSeries columnSeries3 = new StackedRowSeries();
                columnSeries3.Values = new ChartValues <int> {
                    6, 3, 3
                };
                columnSeries3.Title      = "C";
                columnSeries3.DataLabels = true;

                cartesianChart.Series.Add(columnSeries);
                cartesianChart.Series.Add(columnSeries2);
                cartesianChart.Series.Add(columnSeries3);

                cartesianChart.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));

                Panel.SetZIndex(cartesianChart, 0);
                Canvas.SetLeft(cartesianChart, p.X - cartesianChart.DesiredSize.Width / 2);
                Canvas.SetTop(cartesianChart, p.Y - cartesianChart.DesiredSize.Height / 2);

                AddEvents(cartesianChart);
                DesignCanvas.Children.Add(cartesianChart);
            }
            break;

            case 36:
            {
                CartesianChart lineChart = new CartesianChart();
                lineChart.Width  = 400;
                lineChart.Height = 300;

                lineChart.LegendLocation = LegendLocation.Bottom;

                LineSeries lineSeries = new LineSeries();
                lineSeries.Values = new ChartValues <int> {
                    5, 6, 8
                };
                lineSeries.Title      = "A";
                lineSeries.DataLabels = true;

                LineSeries lineSeries2 = new LineSeries();
                lineSeries2.Values = new ChartValues <int> {
                    3, 2, 5
                };
                lineSeries2.Title      = "B";
                lineSeries2.DataLabels = true;

                LineSeries lineSeries3 = new LineSeries();
                lineSeries3.Values = new ChartValues <int> {
                    6, 5, 3
                };
                lineSeries3.Title      = "C";
                lineSeries3.DataLabels = true;

                lineChart.Series.Add(lineSeries);
                lineChart.Series.Add(lineSeries2);
                lineChart.Series.Add(lineSeries3);

                lineChart.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));

                Panel.SetZIndex(lineChart, 0);
                Canvas.SetLeft(lineChart, p.X - lineChart.DesiredSize.Width / 2);
                Canvas.SetTop(lineChart, p.Y - lineChart.DesiredSize.Height / 2);

                AddEvents(lineChart);
                DesignCanvas.Children.Add(lineChart);
            }
            break;

            case 37:
            {
                CartesianChart cartesianChart = new CartesianChart();
                cartesianChart.Width  = 400;
                cartesianChart.Height = 300;

                cartesianChart.LegendLocation = LegendLocation.Bottom;

                StackedAreaSeries columnSeries = new StackedAreaSeries();
                columnSeries.Values = new ChartValues <int> {
                    2, 4, 6
                };
                columnSeries.Title      = "A";
                columnSeries.DataLabels = true;

                StackedAreaSeries columnSeries2 = new StackedAreaSeries();
                columnSeries2.Values = new ChartValues <int> {
                    3, 5, 7
                };
                columnSeries2.Title      = "B";
                columnSeries2.DataLabels = true;

                StackedAreaSeries columnSeries3 = new StackedAreaSeries();
                columnSeries3.Values = new ChartValues <int> {
                    4, 6, 8
                };
                columnSeries3.Title      = "C";
                columnSeries3.DataLabels = true;

                cartesianChart.Series.Add(columnSeries);
                cartesianChart.Series.Add(columnSeries2);
                cartesianChart.Series.Add(columnSeries3);

                cartesianChart.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));

                Panel.SetZIndex(cartesianChart, 0);
                Canvas.SetLeft(cartesianChart, p.X - cartesianChart.DesiredSize.Width / 2);
                Canvas.SetTop(cartesianChart, p.Y - cartesianChart.DesiredSize.Height / 2);

                AddEvents(cartesianChart);
                DesignCanvas.Children.Add(cartesianChart);
            }
            break;

            case 38:
            {
                CartesianChart cartesianChart = new CartesianChart();
                cartesianChart.Width  = 400;
                cartesianChart.Height = 300;

                cartesianChart.LegendLocation = LegendLocation.Bottom;

                StepLineSeries columnSeries = new StepLineSeries();
                columnSeries.Values = new ChartValues <int> {
                    1, 2, 1
                };
                columnSeries.Title      = "A";
                columnSeries.DataLabels = true;

                StepLineSeries columnSeries2 = new StepLineSeries();
                columnSeries2.Values = new ChartValues <int> {
                    3, 5, 6
                };
                columnSeries2.Title      = "B";
                columnSeries2.DataLabels = true;

                StepLineSeries columnSeries3 = new StepLineSeries();
                columnSeries3.Values = new ChartValues <int> {
                    6, 7, 7
                };
                columnSeries3.Title      = "C";
                columnSeries3.DataLabels = true;

                cartesianChart.Series.Add(columnSeries);
                cartesianChart.Series.Add(columnSeries2);
                cartesianChart.Series.Add(columnSeries3);

                cartesianChart.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));

                Panel.SetZIndex(cartesianChart, 0);
                Canvas.SetLeft(cartesianChart, p.X - cartesianChart.DesiredSize.Width / 2);
                Canvas.SetTop(cartesianChart, p.Y - cartesianChart.DesiredSize.Height / 2);

                AddEvents(cartesianChart);
                DesignCanvas.Children.Add(cartesianChart);
            }
            break;
            }
        }
    private void PlotSecondIterationGraph(string chartId, string drillBy, string subType)
    {
        SandlerControls.ChartLiteral chartLiteral = new SandlerControls.ChartLiteral();
        chartLiteral.ID = "chartLiteralClosedSalesAnalysis";
        chartLiteral.Width = "80%";
        chartLiteral.Height = "450";

        ChartRepository cR = new ChartRepository();
        SandlerModels.TBL_CHART dbChart = cR.GetAll().Where(c => c.ChartID == chartId && c.IsActive == true).SingleOrDefault();

        PieChart chartToLoad = new PieChart() { SubType = (ChartSubType)Enum.Parse(typeof(ChartSubType), subType), BGAlpha = dbChart.BgAlpha, BGColor = dbChart.BgColor, CanvasBGAlpha = dbChart.CanvasBgAlpha, CanvasBGColor = dbChart.CanvasBgColor, Caption = dbChart.Caption, SWF = dbChart.SWFile, NumberSuffix = dbChart.NumberSuffix, PieRadius = dbChart.PieRadius, showLabels = dbChart.ShowLabels, showLegend = dbChart.ShowLegend, XaxisName = dbChart.XaxisName, YaxisName = dbChart.YaxisName, Id = ChartID.ClosedSalesAnalysisBySource, enableRotation = dbChart.EnableRotation, DrillChartIds = dbChart.DrillLevelChartIDs, DrillOverride = false, DrillBy = drillBy};
        chartToLoad.LoadChart(CurrentUser);
        chartToLoad.CreateChart();

        chartLiteral.Text = FusionCharts.RenderChart(Page.ResolveClientUrl("~/FusionChartLib/" + chartToLoad.SWF), "", ((PieChart)chartToLoad).ChartXML, chartLiteral.ID, chartLiteral.Width, chartLiteral.Height, false, true);
        (plotChart.ContentTemplateContainer.FindControl("chartPanel") as Panel).Controls.Add(chartLiteral);
    }
コード例 #30
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            Window.SetFlags(WindowManagerFlags.Fullscreen, WindowManagerFlags.Fullscreen);

            SetContentView(Resource.Layout.PieChartLayout);

            //mChart = new PieChart(this);
            //SetContentView(mChart);

            #if true
            tvX = (TextView) FindViewById(Resource.Id.tvXMax);
            tvY = (TextView) FindViewById(Resource.Id.tvYMax);

            mSeekBarX = (SeekBar) FindViewById(Resource.Id.seekBar1);
            mSeekBarY = (SeekBar) FindViewById(Resource.Id.seekBar2);

            mSeekBarY.Progress = 10;

            mSeekBarX.SetOnSeekBarChangeListener(this);
            mSeekBarY.SetOnSeekBarChangeListener(this);
            #endif
            #if true
            mChart = (PieChart) FindViewById(Resource.Id.chart1);
            mChart.SetUsePercentValues(true);
            mChart.SetDescription("");
            mChart.SetExtraOffsets(5, 10, 5, 5);

            mChart.DragDecelerationFrictionCoef = 0.95f;

            //tf = Typeface.CreateFromAsset(Assets, "OpenSans-Regular.ttf");

            //mChart.SetCenterTextTypeface(Typeface.CreateFromAsset(Assets, "OpenSans-Light.ttf"));
            mChart.CenterText = "MPAndroidChart developed by Philipp Jahoda";
            //mChart.setcenter CenterText = new SpannableString(mChart.) Spanable generateCenterSpannableText();

            mChart.DrawHoleEnabled = true;
            mChart.SetHoleColorTransparent(true);

            mChart.SetTransparentCircleColor(Color.White);
            mChart.SetTransparentCircleAlpha(110);

            mChart.HoleRadius = 58f;
            mChart.TransparentCircleRadius = 61f;

            mChart.SetDrawCenterText(true);

            mChart.RotationAngle = 0;
            // enable rotation of the chart by touch
            mChart.RotationEnabled = true;
            mChart.HighlightEnabled = true;

            // mChart.setUnit(" €");
            // mChart.setDrawUnitsInChart(true);

            // add a selection listener
            mChart.SetOnChartValueSelectedListener(this);

            SetData(3, 100);

            mChart.AnimateY(1400, Easing.EasingOption.EaseInOutQuad);
            // mChart.spin(2000, 0, 360);

            var l = mChart.Legend;
            l.Position = Legend.LegendPosition.RightOfChart;
            l.XEntrySpace = 7f;
            l.YEntrySpace = 0f;
            l.YOffset = 0f;
            // Create your application here
            #endif
        }
コード例 #31
0
ファイル: Form_Medley.cs プロジェクト: enildne/zest
        // -------------------------------------------------        Click_miAddPieChart
        private void Click_miAddPieChart (object sender, EventArgs e)
        {
            Form_DefineNewPieChart form = new Form_DefineNewPieChart (2, 26);
            if (form .ShowDialog () == DialogResult .OK)
            {
                PieChart pieSrc = form .PieChart;
                PieChart pie = new PieChart (this, ptMouse_Down, 120, pieSrc .Values);
                pie .AddComment (-90, -0.4, DateTime .Now .ToShortTimeString (),
                                 new Font ("Microsoft Sans Serif", 12, FontStyle .Bold | FontStyle .Italic), 0, Color .Blue);
                pie .Colors = pieSrc .Colors;
                for (int i = 0; i < pie .SectorComments .Count; i++)
                {
                    pie .SectorComments [i] .Text = pieSrc .SectorComments [i] .Text;
                }
                elems .Insert (0, new SingleElem (pie));

                RenewMover ();
                Invalidate ();
            }
        }
コード例 #32
0
 public static Chart CreateChart(ChartType type, ChartModel model)
 {
   Chart chart = null;
   if (type == ChartType.VBAR || 
       type == ChartType.VBAR_STACKED || 
       type == ChartType.BAR_LINE_COMBO ||
       type == ChartType.BAR_AREA_COMBO ||
       type == ChartType.BAR_LINE_AREA_COMBO)
   {
     chart = new BarChart(type, model);
   }
   else if (type == ChartType.HBAR || type == ChartType.HBAR_STACKED)
   {
     chart = new HorizontalBarChart(type, model);
   }
   else if( type == ChartType.CYLINDERBAR)
   {
     chart = new CylinderBarChart(type, model);
   }
   
   else if (type == ChartType.PIE)
   {
     chart = new PieChart(type, model);
   }
   else if (type == ChartType.AREA || type == ChartType.AREA_STACKED)
   {
     chart = new AreaChart(type, model);
   }
   else if (type == ChartType.LINE)
   {
     chart = new LineChart(type, model);
   }
   else if (type == ChartType.SCATTER_PLOT)
   {
     chart = new ScatterPlotChart(type, model);
   }
   else if (type == ChartType.XYLINE)
   {
     chart = new XYLineChart(type, model);
   }
   else if (type == ChartType.RADAR || type == ChartType.RADAR_AREA)
   {
     chart = new RadarChart(type, model);
   }
   else if (type == ChartType.FUNNEL)
   {
     chart = new FunnelChart(type, model);
   }
   else if (type == ChartType.SEMI_CIRCULAR_GAUGE)
   {
     chart = new SemiCircularGaugeChart(type, model);
   }
   else if (type == ChartType.CIRCULAR_GAUGE)
   {
     chart = new GaugeChart(type, model);
   }
   else if (type == ChartType.CANDLE_STICK)
   {
     chart = new CandleStickChart(type, model);
   }
   return chart;
 }
コード例 #33
0
        /// <summary>
        /// 初始化方法
        /// </summary>
        /// <remarks></remarks>
        private void Bind()
        {
            try {
                COMSSmobilerDemo.common.ReimbursementInfo ReimbursementInfo = new COMSSmobilerDemo.common.ReimbursementInfo();
                switch (Mode)
                {
                case 1:
                    TitleText = "消费记录月份趋势分析";
                    DataTable table = new DataTable();
                    switch (TextTabBar1.SelectItemIndex)
                    {
                    case 0:
                        //趋势 按消费月份统计
                        TextTabBar2.Visible = false;
                        table = ReimbursementInfo.GetSanalysis(TextTabBar1.SelectItemIndex, "xiaofei");
                        this.GridView1.Rows.Clear();
                        this.GridView1.DataSource = table;
                        this.GridView1.DataBind();
                        //创建BarChart
                        BarChart BarChart1 = new BarChart();
                        chartObj                   = BarChart1;
                        BarChart1.Size             = new System.Drawing.Size(250, 250);
                        BarChart1.Location         = new System.Drawing.Point(25, 63);
                        BarChart1.XAxisLabelMember = "XMember";
                        BarChart1.YAxisValueMember = "YMember";
                        this.Controls.Add(BarChart1);
                        if (table.Rows.Count > 0)
                        {
                            System.Data.DataTable matTable = new DataTable();
                            matTable.Columns.Add("XMember", typeof(string));
                            matTable.Columns.Add("YMember", typeof(int));
                            foreach (GridViewRow ROW in GridView1.Rows)
                            {
                                string  XMember = ROW.Cell.Items["lblName"].Value.ToString();
                                decimal YMember = Convert.ToDecimal(ROW.Cell.Items["lblAmount"].Value);
                                matTable.Rows.Add(XMember, YMember);
                            }
                            BarChart1.DataSource = matTable;
                            BarChart1.DataBind();
                        }
                        else
                        {
                            this.GridView1.Rows.Clear();
                        }
                        break;

                    case 1:
                        //分布 按消费类型统计
                        TextTabBar2.Visible = true;
                        TitleText           = "消费记录趋势分析";
                        table = ReimbursementInfo.GetSanalysis(TextTabBar1.SelectItemIndex, "xiaofei");
                        this.GridView1.Rows.Clear();
                        this.GridView1.DataSource = table;
                        this.GridView1.DataBind();
                        if (table.Rows.Count > 0)
                        {
                            switch (TextTabBar2.SelectItemIndex)
                            {
                            case 0:
                                //创建BubbleChart
                                BubbleChart BubbleChart1 = new BubbleChart();
                                chartObj                      = BubbleChart1;
                                BubbleChart1.Size             = new System.Drawing.Size(250, 225);
                                BubbleChart1.Location         = new System.Drawing.Point(25, 80);
                                BubbleChart1.XAxisLabelMember = "XMember";
                                BubbleChart1.YAxisValueMember = "YMember";
                                this.Controls.Add(BubbleChart1);

                                DataTable matTable = new DataTable();
                                matTable.Columns.Add("XMember", typeof(string));
                                matTable.Columns.Add("YMember", typeof(int));
                                foreach (GridViewRow ROW in GridView1.Rows)
                                {
                                    string  XMember = ROW.Cell.Items["lblName"].Value.ToString();
                                    decimal YMember = Convert.ToDecimal(ROW.Cell.Items["lblAmount"].Value);
                                    matTable.Rows.Add(XMember, YMember);
                                }
                                BubbleChart1.DataSource = matTable;
                                BubbleChart1.DataBind();
                                break;

                            case 1:
                                //创建ScatterChart
                                ScatterChart ScatterChart1 = new ScatterChart();
                                chartObj                       = ScatterChart1;
                                ScatterChart1.Size             = new System.Drawing.Size(250, 225);
                                ScatterChart1.Location         = new System.Drawing.Point(25, 80);
                                ScatterChart1.SeriesMember     = "XMember";
                                ScatterChart1.SeriesShapMember = "Shape";
                                ScatterChart1.XAxisLabelMember = "XMember";
                                ScatterChart1.YAxisValueMember = "YMember";
                                Controls.Add(ScatterChart1);

                                DataTable matTable2 = new DataTable();
                                matTable2.Columns.Add("XMember", typeof(string));
                                matTable2.Columns.Add("YMember", typeof(int));
                                matTable2.Columns.Add("Shape", typeof(int));
                                int Shape = 0;
                                foreach (GridViewRow ROW in GridView1.Rows)
                                {
                                    string  XMember = ROW.Cell.Items["lblName"].Value.ToString();
                                    decimal YMember = Convert.ToDecimal(ROW.Cell.Items["lblAmount"].Value);
                                    matTable2.Rows.Add(XMember, YMember, Shape);
                                    if (Shape <= 4)
                                    {
                                        Shape += 1;
                                    }
                                    else
                                    {
                                        Shape = 0;
                                    }
                                }
                                ScatterChart1.DataSource = matTable2;
                                ScatterChart1.DataBind();
                                break;

                            case 2:
                                //创建RadarChart
                                RadarChart RadarChart1 = new RadarChart();
                                chartObj                     = RadarChart1;
                                RadarChart1.Size             = new System.Drawing.Size(250, 225);
                                RadarChart1.Location         = new System.Drawing.Point(25, 80);
                                RadarChart1.SeriesMember     = "XMember";
                                RadarChart1.XAxisLabelMember = "XMember";
                                RadarChart1.YAxisValueMember = "YMember";
                                this.Controls.Add(RadarChart1);

                                DataTable matTable3 = new DataTable();
                                matTable3.Columns.Add("XMember", typeof(string));
                                matTable3.Columns.Add("YMember", typeof(int));
                                foreach (GridViewRow ROW in GridView1.Rows)
                                {
                                    string  XMember = ROW.Cell.Items["lblName"].Value.ToString();
                                    decimal YMember = Convert.ToDecimal(ROW.Cell.Items["lblAmount"].Value);
                                    matTable3.Rows.Add(XMember, YMember);
                                }
                                RadarChart1.DataSource = matTable3;
                                RadarChart1.DataBind();
                                break;
                            }
                        }
                        else
                        {
                            this.GridView1.Rows.Clear();
                        }
                        break;
                    }

                    break;

                case 2:
                    switch (TextTabBar1.SelectItemIndex)
                    {
                    case 0:
                        TextTabBar2.Visible = false;
                        //趋势 按报销月份统计
                        table = ReimbursementInfo.GetSanalysis(TextTabBar1.SelectItemIndex, "baoxiao");
                        this.GridView1.Rows.Clear();
                        this.GridView1.DataSource = table;
                        this.GridView1.DataBind();

                        //创建LineChart
                        LineChart LineChart1 = new LineChart();
                        chartObj                    = LineChart1;
                        LineChart1.Size             = new System.Drawing.Size(250, 250);
                        LineChart1.Location         = new System.Drawing.Point(25, 63);
                        LineChart1.XAxisLabelMember = "XMember";
                        LineChart1.YAxisValueMember = "YMember";
                        this.Controls.Add(LineChart1);
                        if (table.Rows.Count > 0)
                        {
                            DataTable matTable = new DataTable();
                            matTable.Columns.Add("XMember", typeof(string));
                            matTable.Columns.Add("YMember", typeof(int));
                            foreach (GridViewRow ROW in GridView1.Rows)
                            {
                                string  XMember = ROW.Cell.Items["lblName"].Value.ToString();
                                decimal YMember = Convert.ToDecimal(ROW.Cell.Items["lblAmount"].Value);
                                matTable.Rows.Add(XMember, YMember);
                            }
                            LineChart1.DataSource = matTable;
                            LineChart1.DataBind();
                        }
                        else
                        {
                            this.GridView1.Rows.Clear();
                        }
                        break;

                    case 1:
                        //分布 按报销状态统计
                        table = ReimbursementInfo.GetSanalysis(TextTabBar1.SelectItemIndex, "baoxiao");
                        this.GridView1.Rows.Clear();
                        this.GridView1.DataSource = table;
                        this.GridView1.DataBind();

                        //创建PieChart
                        PieChart PieChart1 = new PieChart();
                        chartObj = PieChart1;

                        PieChart1.Size             = new System.Drawing.Size(250, 250);
                        PieChart1.Location         = new System.Drawing.Point(25, 63);
                        PieChart1.XAxisLabelMember = "XMember";
                        PieChart1.YAxisValueMember = "YMember";
                        this.Controls.Add(PieChart1);
                        //报销状态分布统计表
                        if (table.Rows.Count > 0)
                        {
                            DataTable matTable = new DataTable();
                            matTable.Columns.Add("XMember", typeof(string));
                            matTable.Columns.Add("YMember", typeof(int));
                            foreach (GridViewRow ROW in GridView1.Rows)
                            {
                                string  XMember = ROW.Cell.Items["lblName"].Value.ToString();
                                decimal YMember = Convert.ToDecimal(ROW.Cell.Items["lblAmount"].Value);
                                matTable.Rows.Add(XMember, YMember);
                            }
                            PieChart1.DataSource = matTable;
                            PieChart1.DataBind();
                        }
                        else
                        {
                            this.GridView1.Rows.Clear();
                        }
                        break;
                    }

                    break;
                }
            } catch (Exception ex) {
                MessageBox.Show(ex.Message);
            }
        }