Beispiel #1
0
    private string DrawChart(DataTable dtTemp)
    {
        int zz = dtTemp.Rows.Count - 1;

        if (zz > 0)
        {
            string[] AllWeek          = new string[zz];
            string[] AllAttendanceNum = new string[zz];
            for (int i = 0; i < dtTemp.Rows.Count - 1; i++)
            {
                zz--;
                AllWeek[i]          = dtTemp.Rows[zz]["周次"].ToString();
                AllAttendanceNum[i] = dtTemp.Rows[zz]["合计"].ToString();
            }

            string strXdata = string.Empty;
            foreach (string strData in AllWeek)
            {
                strXdata += strData + "\t";
            }

            string strYdata = string.Empty;
            foreach (string strValue in AllAttendanceNum)
            {
                strYdata += strValue + "\t";
            }

            ChartSpace laySpace    = new ChartSpaceClass();
            ChChart    InsertChart = laySpace.Charts.Add(0);

            InsertChart.Type      = ChartChartTypeEnum.chChartTypeLineStacked;
            InsertChart.HasLegend = false;

            InsertChart.HasTitle              = true;
            InsertChart.Title.Caption         = dtTemp.Rows[0]["系部"] + "学生" + AllWeek[0] + "-" + AllWeek[AllWeek.Length - 1] + "周缺勤情况走势图";
            InsertChart.Axes[0].HasTitle      = true;
            InsertChart.Axes[0].Title.Caption = "周次";
            InsertChart.Axes[1].HasTitle      = true;
            InsertChart.Axes[1].Title.Caption = "缺勤人数";

            InsertChart.SeriesCollection.Add(0);

            InsertChart.SeriesCollection[0].SetData(ChartDimensionsEnum.chDimSeriesNames, (int)ChartSpecialDataSourcesEnum.chDataLiteral, "图例1");
            InsertChart.SeriesCollection[0].SetData(ChartDimensionsEnum.chDimCategories, (int)ChartSpecialDataSourcesEnum.chDataLiteral, strXdata);
            InsertChart.SeriesCollection[0].SetData(ChartDimensionsEnum.chDimValues, (int)ChartSpecialDataSourcesEnum.chDataLiteral, strYdata);

            string strAbsolutePath = (Server.MapPath(".")) + "\\ShowData.gif";
            laySpace.ExportPicture(strAbsolutePath, "GIF", 1450, 250);

            string strRelativePath = "./ShowData.gif";
            Random rd          = new Random();
            string strImageTag = "<IMG SRC='" + strRelativePath + "?id=" + rd.Next(65500) + "'/>";

            return(strImageTag);
        }
        else
        {
            return("");
        }
    }
Beispiel #2
0
  }//Page_Load()

  ///<summary>ChartPie</summary>
  public void ChartPie()
  {
   string      exceptionMessage  =  null;

   ChartSpace  chartSpace        =  null;
   ChChart     chChart           =  null;
   
   try
   {
    
    //First create a ChartSpace object to hold the chart
    chartSpace = new ChartSpaceClass();
   
    //Add a chart and provide a type
    chChart = chartSpace.Charts.Add(0);
    chChart.Type = ChartChartTypeEnum.chChartTypePie3D;

    //add chart titles and legend
    chChart.HasTitle                 =  true;
    chChart.Title.Caption            =  "Office Web Components (OWC) Pie";
    chChart.HasLegend                =  true;
    chChart.Legend.Border.DashStyle  =  OWCTypeLib.ChartLineDashStyleEnum.chLineDash;
    chChart.Legend.Position          =  OWCTypeLib.ChartLegendPositionEnum.chLegendPositionRight;
   
    //Add a series to the chart's series collection
    chChart.SeriesCollection.Add(0);
   
    //load the GraphCategory and GraphValue data
    chChart.SeriesCollection[0].SetData 
    (
     ChartDimensionsEnum.chDimCategories,
     ( int ) ChartSpecialDataSourcesEnum.chDataLiteral, 
     string.Join( ",", GraphCategory )
    );
   
    chChart.SeriesCollection[0].SetData 
    (
     ChartDimensionsEnum.chDimValues,
     ( int ) ChartSpecialDataSourcesEnum.chDataLiteral,
     string.Join( ",", Array.ConvertAll<double, string>( GraphValue, ConvertDoubleString ) )
    );

    //chartSpace.ExportPicture( FilenameImage, "gif", 500, 400 );
    
    //show the chart on the client
    Response.ContentType= "image/gif";
    Response.BinaryWrite( ( byte[] ) chartSpace.GetPicture( "gif", 500, 400 ) ); 
    Response.End();
  
   }
   catch ( Exception exception )
   {
   	exceptionMessage = exception.Message;
   }
   if ( exceptionMessage != null )
   {
   	Response.Write( exceptionMessage );
   }
  }//ChartPie()
Beispiel #3
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        string        strSeriesName = "图例1";
        string        ConnectString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
        string        Sql           = "SELECT Name,sum(AddMoney) AS Total FROM F_Money  where AddUserId='" + Session["UserId"].ToString() + "' and AddTime>='" + df.Text + "' and AddTime<='" + dt.Text + "'  GROUP BY Name";
        SqlConnection myConn        = new SqlConnection(ConnectString);

        myConn.Open();
        SqlDataAdapter Da = new SqlDataAdapter(Sql, myConn);
        DataSet        ds = new DataSet();

        Da.Fill(ds);
        string[] ProjectType  = new string[14];
        string[] ProjectTotal = new string[14];
        for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
        {
            ProjectType[i]  = ds.Tables[0].Rows[i][0].ToString();
            ProjectTotal[i] = ds.Tables[0].Rows[i][1].ToString();
        }
        string strXdata = String.Empty;

        foreach (string strData in ProjectType)
        {
            strXdata += strData + "\t";
        }
        string strYdata = String.Empty;

        foreach (string strValue in ProjectTotal)
        {
            strYdata += strValue + "\t";
        }
        ChartSpace laySpace    = new ChartSpaceClass();
        ChChart    InsertChart = laySpace.Charts.Add(0);

        InsertChart.Type                  = ChartChartTypeEnum.chChartTypeColumnClustered;
        InsertChart.HasLegend             = false;
        InsertChart.HasTitle              = true;
        InsertChart.Title.Caption         = "收支信息统计图";
        InsertChart.Axes[0].HasTitle      = true;
        InsertChart.Axes[0].Title.Caption = "";
        InsertChart.Axes[1].HasTitle      = true;

        InsertChart.Axes[1].Scaling.SplitMinimum = 0;
        InsertChart.Axes[1].Title.Caption        = "收支金额";
        InsertChart.SeriesCollection.Add(0);
        InsertChart.SeriesCollection[0].SetData(ChartDimensionsEnum.chDimSeriesNames,
                                                +(int)ChartSpecialDataSourcesEnum.chDataLiteral, strSeriesName);
        InsertChart.SeriesCollection[0].SetData(ChartDimensionsEnum.chDimCategories,
                                                +(int)ChartSpecialDataSourcesEnum.chDataLiteral, strXdata);
        InsertChart.SeriesCollection[0].SetData(ChartDimensionsEnum.chDimValues,
                                                (int)ChartSpecialDataSourcesEnum.chDataLiteral, strYdata);
        string strAbsolutePath = (Server.MapPath(".")) + "\\ShowData.gif";

        laySpace.ExportPicture(strAbsolutePath, "GIF", 600, 400);
        string strRelativePath = (Server.MapPath(".")) + "\\ShowData.gif";
        string strImageTag     = "<IMG SRC='" + strRelativePath + "?kkd=" + Guid.NewGuid().ToString() + "&dd=" + DateTime.Now.ToString() + "'/>";

        //this.PlaceHolder1.Controls.Add(new LiteralControl(strImageTag));
    }
Beispiel #4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //创建图表控件
        ChartSpace myspace = new ChartSpace();
        //添加一个图表对象
        ChChart mychart = myspace.Charts.Add(0);

        //设置图表类型为柱形
        mychart.Type = ChartChartTypeEnum.chChartTypePie;
        //设置图表的相关属性
        mychart.HasLegend     = true;     //添加图列
        mychart.HasTitle      = true;     //添加主题
        mychart.Title.Caption = "员工信息图表"; //设置主题内容
        //连接数据库
        String        str = ConfigurationManager.ConnectionStrings["connection"].ConnectionString.ToString();
        SqlConnection con = new SqlConnection(str);

        con.Open();
        String         sel  = "select jiguan,count(jiguan) as number from xx group by jiguan";
        SqlDataAdapter adsa = new SqlDataAdapter(sel, con);
        DataSet        adds = new DataSet();

        adsa.Fill(adds);
        if (adds.Tables[0].Rows.Count > 0)
        {
            string strDataName = "";
            string strData     = "";
            //添加图表块
            mychart.SeriesCollection.Add(0);
            //添加图表数据
            for (int j = 0; j < adds.Tables[0].Rows.Count; j++)
            {
                if (j == adds.Tables[0].Rows.Count - 1)
                {
                    strDataName += adds.Tables[0].Rows[j][0].ToString();
                }
                else
                {
                    strDataName += adds.Tables[0].Rows[j][0].ToString() + "\t";
                }
                strData += adds.Tables[0].Rows[j][1].ToString() + "\t";
            }
            //设置图表的属性
            mychart.SeriesCollection[0].SetData(ChartDimensionsEnum.chDimCategories, (int)ChartSpecialDataSourcesEnum.chDataLiteral, strDataName);
            mychart.SeriesCollection[0].SetData(ChartDimensionsEnum.chDimValues, (int)ChartSpecialDataSourcesEnum.chDataLiteral, strData);
            //设置百分比
            ChDataLabels labels = mychart.SeriesCollection[0].DataLabelsCollection.Add();
            labels.HasPercentage = true;
        }
        con.Close();
        myspace.ExportPicture(Server.MapPath(".") + @"\temp.jpg", "jpg", 600, 450);
    }
Beispiel #5
0
        string st1; //diqu
        private void showChart(ChartChartTypeEnum Type)
        {
            try
            {
                axChartSpace2.Clear();
                ChChart objChart = axChartSpace2.Charts.Add(0);

                objChart.Type                  = Type;
                objChart.HasLegend             = true;
                objChart.HasTitle              = true;
                objChart.Title.Caption         = "湿地预测数据";
                objChart.Axes[0].HasTitle      = true;
                objChart.Axes[0].Title.Caption = "年份";
                objChart.Axes[1].HasTitle      = true;
                objChart.Axes[1].Title.Caption = "面积";

                objChart.SeriesCollection.Add(0);
                objChart.SeriesCollection[0].SetData(ChartDimensionsEnum.chDimSeriesNames,
                                                     +(int)ChartSpecialDataSourcesEnum.chDataLiteral, st);
                //st = dataGridView1.Columns[1].HeaderText;
                objChart.SeriesCollection[0].SetData(ChartDimensionsEnum.chDimCategories,
                                                     +(int)ChartSpecialDataSourcesEnum.chDataLiteral,
                                                     dataGridView1.Rows[0].Cells[0].Value.ToString() + '\t' + dataGridView1.Rows[1].Cells[0].Value.ToString() + '\t' + dataGridView1.Rows[2].Cells[0].Value.ToString() + '\t' + dataGridView1.Rows[3].Cells[0].Value.ToString() + '\t' + dataGridView1.Rows[4].Cells[0].Value.ToString() + '\t' + dataGridView1.Rows[5].Cells[0].Value.ToString() + '\t' + dataGridView1.Rows[6].Cells[0].Value.ToString() + '\t' + dataGridView1.Rows[7].Cells[0].Value.ToString() + '\t' + dataGridView1.Rows[8].Cells[0].Value.ToString() + '\t' + dataGridView1.Rows[9].Cells[0].Value.ToString() + '\t' + dataGridView1.Rows[10].Cells[0].Value.ToString() + '\t');
                Random r   = new Random(DateTime.Now.Second);
                string w1  = dataGridView1.Rows[0].Cells[1].Value.ToString();
                string w2  = dataGridView1.Rows[1].Cells[1].Value.ToString();
                string w3  = dataGridView1.Rows[2].Cells[1].Value.ToString();
                string w4  = dataGridView1.Rows[3].Cells[1].Value.ToString();
                string w5  = dataGridView1.Rows[4].Cells[1].Value.ToString();
                string w6  = dataGridView1.Rows[5].Cells[1].Value.ToString();
                string w7  = dataGridView1.Rows[6].Cells[1].Value.ToString();
                string w8  = dataGridView1.Rows[7].Cells[1].Value.ToString();
                string w9  = dataGridView1.Rows[8].Cells[1].Value.ToString();
                string w10 = dataGridView1.Rows[9].Cells[1].Value.ToString();
                string w11 = dataGridView1.Rows[10].Cells[1].Value.ToString();
                objChart.SeriesCollection[0].SetData(ChartDimensionsEnum.chDimValues,
                                                     (int)ChartSpecialDataSourcesEnum.chDataLiteral,
                                                     w1 + '\t' + w2 + '\t' + w3 + '\t' + w4 + '\t' + w5 + '\t' + w6 + '\t' + w7 + '\t' + w8 + '\t' + w9 + '\t' + w10 + '\t' + w11 + '\t');
            }
            catch (Exception ex)
            {
                timer1.Enabled = false;
                MessageBox.Show(ex.Message);
            }
            finally
            {
                _Type = Type;
            }
        }
Beispiel #6
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //创建ChartSpace对象来放置图表
        ChartSpace laySpace = new ChartSpace();
        //在ChartSpace对象中添加图表
        ChChart InsertChart = laySpace.Charts.Add(0);

        //指定绘制图表类型
        InsertChart.Type = ChartChartTypeEnum.chChartTypeLine;//折线图
        //指定图表是否需要图例标注
        InsertChart.HasLegend     = false;
        InsertChart.HasTitle      = true;//为图表添加标题
        InsertChart.Title.Caption = "员工信息表";
        //为x,y轴添加图示说明
        InsertChart.Axes[0].HasTitle      = true;
        InsertChart.Axes[0].Title.Caption = "籍贯";
        InsertChart.Axes[1].HasTitle      = true;
        InsertChart.Axes[1].Title.Caption = "人数";
        //连接数据库
        String        str = ConfigurationManager.ConnectionStrings["connection"].ConnectionString.ToString();
        SqlConnection con = new SqlConnection(str);

        con.Open();
        String         sel  = "select jiguan,count(jiguan) as number from xx group by jiguan";
        SqlDataAdapter adsa = new SqlDataAdapter(sel, con);
        DataSet        adds = new DataSet();

        adsa.Fill(adds);
        //为x,y轴指定特定字符串,以便显示数据
        string strXdata = String.Empty;
        string strYdata = String.Empty;

        if (adds.Tables[0].Rows.Count > 0)
        {
            for (int i = 0; i < adds.Tables[0].Rows.Count; i++)
            {
                strXdata = strXdata + adds.Tables[0].Rows[i][0].ToString() + "\t";
                strYdata = strYdata + adds.Tables[0].Rows[i][1].ToString() + "\t";
            }
        }
        //添加图表块
        InsertChart.SeriesCollection.Add(0);
        //设置图表的属性
        InsertChart.SeriesCollection[0].SetData(ChartDimensionsEnum.chDimCategories, (int)ChartSpecialDataSourcesEnum.chDataLiteral, strXdata);
        InsertChart.SeriesCollection[0].SetData(ChartDimensionsEnum.chDimValues, (int)ChartSpecialDataSourcesEnum.chDataLiteral, strYdata);
        con.Close();
        laySpace.ExportPicture(Server.MapPath(".") + @"\temp.jpg", "jpg", 600, 450);
    }
Beispiel #7
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //创建图表控件
        ChartSpace myspace = new ChartSpace();
        //添加一个图表对象
        ChChart mychart = myspace.Charts.Add(0);

        //设置图表类型为柱形
        mychart.Type = ChartChartTypeEnum.chChartTypeColumnClustered;
        //设置图表的相关属性
        mychart.HasLegend     = true;     //添加图列
        mychart.HasTitle      = true;     //添加主题
        mychart.Title.Caption = "员工信息图表"; //设置主题内容
        //设置x,y轴
        mychart.Axes[0].HasTitle      = true;
        mychart.Axes[0].Title.Caption = "籍贯";
        mychart.Axes[1].HasTitle      = true;
        mychart.Axes[1].Title.Caption = "人数";
        //连接数据库
        String        str = ConfigurationManager.ConnectionStrings["connection"].ConnectionString.ToString();
        SqlConnection con = new SqlConnection(str);

        con.Open();
        String         sel  = "select jiguan,count(jiguan) as number from xx group by jiguan";
        SqlDataAdapter adsa = new SqlDataAdapter(sel, con);
        DataSet        adds = new DataSet();

        adsa.Fill(adds);
        if (adds.Tables[0].Rows.Count > 0)
        {
            //添加图表块
            for (int i = 0; i < adds.Tables[0].Rows.Count; i++)
            {
                mychart.SeriesCollection.Add(0);
            }
            for (int j = 0; j < adds.Tables[0].Rows.Count; j++)
            {
                //设置图表的属性
                mychart.SeriesCollection[j].Caption = adds.Tables[0].Rows[j][0].ToString();
                mychart.SeriesCollection[j].SetData(ChartDimensionsEnum.chDimCategories, (int)ChartSpecialDataSourcesEnum.chDataLiteral, adds.Tables[0].Rows[j][0].ToString());
                mychart.SeriesCollection[j].SetData(ChartDimensionsEnum.chDimValues, (int)ChartSpecialDataSourcesEnum.chDataLiteral, Convert.ToInt32(adds.Tables[0].Rows[j][1].ToString()));
            }
        }
        con.Close();
        myspace.ExportPicture(Server.MapPath(".") + @"\temp.jpg", "jpg", 600, 450);
    }
    protected string DrawChart(string DrawType, string[] AllDepartment, string[] AllDataRote, string Range)
    {
        string strXdata = string.Empty;

        for (int i = 0; i < AllDepartment.Length; i++)
        {
            strXdata += AllDepartment[i] + "\r" + DrawType + AllDataRote[i] + "\t";
        }
        string strYdata = string.Empty;

        foreach (string strValue in AllDataRote)
        {
            strYdata += strValue + "\t";
        }

        ChartSpace laySpace    = new ChartSpace();
        ChChart    InsertChart = laySpace.Charts.Add(0);

        InsertChart.Type      = ChartChartTypeEnum.chChartTypeColumnClustered;
        InsertChart.HasLegend = false;

        InsertChart.HasTitle      = true;
        InsertChart.Title.Caption = "第" + Range + "周各系部学生【" + DrawType + "】对比图";

        InsertChart.Axes[0].HasTitle      = true;
        InsertChart.Axes[0].Title.Caption = "系部";
        InsertChart.Axes[1].HasTitle      = true;
        InsertChart.Axes[1].Title.Caption = DrawType;

        InsertChart.SeriesCollection.Add(0);
        InsertChart.SeriesCollection[0].SetData(ChartDimensionsEnum.chDimSeriesNames, (int)ChartSpecialDataSourcesEnum.chDataLiteral, "图例1");
        InsertChart.SeriesCollection[0].SetData(ChartDimensionsEnum.chDimCategories, (int)ChartSpecialDataSourcesEnum.chDataLiteral, strXdata);
        InsertChart.SeriesCollection[0].SetData(ChartDimensionsEnum.chDimValues, (int)ChartSpecialDataSourcesEnum.chDataLiteral, strYdata);

        string strAbsolutePath = (Server.MapPath(".")) + "\\" + DrawType + ".gif";

        laySpace.ExportPicture(strAbsolutePath, "GIF", 1730, 400);

        string strRelativePath = "./" + DrawType + ".gif";
        Random rd          = new Random();
        string strImageTag = "<IMG SRC='" + strRelativePath + "?id=" + rd.Next(65500) + "'>";
        string url         = "DepartmentEachCompare.aspx?ImageUrl=" + strImageTag;

        return(strImageTag);
    }
        private void MakeLineChart(DataTable mDataTable)//string[] DataName,string[] Data,string[] Data1, string[] Data2)
        {
            string strValue1 = "";

            string strValue = "";

            string strValue2 = "";

            string strCateory = "";

            //循环取得数据并格式化为OWC10需要的格式,(加'\t')
            foreach (DataRow mRow in mDataTable.Rows)
            {
                strCateory += mRow[0].ToString() + '\t';
                strValue   += mRow[1].ToString() + '\t';
                strValue1  += mRow[2].ToString() + '\t';
            }



            ChartSpace mySpace = new ChartSpace();
            ChChart    myChart = mySpace.Charts.Add(0);

            myChart.Type = ChartChartTypeEnum.chChartTypeColumnClustered;

            myChart.HasLegend = true;
            myChart.HasTitle  = true;
            if (cbDate.Checked == true)
            {
                myChart.Title.Caption = dtpStart.Value.ToString("yyyy年MM月dd日--") + dtpEnd.Value.ToString("yyyy年MM月dd日") + cmbCompareType.Text + "交易曲线图";
            }
            else
            {
                myChart.Title.Caption = "交易曲线图";
            }


            myChart.Axes[0].HasTitle      = true;
            myChart.Axes[0].Title.Caption = mDataTable.Columns[0].Caption;
            myChart.Axes[1].HasTitle      = true;
            myChart.Axes[1].Title.Caption = "总额";


            myChart.SeriesCollection.Add(0);
            //myChart.
            myChart.SeriesCollection[0].SetData(ChartDimensionsEnum.chDimSeriesNames, (int)ChartSpecialDataSourcesEnum.chDataLiteral, mDataTable.Columns[1].Caption);
            myChart.SeriesCollection[0].SetData(ChartDimensionsEnum.chDimCategories, (int)ChartSpecialDataSourcesEnum.chDataLiteral, strCateory);
            ChDataLabels myLabels1 = myChart.SeriesCollection[0].DataLabelsCollection.Add();

            myLabels1.NumberFormat = "0.00";
            myLabels1.HasValue     = true;

            myChart.SeriesCollection[0].SetData(ChartDimensionsEnum.chDimValues, (int)ChartSpecialDataSourcesEnum.chDataLiteral, strValue);
            if (strValue1 != "")
            {
                myChart.SeriesCollection.Add(1);
                myChart.SeriesCollection[1].SetData(ChartDimensionsEnum.chDimSeriesNames, (int)ChartSpecialDataSourcesEnum.chDataLiteral, mDataTable.Columns[2].Caption);
                myChart.SeriesCollection[1].SetData(ChartDimensionsEnum.chDimValues, (int)ChartSpecialDataSourcesEnum.chDataLiteral, strValue1);
                ChDataLabels myLabels2 = myChart.SeriesCollection[1].DataLabelsCollection.Add();
                myLabels2.NumberFormat = "0.00";
                myLabels2.HasValue     = true;
            }
            //if (strValue2 !="")
            //{
            //    myChart.SeriesCollection.Add(2);
            //    myChart.SeriesCollection[2].SetData(ChartDimensionsEnum.chDimValues, (int)ChartSpecialDataSourcesEnum.chDataLiteral, strValue2);
            //    ChDataLabels myLabels3 = myChart.SeriesCollection[2].DataLabelsCollection.Add();
            //    myLabels3.NumberFormat = "0.00";
            //    myLabels3.HasValue = true;
            //}
            //if (pictureBox1.Image != null)
            //{
            //    pictureBox1.Image.Dispose();
            //}
            string mPath = Application.StartupPath + @"temp.gif"; //临时图片保存地址

            System.IO.File.Delete(mPath);
            mySpace.ExportPicture(mPath, "GIF", pictureBox1.Width, pictureBox1.Height);

            //Image image = Image.FromFile(@"C:\temp.gif");

            //Image image1 = (Image)image.Clone();
            //image.Dispose();
            FileStream mFs = File.OpenRead(mPath);

            pictureBox1.Image = Image.FromStream(mFs);
            mFs.Close();
            //pictureBox1.Size = image.Size;
            //pictureBox1.Visible = true;
        }
Beispiel #10
0
        private void button1_Click(object sender, EventArgs e)
        {
            string str  = "1999-01-01";
            string str2 = str;
            string str3 = "";

            OleDbBase.DB    db     = new OleDbBase.DB();
            OleDbDataReader reader = db.Read("select PutDateTime,TW from TW where PutDateTime>= #" + this.dtp1.Value.ToShortDateString() + " 00:00:00# and PutDateTime<= #" + this.dtp2.Value.ToShortDateString() + " 23:59:59# and UserName='******' order by PutDateTime");

            while (reader.Read())
            {
                str2 = DateTime.Parse(reader[0].ToString()).ToString("yyyy-MM-dd");
                if (str != str2)
                {
                    str3 = str3 + ",";
                    str  = str2;
                }
                str3 = str3 + reader[1].ToString() + "\t";
            }
            reader.Close();
            ChartSpace space = new ChartSpaceClass();

            ChChart chart = space.Charts.Add(0);
            string  str6  = "6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24";

            str6 = str6.Replace(" ", "时\t");
            string[] strArray = str3.Split(',');

            switch (cboStyle.Text)
            {
            case "chChartTypeSmoothLine":
                chart.Type = ChartChartTypeEnum.chChartTypeSmoothLine;
                break;

            case "chChartTypeColumnClustered3D":
                chart.Type = ChartChartTypeEnum.chChartTypeColumnClustered3D;
                break;

            default:
                chart.Type = ChartChartTypeEnum.chChartTypeLine;
                break;
            }
            //chart.Type = ChartChartTypeEnum.chChartTypeSmoothLine;
            chart.HasTitle      = true;
            chart.Title.Caption = "体温变化曲线";

            //给定x,y轴图示说明
            chart.Axes[0].HasTitle      = true;
            chart.Axes[0].Title.Caption = "测试时间";

            chart.Axes[1].HasTitle      = true;
            chart.Axes[1].Title.Caption = "体温";

            chart.SetData(ChartDimensionsEnum.chDimCategories, (int)ChartSpecialDataSourcesEnum.chDataLiteral, str6);
            for (int i = 1; i < strArray.Length; i++)
            {
                chart.SeriesCollection.Add(i).SetData(ChartDimensionsEnum.chDimValues, (int)ChartSpecialDataSourcesEnum.chDataLiteral, strArray[i]);
            }
            space.ExportPicture("OK.gif", "gif", 760, 500);
            this.pictureBox1.ImageLocation = "OK.gif";
        }
        private void MakeLineChart(DataTable mDataTable)//string[] DataName,string[] Data,string[] Data1, string[] Data2)
        {
            //Y坐标轴

            //string[] DataName = { "星期一", "星期二", "星期三", "星期四", "星期五", "星期六", "星期日" };
            //string[] DataName = { "一", "二", "三", "四", "五", "六", "日" };
            //第一条曲线的数据

            //int[] Data = { 0, 10, 20, 100, 40, 50, 60 };

            //第二条曲线的数据

            //int[] Data1 = { 100, 50, 41, 86 };

            //第三条曲线的数据

            // int[] Data2 = { 10, 50, 100, 30, 50, 60, 200 };

            string strValue1 = "";

            string strValue = "";

            string strValue2 = "";

            string strCateory = "";

            //循环取得数据并格式化为OWC10需要的格式,(加'\t')
            foreach (DataRow mRow in mDataTable.Rows)
            {
                strCateory += mRow[0].ToString() + '\t';
                strValue   += mRow[1].ToString() + '\t';
                strValue1  += mRow[2].ToString() + '\t';
            }



            //for (int i = 0; i < DataName.Length; i++)
            //{

            //    strCateory += DataName[i] + '\t';

            //}


            //for (int i = 0; i < Data.Length; i++)
            //{

            //    strValue += Data[i] + '\t';

            //}

            //for (int i = 0; i < Data1.Length; i++)
            //{

            //    strValue1 += Data1[i] + '\t';

            //}

            //for (int i = 0; i < Data2.Length; i++)
            //{

            //    strValue2 += Data2[i] + '\t';

            //}


            ChartSpace mySpace = new ChartSpace();
            ChChart    myChart = mySpace.Charts.Add(0);

            myChart.Type = ChartChartTypeEnum.chChartTypeColumnClustered;

            myChart.HasLegend     = true;
            myChart.HasTitle      = true;
            myChart.Title.Caption = "交易曲线图";

            myChart.Axes[0].HasTitle      = true;
            myChart.Axes[0].Title.Caption = mDataTable.Columns[0].Caption;
            myChart.Axes[1].HasTitle      = true;
            myChart.Axes[1].Title.Caption = "总额";


            myChart.SeriesCollection.Add(0);
            //myChart.
            myChart.SeriesCollection[0].SetData(ChartDimensionsEnum.chDimSeriesNames, (int)ChartSpecialDataSourcesEnum.chDataLiteral, mDataTable.Columns[1].Caption);
            myChart.SeriesCollection[0].SetData(ChartDimensionsEnum.chDimCategories, (int)ChartSpecialDataSourcesEnum.chDataLiteral, strCateory);
            ChDataLabels myLabels1 = myChart.SeriesCollection[0].DataLabelsCollection.Add();

            myLabels1.NumberFormat = "0.00";
            myLabels1.HasValue     = true;

            myChart.SeriesCollection[0].SetData(ChartDimensionsEnum.chDimValues, (int)ChartSpecialDataSourcesEnum.chDataLiteral, strValue);
            if (strValue1 != "")
            {
                myChart.SeriesCollection.Add(1);
                myChart.SeriesCollection[1].SetData(ChartDimensionsEnum.chDimSeriesNames, (int)ChartSpecialDataSourcesEnum.chDataLiteral, mDataTable.Columns[2].Caption);
                myChart.SeriesCollection[1].SetData(ChartDimensionsEnum.chDimValues, (int)ChartSpecialDataSourcesEnum.chDataLiteral, strValue1);
                ChDataLabels myLabels2 = myChart.SeriesCollection[1].DataLabelsCollection.Add();
                myLabels2.NumberFormat = "0.00";
                myLabels2.HasValue     = true;
            }
            //if (strValue2 !="")
            //{
            //    myChart.SeriesCollection.Add(2);
            //    myChart.SeriesCollection[2].SetData(ChartDimensionsEnum.chDimValues, (int)ChartSpecialDataSourcesEnum.chDataLiteral, strValue2);
            //    ChDataLabels myLabels3 = myChart.SeriesCollection[2].DataLabelsCollection.Add();
            //    myLabels3.NumberFormat = "0.00";
            //    myLabels3.HasValue = true;
            //}

            System.IO.File.Delete(@"C:\temp.gif");
            mySpace.ExportPicture(@"C:\temp.gif", "GIF", this.Width, this.Height);

            Image image = Image.FromFile(@"C:\temp.gif");

            pictureBox1.Image   = image;
            pictureBox1.Size    = image.Size;
            pictureBox1.Visible = true;
        }
Beispiel #12
0
        public string PieChart(Pie pie, Page page)
        {
            //创建X坐标的值
            string[] str = pie.DataNames;

            //创建Y坐标的值,表示销售额
            double[] count       = pie.DataValues;
            string   strDataName = "";
            string   strData     = "";

            //创建图表空间
            ChartSpace mychartSpace = new ChartSpace();

            mychartSpace.Border.Color = pie.ChartBorderColor;

            //在图表空间内添加一个图表对象
            ChChart mychart = mychartSpace.Charts.Add(0);

            //设置每块饼的数据
            for (int i = 0; i < count.Length; i++)
            {
                strDataName += str[i].ToString() + "\t";
                strData     += count[i].ToString() + "\t";
            }
            strDataName = strDataName.Substring(0, strDataName.Length - 1);
            strData     = strData.Substring(0, strData.Length - 1);

            //设置图表类型,本例使用饼
            switch (pie.PicChartType)
            {
            case PieType.Pie:
                mychart.Type = ChartChartTypeEnum.chChartTypePie;
                break;

            case PieType.Pie3D:
                mychart.Type = ChartChartTypeEnum.chChartTypePie3D;
                break;

            case PieType.Exploded:
                mychart.Type = ChartChartTypeEnum.chChartTypePieExploded;
                break;

            case PieType.Exploded3D:
                mychart.Type = ChartChartTypeEnum.chChartTypePieExploded3D;
                break;

            default:
                mychart.Type = ChartChartTypeEnum.chChartTypePie;
                break;
            }


            //设置图表的一些属性
            //是否需要图例
            mychart.HasLegend = true;
            //是否需要主题
            mychart.HasTitle = true;


            //主题内容
            mychart.Title.Caption    = pie.ChartTitle;
            mychart.Title.Font.Size  = pie.ChartTitleSize;
            mychart.Title.Font.Bold  = pie.ChartTitleBold;
            mychart.Title.Font.Color = pie.ChartTitleColor;
            switch (pie.LegendPosition)
            {
            case LegendPosition.Top:
                mychart.Legend.Position = ChartLegendPositionEnum.chLegendPositionTop;
                break;

            case LegendPosition.Bottom:
                mychart.Legend.Position = ChartLegendPositionEnum.chLegendPositionBottom;
                break;

            case LegendPosition.Left:
                mychart.Legend.Position = ChartLegendPositionEnum.chLegendPositionLeft;
                break;

            case LegendPosition.Right:
                mychart.Legend.Position = ChartLegendPositionEnum.chLegendPositionRight;
                break;

            default:
                mychart.Legend.Position = ChartLegendPositionEnum.chLegendPositionRight;
                break;
            }



            mychart.Legend.Interior.Color = pie.LegendBgColor;
            mychart.Legend.Font.Bold      = pie.LegenFontBold;
            mychart.Legend.Font.Size      = pie.LegendFontSize;
            mychart.Legend.Border.Color   = pie.LegendBorderColor;



            //添加图表块
            mychart.SeriesCollection.Add(0);
            //设置图表块的属性
            //分类属性
            mychart.SeriesCollection[0].SetData(ChartDimensionsEnum.chDimCategories,
                                                (int)ChartSpecialDataSourcesEnum.chDataLiteral, strDataName);
            //mychart.SeriesCollection[0].Interior.Color = "#C1DBEE";
            //mychart.SeriesCollection[1].Interior.Color = "#D1A00B";


            //值属性
            mychart.SeriesCollection[0].SetData(ChartDimensionsEnum.chDimValues,
                                                (int)ChartSpecialDataSourcesEnum.chDataLiteral, strData);
            for (int j = 0; j < mychart.SeriesCollection[0].Points.Count; j++)
            {
                mychart.SeriesCollection[0].Points[j].Border.Color = pie.SeriesCollectionBorderColor;
                if (pie.DataColor != null)
                {
                    mychart.SeriesCollection[0].Points[j].Interior.Color = pie.DataColor[j].ToString();
                }
            }

            //显示百分比
            ChDataLabels mytb = mychart.SeriesCollection[0].DataLabelsCollection.Add();

            mytb.HasPercentage = pie.HasPercentage;
            mytb.Font.Color    = pie.DataFontColor;
            mytb.Font.Size     = pie.DataFontSize;
            mytb.HasValue      = true;
            //生成图片
            //劉宏哲修改,先删除文件再创建文件。解决第一次生成图片以后,再次生成报错。时间:2010-04-21 9:44。
            string path = page.MapPath(".") + @"\" + pie.PicName + ".gif";

            if (File.Exists(path))
            {
                File.Delete(path);
            }
            mychartSpace.ExportPicture(path, "gif", pie.ChartWidth, pie.ChartHeight);

            //返回图片路径
            return(pie.PicName + ".gif" + "?temp=" + System.DateTime.Now.Ticks.ToString() + "");
        }
Beispiel #13
0
        public string ColumnChart(Column column, Page page)
        {
            //创建图表空间
            ChartSpace mychartSpace = new ChartSpace();

            //在图表空间内添加一个图表对象
            ChChart mychart = mychartSpace.Charts.Add(0);

            mychartSpace.Border.Color = column.ChartBorderColor;
            //设置图表类型,本例使用柱形
            mychart.Type = ChartChartTypeEnum.chChartTypeColumnClustered;
            //设置图表的一些属性
            //是否需要图例
            mychart.HasLegend = true;
            //是否需要主题
            mychart.HasTitle = true;
            //主题内容
            mychart.Title.Caption   = column.ChartTitle;
            mychart.Title.Font.Size = column.ChartTitleSize;
            mychart.Title.Font.Bold = column.ChartTitleBold;

            switch (column.LegendPosition)
            {
            case LegendPosition.Top:
                mychart.Legend.Position = ChartLegendPositionEnum.chLegendPositionTop;
                break;

            case LegendPosition.Bottom:
                mychart.Legend.Position = ChartLegendPositionEnum.chLegendPositionBottom;
                break;

            case LegendPosition.Left:
                mychart.Legend.Position = ChartLegendPositionEnum.chLegendPositionLeft;
                break;

            case LegendPosition.Right:
                mychart.Legend.Position = ChartLegendPositionEnum.chLegendPositionRight;
                break;

            default:
                mychart.Legend.Position = ChartLegendPositionEnum.chLegendPositionRight;
                break;
            }
            mychart.Legend.Interior.Color = column.LegendBgColor;
            mychart.Legend.Font.Size      = column.LegendFontSize;
            mychart.Legend.Border.Color   = column.LegendBorderColor;


            //设置x,y坐标

            mychart.Axes[1].HasTitle        = column.ShowYAxes;
            mychart.Axes[1].Title.Caption   = column.YAxesCaption;
            mychart.Axes[1].Title.Font.Size = 10;

            mychart.Axes[0].HasTitle      = column.ShowXAxes;
            mychart.Axes[0].Title.Caption = column.XAxesCaption;
            mychart.Axes[0].Font.Name     = "宋体";
            mychart.Axes[0].Font.Size     = 10;

            string seriesName = "";
            string strValue   = "";
            string category   = "";

            for (int i = 0; i < column.SeriesNames.Length; i++)
            {
                seriesName = column.SeriesNames[i];
                strValue   = "";
                category   = "";
                for (int j = 0; j < column.Values[i].Length; j++)
                {
                    strValue += column.Values[i][j].ToString() + "\t";
                }

                for (int j = 0; j < column.Categorys.Length; j++)
                {
                    category += column.Categorys[j] + "\t";
                }
                mychart.SeriesCollection.Add(i);
                mychart.SeriesCollection[i].SetData(ChartDimensionsEnum.chDimSeriesNames, (int)ChartSpecialDataSourcesEnum.chDataLiteral, seriesName);
                mychart.SeriesCollection[i].SetData(ChartDimensionsEnum.chDimCategories, (int)ChartSpecialDataSourcesEnum.chDataLiteral, category);
                mychart.SeriesCollection[i].SetData(ChartDimensionsEnum.chDimValues, (int)ChartSpecialDataSourcesEnum.chDataLiteral, strValue);
                mychart.SeriesCollection[i].DataLabelsCollection.Add();
                mychart.SeriesCollection[i].DataLabelsCollection[0].HasValue = true;
                //mychart.SeriesCollection.Add(1);

                //if (column.DataColor != null)
                //{
                //    mychart.SeriesCollection[i].Points[0].Interior.Color = column.DataColor[i].ToString();
                //}
            }

            //生成图片
            //劉宏哲修改,先删除文件再创建文件。解决第一次生成图片以后,再次生成报错。时间:2010-04-21 9:44。

            string path = page.MapPath(".") + @"\" + column.PicName + ".gif";

            if (File.Exists(path))
            {
                File.Delete(path);
            }
            mychartSpace.ExportPicture(path, "gif", column.ChartWidth, column.ChartHeight);

            //返回图片路径
            return(column.PicName + ".gif" + "?temp=" + System.DateTime.Now.Ticks.ToString() + "");
        }
Beispiel #14
0
        public void SimulateMarket()
        {
            try
            {
                AxChartSpace chartSpace = this.axChartSpace;

                // It is possible for this foreground thread to be called after the thread has been terminated.  This will prevent
                // the COM control from being accessed during a shutdown sequence.  Also, if there is nothing to display there's no
                // need to continue trying to paint the chart.
                if (!this.isTickerRunning || chartSpace.Charts.Count == 0)
                {
                    return;
                }

                ChChart chartMain = chartSpace.Charts[0];

                int side = random.Next(0, 3);
                if (side == 0)
                {
                    int range = this.market.Bid.Rows.Count;
                    if (range == 0)
                    {
                        return;
                    }

                    int           bidIndex = random.Next(0, range - 1);
                    Market.BidRow bidRow   = this.market.Bid[bidIndex];

                    int down = random.Next(0, 2);
                    if (down == 0)
                    {
                        int    largeBlock = random.Next(0, 3);
                        double quantity   = Convert.ToDouble(random.Next(1, largeBlock == 0 ? 20 : 5) * 100);
                        bidRow.Quantity -= quantity;
                        if (bidRow.Quantity <= 0.0)
                        {
                            bidRow.Quantity = 0.0;
                        }
                    }
                    else
                    {
                        int    largeBlock = random.Next(0, 3);
                        double quantity   = Convert.ToDouble(random.Next(1, largeBlock == 0 ? 20 : 5) * 100);
                        bidRow.Quantity += quantity;
                    }

                    bidRow.AcceptChanges();
                }
                else
                {
                    if (side == 1)
                    {
                        int range = this.market.Ask.Rows.Count;
                        if (range == 0)
                        {
                            return;
                        }

                        int           askIndex = random.Next(0, range - 1);
                        Market.AskRow askRow   = this.market.Ask[askIndex];

                        int down = random.Next(0, 2);
                        if (down == 0)
                        {
                            int    largeBlock = random.Next(0, 3);
                            double quantity   = Convert.ToDouble(random.Next(1, largeBlock == 0 ? 20 : 5) * 100);
                            askRow.Quantity -= quantity;
                            if (askRow.Quantity <= 0.0)
                            {
                                askRow.Quantity = 0.0;
                            }
                        }
                        else
                        {
                            int    largeBlock = random.Next(0, 3);
                            double quantity   = Convert.ToDouble(random.Next(1, largeBlock == 0 ? 20 : 5) * 100);
                            askRow.Quantity += quantity;
                        }

                        askRow.AcceptChanges();
                    }
                    else
                    {
                        int    largeBlock = random.Next(0, 3);
                        int    direction  = random.Next(0, 3);
                        double newPrice   = this.lastPrice + (direction == 0 ? -0.01 : direction == 1 ? 0.0 : 0.01);

                        Market.BidRow highestBid = null;
                        foreach (Market.BidRow bidLoop in market.Bid)
                        {
                            if (highestBid == null || bidLoop.Price > highestBid.Price)
                            {
                                highestBid = bidLoop;
                            }
                        }

                        Market.AskRow lowestAsk = null;
                        foreach (Market.AskRow askLoop in market.Ask)
                        {
                            if (lowestAsk == null || askLoop.Price < lowestAsk.Price)
                            {
                                lowestAsk = askLoop;
                            }
                        }

                        if (newPrice < highestBid.Price || lowestAsk.Price < newPrice)
                        {
                            return;
                        }

                        this.lastPrice    = newPrice;
                        this.lastQuantity = Convert.ToDouble(random.Next(1, largeBlock == 0 ? 20 : 5) * 100);
                    }
                }

                Series   series   = GenerateSeries();
                ChSeries chSeries = chartMain.SeriesCollection[0];
                chSeries.SetData(ChartDimensionsEnum.chDimValues, (int)ChartSpecialDataSourcesEnum.chDataLiteral, series.values);
                chSeries.SetData(ChartDimensionsEnum.chDimFormatValues, (int)ChartSpecialDataSourcesEnum.chDataLiteral, series.format);
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception.Message);
            }
        }
Beispiel #15
0
        public void DisplayForeground(string securityName, decimal startingPrice)
        {
            lock (this)
            {
                try
                {
                    lastPrice    = 0.0;
                    lastQuantity = 0.0;
                    steps        = 17;
                    lowRange     = Convert.ToDouble(startingPrice - startingPrice * 0.01M);
                    highRange    = Convert.ToDouble(startingPrice + startingPrice * 0.01M);
                    stepSize     = (highRange - lowRange) / steps;

                    // Initialize the market
                    InitializeMarket(Convert.ToDouble(startingPrice) + stepSize * 2.0);

                    // Calculate a random price movement and go back in time building the history for this security.  The
                    // price movement will be anywhere between nothing and 10 cents.
                    int    direction   = random.Next(0, 1);
                    double priceChange = Math.Round(random.NextDouble() * direction == 0 ? -0.05 : 0.05, 2);

                    double[] priceHistory = new Double[4];
                    priceHistory[0] = Convert.ToDouble(startingPrice) + (-priceChange * 2);
                    priceHistory[1] = priceHistory[0] + priceChange;
                    priceHistory[2] = priceHistory[1] + priceChange;
                    priceHistory[3] = priceHistory[2] + priceChange;

                    series    = new Series[4];
                    series[0] = GenerateSeries();
                    this.MoveMarket(priceHistory[1]);
                    series[1] = GenerateSeries();
                    this.MoveMarket(priceHistory[2]);
                    series[2] = GenerateSeries();
                    this.MoveMarket(priceHistory[3]);
                    series[3] = GenerateSeries();

                    object[] categories = new object[steps];
                    for (int step = 0; step < steps; step++)
                    {
                        categories[step] = Convert.ToDouble(Math.Round(lowRange + step * stepSize, 2));
                    }

                    double maxQuantity = 0.0;
                    for (int seriesIndex = 0; seriesIndex < 4; seriesIndex++)
                    {
                        for (int step = 0; step < steps; step++)
                        {
                            if (Convert.ToDouble(series[seriesIndex].values[step]) > maxQuantity)
                            {
                                maxQuantity = Convert.ToDouble(series[seriesIndex].values[step]);
                            }
                        }
                    }

                    // Clear the contents of the chart workspace. This removes
                    // any old charts that may already exist and leaves the chart workspace
                    // completely empty. One chart object is then added.
                    AxChartSpace chartSpace = this.axChartSpace;
                    chartSpace.Clear();
                    ChChart chartMain = chartSpace.Charts.Add(0);
                    chartMain.Type = ChartChartTypeEnum.chChartTypeColumn3D;
                    chartMain.PlotArea.BackWall.Interior.SetTextured(ChartPresetTextureEnum.chTextureWhiteMarble, ChartTextureFormatEnum.chTile, 0.0, ChartTexturePlacementEnum.chAllFaces);
                    chartMain.PlotArea.SideWall.Interior.SetTextured(ChartPresetTextureEnum.chTextureWhiteMarble, ChartTextureFormatEnum.chTile, 0.0, ChartTexturePlacementEnum.chAllFaces);
                    chartMain.PlotArea.Floor.Interior.SetTextured(ChartPresetTextureEnum.chTextureWhiteMarble, ChartTextureFormatEnum.chTile, 0.0, ChartTexturePlacementEnum.chAllFaces);
                    chartMain.Overlap        = 100;
                    chartMain.ChartDepth     = 50;
                    chartMain.GapWidth       = 50;
                    chartMain.Perspective    = 0;
                    chartMain.ProjectionMode = ChartProjectionModeEnum.chProjectionModePerspective;
                    chartMain.Inclination    = 30.0;
                    chartMain.DirectionalLightInclination = 10.0;
                    chartMain.DirectionalLightRotation    = 60.0;
                    chartMain.DirectionalLightIntensity   = 0.5;
                    chartMain.Rotation        = 330.0;
                    chartMain.HasTitle        = true;
                    chartMain.Title.Caption   = securityName;
                    chartMain.Title.Font.Bold = true;
                    chartMain.Title.Font.Name = "Ariel";
                    chartMain.Title.Font.Size = 12;

                    chartMain.Axes[0].Scaling.Minimum = 1.0;
                    chartMain.Axes[0].Scaling.Maximum = 17.0;
                    chartMain.Axes[1].Scaling.Minimum = 0.0;
                    chartMain.Axes[1].Scaling.Maximum = maxQuantity;
                    chartMain.Axes[1].NumberFormat    = "#0.00";

                    DateTime currentTime = DateTime.Now;

                    // Bid Series
                    ChSeries chSeries0 = chartMain.SeriesCollection.Add(0);
                    chSeries0.Caption = (currentTime - new TimeSpan(0, 15, 0)).ToString("hh:mm");
                    chSeries0.Interior.SetSolid(ChRGB.Get(Color.Transparent));
                    chSeries0.Border.Color = ChRGB.Get(Color.Transparent);
                    chSeries0.SetData(ChartDimensionsEnum.chDimCategories, (int)ChartSpecialDataSourcesEnum.chDataLiteral, categories);
                    chSeries0.SetData(ChartDimensionsEnum.chDimValues, (int)ChartSpecialDataSourcesEnum.chDataLiteral, series[0].values);
                    chSeries0.SetData(ChartDimensionsEnum.chDimFormatValues, (int)ChartSpecialDataSourcesEnum.chDataLiteral, series[0].format);
                    AddBidAskSegment(chSeries0, 3);

                    ChSeries chSeries1 = chartMain.SeriesCollection.Add(0);
                    chSeries1.Caption = (currentTime - new TimeSpan(0, 10, 0)).ToString("hh:mm");
                    chSeries1.Interior.SetSolid(ChRGB.Get(Color.Transparent));
                    chSeries1.Border.Color = ChRGB.Get(Color.Transparent);
                    chSeries1.SetData(ChartDimensionsEnum.chDimCategories, (int)ChartSpecialDataSourcesEnum.chDataLiteral, categories);
                    chSeries1.SetData(ChartDimensionsEnum.chDimValues, (int)ChartSpecialDataSourcesEnum.chDataLiteral, series[1].values);
                    chSeries1.SetData(ChartDimensionsEnum.chDimFormatValues, (int)ChartSpecialDataSourcesEnum.chDataLiteral, series[1].format);
                    AddBidAskSegment(chSeries1, 2);

                    ChSeries chSeries2 = chartMain.SeriesCollection.Add(0);
                    chSeries2.Caption = (currentTime - new TimeSpan(0, 5, 0)).ToString("hh:mm");
                    chSeries2.Interior.SetSolid(ChRGB.Get(Color.Transparent));
                    chSeries2.Border.Color = ChRGB.Get(Color.Transparent);
                    chSeries2.SetData(ChartDimensionsEnum.chDimCategories, (int)ChartSpecialDataSourcesEnum.chDataLiteral, categories);
                    chSeries2.SetData(ChartDimensionsEnum.chDimValues, (int)ChartSpecialDataSourcesEnum.chDataLiteral, series[2].values);
                    chSeries2.SetData(ChartDimensionsEnum.chDimFormatValues, (int)ChartSpecialDataSourcesEnum.chDataLiteral, series[2].format);
                    AddBidAskSegment(chSeries2, 1);

                    ChSeries chSeries3 = chartMain.SeriesCollection.Add(0);
                    chSeries3.Caption = "Now";
                    chSeries3.Interior.SetSolid(ChRGB.Get(Color.Transparent));
                    chSeries3.Border.Color = ChRGB.Get(Color.Transparent);
                    chSeries3.SetData(ChartDimensionsEnum.chDimCategories, (int)ChartSpecialDataSourcesEnum.chDataLiteral, categories);
                    chSeries3.SetData(ChartDimensionsEnum.chDimValues, (int)ChartSpecialDataSourcesEnum.chDataLiteral, series[3].values);
                    chSeries3.SetData(ChartDimensionsEnum.chDimFormatValues, (int)ChartSpecialDataSourcesEnum.chDataLiteral, series[3].format);
                    AddBidAskSegment(chSeries3, 0);

                    this.lastPrice = Convert.ToDouble(startingPrice);
                }
                catch (Exception exception)
                {
                    Console.WriteLine(exception.Message);
                }
            }
        }