程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> C語言 >> 關於C語言 >> 基本教程篇--第六、七節(2)

基本教程篇--第六、七節(2)

編輯:關於C語言

using System;

using System.Drawing;

using System.Collections;

using ZedGraph;

namespace ZedGraph.Demo

{

     ///<summary>

     /// Summary description for SimpleDemo.

     ///</summary>

     public class StackedBarSampleDemo : DemoBase

     {

           public StackedBarSampleDemo() : base( "Code Project Stacked Bar Chart Sample",

                "Stacked Bar Sample", DemoType.Tutorial )

           {

                GraphPane myPane = base.GraPHPane;

                // Set the title and axis labels

                myPane.Title = "Cat Stats";

                myPane.XAxis.Title = "Big Cats";

                myPane.YAxis.Title = "Population";

                // Make up some data points

                string[] labels = { "Panther", "Lion", "Cheetah", "Cougar", "Tiger", "Leopard" };

                double[] y = { 100, 115, 75, 22, 98, 40 };

                double[] y2 = { 120, 175, 95, 57, 113, 110 };

                double[] y3 = { 204, 192, 119, 80, 134, 156 };

                // Generate a red bar with "Curve 1" in the legend

                BarItem myCurve = myPane.AddBar( "Here", null, y, Color.Red );

                // Fill the bar with a red-white-red color gradIEnt for a 3d look

                myCurve.Bar.Fill = new Fill( Color.Red, Color.White, Color.Red );

                // Generate a blue bar with "Curve 2" in the legend

                myCurve = myPane.AddBar( "There", null, y2, Color.Blue );

                // Fill the bar with a Blue-white-Blue color gradIEnt for a 3d look

                myCurve.Bar.Fill = new Fill( Color.Blue, Color.White, Color.Blue );

                // Generate a green bar with "Curve 3" in the legend

                myCurve = myPane.AddBar( "Elsewhere", null, y3, Color.Green );

                // Fill the bar with a Green-white-Green color gradIEnt for a 3d look

                myCurve.Bar.Fill = new Fill( Color.Green, Color.White, Color.Green );

                // Draw the X tics between the labels instead of at the labels

                myPane.XAxis.IsTicsBetweenLabels = true;

                // Set the XAxis labels

                myPane.XAxis.TextLabels = labels;

                // Set the XAxis to Text type

                myPane.XAxis.Type = AxisType.Text;

                // Set the bar type to stack, which stacks the bars by automatically accumulating the values

                myPane.BarType = BarType.Stack;

                base.ZedGraphControl.AxisChange();

           }

     }

}

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved