티스토리 뷰
차트의 Min 과 Max를 적절히 조절하기 위한 함수
만든이 - 민승기
void CKoreaMarket::calcGridStep( double *pdMin, double *pdMax, int num )
{
double step = (*pdMax - *pdMin ) / num;
step = (*pdMax - *pdMin) / (num - 1) ;
if( step < 0 )
{
*pdMax = *pdMin = 0; step = 0;
}
if( step == 0 ) step = 1.0;
else if( step < 0.001 ) step = ((int)(step * 10000) + 1) / 10000.0;
else if( step < 0.01 ) step = ((int)(step * 1000) + 1) / 1000.0;
else if( step < 0.1 ) step = ((int)(step * 100) + 1) / 100.0;
else if( step < 1 ) step = ((int)(step * 10) + 1) / 10.0;
else if( step < 10 ) step = (int)(step + 1);
else if( step < 100 ) step = ((int)(step / 10) + 1) * 10;
else if( step < 1000 ) step = ((int)(step / 100) + 1) * 100;
else if( step < 10000 ) step = ((int)(step / 1000) + 1) * 1000;
else if( step < 100000 ) step = ((int)(step / 10000) + 1) * 10000;
else if( step < 1000000 ) step = ((int)(step / 100000) + 1) * 100000;
else if( step < 10000000 ) step = ((int)(step / 1000000) + 1) * 1000000;
if( *pdMin >= 0 ) {
if((int)(*pdMin/step) * step == *pdMin){
*pdMin = (int)(*pdMin/step - 0.5) * step; // adjust min
}
else{
*pdMin = (int)(*pdMin/step)*step;
}
} else {
if((int)(*pdMin/step - 1) * step == *pdMin)
*pdMin = (int)(*pdMin/step - 1.5) * step; // adjust min
else
*pdMin = (int)(*pdMin/step - 1) * step;
}
*pdMax = *pdMin + step * num; // adjust min & max
// return step;
}
'Study > Application > Windows' 카테고리의 다른 글
MFC 리스트 컨트롤에 소팅기능 추가하기 (2) | 2010.08.18 |
---|---|
OLE 작업 (0) | 2010.08.12 |
MFC - Excel OLE 작업중 (0) | 2010.07.14 |
MFC에서 EditBox 한글입력문제 (0) | 2010.06.24 |
Professional MFC with Visual C++ 1주차 강의 (Chapter1-3) (0) | 2010.02.05 |
댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- 리눅스
- watchface
- 창조경제혁신센터
- gdgssu
- 안드로이드
- gdg watchfacehack
- 서버개발자
- 창의과학교구
- jakeyoon
- 핸즈온머신러닝
- Linux
- AndroidWear
- Developing on AWS
- GDG
- 숭실대
- 윤재석
- WatchFaceHack
- 해커톤
- yjaeseok
- jaeseokyoon
- Jake Yoon
- 하쭈서쭈
- 안드로이드폰
- 리눅스2.6
- 소설네트워크2
- 리눅스 커널 2.6 구조와 원리
- 리눅스 커널 2.6
- 릴레이대회본선
- GDG SSU
- 그래비트랙스
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
글 보관함