c++ builder Chart 问题?
数据库是ACCESS,我用TChart显示一年中每月的收入总和
this->Chart1->Title->Text->Strings[0]=this->FlatComboBox1->Text.Trim() +"年收入变化图";
this->Chart1->LeftAxis->Title->Caption="";
this->Chart1->BottomAxis->Title->Caption="月份";
for(int i=0;i <this->Chart1->SeriesCount();i++)
this->Chart1->Series[i]->Clear() ;
DataModule1->ADOQueryChart->Active =false;
DataModule1->ADOQueryChart->SQL->Clear();
DataModule1->ADOQueryChart->SQL->Add("SELECT sum(Money1) as InOfMonth, format(IncomDate,'yyyy-mm') FROM Income where
year(IncomDate)=:Cyear group by format(IncomDate,'yyyy-mm')");
DataModule1->ADOQueryChart->Parameters->ParamByName("Cyear")->Value= this->FlatComboBox1->Text.Trim();
DataModule1->ADOQueryChart->Open() ;
for(int i=0;i <this->Chart1->SeriesCount();i++)
this->Chart1->Series[i]->Clear() ;
for(int i=0;i <DataModule1->ADOQueryChart->RecordCount;i++) //
{
this->Series22->Add(DataModule1->ADOQueryChart->FieldByName("InOfMonth")->Value,i+1,clGreen);
DataModule1->ADOQueryChart->Next() ;
}
如果一年中有几个月没有数据,显示就不正常了, 请问要怎么改代码?其中IncomDate是日期字段