예제 #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        Chartlet1.MaxValueY     = 1000;
        Chartlet1.Shadow.Radius = 5;

        Chartlet1.BindChartData(SqlDataSource1);

        //Get more info on http://www.Chartlet.cn
    }
예제 #2
0
    protected void select(object sender, EventArgs e)
    {
        if (TextBox1.Text == "")
        {
            ScriptManager.RegisterStartupScript(this.form1, this.GetType(), "click", "alert('please input start time')", true);
        }

        else if (TextBox2.Text == "")
        {
            ScriptManager.RegisterStartupScript(this.form1, this.GetType(), "click", "alert('please input Termination time')", true);
        }
        else if (TextBox1.Text != "" && TextBox2.Text != "")
        {
            //string from = Request.Form["from"];
            //string to = Request.Form["to"];
            string SQL =
                "SELECT CAST(CONVERT(float, (SELECT COUNT(VAL_01) AS VAL_01t  FROM  BCSS_DATE WHERE (VAL_01 = 3)and STATUS='NEW' and (CAST(DEP_DT AS date) between '" + TextBox1.Text + "' and '" + TextBox2.Text + "'))) / CONVERT(float, COUNT(VAL_01)) * 100 AS decimal(38, 2))  AS VAL1,CAST(CONVERT(float, (SELECT COUNT(VAL_02) AS VAL_02t  FROM  BCSS_DATE WHERE (VAL_02 = 3)and STATUS='NEW' and (CAST(DEP_DT AS date) between '" + TextBox1.Text + "' and '" + TextBox2.Text + "'))) / CONVERT(float, COUNT(VAL_02)) * 100 AS decimal(38, 2)) AS VAL2,CAST(CONVERT(float, (SELECT COUNT(VAL_03) AS VAL_03t  FROM  BCSS_DATE WHERE (VAL_03 = 3)and STATUS='NEW' and (CAST(DEP_DT AS date) between '" + TextBox1.Text + "' and '" + TextBox2.Text + "'))) / CONVERT(float, COUNT(VAL_03)) * 100 AS decimal(38, 2)) AS VAL3,CAST(CONVERT(float, (SELECT COUNT(VAL_04) AS VAL_04t  FROM  BCSS_DATE WHERE (VAL_04 = 3)and STATUS='NEW' and(CAST(DEP_DT AS date) between '" + TextBox1.Text + "' and '" + TextBox2.Text + "'))) / CONVERT(float, COUNT(VAL_04)) * 100 AS decimal(38, 2)) AS VAL4,CAST(CONVERT(float, (SELECT COUNT(VAL_05) AS VAL_05t  FROM  BCSS_DATE WHERE (VAL_05 = 3)and STATUS='NEW' and(CAST(DEP_DT AS date) between '" + TextBox1.Text + "' and '" + TextBox2.Text + "'))) / CONVERT(float, COUNT(VAL_05)) * 100 AS decimal(38, 2)) AS VAL5,CAST(CONVERT(float, (SELECT COUNT(VAL_06) AS VAL_06t  FROM  BCSS_DATE WHERE (VAL_06 = 3)and STATUS='NEW' and(CAST(DEP_DT AS date) between '" + TextBox1.Text + "' and '" + TextBox2.Text + "'))) / CONVERT(float, COUNT(VAL_06)) * 100 AS decimal(38, 2)) AS VAL6,CAST(CONVERT(float, (SELECT COUNT(VAL_07) AS VAL_07t  FROM  BCSS_DATE WHERE (VAL_07 = 3)and STATUS='NEW' and(CAST(DEP_DT AS date) between '" + TextBox1.Text + "' and '" + TextBox2.Text + "'))) / CONVERT(float, COUNT(VAL_07)) * 100 AS decimal(38, 2)) AS VAL7,CAST(CONVERT(float, (SELECT COUNT(VAL_08) AS VAL_08t  FROM  BCSS_DATE WHERE (VAL_08 = 3)and STATUS='NEW' and(CAST(DEP_DT AS date) between '" + TextBox1.Text + "' and '" + TextBox2.Text + "'))) / CONVERT(float, COUNT(VAL_08)) * 100 AS decimal(38, 2)) AS VAL8,CAST(CONVERT(float, (SELECT COUNT(VAL_09) AS VAL_09t  FROM  BCSS_DATE WHERE (VAL_09 = 3)and STATUS='NEW' and(CAST(DEP_DT AS date) between '" + TextBox1.Text + "' and '" + TextBox2.Text + "'))) / CONVERT(float, COUNT(VAL_09)) * 100 AS decimal(38, 2)) AS VAL9,CAST(CONVERT(float, (SELECT COUNT(VAL_10) AS VAL_10t  FROM  BCSS_DATE WHERE (VAL_10 = 3)and STATUS='NEW' and(CAST(DEP_DT AS date) between '" + TextBox1.Text + "' and '" + TextBox2.Text + "'))) / CONVERT(float, COUNT(VAL_10)) * 100 AS decimal(38, 2)) AS VAL10,CAST(CONVERT(float, (SELECT COUNT(VAL_11) AS VAL_11t  FROM  BCSS_DATE WHERE (VAL_11 = 3)and STATUS='NEW' and(CAST(DEP_DT AS date) between '" + TextBox1.Text + "' and '" + TextBox2.Text + "'))) / CONVERT(float, COUNT(VAL_11)) * 100 AS decimal(38, 2)) AS VAL11,CAST(CONVERT(float, (SELECT COUNT(VAL_12) AS VAL_12t  FROM  BCSS_DATE WHERE (VAL_12 = 3)and STATUS='NEW' and(CAST(DEP_DT AS date) between '" + TextBox1.Text + "' and '" + TextBox2.Text + "'))) / CONVERT(float, COUNT(VAL_12)) * 100 AS decimal(38, 2)) AS VAL12,CAST(CONVERT(float, (SELECT COUNT(VAL_13) AS VAL_13t  FROM  BCSS_DATE WHERE (VAL_13 = 3)and STATUS='NEW' and(CAST(DEP_DT AS date) between '" + TextBox1.Text + "' and '" + TextBox2.Text + "'))) / CONVERT(float, COUNT(VAL_13)) * 100 AS decimal(38, 2)) AS VAL13 FROM  BCSS_DATE AS BCSS_DATE_1 where STATUS='NEW' and (CAST(DEP_DT AS date) between '" + TextBox1.Text + "' and '" + TextBox2.Text + "')";
            //SqlParameter[] parm = new SqlParameter[]{
            //        new SqlParameter("@from", SqlDbType.Date),
            //          new SqlParameter("@to", SqlDbType.Date)
            //    };
            //parm[0].Value = from;
            //parm[1].Value = to;
            DataTable  dt  = new DataTable();
            DataColumn dc1 = new DataColumn("station", Type.GetType("System.String"));
            DataColumn dc2 = new DataColumn("Proportion", Type.GetType("System.Double"));

            dt.Columns.Add(dc1);
            dt.Columns.Add(dc2);

            using (SqlDataReader reader = SqlHelper.ExecuteReader(SqlHelper.Conn1, CommandType.Text, SQL))
            {
                while (reader.Read())
                {
                    for (int i = 0; i <= 12; i++)
                    {
                        DataRow dr = dt.NewRow();
                        dr["station"] = "MFM";

                        dr["Proportion"] = reader[i];
                        dt.Rows.Add(dr);
                    }
                }
            }
            DataTable dt1 = new DataTable();
            dt1 = rowtocolumn(dt);
            GridView1.DataSource = dt1;
            GridView1.DataBind();
            Chartlet1.BindChartData(dt);
            Chartlet1.Visible = true;
        }
    }
예제 #3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //Please modify the connection string in web.config and choose the correct path of .mdb file.

        //Step 1: Choose one appearance style from enum FanG.Chartlet.AppearanceStyles
        Chartlet1.AppearanceStyle = FanG.Chartlet.AppearanceStyles.Bar_2D_StarryNight_FlatCrystal_Glow_TextureBorder;

        //Alternative steps
        //If you want to use other colors, decomments the statement below, and you can use different value (0 ~ 12)
        //Chartlet1.FillShiftStep = 8;
        //You can still setting other attributes here.

        //Step 2: Bind a data source
        Chartlet1.BindChartData(SqlDataSource1);

        //OK, run your web form, a beautiful chart appears, does it?
        //So simple Chartlet is.
        //More info on http://www.Chartlet.cn

        //========================================================//
        Chartlet2.AppearanceStyle = FanG.Chartlet.AppearanceStyles.Line_2D_StarryNight_ThickRound_Glow_NoBorder;
        Chartlet2.ChartTitle.Text = "Line Chart";
        //You adjust some attributes based on AppearanceStyle selected
        //Chartlet2.LineWidth = 2;
        Chartlet2.MaxValueY = 1000;
        Chartlet2.BindChartData(SqlDataSource1);

        Chartlet3.AppearanceStyle = FanG.Chartlet.AppearanceStyles.Line_3D_StarryNight_FlatCrystalRound_NoGlow_NoBorder;
        Chartlet3.Fill.ShiftStep  = 7;
        Chartlet3.ChartTitle.Text = "Pie Chart";
        Chartlet3.BindChartData(SqlDataSource1);

        Chartlet4.AppearanceStyle = FanG.Chartlet.AppearanceStyles.Pie_3D_Aurora_NoCrystal_NoGlow_NoBorder;
        Chartlet4.Fill.ShiftStep  = 9;
        Chartlet4.ChartTitle.Text = "3D Pie Chart";
        Chartlet4.BindChartData(SqlDataSource1);
    }
예제 #4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        Chartlet1.MaxValueY        = 100;
        Chartlet1.Shadow.Radius    = 3;
        Chartlet1.ChartTitle.Text  = "Satisfaction";
        Chartlet1.YLabels.UnitText = "%";
        Chartlet1.Visible          = false;

        string SQL = "SELECT CAST(CONVERT(float, (SELECT COUNT(VAL_01) AS VAL_01t  FROM  BCSS_DATE WHERE (VAL_01 = 3))) / CONVERT(float, COUNT(VAL_01)) * 100 AS decimal(38, 2))  AS VAL1,CAST(CONVERT(float, (SELECT COUNT(VAL_02) AS VAL_02t  FROM  BCSS_DATE WHERE (VAL_02 = 3))) / CONVERT(float, COUNT(VAL_02)) * 100 AS decimal(38, 2)) AS VAL2,CAST(CONVERT(float, (SELECT COUNT(VAL_03) AS VAL_03t  FROM  BCSS_DATE WHERE (VAL_03 = 3))) / CONVERT(float, COUNT(VAL_03)) * 100 AS decimal(38, 2)) AS VAL3,CAST(CONVERT(float, (SELECT COUNT(VAL_04) AS VAL_04t  FROM  BCSS_DATE WHERE (VAL_04 = 3))) / CONVERT(float, COUNT(VAL_04)) * 100 AS decimal(38, 2)) AS VAL4,CAST(CONVERT(float, (SELECT COUNT(VAL_05) AS VAL_05t  FROM  BCSS_DATE WHERE (VAL_05 = 3))) / CONVERT(float, COUNT(VAL_05)) * 100 AS decimal(38, 2)) AS VAL5,CAST(CONVERT(float, (SELECT COUNT(VAL_06) AS VAL_06t  FROM  BCSS_DATE WHERE (VAL_06 = 3))) / CONVERT(float, COUNT(VAL_06)) * 100 AS decimal(38, 2)) AS VAL6,CAST(CONVERT(float, (SELECT COUNT(VAL_07) AS VAL_07t  FROM  BCSS_DATE WHERE (VAL_07 = 3))) / CONVERT(float, COUNT(VAL_07)) * 100 AS decimal(38, 2)) AS VAL7,CAST(CONVERT(float, (SELECT COUNT(VAL_08) AS VAL_08t  FROM  BCSS_DATE WHERE (VAL_08 = 3))) / CONVERT(float, COUNT(VAL_08)) * 100 AS decimal(38, 2)) AS VAL8,CAST(CONVERT(float, (SELECT COUNT(VAL_09) AS VAL_09t  FROM  BCSS_DATE WHERE (VAL_09 = 3))) / CONVERT(float, COUNT(VAL_09)) * 100 AS decimal(38, 2)) AS VAL9,CAST(CONVERT(float, (SELECT COUNT(VAL_10) AS VAL_10t  FROM  BCSS_DATE WHERE (VAL_10 = 3))) / CONVERT(float, COUNT(VAL_10)) * 100 AS decimal(38, 2)) AS VAL10,CAST(CONVERT(float, (SELECT COUNT(VAL_11) AS VAL_11t  FROM  BCSS_DATE WHERE (VAL_11 = 3))) / CONVERT(float, COUNT(VAL_11)) * 100 AS decimal(38, 2)) AS VAL11,CAST(CONVERT(float, (SELECT COUNT(VAL_12) AS VAL_12t  FROM  BCSS_DATE WHERE (VAL_12 = 3))) / CONVERT(float, COUNT(VAL_12)) * 100 AS decimal(38, 2)) AS VAL12,CAST(CONVERT(float, (SELECT COUNT(VAL_13) AS VAL_13t  FROM  BCSS_DATE WHERE (VAL_13 = 3))) / CONVERT(float, COUNT(VAL_13)) * 100 AS decimal(38, 2)) AS VAL13 FROM  BCSS_DATE AS BCSS_DATE_1 ";

        using (SqlDataReader reader = SqlHelper.ExecuteReader(SqlHelper.Conn1, CommandType.Text, SQL))
        {
            while (reader.Read())
            {
                DataSet    ds  = new DataSet();
                DataTable  dt  = new DataTable();
                DataColumn dc1 = new DataColumn("station", Type.GetType("System.String"));

                DataColumn dc3 = new DataColumn("Proportion", Type.GetType("System.Double"));
                dt.Columns.Add(dc1);

                dt.Columns.Add(dc3);
                for (int i = 0; i <= 12; i++)
                {
                    DataRow dr = dt.NewRow();
                    dr["station"] = "MFM";

                    dr["Proportion"] = reader[i];
                    dt.Rows.Add(dr);
                }
                ds.Tables.Add(dt);
                Chartlet1.BindChartData(ds);
            }
            reader.Close();
        }
    }
예제 #5
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        string from = Request.Form["from"];
        string to   = Request.Form["to"];
        bool   flag = true;

        if (from == "")
        {
            ClientScript.RegisterStartupScript(GetType(), "message", "<script>alert('From is request.');</script>");
            flag = false;
            GridView1.Visible = false;
            Chartlet1.Visible = false;
        }

        if (to == "")
        {
            ClientScript.RegisterStartupScript(GetType(), "message", "<script>alert('To is request.');</script>");
            flag = false;
            GridView1.Visible = false;
            Chartlet1.Visible = false;
        }

        if (flag)
        {
            string SQL_select =
                "select station as Station, SUM(BD.VAL_07),COUNT(BD.VAL_07), Convert(decimal(18,2),SUM(BD.VAL_07)*1.0/COUNT(BD.VAL_07)) Avg"
                + " from BCSS_DATE BD"
                + " where STATUS='NEW'"
                + " and BD.VAL_01<>0"
                + " and (CAST(DEP_DT AS date) between @from and @to)"
                + " group by station"
                + " order by station";
            SqlParameter[] parm = new SqlParameter[] {
                new SqlParameter("@from", SqlDbType.Date),
                new SqlParameter("@to", SqlDbType.Date)
            };
            parm[0].Value = from;
            parm[1].Value = to;
            DataTable  dt  = new DataTable();
            DataColumn dc1 = new DataColumn("Station", Type.GetType("System.String"));
            DataColumn dc2 = new DataColumn("Point", Type.GetType("System.String"));
            //DataColumn dc3 = new DataColumn("Point2", Type.GetType("System.String"));
            dt.Columns.Add(dc1);
            dt.Columns.Add(dc2);
            //dt.Columns.Add(dc3);
            using (SqlDataReader rdr = SqlHelper.ExecuteReader(SqlHelper.Conn1, CommandType.Text, SQL_select, parm))
            {
                while (rdr.Read())
                {
                    DataRow dr = dt.NewRow();
                    dr["Station"] = rdr["Station"].ToString();
                    dr["Point"]   = rdr["Avg"].ToString();
                    // dr["point2"] = rdr["avg2"].ToString();
                    dt.Rows.Add(dr);
                }
            }


            if (dt.Rows.Count > 0)
            {
                DataTable dt1 = new DataTable();
                dt1 = rowtocolumn(dt);
                GridView1.DataSource = dt1;
                GridView1.DataBind();
                GridView1.Visible = true;
                Chartlet1.BindChartData(dt);
                Chartlet1.Visible = true;
                // Chartlet1.MaxValueY = 100;
                // Chartlet1.Shadow.Radius = 3;
                Chartlet1.ChartTitle.Text  = "Avg Satisfaction for Question7";
                Chartlet1.YLabels.UnitText = "point";
            }
            else
            {
                GridView1.Visible = false;
                Chartlet1.Visible = false;
            }
        }
    }
예제 #6
0
    protected void Page_Load(object sender, EventArgs e)
    {
        Label1.Text = Chartlet1.GetVersion();;

        //Modify the conneciton string in web.config, so that program can find the database file.
        //修改web.config里面的连接字符串,使之能够找到数据库文件
        cs += Server.MapPath("App_Data/Chartlet.mdb");
        SqlDataSource1.ConnectionString = cs;

        //=====================================================================================================
        //1. Bind data for first Chart, it's so easy.
        //Note: If you have some Error in database connection, pelase modify connection string in web.config
        //1.下面为第一个图表加载数据,使用BindChartData()方法,超级简单!
        //注:数据库在App_Data/Chartlet.mdb,如果你运行时无法连接,可能需要修改web.config里面的连接字符串

        //设置2个显示属性
        //Attributes setting
        Chartlet1.ChartTitle.Text  = "Sales Accomplishment";
        Chartlet1.YLabels.UnitText = "Million";

        //绑定数据就是这么简单,直接一句话搞定
        //You see, so easy! only 1 statement can bind all the data.
        Chartlet1.BindChartData(SqlDataSource1);


        //=====================================================================================================
        //2. Bind data for 2nd Chart.
        //2.为图表二添加后台数据(使用InitalizeData()方法)*/

        //构造数据数组ArrayList[]
        /*注: 这里构造数据数组时,是直接手填的,当然你在实际应用中应该是从数据库读出数据再构建这个数组*/
        ArrayList ChartD21 = new ArrayList();

        ChartD21.Add(53); ChartD21.Add(85); ChartD21.Add(60);
        ChartD21.Add(40); ChartD21.Add(45); ChartD21.Add(53);
        ChartD21.Add(60); ChartD21.Add(90); ChartD21.Add(76);
        ChartD21.Add(57); ChartD21.Add(60); ChartD21.Add(53);
        //只有一组数据的 ArrayList[]
        ArrayList[] ChartData2 = { ChartD21 };

        //将数据数组传入InitializeData()方法,后两个参数数据使用默认值
        Chartlet2.InitializeData(ChartData2, null, null);

        //======================================================================================================
        //3. Bind data for 3rd chart and 4th chart.
        // 3.为第三,四个图表加载数据,使用InitializeData()方法
        //颜色图例数组
        ArrayList ColorGuider = new ArrayList();

        ColorGuider.Add("Laura");
        ColorGuider.Add("Jesy");
        ColorGuider.Add("Linda");

        //X坐标轴标识数组
        //Labels on X Axis
        ArrayList XTitle = new ArrayList();

        XTitle.Add("East");
        XTitle.Add("South");
        XTitle.Add("West");
        XTitle.Add("North");

        //图表数据(3组)
        //Chart data (3 Groups)
        ArrayList[] ChartData = new ArrayList[3];

        ChartData[0] = new ArrayList();
        ChartData[0].Add(170);
        ChartData[0].Add(85);
        ChartData[0].Add(5287);
        ChartData[0].Add(910);
        ChartData[0].Add(9);
        ChartData[0].Add(3);

        ChartData[1] = new ArrayList();
        ChartData[1].Add(76);
        ChartData[1].Add(68);
        ChartData[1].Add(43);
        ChartData[1].Add(99);

        ChartData[2] = new ArrayList();
        ChartData[2].Add(10);
        ChartData[2].Add(77);
        ChartData[2].Add(15);
        ChartData[2].Add(79);
        //图表数据(3组)


        Chartlet3.AppearanceStyle = FanG.Chartlet.AppearanceStyles.Pie_3D_Aurora_NoCrystal_NoGlow_NoBorder;
        Chartlet3.Fill.ShiftStep  = 8;
        Chartlet3.InitializeData(ChartData, XTitle, ColorGuider);

        Chartlet4.InitializeData(ChartData, XTitle, ColorGuider);
        //======================================================================================================


        Label2.Text = Chartlet1.GetVersionDetail();
    }
예제 #7
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string cs = WebConfigurationManager.ConnectionStrings["Chartlet"].ConnectionString + Server.MapPath("App_data\\Chartlet.mdb");

        SqlDataSource1.ConnectionString = cs;

        //设置数值标签的文字样式
        Chartlet1.Tips.ForeColor = Color.Brown;

        Chartlet1.MaxValueY        = 1000;
        Chartlet1.Shadow.Radius    = 5;
        Chartlet1.ColorGuider.Show = false;
        Chartlet1.AppearanceStyle  = FanG.Chartlet.AppearanceStyles.Pie_3D_Aurora_FlatCrystal_NoGlow_NoBorder;
        Chartlet1.Fill.ShiftStep   = 4;
        Chartlet1.BindChartData(SqlDataSource1);

        //更多信息请参看 http://www.Chartlet.cn
        string           sql = "Select Season,Profit from Sales";
        OleDbConnection  cn  = new OleDbConnection(cs);
        OleDbDataAdapter da  = new OleDbDataAdapter(sql, cn);
        DataSet          ds  = new DataSet();

        da.Fill(ds, "Jesy");

        Chartlet2.AppearanceStyle = FanG.Chartlet.AppearanceStyles.Line_3D_Aurora_FlatCrystalRound_NoGlow_NoBorder;
        //下面两个属性用来增大图形右边和下面的可视范围,避免ColorGuider和XLabels的字符被截断
        Chartlet2.InflateBottom = 50;
        Chartlet2.InflateRight  = 100;
        Chartlet2.Width         = 1200;
        //下面通过MinValueY和MaxValueY来纵向拉伸图形,可以注释下面两句看看不拉伸的效果
        Chartlet2.MinValueY = 200;
        Chartlet2.MaxValueY = 600;
        Chartlet2.BindChartData(ds);



/*** 这里演示手动修改横坐标,纵坐标一般是数值,最多只能修改纵坐标的单位,其他暂时不支持修改 ***/

        DataTable tb = ds.Tables["Jesy"];

        Chartlet3.YLabels.UnitText = "销售额(万元)";
        Chartlet3.XLabels.UnitFont = new Font("Arial", 18, FontStyle.Bold, GraphicsUnit.Pixel);
        Chartlet3.ShowErrorInfo    = false;
        Chartlet3.InflateBottom    = 100;
        Chartlet3.AppearanceStyle  = FanG.Chartlet.AppearanceStyles.Bar_2D_StarryNight_FlatCrystal_Glow_WhiteBorder;
        Chartlet3.BindChartData(tb);

        //下面演示在绑定数据源之后,如何修改X坐标和ColorGuider的文字
        Chartlet3.GroupTitle = new string[] { "利润", "成本" };

        /** X 坐标的修改 **/
        Chartlet3.AxisX[0] = "春";
        Chartlet3.AxisX[1] = "夏";

        /*
         * 以此类推,修改每一个X坐标
         * 你也可以把一个string数组赋给AxisX,但是数组长度必须大于等于tb.Rows.Count
         *
         * 下面提供一种利用数组拷贝的方法赋值,不需要知道AxisX数组的长度
         */
        string[] xlabels = new string[] { "春", "夏", "秋", "冬" };
        xlabels.CopyTo(Chartlet3.AxisX, 0);

/*** 这里演示手动修改横坐标,纵坐标一般是数值,最多只能修改纵坐标的单位,其他暂时不支持修改 ***/
    }
예제 #8
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string           cs  = WebConfigurationManager.ConnectionStrings["Chartlet"].ConnectionString + Server.MapPath("App_data\\Chartlet.mdb");
        string           sql = "Select Season,Sales,Profit,Cost,(Sales-Profit-Cost) as S1 from Sales where user='******' order by Profit DESC";
        OleDbConnection  cn  = new OleDbConnection(cs);
        OleDbDataAdapter da  = new OleDbDataAdapter(sql, cn);
        DataSet          ds  = new DataSet();

        da.Fill(ds, "Jesy");

        string  sql2 = "select DTime,Sales,Cost from Sales order by Dtime ASC";
        DataSet ds2  = new DataSet();

        da = new OleDbDataAdapter(sql2, cn);
        da.Fill(ds2, "Jesy");

        /*选择外观基调*/
        Chartlet1.AppearanceStyle = FanG.Chartlet.AppearanceStyles.Trend_2D_Aurora_ThinRound_Glow_NoBorder;
        //调整折线连接点的大小
        Chartlet1.LineConnectionRadius = 6;
        //调整折线宽度
        Chartlet1.Stroke.Width = 2;
        //关闭投影效果
        Chartlet1.Shadow.Enable = false;
        //通过下面一句调整标题的高度
        Chartlet1.ChartTitle.OffsetY = -10;
        //下面一句是TrendChart必须要有的,是TrendChart中最重要的设置(StartTime,EndTime,TimeSpanType,XLabelDisplayFormat)
        //如果你使用TrendChart,但是缺少了这一句,那么系统会提示:Please Set Chartlet.Trend attribute for Trend Chart
        //详细介绍请参看Chartlet.Trend的参考手册
        Chartlet1.Trend = new FanG.TrendAttributes("2009-04-29", "2009-5-11", FanG.Chartlet.TimeSpanTypes.Day, "MM-dd");
        //图表标题
        Chartlet1.ChartTitle.Text = "TrendChart(趋势图)";
        //绑定数据
        Chartlet1.BindChartData(ds2);


        /******************************/
        Chartlet2.AppearanceStyle       = FanG.Chartlet.AppearanceStyles.Bar_2D_Aurora_FlatCrystal_NoGlow_NoBorder;
        Chartlet2.ColorGuider.Font      = new Font("Arial", 9, FontStyle.Italic);
        Chartlet2.ColorGuider.ForeColor = Color.Green;
        Chartlet2.ChartTitle.ForeColor  = Color.Green;
        Chartlet2.XLabels.ForeColor     = Color.Green;
        Chartlet2.YLabels.ForeColor     = Color.Green;
        Chartlet2.Tips.ForeColor        = Color.Green;
        Chartlet2.ChartTitle.Text       = "BaseLine Attribute(基准线属性)";
        Chartlet2.YLabels.ValueFormat   = "0.";
        //线面设置baseline属性,会产生一条基准线,基准线一下的数据会导致柱子负向增长
        Chartlet2.BaseLineX = 360;
        Chartlet2.BindChartData(ds);

        /*****************************/
        Chartlet3.AppearanceStyle     = FanG.Chartlet.AppearanceStyles.Line_2D_StarryNight_ThickRound_Glow_NoBorder;
        Chartlet3.Tips.Font           = new Font("Verdana", 6, FontStyle.Regular);
        Chartlet3.Tips.ForeColor      = Color.Purple;
        Chartlet3.ChartTitle.Font     = new Font("Verdana", 12, FontStyle.Regular);
        Chartlet3.YLabels.Font        = new Font("Arial", 6);
        Chartlet3.YLabels.UnitFont    = new Font("Arial", 6);
        Chartlet3.XLabels.Font        = new Font("Arial", 11);
        Chartlet3.XLabels.UnitFont    = new Font("Arial", 6);
        Chartlet3.XLabels.RotateAngle = 0;
        Chartlet3.ChartTitle.Text     = "自定义颜色、X坐标文字、ColorGuider文字";
        Chartlet3.BaseLineX           = 492;
        //使用自定义颜色数组
        //先定义一个自己的颜色数组
        Color[] myColorA = { Color.Black, Color.Blue, Color.Green };
        //在把它复制到你使用的Chartlet颜色数组中,如StarryNight
        myColorA.CopyTo(Chartlet3.StarryNight, 0);
        //折线连接符的大小
        Chartlet3.LineConnectionRadius = 8;
        Chartlet3.Stroke.Width         = 3;
        Chartlet3.BindChartData(ds);
        //自定义ColorGuider的文字,必须放在BindChartData()后面
        Chartlet3.GroupTitle = new string[] { "CG1", "CG2", "CG3", "CG4", "CG5" };
        //自定义X坐标文字,必须放在BindChartData()后面
        Chartlet3.AxisX = new string[] { "x1", "x2", "x3", "x4", "x5" };


        /****************************/
        Chartlet4.AppearanceStyle     = FanG.Chartlet.AppearanceStyles.HBar_2D_Aurora_FlatCrystal_Glow_NoBorder;
        Chartlet4.XLabels.RotateAngle = 0;
        Chartlet4.ChartTitle.Text     = "HBar-Pareto (横向柱图-柏拉图)";
        Chartlet4.Fill.TextureEnable  = true;
        Chartlet4.BindChartData(ds);
    }
예제 #9
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //请先修改Web.Config里面的数据库连接字符串的.mdb文件的路径

        /***********************************************************/
        //第一步:设置一个属性(只需要从枚举类型中选取就可以了)
        Chartlet1.AppearanceStyle = FanG.Chartlet.AppearanceStyles.Bar_2D_Aurora_FlatCrystal_Glow_NoBorder;

        //可选步骤
        //如果你要改变颜色,请取消下面一行的注释,并可以修改参数的值 0 ~ 12 (预置了12种典型颜色)
        Chartlet1.Fill.ShiftStep      = 8;
        Chartlet1.Crystal.Contraction = 0;
        Chartlet1.Shadow.Distance     = 2;
        Chartlet1.Shadow.Alpha        = 200;

        //第二步:绑定一个数据源
        Chartlet1.BindChartData(SqlDataSource1);

        //好了,运行一下看看,是不是一个很美丽的图表出现了?
        //Chartlet就这么简单
        //更多信息请参看 http://www.Chartlet.cn

        /*☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆
        *  ☆ BindChartData()方法有四个构造函数,支持常见的四种数据源(DataSet,DataTable,DataView,SqlDataSource)
        *  ☆ BindChartData(DataSet DataSource)
        *  ☆ BindChartData(DataTable DataSource)
        *  ☆ BindChartData(DataView DataSource)
        *  ☆ BindChartData(SqlDataSource DataSource)
        *  ☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆*/
        /**********************************************************/


        //========================================================//
        Chartlet2.AppearanceStyle = FanG.Chartlet.AppearanceStyles.Line_2D_StarryNight_ThickRound_Glow_NoBorder;
        Chartlet2.ChartTitle.Text = "2D Line Chart";
        //在选择了AppearanceType的基础上进行微调
        //Chartlet2.LineWidth = 2;
        Chartlet2.MaxValueY = 1000;
        Chartlet2.BindChartData(SqlDataSource1);


        Chartlet3.AppearanceStyle = FanG.Chartlet.AppearanceStyles.Line_3D_Aurora_FlatCrystalRound_NoGlow_NoBorder;
        /*************在选择了AppearanceType的基础上进行微调****************/
        Chartlet3.Fill.ShiftStep       = 7;
        Chartlet3.LineConnectionRadius = 8;
        //对于折线的颜色控制都使用StrokeColor属性(包括3D折线图)
        Chartlet3.Stroke.ShiftStep = 8;
        Chartlet3.Alpha3D          = 200;
        Chartlet2.Tips.Show        = false;
        //你可以取消注释下面一句,看看另一种效果
        //Chartlet3.Crystal.Direction = FanG.Chartlet.Direction.BottomTop;
        //************上面代码是在AppearanceType的基础上进行微调***********/
        Chartlet3.ChartTitle.Text = "3D Line Chart";
        Chartlet3.BindChartData(SqlDataSource1);


        Chartlet4.AppearanceStyle = FanG.Chartlet.AppearanceStyles.Pie_3D_Aurora_NoCrystal_NoGlow_NoBorder;
        Chartlet4.Fill.ShiftStep  = 9;
        Chartlet4.ChartTitle.Text = "3D Pie Chart";
        Chartlet4.BindChartData(SqlDataSource1);
    }