---折线图
int iCol, iRow;
double value;ChartMain.Series.Clear();
Random rand = new Random((int)DateTime.Now.Ticks); // 产生随机数for (iRow = GridMain.FixedRows + 1; iRow < GridMain.Rows; iRow++)
{ Steema.TeeChart.Styles.Line line = new Steema.TeeChart.Styles.Line(); //声明 line.Color = System.Drawing.Color.FromArgb(rand.Next(255), rand.Next(255), rand.Next(255)); ·· //随机线条颜色 line.Pointer.Visible = true;// 坐标点可见 line.Pointer.HorizSize = 2; line.Pointer.VertSize = 2; line.Marks.Visible = true; line.Marks.ArrowLength = 8; //掐头长度 line.Marks.Style = Steema.TeeChart.Styles.MarksStyles.Value; line.Title = GridMain.get_TextMatrix(iRow, (int)peGridMainKey.MACHINE); //线条内容 // ChartMain.Series.Add(line); for (iCol = (int)peGridMainKey.TOTALYIELD; iCol < GridMain.Cols - 1; iCol++) { double.TryParse(GridMain.get_TextMatrix(iRow, iCol), out value ); line.Add(value, GridMain.get_TextMatrix(0, iCol).ToString()); // 线条的值 } ChartMain.Series.Add(line); // 向tchart的中添加设置好的线条}
柱状图
Steema.TeeChart.Styles.Bar bar = new Steema.TeeChart.Styles.Bar();
ChartMain.Series.Add(bar); ChartMain.Axes.Bottom.Labels.Angle = 270;饼装图
Steema.TeeChart.Styles.Pie pie = new Steema.TeeChart.Styles.Pie();
ChartMain.Series.Add(pie);int iSeries = 0;
double value; string value2; for (iCol = (int)peGridSubtotalKey.YIELD + 2; iCol < GridMain.Cols ; iCol += 2) { // string.TryParse(GridMain.get_TextMatrix(GridMain.FixedRows -1, iCol), out value2); double.TryParse(GridMain.get_TextMatrix(GridMain.FixedRows +1 , iCol), out value); value2 = GridMain.get_TextMatrix(GridMain.FixedRows-1, iCol);ChartMain.Series[iSeries].Add(value, value2);
ChartPERCENT.Series[iSeries].Add(value, value2); ChartMain.Series[iSeries].Marks.Style = Steema.TeeChart.Styles.MarksStyles.Value ;//ChartBAD.Series(0).Add gNVL(Grid1.TextMatrix(Grid1.FixedRows + 1, inx), 0), Grid1.TextMatrix(Grid1.FixedRows - 1, inx), ChartBAD.Series(0).Color
//ChartPERCENT.Series(0).Add gNVL(Grid1.TextMatrix(Grid1.FixedRows, inx), 0), Grid1.TextMatrix(Grid1.FixedRows - 1, inx), ChartPERCENT.Series(0).Color //ChartMain.Series[iSeries].Title = GridMain.get_TextMatrix(0, iCol); //ChartPERCENT.Series[iSeries].Title = GridMain.get_TextMatrix(0, iCol); //iSeries++; }