본문 바로가기
ETC.../Chart

[차트 디렉터] 준비사항

by izen8 2011. 11. 3.
반응형
차트 디렉터를 설정하기 위해 필요한 파일

 


헤더 파일에 선언
#include "ChartViewer.h"






멤버 변수 선언시
도구모음의 Picture Ctrl 로 다이얼 로그에 위치 시킨후 멤버 변수로 선언할때
CStatic --> CCharViewer로 변경 시켜준다.
ex)
CStatic m_chartLoc;
CChartViewer m_chart;


 

Sample Source

  // 차트영역 출력
 CRect areaRect;

 // 차트 영역 계산
 m_staticChartArea.GetClientRect(areaRect);

 //PieChart *c = new PieChart(areaRect.Width(), areaRect.Height());
 // The data for the line chart
 double data[] = {30, 28, 40, 55, 75, 68, 54, 60, 50, 62, 75, 65, 75, 91, 60, 55,
  53, 35, 50, 66, 56, 48, 52, 65, 62};

 // The labels for the line chart
 const char *labels[] = {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10",
  "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23",
  "24"};

 // Create a XYChart object of size 250 x 250 pixels
 XYChart *c = new XYChart(areaRect.Width(), areaRect.Height());

 // Set the plotarea at (30, 20) and of size 200 x 200 pixels
 c->setPlotArea(30, 20, 200, 200);

 // Add a line chart layer using the given data
 c->addLineLayer(DoubleArray(data, sizeof(data)/sizeof(data[0])));

 // Set the labels on the x axis.
 c->xAxis()->setLabels(StringArray(labels, sizeof(labels)/sizeof(labels[0])));

 // Display 1 out of 3 labels on the x-axis.
 c->xAxis()->setLabelStep(3);

 // output the chart
 c->makeChart();

 m_chart.setChart(c);

 delete c;


반응형

'ETC... > Chart' 카테고리의 다른 글

[C#] [Chart] MS Chart  (0) 2012.01.10
차트 구성  (0) 2012.01.05
[차트디렉터] 한글표시  (0) 2011.11.01
[차트 디렉터] 참고자료  (0) 2011.04.18
[참고자료] A 2D Lite Graph Control with Multiple Plot Support  (0) 2011.03.27

댓글