void CreateGraph( ZedGraphControl ^z1 )
{
// Get a reference to the GraphPane instance in the ZedGraphControl
GraphPane ^myPane = z1->GraphPane;
// Set the titles and axis labels
myPane->Title->Text = L" ";
myPane->XAxis->Title->Text = L" ";
myPane->YAxis->Title->Text = L" ";
array<double>^ x = { 1, 2, 3, 4 };
array<double>^ y = { 80, 70, 65, 78, 40 };
BarItem ^myCurve = myPane->AddBar(L"Hist", x, y, Color::White);
myPane->YAxis->Scale->Min = 0;
myPane->YAxis->Scale->Max = 100;
myPane->XAxis->Scale->Min = 0;
myPane->XAxis->Scale->Max = 5;
myPane->YAxis->Scale->MinorStep=10;
myPane->XAxis->Scale->MinorStep= 1;
myPane->YAxis->Scale->MajorStep=10;
myPane->XAxis->Scale->MajorStep= 1;
//myPane->XAxis->IsAxisSegmentVisible=false;
//myPane->XAxis->MinSpace=1;
myCurve->Bar->Border->IsVisible = true;
// Draw the X tics between the labels instead of at the labels
//myPane->XAxis->MajorTic->IsBetweenLabels = false;
// Fill the axis background with a color gradient
myPane->Chart->Fill = gcnew Fill( Color::White, Color::SteelBlue, 45.0f );
//array<string,4>^ str = { "North", "South", "West", "East"};
//myPane->XAxis->Scale->TextLabels-> = //str;
//myPane->XAxis->Type = AxisType::Text;
// disable the legend
myPane->Legend->IsVisible = false;
}
Partager