1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
|
String leg[7];
const char *lab[7];
double dta[10];
//double *tt;
//---------------------------------------------------------------------------
__fastcall TFormMain::TFormMain(TComponent* Owner)
: TForm(Owner)
{
_control87(MCW_EM, MCW_EM);
}
//---------------------------------------------------------------------------
void __fastcall TFormMain::Quit1Click(TObject *Sender)
{
Close();
}
//---------------------------------------------------------------------------
void __fastcall TFormMain::Button1Click(TObject *Sender)
{
int i = 0 ;
int nbr = MyQuery->RecordCount;
double * tt = new double[nbr];
MyQuery->First();
while(!MyQuery->Eof)
{
leg[i] = MyQuerytypeglobal->Value;
tt[i] = MyQuerytotal->Value;
MyQuery->Next();
i++;
}
memcpy(dta,tt,nbr);
for(int j=0;j< nbr ;j++){
LBox1->Items->Add(dta[j]);
// tt[j] = dta[j];
}
int f = sizeof(leg)/sizeof(leg[0]);
for(int j=0;j<f;j++)
{
lab[j] = leg[j].c_str(); // lab[j] = new char[leg[j].Length()+1];
}
Screen->Cursor = crHourGlass;
PieChart *c = new PieChart(500, 300, Chart::goldColor(), -1, 1);
c->addTitle("Vente dans le Segment A00 en 2005", "LuCon.ttf", 14)->setBackground(Chart::metalColor(0xff9999));
c->setPieSize(250, 120, 100);
c->set3D();
c->setLabelLayout(Chart::SideLayout);
c->setLabelStyle()->setBackground(Chart::SameAsMainColor,Chart::Transparent, 1);
c->setLineColor(Chart::SameAsMainColor, 0x0);
c->setStartAngle(135);
c->setData(DoubleArray(dta,sizeof(dta)/sizeof(dta[0])), StringArray(lab, sizeof(lab)/sizeof(lab[0])));
c->makeChart("q.bmp");
delete c;
// delete[] dta;
Screen->Cursor = crDefault;
Image1->Picture->LoadFromFile("q.bmp");
} |
Partager