当前位置: 首页>>代码示例>>C#>>正文


C# MasterPane.AxisChange方法代码示例

本文整理汇总了C#中ZedGraph.MasterPane.AxisChange方法的典型用法代码示例。如果您正苦于以下问题:C# MasterPane.AxisChange方法的具体用法?C# MasterPane.AxisChange怎么用?C# MasterPane.AxisChange使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ZedGraph.MasterPane的用法示例。


在下文中一共展示了MasterPane.AxisChange方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CreateGraph

        /// <summary>
        /// 
        /// </summary>
        /// <param name="OutputStream"></param>
        /// <param name="Format"></param>
        /// <param name="bShowTransparency">if true, draw squares instead of leaving the
        /// background transparent</param>
        /// <remarks>
        /// bShowTransparency is set to true in design mode, to false otherwise.
        /// </remarks>
        protected MasterPane CreateGraph( System.IO.Stream OutputStream, ImageFormat Format,
				bool bShowTransparency )
        {
            RectangleF rect = new RectangleF( 0, 0, this.Width, this.Height );
            MasterPane mp = new MasterPane( string.Empty, rect );
            mp.Margin.All = 0;
            mp.Fill.IsVisible = false;
            mp.Border.IsVisible = false;

            // create all required panes
            //for ( int i = 0; i < this.PaneCount; i++ )
            //{
            mp.Add( new GraphPane( rect, Title, string.Empty, string.Empty ) );
            //}

            // create output bitmap container
            Bitmap image = new Bitmap( this.Width, this.Height );
            using ( Graphics g = Graphics.FromImage( image ) )
            {
                // Apply layout plan
                //mp.SetLayout( this.PaneLayout );
                mp.ReSize( g, rect );

                // Use callback to gather more settings and data values
                OnDrawPane( g, mp );

                // Allow designer control of axischange
                if ( this.AxisChanged ) mp.AxisChange( g );

                // Render the graph to a bitmap
                if ( bShowTransparency && mp.Fill.Color.A != 255 )
                {
                    //Show the transparency as white/gray filled squares
                    // We need to add the resource namespace to its name
                    //string resourceName = string.Format( "{0}.transparency.png", GetType().Namespace );
                    string resourceName = "ZedGraph.ZedGraph.transparency.png";
                    Stream stream = System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream( resourceName );

                    if ( stream == null )
                        throw new Exception( "Does the Build Action of the resource " + resourceName + " is set to Embedded Resource ?" );

                    using ( System.Drawing.Image brushImage = new Bitmap( stream ) )
                    using ( TextureBrush brush = new TextureBrush( brushImage, WrapMode.Tile ) )
                    {
                        g.FillRectangle( brush, 0, 0, this.Width, this.Height );
                    }
                    stream.Close();
                }
                mp.Draw( g );
            }

            // Stream the graph out
            MemoryStream ms = new MemoryStream();
            image.Save( ms, Format );

            //TODO: provide caching options
            ms.WriteTo( OutputStream );

            return mp;
        }
开发者ID:JohnChantzis,项目名称:bark_GUI,代码行数:70,代码来源:ZedGraphWeb.cs

示例2: OnRenderUserChart

        private void OnRenderUserChart(ZedGraphWeb z, Graphics g, MasterPane masterPane)
        {
            GraphPane graphPane = masterPane[0];
            graphPane.Title.Text = Resource.SalesByMonthChartLabel;
            graphPane.XAxis.Title.Text = Resource.SalesByMonthChartMonthLabel;
            graphPane.YAxis.Title.Text = Resource.SalesByMonthChartSalesLabel;

            PointPairList pointList = new PointPairList();

            if (salesByMonthData == null) { salesByMonthData = CommerceReport.GetSalesByYearMonthBySite(siteSettings.SiteGuid); }

            foreach (DataRow row in salesByMonthData.Rows)
            {
                double x = new XDate(Convert.ToInt32(row["Y"]), Convert.ToInt32(row["M"]), 1);
                double y = Convert.ToDouble(row["Sales"]);
                pointList.Add(x, y);
            }

            LineItem myCurve2 = graphPane.AddCurve(Resource.SalesByMonthChartLabel, pointList, Color.Blue, SymbolType.Circle);
            // Fill the area under the curve with a white-red gradient at 45 degrees
            myCurve2.Line.Fill = new Fill(Color.White, Color.Green, 45F);
            // Make the symbols opaque by filling them with white
            myCurve2.Symbol.Fill = new Fill(Color.White);

            // Set the XAxis to date type
            graphPane.XAxis.Type = AxisType.Date;
            graphPane.XAxis.CrossAuto = true;

            // Fill the axis background with a color gradient
            graphPane.Chart.Fill = new Fill(Color.White, Color.LightGoldenrodYellow, 45F);

            masterPane.AxisChange(g);
        }
开发者ID:saiesh86,项目名称:TravelBlog,代码行数:33,代码来源:SalesSummary.aspx.cs

示例3: ZedGraphWebExpStatistic_RenderGraph

    protected void ZedGraphWebExpStatistic_RenderGraph(ZedGraph.Web.ZedGraphWeb webObject, Graphics g, MasterPane masterPane)
    {
        Color statColor = Color.Blue;
        string statTitle = string.Empty;
        string statXAxisTitle = string.Empty;
        switch (ListBoxViewContent.SelectedValue)
        {
            case "NpcBeKilled":
                statColor = Color.Orange;
                statTitle = StringDef.NpcBeKilledStatistic;
                statXAxisTitle = StringDef.NpcBeKilledCount;
                break;
            case "NpcKill":
                statColor = Color.Red;
                statTitle = StringDef.NpcKillPlayerStatistic;
                statXAxisTitle = StringDef.NpcKillPlayerCount;
                break;
        }

        GraphPane graphPane = masterPane[0];
        graphPane.Fill = new Fill(WebConfig.GraphPaneBgColor);
        graphPane.Title.Text = statTitle;
        graphPane.Title.FontSpec.Family = StringDef.DefaultFontFamily;
        graphPane.Title.FontSpec.Size = 10;
        graphPane.Legend.IsVisible = false;
        graphPane.BarSettings.Base = BarBase.Y;

        graphPane.XAxis.Title.Text = statXAxisTitle;
        graphPane.XAxis.Title.FontSpec.Family = StringDef.DefaultFontFamily;
        graphPane.XAxis.Title.FontSpec.Size = 6.2f;
        graphPane.XAxis.MajorGrid.IsVisible = true;
        graphPane.XAxis.MajorGrid.DashOff = 0;
        graphPane.XAxis.MajorGrid.Color = Color.Gray;
        graphPane.XAxis.MinorGrid.IsVisible = true;
        graphPane.XAxis.MinorGrid.Color = Color.LightGray;
        graphPane.XAxis.MinorGrid.DashOff = 0;
        graphPane.XAxis.Scale.FontSpec.Size = 5.6f;
        graphPane.XAxis.Scale.FontSpec.Family = StringDef.DefaultFontFamily;

        //graphPane.YAxis.Title.Text = StringDef.NpcTemplate;
        graphPane.YAxis.Title.FontSpec.Family = StringDef.DefaultFontFamily;
        graphPane.YAxis.MajorTic.IsBetweenLabels = true;
        graphPane.YAxis.Scale.IsPreventLabelOverlap = false;
        graphPane.YAxis.Scale.AlignH = AlignH.Center;
        graphPane.YAxis.Scale.FontSpec.Size = 5.6f;
        graphPane.YAxis.Scale.FontSpec.Family = StringDef.DefaultFontFamily;
        graphPane.YAxis.Scale.IsReverse = true;
        graphPane.YAxis.Type = AxisType.Text;

        double[] countList = new double[_recordList.Count];
        string[] templateList = new string[_recordList.Count];
        for (int i = 0; i < _recordList.Count; i++)
        {
            NpcStatisticInfo info = _recordList[i];
            countList[i] = info.Count;
            FS2NpcData npcData = FS2GameDataManager.TheInstance.GetNpcData(int.Parse(info.TemaplteId));
            if (npcData != null)
            {
                templateList[i] = npcData.ToString();
            }
            else
            {
                templateList[i] = info.TemaplteId;
            }
        }
        BarItem barItem = graphPane.AddBar(StringDef.NpcBeKilledCount, countList, null, Color.Blue);
        barItem.Bar.Fill = new Fill(statColor);
        graphPane.YAxis.Scale.TextLabels = templateList;
        masterPane.AxisChange();
        BarItem.CreateBarLabels(graphPane, false, string.Empty, StringDef.DefaultFontFamily, 5.6f, TextObj.Default.FontColor, false, false, false);
    }
开发者ID:viticm,项目名称:pap2,代码行数:71,代码来源:NpcDeathStatistic.aspx.cs

示例4: ZedGraphWebLevelSuiStatistic_RenderGraph


//.........这里部分代码省略.........
            graphPane.Legend.Border.IsVisible = false;

            graphPane.YAxis.Title.Text = StringDef.Count;
            graphPane.YAxis.Title.FontSpec.IsBold = false;
            graphPane.YAxis.Title.FontSpec.Size = 10.5f;
            graphPane.YAxis.Scale.FontSpec.Size = 10.5f;
            graphPane.YAxis.MajorGrid.IsVisible = true;
            graphPane.YAxis.MajorGrid.DashOff = 0;
            graphPane.YAxis.MajorGrid.Color = Color.Gray;
            graphPane.YAxis.MinorGrid.IsVisible = true;
            graphPane.YAxis.MinorGrid.Color = Color.LightGray;
            graphPane.YAxis.MinorGrid.DashOff = 0;

            graphPane.XAxis.Title.Text = StringDef.Level;
            graphPane.XAxis.Title.FontSpec.IsBold = false;
            graphPane.XAxis.Title.FontSpec.Size = 10.5f;
            graphPane.XAxis.Scale.IsVisible = true;
            graphPane.XAxis.Type = AxisType.Text;
            graphPane.XAxis.Scale.TextLabels = levels;
            graphPane.XAxis.Scale.FontSpec.Size = 10.5f;

            switch (DropDownListBarType.SelectedItem.Text)
            {
                case "Stack":
                    graphPane.BarSettings.Type = BarType.Stack;
                    break;
                case "PercentStack":
                    graphPane.BarSettings.Type = BarType.PercentStack;
                    break;
                case "Cluster":
                    graphPane.BarSettings.Type = BarType.Cluster;
                    break;
                case "ClusterHiLow":
                    graphPane.BarSettings.Type = BarType.ClusterHiLow;
                    break;
                case "Overlay":
                    graphPane.BarSettings.Type = BarType.Overlay;
                    break;
                case "SortedOverlay":
                    graphPane.BarSettings.Type = BarType.SortedOverlay;
                    break;
            }            

            for (int roleType = 0; roleType != 10; ++roleType)
            {
                ArrayList infoList = _infoHashtable[(FS2RoleType)roleType] as ArrayList;
                if (infoList != null)
                {
                    counts = new double[(endLevel - startLevel) / groupCount + 1];
                    for (int index = 0; index != levels.Length; ++index)
                    {
                        foreach (LevelInfo info in (LevelInfo[])infoList.ToArray(typeof(LevelInfo)))
                        {
                            if (info.Level >= startLevel + index * groupCount && info.Level < startLevel + (index + 1) * groupCount)
                                counts[index] += info.Num;
                            else if (info.Level >= startLevel + (index + 1) * groupCount)
                                break;
                        }
                    }
                    string classDescription = string.Empty;
                    switch ((FS2RoleType)roleType)
                    {
                        case FS2RoleType.Jiashi:
                            classDescription = StringDef.Jiashi;
                            break;
                        case FS2RoleType.Xuanfeng:
                            classDescription = StringDef.XuanFeng;
                            break;
                        case FS2RoleType.Xingtian:
                            classDescription = StringDef.XingTian;
                            break;
                        case FS2RoleType.Daoshi:
                            classDescription = StringDef.Daoshi;
                            break;
                        case FS2RoleType.Zhenren:
                            classDescription = StringDef.ZhenRen;
                            break;
                        case FS2RoleType.Tianshi:
                            classDescription = StringDef.TianShi;
                            break;
                        case FS2RoleType.Yiren:
                            classDescription = StringDef.Yiren;
                            break;
                        case FS2RoleType.Shoushi:
                            classDescription = StringDef.ShouShi;
                            break;
                        case FS2RoleType.Yishi:
                            classDescription = StringDef.YiShi;
                            break;
                    }
                    BarItem bar = graphPane.AddBar(classDescription, null, counts, roleTypeColor[(int)roleType]);
                    bar.Bar.Fill = new Fill(roleTypeColor[(int)roleType]);
                }
            }

            masterPane.AxisChange(g);
            BarItem.CreateBarLabels(graphPane, true, string.Empty, TextObj.Default.FontFamily, 10.5f,
                TextObj.Default.FontColor, false, false, false);
        }
    }
开发者ID:viticm,项目名称:pap2,代码行数:101,代码来源:LevelDistribution.aspx.cs

示例5: ZedGraphWebTaiSuiStatistic_RenderGraph


//.........这里部分代码省略.........

            if (RadioButtonListType.SelectedValue.Equals("Day"))
            {
                //按天
                TimeSpan span = _end.Subtract(_start);
                timeArray = new double[span.Days + 1];
                counts = new double[span.Days + 1];

                for (int index = 0; index != span.Days + 1; ++index)
                {
                    DateTime tempDate = _start.Date.AddDays(index);
                    timeArray[index] = new XDate(tempDate);
                    foreach (TaiSuiUseInfo info in _statInfo)
                    {
                        //如果相等赋num,如果比date的日期小则结束
                        if (tempDate.Date.Equals(info.date))
                        {
                            counts[index] = info.num;
                            break;
                        }
                        else if (tempDate.Date < info.date)
                        {
                            break;
                        }
                    }
                }
            }
            else
            {
                //按月
                int monthLength = (_end.Year - _start.Year) * 12 + (_end.Month - _start.Month);
                timeArray = new double[monthLength + 1];
                counts = new double[monthLength + 1];

                for (int index = 0; index != monthLength + 1; ++index)
                {
                    DateTime tempDate = _start.Date.AddMonths(index);
                    timeArray[index] = new XDate(tempDate);
                    foreach (TaiSuiUseInfo info in _statInfo)
                    {
                        //如果相等赋num,如果比date的日期小则结束
                        if (tempDate.ToString("yyyyMM").Equals(info.date.ToString("yyyyMM")))
                        {
                            counts[index] = info.num;
                            break;
                        }
                        else if (tempDate.Date < info.date)
                        {
                            break;
                        }
                    }
                }
            }

            GraphPane graphPane = masterPane[0];

            //绘制图表
            graphPane.Title.Text = string.Format("{0} {1} {2} {3}", _start.ToShortDateString(), StringDef.To, _end.ToShortDateString(),
                StringDef.TaiSui + StringDef.Total + StringDef.Colon + _totalCount.ToString());
            graphPane.Title.IsVisible = true;
            graphPane.Title.FontSpec.Size = 14;

            graphPane.Fill = new Fill(WebConfig.GraphPaneBgColor);
            graphPane.Legend.FontSpec.Fill.IsVisible = false;
            graphPane.Legend.FontSpec.Size = 10.5f;
            graphPane.Legend.Fill.IsVisible = false;
            graphPane.Legend.Border.IsVisible = false;

            graphPane.YAxis.Title.Text = StringDef.UseCount;
            graphPane.YAxis.Title.FontSpec.IsBold = false;
            graphPane.YAxis.Title.FontSpec.Size = 10.5f;
            graphPane.YAxis.Scale.FontSpec.Size = 10.5f;
            graphPane.YAxis.MajorGrid.IsVisible = true;
            graphPane.YAxis.MajorGrid.DashOff = 0;
            graphPane.YAxis.MajorGrid.Color = Color.Gray;
            graphPane.YAxis.MinorGrid.IsVisible = true;
            graphPane.YAxis.MinorGrid.Color = Color.LightGray;
            graphPane.YAxis.MinorGrid.DashOff = 0;

            graphPane.XAxis.Title.Text = StringDef.Date;
            graphPane.XAxis.Title.FontSpec.IsBold = false;
            graphPane.XAxis.Title.FontSpec.Size = 10.5f;
            graphPane.XAxis.Scale.MajorUnit = DateUnit.Day;
            graphPane.XAxis.MinorGrid.IsVisible = false;            
            graphPane.XAxis.Type = AxisType.DateAsOrdinal;
            if (RadioButtonListType.SelectedValue.Equals("Day"))
                graphPane.XAxis.Scale.Format = "MM-dd";
            else
                graphPane.XAxis.Scale.Format = "yyyy-MM";
            graphPane.XAxis.Scale.FontSpec.Size = 10.5f;
            //graphPane.XAxis.Scale.FontSpec.Angle = 45;

            graphPane.BarSettings.Type = BarType.Cluster;

            BarItem barItem = graphPane.AddBar(StringDef.UseCount, timeArray, counts, Color.Blue);
            masterPane.AxisChange(g);
            BarItem.CreateBarLabels(graphPane, false, string.Empty, TextObj.Default.FontFamily, 10.5f,
                TextObj.Default.FontColor, false, false, false);
        }
    }
开发者ID:viticm,项目名称:pap2,代码行数:101,代码来源:TaiSuiStatistic.aspx.cs

示例6: Form1_Load


//.........这里部分代码省略.........
            //myPane.YAxis.Type = AxisType.Text;
            //myPane.YAxis.TextLabels = ystr;
            //myPane.ClusterScaleWidth = 1;

            //myPane.AxisChange( this.CreateGraphics() );

            #endif

            #if false	// GradientByZ dual bars
            myPane = new GraphPane( new RectangleF(0,0,300,400), "Title", "X Label", "Y Label" );

            double[] xx = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
            double[] yy = { 1, 2, 3, 4, 5, 4, 3, 2, 1, 2 };
            double[] yy2 = { 4, 5, 7, 8, 1, 3, 5, 2, 4, 9 };
            double[] zz = { 1, 2, 3, 4, 5, 5, 4, 3, 2, 1 };
            double[] zz2 = { 5, 1, 4, 2, 3, 4, 2, 1, 5, 5 };
            PointPairList list = new PointPairList( xx, yy, zz );
            PointPairList list2 = new PointPairList( xx, yy2, zz2 );

            Color[] colors = { Color.Red, Color.Green, Color.Blue,
                                 Color.Yellow, Color.Orange };
            Fill fill = new Fill( colors );
            fill.Type = FillType.GradientByZ;
            fill.RangeMin = 1;
            fill.RangeMax = 5;

            BarItem myBar = myPane.AddBar( "My Bar", list, Color.Tomato );
            myBar.Bar.Fill = fill;
            BarItem myBar2 = myPane.AddBar( "My Bar 2", list2, Color.Tomato );
            myBar2.Bar.Fill = fill;
            myPane.XAxis.Type = AxisType.Ordinal;
            myPane.MinBarGap = 0.1f;
            //myPane.MinClusterGap = 0;
            myPane.AxisChange( this.CreateGraphics() );

            #endif

            #if false	// stacked bars

            Random rand = new Random();

            myPane = new GraphPane();
            //			myPane.Title.Text = "My Title";
            //			myPane.XAxis.Title.Text = "X Axis";
            //			myPane.YAxis.Title.Text = "Y Axis";

            PointPairList list1 = new PointPairList();
            PointPairList list2 = new PointPairList();
            PointPairList list3 = new PointPairList();
            PointPairList list4 = new PointPairList();

            for ( int i=1; i<5; i++ )
            {
                double y = (double) i;
                double x1 = 100.0 + rand.NextDouble() * 100.0;
                double x2 = 100.0 + rand.NextDouble() * 100.0;
                double x3 = 100.0 + rand.NextDouble() * 100.0;
                double x4 = 100.0 + rand.NextDouble() * 100.0;

                list1.Add( x1, y );
                list2.Add( x2, y );
                list3.Add( x3, y );
                list4.Add( x4, y );
            }

            BarItem bar1 = myPane.AddBar( "Bar 1", list1, Color.Red );
开发者ID:Jungwon,项目名称:ZedGraph,代码行数:67,代码来源:Form1.cs

示例7: OnRenderGraphVillagePie

    /// <summary>
    /// This method is where you generate your graph.
    /// </summary>
    /// <param name="masterPane">You are provided with a MasterPane instance that
    /// contains one GraphPane by default (accessible via masterPane[0]).</param>
    /// <param name="g">A graphics instance so you can easily make the call to AxisChange()</param>
    /// <param name="z">And a ZedGraphWeb instance because the event handler requires it</param>
    /// <param name="row">Selected row n gridview.</param>
    private static void OnRenderGraphVillagePie(ZedGraphWeb z,
        Graphics g,
        MasterPane masterPane,
        TableRow row)
    {
        // Get the GraphPane so we can work with it
        GraphPane myPane = masterPane[0];

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

        myPane.Legend.IsVisible = false;
        myPane.Legend.IsShowLegendSymbols = true;
        myPane.Legend.IsHStack = false;

        // Add some pie slices
        const string srcTable = "Goods";
        DataBase dataBase = new DataBase();
        DataSet dataSet = dataBase.GetGoods(srcTable, Misc.String2Number(row.Cells[0].Text.Trim()));
        DataRow dataRow = dataSet.Tables[srcTable].Rows[0];
        int wood = Misc.String2Number(dataRow.ItemArray[0].ToString());
        int clay = Misc.String2Number(dataRow.ItemArray[1].ToString());
        int iron = Misc.String2Number(dataRow.ItemArray[2].ToString());
        int crop = Misc.String2Number(dataRow.ItemArray[3].ToString());

        PieItem segmentWood = myPane.AddPieSlice(wood, Color.Green, Color.Green, 45f, 0, wood.ToString());
        PieItem segmentClay = myPane.AddPieSlice(clay, Color.OrangeRed, Color.OrangeRed, 45f, .0, clay.ToString());
        PieItem segmentIron = myPane.AddPieSlice(iron, Color.Blue, Color.Blue, 45f, 0, iron.ToString());
        PieItem segmentCrop = myPane.AddPieSlice(crop, Color.Yellow, Color.Yellow, 45f, 0.2, crop.ToString());

        segmentWood.LabelDetail.FontSpec.Size = 20f;
        segmentClay.LabelDetail.FontSpec.Size = 20f;
        segmentIron.LabelDetail.FontSpec.Size = 20f;
        segmentCrop.LabelDetail.FontSpec.Size = 20f;

        // 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;
        }

        // Set the GraphPane title
        //myPane.Title.Text = String.Format("Total Goods : {0}\nWood : {1}\nClay : {2}\nIron : {3}\nCrop : {4}", total,
        //                                  wood, clay, iron, crop);
        myPane.Title.Text = String.Format("Total Goods : {0}", total);
        myPane.Title.FontSpec.IsItalic = true;
        myPane.Title.FontSpec.Size = 24f;
        myPane.Title.FontSpec.Family = "Times New Roman";

        masterPane.AxisChange(g);
    }
开发者ID:trippleflux,项目名称:jezatools,代码行数:63,代码来源:Reports.aspx.cs


注:本文中的ZedGraph.MasterPane.AxisChange方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。