2014年7月28日 星期一

Visual Studio 2013 Express C++ 繪圖

A.清除已繪圖的Chart之Series:
        if (this->chart2->Series["Series1"]->Points->Count >= 0){
Console::WriteLine("Clear Series!");
this->chart2->Series["Series1"]->Points->Clear();
}








B.讓Chart能夠加入Scrollbar

  B-1:選擇ChartAreas進入設定.


   B-2:選擇CursorX -> IsUserSelectionEnabled (true) 使其Chart能夠選取縮放範圍

B-3: 進入Axes橫軸

B-4:選定MinSize數量可以在畫面有ScrollBar的情況下,一個畫面有多少個橫軸數值

 B-5:程式碼參考
   B-5-1: 
http://social.msdn.microsoft.com/Forums/vstudio/en-US/f569382a-e05e-4295-b0f8-75cc4e504f79/add-scroll-bar-on-bar-chart-created-by-systemwindowsformsdatavisualizationchartingchart?forum=MSWinWebChart

   B-5-2: Visual C++ 
 this->chart2->ChartAreas["ChartArea1"]->AxisX->ScrollBar->Size = 20;
 this->chart2->ChartAreas["ChartArea1"]->AxisX->ScrollBar->ButtonStyle = ScrollBarButtonStyles-        >SmallScroll;
 this->chart2->ChartAreas["ChartArea1"]->AxisX->ScrollBar->IsPositionedInside = true;
 this->chart2->ChartAreas["ChartArea1"]->AxisX->ScrollBar->Enabled = true;


//get the current maximum of the axis

double ymax =chart2->ChartAreas["ChartArea1"]->AxisX->Maximum;

//Add the new data
 chart1.Series["Series1"].Points.AddXY();
//set the zoom size to the exisiting scale values other wise nothing happens
         chart2->ChartAreas["ChartArea1"]->AxisX->ScaleView->Zoom(-10, 10);
 chart2->ChartAreas["ChartArea1"]->AxisX->ScaleView->Zoomable;

沒有留言:

張貼留言