Exemplo n.º 1
0
        private void zedGraphStyle_ZedGraphDrawing(object sender, ZedGraphDrawingEventArgs e)
        {
            ZedGraphControl zedGraph = new ZedGraphControl()
            {
                Size = new Size(100, 100)
            };

            zedGraph.GraphPane.Fill.Type              = FillType.None;
            zedGraph.GraphPane.Chart.Fill.Type        = FillType.None;
            zedGraph.GraphPane.Border.IsVisible       = false;
            zedGraph.GraphPane.Chart.Border.IsVisible = false;
            zedGraph.GraphPane.XAxis.IsVisible        = false;
            zedGraph.GraphPane.YAxis.IsVisible        = false;
            zedGraph.GraphPane.Legend.IsVisible       = false;
            zedGraph.GraphPane.Title.IsVisible        = false;

            PieItem pieItem1 = zedGraph.GraphPane.AddPieSlice(Convert.ToDouble(e.Feature.ColumnValues["WHITE"], CultureInfo.InvariantCulture), GetColorFromGeoColor(GeoColor.FromHtml("#93fc8f")), 0.08f, "White");

            pieItem1.LabelDetail.IsVisible = false;

            PieItem pieItem2 = zedGraph.GraphPane.AddPieSlice(Convert.ToDouble(e.Feature.ColumnValues["ASIAN"], CultureInfo.InvariantCulture), GetColorFromGeoColor(GeoColor.FromHtml("#8ffbe8")), 0.08f, "Asian");

            pieItem2.LabelDetail.IsVisible = false;

            PieItem pieItem3 = zedGraph.GraphPane.AddPieSlice(Convert.ToDouble(e.Feature.ColumnValues["Black"], CultureInfo.InvariantCulture), GetColorFromGeoColor(GeoColor.FromHtml("#cc8efa")), 0.08f, "Black");

            pieItem3.LabelDetail.IsVisible = false;

            PieItem pieItem4 = zedGraph.GraphPane.AddPieSlice(Convert.ToDouble(e.Feature.ColumnValues["Other"], CultureInfo.InvariantCulture), GetColorFromGeoColor(GeoColor.FromHtml("#fcab8d")), 0.08f, "Other");

            pieItem4.LabelDetail.IsVisible = false;

            zedGraph.AxisChange();
            e.GeoImage = new GeoImage(zedGraph.GraphPane.GetImage());
        }
Exemplo n.º 2
0
        private void UpdateGraphManaSymbols()
        {
            zgManaSymbols.GraphPane.CurveList.Clear();
            GraphPane pane = zgManaSymbols.GraphPane;

            pane.Legend.IsVisible = false;

            pane.Title.Text = String.Format("Mana Symbols - {0}", CardCountText());

            Dictionary <char, int> calculatedManaSymbols = new Dictionary <char, int>();

            foreach (Card c in cards)
            {
                if (c.IsInSideboard)
                {
                    continue;
                }

                foreach (KeyValuePair <char, int> symb in c.CalculatedManaSymbols)
                {
                    if (calculatedManaSymbols.ContainsKey(symb.Key))
                    {
                        calculatedManaSymbols[symb.Key] += symb.Value * c.Amount;
                    }
                    else
                    {
                        calculatedManaSymbols.Add(symb.Key, symb.Value * c.Amount);
                    }
                }
            }

            foreach (var item in calculatedManaSymbols)
            {
                Color  c    = Color.Gold; // Other
                string name = "Multicolor and others";
                if (item.Key == 'W')
                {
                    c = Color.White; name = "White";
                }
                else if (item.Key == 'U')
                {
                    c = Color.Blue; name = "Blue";
                }
                else if (item.Key == 'R')
                {
                    c = Color.Red; name = "Red";
                }
                else if (item.Key == 'B')
                {
                    c = Color.Black; name = "Black";
                }
                else if (item.Key == 'G')
                {
                    c = Color.DarkGreen; name = "Green";
                }
                PieItem pi = pane.AddPieSlice(item.Value, c, 0, name + " - " + item.Value);
            }

            zgManaSymbols.AxisChange();
        }
Exemplo n.º 3
0
        void zedGraphStyle_ZedGraphDrawing(object sender, ZedGraphDrawingEventArgs e)
        {
            ZedGraphControl zedGraph = new ZedGraphControl();

            zedGraph.Size = new Size(100, 100);

            zedGraph.GraphPane.Fill.Type       = FillType.None;
            zedGraph.GraphPane.Chart.Fill.Type = FillType.None;

            zedGraph.GraphPane.Border.IsVisible       = false;
            zedGraph.GraphPane.Chart.Border.IsVisible = false;
            zedGraph.GraphPane.XAxis.IsVisible        = false;
            zedGraph.GraphPane.YAxis.IsVisible        = false;
            zedGraph.GraphPane.Legend.IsVisible       = false;
            zedGraph.GraphPane.Title.IsVisible        = false;

            for (int i = 0; i < SelectedColumns.Count; i++)
            {
                Color   color   = Color.FromArgb(pieColors[i].AlphaComponent, pieColors[i].RedComponent, pieColors[i].GreenComponent, pieColors[i].BlueComponent);
                PieItem pieItem = zedGraph.GraphPane.AddPieSlice(Convert.ToDouble(e.Feature.ColumnValues[SelectedColumns[i]]), color, 0.08, "");
                pieItem.LabelDetail.IsVisible = false;
            }
            zedGraph.AxisChange();

            e.Bitmap = zedGraph.GraphPane.GetImage();
        }
Exemplo n.º 4
0
        private void zedGraphStyle_ZedGraphDrawing(object sender, ZedGraphDrawingEventArgs e)
        {
            ChangeLabelPosition(((ShapeFileFeatureLayer)((LayerOverlay)currentMap.CustomOverlays[1]).Layers["Cities"]), 100);

            ZedGraphControl zedGraph = new ZedGraphControl();

            zedGraph.Size = new Size(100, 100);

            zedGraph.GraphPane.Fill.Type       = FillType.None;
            zedGraph.GraphPane.Chart.Fill.Type = FillType.None;

            zedGraph.GraphPane.Border.IsVisible       = false;
            zedGraph.GraphPane.Chart.Border.IsVisible = false;
            zedGraph.GraphPane.XAxis.IsVisible        = false;
            zedGraph.GraphPane.YAxis.IsVisible        = false;
            zedGraph.GraphPane.Legend.IsVisible       = false;
            zedGraph.GraphPane.Title.IsVisible        = false;

            PieItem pieItem1 = zedGraph.GraphPane.AddPieSlice(Convert.ToDouble(e.Feature.ColumnValues["WHITE"]), GetColorFromGeoColor(GeoColor.StandardColors.LightBlue), 0, "White");

            pieItem1.LabelDetail.IsVisible = false;

            PieItem pieItem2 = zedGraph.GraphPane.AddPieSlice(Convert.ToDouble(e.Feature.ColumnValues["ASIAN"]), GetColorFromGeoColor(GeoColor.StandardColors.LightGreen), 0, "Asian");

            pieItem2.LabelDetail.IsVisible = false;
            pieItem2.Displacement          = 0.2;

            zedGraph.AxisChange();

            e.GeoImage = new GeoImage(zedGraph.GraphPane.GetImage());
        }
        private void OnRenderGraph(ZedGraphWeb webObject, Graphics g, MasterPane pane)
        {
            DataSet   ds     = (DataSet)Cache["CurseCache"];
            GraphPane myPane = pane[0];

            myPane.Title.Text       = "Nr total de statii in functie de statia de pornire";
            myPane.XAxis.Title.Text = "Statie pornire";
            myPane.YAxis.Title.Text = "Nr. statii";
            Color[] colors =
            {
                Color.Red,    Color.Yellow, Color.Green, Color.Blue,
                Color.Purple, Color.Pink,   Color.Plum,  Color.Silver, Color.Salmon
            };
            if (ds != null)
            {
                List <string> listaX = new List <string>();
                PointPairList list   = new PointPairList();
                int           i      = 0;
                foreach (DataRow r in ds.Tables[0].Rows)
                {
                    listaX.Add(r[2].ToString()); //rezultat

                    list.Add(0, (int)r[3], i++); // k
                }
                i = 0;

                foreach (DataRow r in ds.Tables[0].Rows)
                {
                    PieItem segment1 = myPane.AddPieSlice((
                                                              int)r[3], colors[(i++) % colors.Length],
                                                          Color.White, 45f, (i % 2 == 0) ? 0.2 : 0,
                                                          r[2].ToString());
                }
            }
        }
Exemplo n.º 6
0
		public PieSampleDemo() : base( "Code Project Pie Sample",
									"Pie Sample", DemoType.Pie, DemoType.Tutorial )
		{
			GraphPane myPane = base.GraphPane;

			// Set the GraphPane title
			myPane.Title.Text = "2004 ZedGraph Sales by Region\n($M)";
			myPane.Title.FontSpec.IsItalic = true;
			myPane.Title.FontSpec.Size = 24f;
			myPane.Title.FontSpec.Family = "Times New Roman";

			// Fill the pane background with a color gradient
			myPane.Fill = new Fill( Color.White, Color.Goldenrod, 45.0f );
			// No fill for the axis background
			myPane.Chart.Fill.Type = FillType.None;

			// Set the legend to an arbitrary location
			myPane.Legend.Position = LegendPos.Float ;
			myPane.Legend.Location = new Location( 0.95f, 0.15f, CoordType.PaneFraction,
								AlignH.Right, AlignV.Top );
			myPane.Legend.FontSpec.Size = 10f;
			myPane.Legend.IsHStack = false;
			
			// Add some pie slices
			PieItem segment1 = myPane.AddPieSlice( 20, Color.Navy, Color.White, 45f, 0, "North" );
			PieItem segment3 = myPane.AddPieSlice( 30, Color.Purple, Color.White, 45f, .0, "East" );
			PieItem segment4 = myPane.AddPieSlice( 10.21, Color.LimeGreen, Color.White, 45f, 0, "West" );
			PieItem segment2 = myPane.AddPieSlice( 40, Color.SandyBrown, Color.White, 45f, 0.2, "South" );
			PieItem segment6 = myPane.AddPieSlice( 250, Color.Red, Color.White, 45f, 0, "Europe" );
			PieItem segment7 = myPane.AddPieSlice( 50, Color.Blue, Color.White, 45f, 0.2, "Pac Rim" );
			PieItem segment8 = myPane.AddPieSlice( 400, Color.Green, Color.White, 45f, 0, "South America" );
			PieItem segment9 = myPane.AddPieSlice( 50, Color.Yellow, Color.White, 45f, 0.2, "Africa" );
			
			segment2.LabelDetail.FontSpec.FontColor = Color.Red;
												
			// Sum up the pie values																					
			CurveList curves = myPane.CurveList ;
			double total = 0 ;
			for ( int x = 0 ; x <  curves.Count ; x++ )
				total += ((PieItem)curves[x]).Value ;

			// Make a text label to highlight the total value
			TextObj text = new TextObj( "Total 2004 Sales\n" + "$" + total.ToString () + "M",
								0.18F, 0.40F, CoordType.PaneFraction );
			text.Location.AlignH = AlignH.Center;
			text.Location.AlignV = AlignV.Bottom;
			text.FontSpec.Border.IsVisible = false ;
			text.FontSpec.Fill = new Fill( Color.White, Color.FromArgb( 255, 100, 100 ), 45F );
			text.FontSpec.StringAlignment = StringAlignment.Center ;
			myPane.GraphObjList.Add( text );

			// Create a drop shadow for the total value text item
			TextObj text2 = new TextObj( text );
			text2.FontSpec.Fill = new Fill( Color.Black );
			text2.Location.X += 0.008f;
			text2.Location.Y += 0.01f;
			myPane.GraphObjList.Add( text2 );
			 
			base.ZedGraphControl.AxisChange();
		}
Exemplo n.º 7
0
        private void ZedGraphStyle_ZedGraphDrawing(object sender, ZedGraphDrawingEventArgs e)
        {
            ZedGraphControl zedGraph = new ZedGraphControl();

            zedGraph.Size = new Size(100, 100);

            zedGraph.GraphPane.Fill.Type       = FillType.None;
            zedGraph.GraphPane.Chart.Fill.Type = FillType.None;

            zedGraph.GraphPane.Border.IsVisible       = false;
            zedGraph.GraphPane.Chart.Border.IsVisible = false;
            zedGraph.GraphPane.XAxis.IsVisible        = false;
            zedGraph.GraphPane.YAxis.IsVisible        = false;
            zedGraph.GraphPane.Legend.IsVisible       = false;
            zedGraph.GraphPane.Title.IsVisible        = false;

            for (int i = 0; i < SelectedColumns.Count; i++)
            {
                double value = 0;
                if (!double.TryParse(e.Feature.ColumnValues[SelectedColumns[i]], out value))
                {
                    zedGraph.Dispose();
                    return;
                }
                Color   color   = System.Drawing.Color.FromArgb(pieColors[i].AlphaComponent, pieColors[i].RedComponent, pieColors[i].GreenComponent, pieColors[i].BlueComponent);
                PieItem pieItem = zedGraph.GraphPane.AddPieSlice(value, color, 0.08, "");
                pieItem.LabelDetail.IsVisible = false;
            }
            zedGraph.AxisChange();

            e.GeoImage = new GeoImage(zedGraph.GraphPane.GetImage());
            zedGraph.Dispose();
        }
        /// <summary>
        /// 根据名称和值进行数据源的显示,两者的长度需要一致
        /// </summary>
        /// <param name="names">名称</param>
        /// <param name="values">值</param>
        /// <exception cref="ArgumentNullException"></exception>
        public void SetDataSource(string[] names, int[] values)
        {
            if (names == null)
            {
                throw new ArgumentNullException("names");
            }
            if (values == null)
            {
                throw new ArgumentNullException("values");
            }
            if (names.Length != values.Length)
            {
                throw new Exception("两个数组的长度不一致!");
            }

            pieItems = new PieItem[names.Length];

            for (int i = 0; i < names.Length; i++)
            {
                pieItems[i] = new PieItem( )
                {
                    Name  = names[i],
                    Value = values[i],
                    Back  = GetRandomColor( ),
                };
            }

            Invalidate( );
        }
        private void SetDisplayForChart(GraphPane myPane)
        {
            myPane.Border.Color = ColorTranslator.FromHtml("#000000");
            //设置标题
            myPane.Title.Text            = "\n司龄构成";
            myPane.Title.FontSpec.IsBold = false;
            myPane.Title.FontSpec.Size   = 22f;
            myPane.Title.FontSpec.Family = "宋体";


            //设置背景色,渐变,按照45度从Color.White渐变到Color.Goldenrod
            // No fill for the axis background
            myPane.Chart.Fill.IsVisible = false;

            //设置数据项说明位置
            myPane.Legend.Position = LegendPos.Float;
            myPane.Legend.Location = new Location(0.95f, 0.5f, CoordType.PaneFraction,
                                                  AlignH.Right, AlignV.Center);
            myPane.Legend.FontSpec.Size   = 18f;
            myPane.Legend.FontSpec.Family = "宋体";
            myPane.Legend.IsHStack        = false;
            myPane.Legend.FontSpec.Fill   = new Fill(Color.Transparent);
            myPane.Legend.Border.Color    = Color.Transparent;

            foreach (CurveItem item in myPane.CurveList)
            {
                PieItem eachPie = (PieItem)item;
                eachPie.LabelDetail.FontSpec.Size             = 20f;
                eachPie.LabelDetail.FontSpec.Family           = "宋体";
                eachPie.LabelDetail.FontSpec.Border.IsVisible = false;
                eachPie.LabelDetail.FontSpec.Fill             = new Fill(Color.Transparent);
                eachPie.LabelType  = PieLabelType.None;
                eachPie.Label.Text = eachPie.Label.Text + " " + eachPie.Value + "人";
            }
        }
Exemplo n.º 10
0
        public void UpdateTestPassFailChart(string version, string branch, string node, string service, string testID, string testName, DateTime from, DateTime to)
        {
            GraphPane myPane = zedGraphControl_TestPassFail.GraphPane;

            myPane.CurveList.Clear();
            zedGraphControl_TestPassFail.Refresh();

            double passed = m_MySql.GetTestStatusCountByDate(version, branch, node, service, testID, "PASS", from, to);
            double failed = m_MySql.GetTestStatusCountByDate(version, branch, node, service, testID, "FAIL", from, to);

            label_TestTotalExecutionsCount.Text = (passed + failed).ToString();

            if (passed == 0 && failed == 0)
            {
                return;
            }

            myPane.Title.Text = "[" + testName + "]" + " PASSED/FAILED executions count";
            myPane.Fill       = new Fill(Color.Snow, Color.LightGoldenrodYellow, Color.Snow);
            zedGraphControl_TestSets.IsShowPointValues = true;
            zedGraphControl_TestSets.PointValueFormat  = "0";

            PieItem passedPie = myPane.AddPieSlice(passed, Color.Green, 0.2, "Passed");

            passedPie.IsVisible = true;
            passedPie.LabelType = PieLabelType.Name_Value_Percent;

            PieItem failedPie = myPane.AddPieSlice(failed, Color.Red, 0.05, "Failed");

            failedPie.IsVisible = true;
            failedPie.LabelType = PieLabelType.Name_Value_Percent;

            zedGraphControl_TestPassFail.AxisChange();
            zedGraphControl_TestPassFail.Refresh();
        }
Exemplo n.º 11
0
        void XPie_ItemSelected(object sender, PieItem e)
        {
            var model = e?.Tag as AreaModel;

            if (model != null)
            {
                List.SelectedItem = model;
            }
        }
Exemplo n.º 12
0
        private void UpdateGraphDistribution()
        {
            // http://zedgraph.dariowiz.com/index77e8.html?title=Pie_Charts

            zgDistribution.GraphPane.CurveList.Clear();
            GraphPane pane = zgDistribution.GraphPane;

            pane.Legend.IsVisible = false;

            pane.Title.Text = String.Format("Distribution - {0}", CardCountText());

            var qry = cards.Where(wh => !wh.IsInSideboard).GroupBy(grp => grp.Type.Substring(0, grp.Type.IndexOf('-') >= 0 ? grp.Type.IndexOf('-') : grp.Type.Length).Trim())
                      .Select(sel => new KeyValuePair <string, int>(sel.Key, sel.Sum(sum => sum.Amount)));

            foreach (var item in qry)
            {
                Color c = Color.Pink;                 // Other
                if (item.Key == "Creature")
                {
                    c = Color.DarkRed;
                }
                else if (item.Key == "Basic Land")
                {
                    c = Color.Goldenrod;
                }
                else if (item.Key == "Land")
                {
                    c = Color.Goldenrod;
                }
                else if (item.Key == "Artifact Land")
                {
                    c = Color.Goldenrod;
                }
                else if (item.Key == "Enchantment")
                {
                    c = Color.Green;
                }
                else if (item.Key == "Instant")
                {
                    c = Color.Navy;
                }
                else if (item.Key == "Sorcery")
                {
                    c = Color.DeepSkyBlue;
                }
                else if (item.Key == "Artifact")
                {
                    c = Color.LightGray;
                }
                PieItem pi = pane.AddPieSlice(item.Value, c, 0, item.Key + " - " + item.Value);
            }

            zgDistribution.AxisChange();
        }
        /// <summary>
        /// 实例化一个饼图的控件
        /// </summary>
        public UserPieChart( )
        {
            InitializeComponent( );
            random         = new Random( );
            DoubleBuffered = true;

            formatCenter               = new StringFormat( );
            formatCenter.Alignment     = StringAlignment.Center;
            formatCenter.LineAlignment = StringAlignment.Center;

            pieItems = new PieItem[0];
        }
        private void plotgraph()
        {
            Baglanti.GetBaglanti.Close();
            Baglanti.GetBaglanti.Open();
            Baglanti.GetKomut.CommandText = "Select * From KitapKayitlari";
            Baglanti.GetKomut.Connection  = Baglanti.GetBaglanti;
            OleDbDataReader oku    = Baglanti.GetKomut.ExecuteReader();
            int             alinan = 0;
            int             kalan  = 0;

            while (oku.Read())
            {
                if ((oku["Odunc"].ToString()) == "Teslim Alındı")
                {
                    alinan += 1;
                }
                else if ((oku["Odunc"].ToString()) == "Alınmadı")
                {
                    kalan += 1;
                }
            }

            ZedGraphControl zedControl = new ZedGraphControl();
            GraphPane       pane       = new GraphPane();

            int[] kveriler = new int[2];


            pane.XAxis.IsVisible = false;
            pane.YAxis.IsVisible = false;
            string[] x0 = new string[] { "Kütüphanedi kitap sayısı", "Alınan kitap sayısı" };
            double[] y0 = new double[] { kalan, alinan };
            Color[]  c0 = new Color[] { Color.DarkBlue, Color.Red };
            pane.Fill                 = new Fill(Color.White, Color.White, 45.0f);
            pane.Chart.Fill.Type      = FillType.None;
            pane.Legend.Position      = LegendPos.Float;
            pane.Legend.Location      = new Location(0.30f, 0.05f, CoordType.PaneFraction, AlignH.Right, AlignV.Top);
            pane.Legend.FontSpec.Size = 10f;
            pane.Legend.IsHStack      = false;
            for (int i = 0; i < 2; i++)
            {
                PieItem segment1 = pane.AddPieSlice(y0[i], c0[i], 0.1, x0[i]);

                segment1.LabelType = PieLabelType.Name_Value_Percent;
            }
            //pane.AddPieSlices(y0, x0);
            zedControl.GraphPane         = pane;
            zedControl.Height            = this.Height;
            zedControl.Width             = this.Width;
            zedControl.IsEnableWheelZoom = false;
            this.Controls.Add(zedControl);
        }
Exemplo n.º 15
0
        private void Representacion(ZedGraphControl zedControl, int incompleto, int proceso, int procedente, int improcedente, int totales)
        {
            GraphPane grafico = zedGrafico.GraphPane;

            double[] values = { incompleto, proceso, procedente, improcedente };
            string[] labels = { "Incompleto", "En proceso", "Procedente", "No procedente" };
            Color[]  colors = { Color.Orange, Color.Yellow, Color.Green, Color.Red };

            grafico.Title.Text = "Expedientes recibidos";

            grafico.Fill            = new Fill(Color.White, Color.Gray, 45.0f);
            grafico.Chart.Fill.Type = FillType.None;

            grafico.Legend.Position      = LegendPos.Float;
            grafico.Legend.Location      = new Location(0.95f, 0.15f, CoordType.PaneFraction, AlignH.Right, AlignV.Top);
            grafico.Legend.FontSpec.Size = 10f;
            grafico.Legend.IsHStack      = false;
            grafico.Legend.IsVisible     = false;

            PieItem[] slices = new PieItem[values.Length];
            slices = grafico.AddPieSlices(values, labels);

            ((PieItem)slices[0]).Fill.Color = Color.Orange;
            ((PieItem)slices[1]).Fill.Color = Color.Yellow;
            ((PieItem)slices[2]).Fill.Color = Color.Green;
            ((PieItem)slices[3]).Fill.Color = Color.DarkRed;


            ((PieItem)slices[0]).LabelType = PieLabelType.Name_Value_Percent;
            ((PieItem)slices[1]).LabelType = PieLabelType.Name_Value_Percent;
            ((PieItem)slices[2]).LabelType = PieLabelType.Name_Value_Percent;
            ((PieItem)slices[3]).LabelType = PieLabelType.Name_Value_Percent;

            CurveList curves = grafico.CurveList;
            double    total  = 0;

            for (int x = 0; x < curves.Count; x++)
            {
                total += ((PieItem)curves[x]).Value;
            }

            TextObj text = new TextObj("Expedientes totales: " + total.ToString(), 0.12f, 0.95f, CoordType.XChartFractionYPaneFraction);

            text.Location.AlignH           = AlignH.Center;
            text.Location.AlignV           = AlignV.Bottom;
            text.FontSpec.Border.IsVisible = false;
            text.FontSpec.Fill             = new Fill(Color.White, Color.Gray, 75.0f);
            grafico.GraphObjList.Add(text);

            zedGrafico.AxisChange();
            zedGrafico.Invalidate();
        }
Exemplo n.º 16
0
 public PieItem ToPieItem()
 {
     Pie = new PieItem {
         Title = Country ?? "",
         Value = this.Value,
         Color = this.Color,
         Tag   = this,
     };
     if (this.TextColor.HasValue)
     {
         Pie.TitleColor = Pie.PercentColor = Pie.ValueColor = this.TextColor.Value;
     }
     return(Pie);
 }
Exemplo n.º 17
0
        private void UCTestPieCharts_Load(object sender, EventArgs e)
        {
            Random r        = new Random();
            var    pieItems = new PieItem[5];

            for (int i = 0; i < 5; i++)
            {
                pieItems[i] = new PieItem
                {
                    Name  = "Source" + (i + 1),
                    Value = r.Next(10, 100)
                };
            }
            this.ucPieChart1.SetDataSource(pieItems);
            this.ucPieChart2.SetDataSource(pieItems);
        }
Exemplo n.º 18
0
        private void AddPieSlice(
            string frameType,
            double frameCount,
            double totalFrameCount,
            int rgb)
        {
            string label = string.Format(
                " {0} Frames \n {1:N0} \n ({2:F2}%) ",
                frameType, frameCount, frameCount / totalFrameCount * 100);

            Color   color   = Color.FromArgb(rgb, rgb, rgb);
            PieItem pieItem = GraphControl.GraphPane.AddPieSlice(
                frameCount, color, color, 0, 0, label);

            pieItem.Border.IsVisible = false;
        }
Exemplo n.º 19
0
    /**/
    /// <summary>
    /// 画柱状图
    /// </summary>
    /// <param name="graphPane"></param>
    private void DrawBar(GraphPane graphPane)
    {
        //折綫圖
        if (IsCurveBar)
        {
            LineItem myCurve = graphPane.AddCurve("公司名称", null, CurveForBar, Color.Black, SymbolType.Circle);
            //myCurve.Line.Fill = new Fill(Color.White, Color.Transparent, -45F);
            List <double> curveList = new List <double>();
            for (int i = 0; i < CurveForBar.Length; i++)
            {
                curveList.Add(CurveForBar[i]);
            }
            CreateBarLabels(graphPane, "f1", curveList);
        }

        //柱狀圖
        for (int i = 0; i < Count; i++)
        {
            //graphPane.AddBar(LabelList[i], DataSource[i], Colors[i]).Bar.Fill = new Fill(Colors[i], Color.White, Colors[i]);

            BarItem myBar = graphPane.AddBar(LabelList[i], DataSource[i], Colors[i]);
            myBar.Bar.Border = new Border(false, Color.Black, 0);
            myBar.Bar.Fill   = new Fill(Colors[i]);
        }

        //graphPane.Legend.IsHStack = false;  //当有多个显示项的时候设置 Y 轴数据是叠加的还是分开的 (Title)
        //graphPane.BarSettings.Type = BarType.SortedOverlay; //当有多个显示项的时候设置 Y 轴数据是叠加的还是分开的


        graphPane.XAxis.MajorTic.IsBetweenLabels = true;
        string[] labels = NameList.ToArray();
        graphPane.XAxis.Scale.TextLabels = labels;
        graphPane.XAxis.Type             = AxisType.Text;
        graphPane.Fill = new Fill(Color.White, Color.FromArgb(235, 235, 238), 45.0f);
        //graphPane.Chart.Fill = new Fill(Color.White, Color.LightGoldenrodYellow, 45.0f);
    }

    /**/
    /// <summary>
    /// 画饼图
    /// </summary>
    /// <param name="graphPane"></param>
    private void DrawPie(GraphPane graphPane)
    {
        graphPane.Fill                 = new Fill(Color.White, Color.White, 45.0f);
        graphPane.Legend.Position      = LegendPos.Right;//LegendPos.Float;
        graphPane.Legend.Location      = new Location(0.95f, 0.15f, CoordType.PaneFraction, AlignH.Right, AlignV.Top);
        graphPane.Legend.Border.Color  = Color.White;
        graphPane.Legend.FontSpec.Size = 20f;
        graphPane.Legend.IsHStack      = false;
        graphPane.Title.FontSpec.Size  = 30f;

        for (int i = 0; i < Count; i++)
        {
            PieItem myPie = graphPane.AddPieSlice(ScaleData[i], Colors[i], Colors[i], 45f, 0, NameList[i]);
            myPie.LabelDetail.FontSpec.Size = 22f;
            myPie.LabelType = PieLabelType.Value;  //饼图上的文字注释
        }
    }
Exemplo n.º 20
0
        private void CreateGraph1(ZedGraphControl zgc)
        {
            // get a reference to the GraphPane
            GraphPane myPane = zgc.GraphPane;

            // Set the GraphPane title
            myPane.Title.Text = "Cycling Graph";
            myPane.Title.FontSpec.IsItalic = true;
            myPane.Title.FontSpec.Size     = 24f;
            myPane.Title.FontSpec.Family   = "Times New Roman";

            // Fill the pane background with a color gradient
            myPane.Fill = new Fill(Color.White, Color.Goldenrod, 45.0f);
            // No fill for the chart background
            myPane.Chart.Fill.Type = FillType.None;

            // Set the legend to an arbitrary location
            myPane.Legend.Position = LegendPos.Float;
            myPane.Legend.Location = new Location(0.95f, 0.15f, CoordType.PaneFraction,
                                                  AlignH.Right, AlignV.Top);
            myPane.Legend.FontSpec.Size = 10f;
            myPane.Legend.IsHStack      = false;

            // Add some pie slices
            PieItem segment1 = myPane.AddPieSlice(20, Color.Navy, Color.White, 45f, 0, "Heart Rate");
            PieItem segment3 = myPane.AddPieSlice(30, Color.Purple, Color.White, 45f, .0, "Speed");
            PieItem segment4 = myPane.AddPieSlice(10.21, Color.LimeGreen, Color.White, 45f, 0, "Cadence");
            PieItem segment2 = myPane.AddPieSlice(40, Color.SandyBrown, Color.White, 45f, 0.2, "Altitude");
            PieItem segment6 = myPane.AddPieSlice(250, Color.Red, Color.White, 45f, 0, "Power");


            segment2.LabelDetail.FontSpec.FontColor = Color.Red;

            // Sum up the pie values
            CurveList curves = myPane.CurveList;
            double    total  = 0;

            for (int x = 0; x < curves.Count; x++)
            {
                total += ((PieItem)curves[x]).Value;
            }


            // Calculate the Axis Scale Ranges
            zgc.AxisChange();
        }
Exemplo n.º 21
0
        private void drawPie()
        {
            zedGraph.GraphPane.CurveList.Clear();
            zedGraph.GraphPane.GraphObjList.Clear();

            GraphPane myPane = zedGraph.GraphPane;

            myPane.Title.Text = "Грфик платежей";
            for (int i = 0; i < _payments.Count; i++)
            {
                PieItem item = myPane.AddPieSlice(_payments[i].Dolg, getRandomColor(), 0F, _payments[i].Dolg.ToString());
                item.LabelType = PieLabelType.Value;
            }

            zedGraph.AxisChange();
            // Обновляем график
            zedGraph.Invalidate();
        }
Exemplo n.º 22
0
        /// <summary>
        /// 饼形图表
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button11_Click(object sender, EventArgs e)
        {
            myPane = zedGraphControl1.GraphPane;

            PieItem segment1 = myPane.AddPieSlice(20, Color.Navy, Color.White, 45.0f, 0, "North");
            PieItem segment3 = myPane.AddPieSlice(30, Color.Purple, Color.White, 45f, 0, "East");
            //六个参数分别为:在整个饼形图中占的比重,渐变颜色1,渐变颜色2,渐变颜色角度,远离中心点的距离,饼形图的文字注释。

            PieItem segment4 = myPane.AddPieSlice(10.21, Color.LimeGreen, Color.White, 45f, 0, "West");
            PieItem segment2 = myPane.AddPieSlice(40, Color.SandyBrown, Color.White, 45f, 0.2, "South");
            PieItem segment6 = myPane.AddPieSlice(250, Color.Red, Color.White, 45f, 0, "Europe");
            PieItem segment7 = myPane.AddPieSlice(50, Color.Blue, Color.White, 45f, 0.2, "Pac Rim");
            PieItem segment8 = myPane.AddPieSlice(400, Color.Green, Color.White, 45f, 0, "South America");
            PieItem segment9 = myPane.AddPieSlice(50, Color.Yellow, Color.White, 45f, 0.2, "Africa");

            segment2.LabelDetail.FontSpec.FontColor = Color.Red;     //对其中一部分的Label提示信息进行设置

            zedGraphControl1.Refresh();
        }
Exemplo n.º 23
0
        public async Task <List <ExpenseChartDto> > GetExpensesForChart()
        {
            var assets = await _assetRepository.GetAllAssets();

            var expenseChartItems = new List <ExpenseChartDto>();

            foreach (var asset in assets)
            {
                var chartItem = new ExpenseChartDto();
                chartItem.Name = asset.AssetCode;
                chartItem.Pie  = new List <PieItem>();

                var pieItemFacebook  = new PieItem();
                var pieItemInstagram = new PieItem();
                var pieItemOthers    = new PieItem();

                pieItemFacebook.Title = "Facebook";
                pieItemFacebook.Value = asset.Expenses
                                        .Where(expense => expense.ExpenseType == ExpenseTypeEnum.Facebook).Sum(expense => expense.Sum);

                pieItemInstagram.Title = "Instagram";
                pieItemInstagram.Value = asset.Expenses
                                         .Where(expense => expense.ExpenseType == ExpenseTypeEnum.Instagram).Sum(expense => expense.Sum);

                pieItemOthers.Title = "Kita";
                pieItemOthers.Value = asset.Expenses
                                      .Where(expense => expense.ExpenseType == ExpenseTypeEnum.Other).Sum(expense => expense.Sum);


                chartItem.TotalSum = pieItemFacebook.Value + pieItemInstagram.Value
                                     + pieItemOthers.Value;

                chartItem.Pie.Add(pieItemFacebook);
                chartItem.Pie.Add(pieItemInstagram);
                chartItem.Pie.Add(pieItemOthers);
                if (chartItem.TotalSum > 0)
                {
                    expenseChartItems.Add(chartItem);
                }
            }

            return(expenseChartItems);
        }
Exemplo n.º 24
0
        public GraphPane plotPieChart(ZedGraphControl zgc, HRMObjectClass hrmObject)
        {
            GraphPane pane = zgc.GraphPane;

            clearPane(pane);
            pane.AddYAxis("");
            pane.Title.Text = "Power Balance";

            // Left Right Balance % distribution
            PieItem segment1 = pane.AddPieSlice(hrmObject.calcAvg(), Color.LightBlue, 0F, "Left Leg");
            PieItem segment2 = pane.AddPieSlice(100 - hrmObject.calcAvg(), Color.LightGreen, 0F, "Right Leg");

            // Segment Label Type (Name and %)
            segment1.LabelType = PieLabelType.Percent;
            segment2.LabelType = PieLabelType.Percent;

            ZGraphControl(zgc);

            return(pane);
        }
Exemplo n.º 25
0
        private void drawParts(Dictionary <ProblemParts, double> data)
        {
            ChartView.GraphPane.CurveList.Clear();
            ChartView.GraphPane.GraphObjList.Clear();
            piePane            = ChartView.GraphPane;
            piePane.Title.Text = "Ratio of dangerous state to normal for parts";
            var labels = new List <string>();
            var values = new List <double>();
            int i      = 0;

            foreach (var key in data.Keys)
            {
                PieItem pieSlice = piePane.AddPieSlice(data[key], colors[i], 0F, key.ToString());
                //pieSlice.LabelType = PieLabelType.None;
                //values.Add(data[key]);
                //labels.Add(key.ToString());
                i++;
            }
            //piePane.AddPieSlices(values.ToArray(), labels.ToArray());
            ChartView.AxisChange();
            ChartView.Invalidate();
        }
Exemplo n.º 26
0
        static int CreateTablePieChart(string fn)
        {
            GraphPane myPane = new GraphPane(new RectangleF(0, 0, 640, 480), "Flavour", "X", "Y");

            // Add some pie slices
            PieItem segment01 = myPane.AddPieSlice(15, Color.Navy, Color.White, 45f, 0.10, "Salt");
            PieItem segment02 = myPane.AddPieSlice(20, Color.DarkRed, Color.White, 45f, 0.00, "Pepper");
            PieItem segment03 = myPane.AddPieSlice(26, Color.LimeGreen, Color.White, 45f, 0.00, "Nutmeg ");

            segment03.LabelDetail.FontSpec.FontColor = Color.Red;

            // Calculate the Axis Scale Ranges
            myPane.AxisChange();

            Bitmap bm = new Bitmap(1, 1);

            using (Graphics g = Graphics.FromImage(bm))
                myPane.AxisChange(g);
            myPane.GetImage().Save(fn, ImageFormat.Png);

            return(3);
        }
        private Bitmap ZedGraphDrawing(ZedGraphDrawingEventArgs e)
        {
            double scale = ExtentHelper.GetScale(winformsMap1.CurrentExtent, winformsMap1.Width, GeographyUnit.DecimalDegree);

            // Change the size of the graph based on the scale.  It will get bigger as you zoom in.
            int          graphHeight   = Convert.ToInt32(1400000000 / scale);
            LayerOverlay staticOverlay = (LayerOverlay)winformsMap1.Overlays["CitiesOverlay"];

            ChangeLabelPosition(((ShapeFileFeatureLayer)staticOverlay.Layers["Cities"]), graphHeight);

            ZedGraphControl zedGraph = new ZedGraphControl();

            zedGraph.Size = new Size(graphHeight, graphHeight);

            zedGraph.GraphPane.Fill.Type       = FillType.None;
            zedGraph.GraphPane.Chart.Fill.Type = FillType.None;

            zedGraph.GraphPane.Border.IsVisible       = false;
            zedGraph.GraphPane.Chart.Border.IsVisible = false;
            zedGraph.GraphPane.XAxis.IsVisible        = false;
            zedGraph.GraphPane.YAxis.IsVisible        = false;
            zedGraph.GraphPane.Legend.IsVisible       = false;
            zedGraph.GraphPane.Title.IsVisible        = false;

            PieItem pieItem1 = zedGraph.GraphPane.AddPieSlice(Convert.ToDouble(e.Feature.ColumnValues["WHITE"], CultureInfo.InvariantCulture), GetColorFromGeoColor(GeoColor.StandardColors.LightBlue), 0, "White");

            pieItem1.LabelDetail.IsVisible = false;

            PieItem pieItem2 = zedGraph.GraphPane.AddPieSlice(Convert.ToDouble(e.Feature.ColumnValues["ASIAN"], CultureInfo.InvariantCulture), GetColorFromGeoColor(GeoColor.StandardColors.LightGreen), 0, "Asian");

            pieItem2.LabelDetail.IsVisible = false;
            pieItem2.Displacement          = 0.2;

            zedGraph.AxisChange();

            return(zedGraph.GraphPane.GetImage());
        }
Exemplo n.º 28
0
        public override void DrawGraph()
        {
            string graphTitle;

            //饼组成部分标签
            string[] labels = null;
            //饼组成部分的值
            double[] values = null;
            //合计
            double total = 0;

            if (base.XAxisScaleRefrence == DataTableStruct.Rows)
            {
                labels = new string[base.DataSource.Rows.Count];
                values = new double[base.DataSource.Rows.Count];

                for (int i = 0; i < base.DataSource.Rows.Count; i++)
                {
                    labels[i] = base.DataSource.Rows[i][base.CNNameColumn].ToString();
                    if (Convert.IsDBNull(base.DataSource.Rows[i][base.ShowValueColumns[index].ColumnField]))
                    {
                        values[i] = 0;
                    }
                    else
                    {
                        values[i] = Convert.ToDouble(base.DataSource.Rows[i][base.ShowValueColumns[index].ColumnField]);
                        total    += values[i];
                    }
                }

                graphTitle = base.ShowValueColumns[index].ColumnName;
            }
            else
            {
                labels = new string[base.ShowValueColumns.Length];
                values = new double[base.ShowValueColumns.Length];

                for (int i = 0; i < base.ShowValueColumns.Length; i++)
                {
                    labels[i] = base.ShowValueColumns[i].ColumnName;
                    if (Convert.IsDBNull(base.DataSource.Rows[index][base.ShowValueColumns[i].ColumnField]))
                    {
                        values[i] = 0;
                    }
                    else
                    {
                        values[i] = Convert.ToDouble(base.DataSource.Rows[index][base.ShowValueColumns[i].ColumnField]);
                    }

                    total += values[i];
                }
                graphTitle = base.DataSource.Rows[index][base.CNNameColumn].ToString();
            }

            #region 显示图形
            base.GraphContainer.Controls.Clear();

            ZedGraph.ZedGraphControl grphTx = new ZedGraph.ZedGraphControl();

            grphTx.IsEnableHZoom     = false;
            grphTx.IsEnableVZoom     = false;
            grphTx.IsEnableWheelZoom = false;
            grphTx.Dock = System.Windows.Forms.DockStyle.Fill;


            ZedGraph.GraphPane myPane = grphTx.GraphPane;
            myPane.Title.Text = graphTitle;
            //字体
            //myPane.Title.FontSpec.IsItalic = true;
            //myPane.Title.FontSpec.Size = 24f;
            //myPane.Title.FontSpec.Family = "Verdana";
            myPane.Fill = new Fill(Color.White, Color.Goldenrod, 45.0f);
            myPane.Chart.Fill.IsVisible = false;
            myPane.Legend.Position      = LegendPos.Float;
            myPane.Legend.Location      = new Location(0.95f, 0.15f, CoordType.PaneFraction, AlignH.Right, AlignV.Top);
            myPane.Legend.FontSpec.Size = 10f;
            myPane.Legend.IsHStack      = false;
            //画饼状部分
            for (int i = 0; i < labels.Length; i++)
            {
                Color color;
                if (base.Colors == null)
                {
                    color = GetColor();
                }
                else
                {
                    color = base.Colors[i];
                }

                PieItem segment = myPane.AddPieSlice(values[i], color, color, 45f, 0, labels[i]);
            }

            CurveList curves = myPane.CurveList;

            TextObj text = new TextObj("合计:\n" + total.ToString(), 0.18F, 0.40F, CoordType.PaneFraction);
            text.Location.AlignH           = AlignH.Center;
            text.Location.AlignV           = AlignV.Bottom;
            text.FontSpec.Border.IsVisible = false;
            text.FontSpec.Fill             = new Fill(Color.White, Color.FromArgb(255, 100, 100), 45F);
            text.FontSpec.StringAlignment  = StringAlignment.Center;
            myPane.GraphObjList.Add(text);

            // Create a drop shadow for the total value text item
            TextObj text2 = new TextObj(text);
            text2.FontSpec.Fill = new Fill(Color.Black);
            text2.Location.X   += 0.008f;
            text2.Location.Y   += 0.01f;
            myPane.GraphObjList.Add(text2);


            grphTx.AxisChange();

            base.GraphContainer.Controls.Add(grphTx);
            #endregion
        }
Exemplo n.º 29
0
        public MultiPieChartDemo() : base("A Demo of the MasterPane with Pie Charts",
                                          "Multi-Pie Chart Demo", DemoType.General, DemoType.Special)
        {
            MasterPane myMaster = base.MasterPane;

            // Remove the default GraphPane that comes with ZedGraphControl
            myMaster.PaneList.Clear();

            // Set the master pane title
            myMaster.Title.Text      = "Multiple Pie Charts on a MasterPane";
            myMaster.Title.IsVisible = true;

            // Fill the masterpane background with a color gradient
            myMaster.Fill = new Fill(Color.White, Color.MediumSlateBlue, 45.0F);

            // Set the margins and the space between panes to 10 points
            myMaster.Margin.All   = 10;
            myMaster.InnerPaneGap = 10;

            // Enable the masterpane legend
            myMaster.Legend.IsVisible       = true;
            myMaster.Legend.Position        = LegendPos.TopCenter;
            myMaster.IsUniformLegendEntries = true;

            // Enter some data values
            double [] values       = { 15, 15, 40, 20 };
            double [] values2      = { 250, 50, 400, 50 };
            Color []  colors       = { Color.Red, Color.Blue, Color.Green, Color.Yellow };
            double [] displacement = { .0, .0, .0, .0 };
            string [] labels       = { "East", "West", "Central", "Canada" };

            // Create some GraphPanes
            for (int x = 0; x < 3; x++)
            {
                // Create the GraphPane
                GraphPane myPane = new GraphPane();
                myPane.Title.Text = "2003 Regional Sales";

                // Fill the pane background with a solid color
                myPane.Fill = new Fill(Color.Cornsilk);
                // Fill the axis background with a solid color
                myPane.Chart.Fill = new Fill(Color.Cornsilk);

                // Hide the GraphPane legend
                myPane.Legend.IsVisible = false;

                // Add some pie slices
                PieItem segment1 = myPane.AddPieSlice(20, Color.Blue, .10, "North");
                PieItem segment2 = myPane.AddPieSlice(40, Color.Red, 0, "South");
                PieItem segment3 = myPane.AddPieSlice(30, Color.Yellow, .0, "East");
                PieItem segment4 = myPane.AddPieSlice(10.21, Color.Green, .20, "West");
                PieItem segment5 = myPane.AddPieSlice(10.5, Color.Aquamarine, .0, "Canada");
                segment1.LabelType = PieLabelType.Name_Value;
                segment2.LabelType = PieLabelType.Name_Value;
                segment3.LabelType = PieLabelType.Name_Value;
                segment4.LabelType = PieLabelType.Name_Value;
                segment5.LabelType = PieLabelType.Name_Value;

                // Add the graphpane to the masterpane
                myMaster.Add(myPane);
            }

            // Tell ZedGraph to auto layout the graphpanes
            using (Graphics g = this.ZedGraphControl.CreateGraphics())
            {
                myMaster.SetLayout(g, PaneLayout.ExplicitRow12);
                myMaster.AxisChange(g);
                //g.Dispose();
            }
        }
Exemplo n.º 30
0
        public Bitmap RealtimeBackInfoStat_TeacherGraphPrint(string getDept, PanelControl pControl)
        {
            using (RealtimeInfo_TeacherDataAccess realTimeInfo_TeacherDataAccess = new RealtimeInfo_TeacherDataAccess())
            {
                try
                {
                    DataSet dsDutyID = realTimeInfo_TeacherDataAccess.GetDutyID(DateTime.Now.ToString("HH:mm:ss"));
                    int     teaAttOnTimeNumbersInDuty      = 0;
                    int     teaAttNotOnTimeNumbersInDuty   = 0;
                    int     teaLeaveOnTimeNumbersInDuty    = 0;
                    int     teaLeaveNotOnTimeNumbersInDuty = 0;
                    int     teaShouldLeaveInDuty           = 0;

                    if (dsDutyID.Tables[0].Rows.Count > 0)
                    {
                        foreach (DataRow dutyRow in dsDutyID.Tables[0].Rows)
                        {
                            //teaAttNumbersInDuty += realTimeInfo_TeacherDataAccess.GetTeaNumbers(DateTime.Now.DayOfWeek.ToString(),dutyRow[0].ToString(),getDept);
                            realTimeInfo_TeacherDataAccess.GetTeaWorkingNumbers(dutyRow[0].ToString(), ref teaAttOnTimeNumbersInDuty, ref teaAttNotOnTimeNumbersInDuty, getDept, DateTime.Now.Date);
                            realTimeInfo_TeacherDataAccess.GetTeaLeaveNumbers(dutyRow[0].ToString(), ref teaLeaveOnTimeNumbersInDuty, ref teaLeaveNotOnTimeNumbersInDuty, getDept, DateTime.Now.Date);
                        }
                    }

                    int noDutyTotal  = 0;
                    int noDutyAttend = 0;
                    int noDutyLeave  = 0;

                    realTimeInfo_TeacherDataAccess.GetTeacherRealTimeInfoWithNoDuty(getDept, DateTime.Now.DayOfWeek.ToString(), ref noDutyTotal, ref noDutyAttend, ref noDutyLeave);

                    teaLeaveOnTimeNumbersInDuty += noDutyLeave;
                    teaShouldLeaveInDuty         = teaAttOnTimeNumbersInDuty + teaAttNotOnTimeNumbersInDuty + noDutyAttend;


                    double onTimePer    = (double)teaLeaveOnTimeNumbersInDuty / (double)teaShouldLeaveInDuty;
                    double notOnTimePer = (double)teaLeaveNotOnTimeNumbersInDuty / (double)teaShouldLeaveInDuty;
                    double remainPer    = 1 - (((double)teaLeaveOnTimeNumbersInDuty + (double)teaLeaveNotOnTimeNumbersInDuty) / (double)teaShouldLeaveInDuty);

                    zedGraph_RealtimeMorningInfoStatTeacher = new ZedGraphControl();
                    pControl.Controls.Clear();
                    pControl.Controls.Add(zedGraph_RealtimeMorningInfoStatTeacher);
                    zedGraph_RealtimeMorningInfoStatTeacher.Dock = DockStyle.Fill;

                    GraphPane myPane = zedGraph_RealtimeMorningInfoStatTeacher.GraphPane;

                    if (getDept.Equals(""))
                    {
                        myPane.Title = new GardenInfoDataAccess().GetGardenInfo().Tables[0].Rows[0][1].ToString()
                                       + "全体教职工下班情况实时统计图\n" + "统计日期: " + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                    }
                    else
                    {
                        myPane.Title = new GardenInfoDataAccess().GetGardenInfo().Tables[0].Rows[0][1].ToString()
                                       + getDept + "部教师下班情况实时统计图\n" + "统计日期: " + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                    }

                    double[] statusVal   = { onTimePer, notOnTimePer, remainPer };
                    string[] statusLabel = { "离开", "早退", "剩余" };

                    myPane.PaneFill             = new Fill(Color.Cornsilk);
                    myPane.AxisFill             = new Fill(Color.Cornsilk);
                    myPane.Legend.Position      = LegendPos.Right;
                    myPane.Legend.FontSpec.Size = 12;

                    PieItem [] slices = new PieItem[statusVal.Length];
                    slices = myPane.AddPieSlices(statusVal, statusLabel);

                    ((PieItem)slices[0]).LabelType = PieLabelType.Percent;
                    ((PieItem)slices[0]).LabelDetail.FontSpec.Size = 14;
                    ((PieItem)slices[1]).LabelType = PieLabelType.Percent;
                    ((PieItem)slices[1]).LabelDetail.FontSpec.Size = 14;
                    ((PieItem)slices[2]).LabelType = PieLabelType.Percent;
                    ((PieItem)slices[2]).LabelDetail.FontSpec.Size = 14;
                    ((PieItem)slices[1]).Displacement = .1;

                    BoxItem box = new BoxItem(new RectangleF(0F, 0F, 1F, 1F),
                                              Color.Empty, Color.PeachPuff);
                    box.Location.CoordinateFrame = CoordType.AxisFraction;
                    box.Border.IsVisible         = false;
                    box.Location.AlignH          = AlignH.Left;
                    box.Location.AlignV          = AlignV.Top;
                    box.ZOrder = ZOrder.E_BehindAxis;

                    myPane.GraphItemList.Add(box);

                    zedGraph_RealtimeMorningInfoStatTeacher.IsShowContextMenu = false;
                    zedGraph_RealtimeMorningInfoStatTeacher.IsEnableZoom      = false;
                    zedGraph_RealtimeMorningInfoStatTeacher.AxisChange();

                    return(myPane.Image);
                }
                catch (Exception e)
                {
                    Util.WriteLog(e.Message, Util.EXCEPTION_LOG_TITLE);
                    return(null);
                }
            }
        }
Exemplo n.º 31
0
 /// <summary>
 /// Copy the properties of this <see cref="ZedGraphWebPieItem"/> to the specified
 /// <see cref="ZedGraph.PieItem"/> object.
 /// </summary>
 /// <param name="item">The destination <see cref="ZedGraph.PieItem"/> object</param>
 internal void CopyTo( PieItem item )
 {
     base.CopyTo( item );
     this.Border.CopyTo( item.Border );
     this.LabelDetail.CopyTo( item.LabelDetail );
     item.Value = this.Value;
     item.Displacement = this.Displacement;
     item.LabelType = this.LabelType;
     item.PercentDecimalDigits = this.PercentDecimalDigits;
     item.ValueDecimalDigits = this.ValueDecimalDigits;
 }