604
社区成员
发帖
与我相关
我的任务
分享
void TDataMiningForm::drawLine(int colNum, AnsiString NameZ[])
{
TColor theColor[16] = {clRed,clGreen,clYellow,clBlue,clWhite,clGray,clFuchsia,clTeal,clNavy,clMaroon,clLime,
clOlive,clPurple,clLtGray,clAqua,clBlack};
int iColorSel;
Chart1->SeriesList->Clear();
Chart1->Title->Visible = 0;
for(int i=0; i<colNum; i++)
{
iColorSel = i % 16 ;
Linetrue = true;
TLineSeries *theSeries;
theSeries = new TLineSeries(this);
theSeries->SeriesColor = theColor[iColorSel] ;
theSeries->Title = NameZ[i];
theSeries->ParentChart = Chart1;
Query1->Close();
Query1->SQL->Clear();
Query1->SQL->Add("select total,namex from tang where namez='"+NameZ[i]+"'");
Query1->Open();
Query1->First();
while(!Query1->Eof)
{
theSeries->Add(StrToFloat(FormatFloat("0.00",Query1->FieldByName("total")->AsFloat)),Query1->FieldByName("namex")->AsString,theColor[iColorSel]);
Query1->Next();
}
}
}
//---------------------------------------------------------------------------
TAreaSeries *series = new TAreaSeries(NULL);
series->Add(2,"测试",TColor(123,123,4));
// series->Add(3,"测试",TColor(123,123,4));
series->Add(4,"测试",TColor(123,123,4));
// series->AddNull("asd");
/*TChartSeries *series = new TChartSeries(NULL);
series->Add(2,"测试",TColor(123,123,4));
*/
cht1->AddSeries(series);
TChart *cht1 ;
cht1 = new TChart(this);
cht1->Top = 0;
cht1->Left = 0;
cht1->Height = 300;
cht1->Width = 300;
cht1->Parent = this;