Microsoft 차트 컨트롤으로 주식 진화 차트를 개발 중이며 AxisX 레이블에 초기 및 최종 날짜를 표시해야하지만 할 수 없습니다.Microsoft Chart Control에서 첫 번째와 마지막 AxisX 레이블을 항상 표시하는 방법은 무엇입니까?
나는 구글과 설정 한 속성 같은 많은 솔루션을 발견 : 같은 differnce 만든
Chart1.ChartAreas[0].AxisX.Minimum = InitialDate.ToOADate();
Chart1.ChartAreas[0].AxisX.Maximum = FinalDate.ToOADate();
Chart1.ChartAreas[0].AxisX.LabelStyle.IsEndLabelVisible = true;
아무것도를. 도움이 필요해!
초기 샘플은 2007 년 7 월 26 일이었으며 최종본은 2010 년 7 월 26 일이었습니다. 이것이 차트 라벨에 표시해야하는 것이며, 나머지 날짜는 차이가 나타나지 않습니다. 어떤 간격. 그 결과를 다음
// get the interval in days
double days = (double)((TimeSpan)(FinalDate - InitialDate)).Days;
// the number os labels
double labels = 10.0;
// check if the number of days is bigger than labels
if (days > labels)
{
// calculate the interval
double interval = days/labels;
Chart1.ChartAreas[0].AxisX.Interval = interval;
}
else
{
// set the interval of 1 day
Chart1.ChartAreas[0].AxisX.Interval = 1;
}
됩니다 :
alt text http://img826.imageshack.us/img826/6518/evolucaoinvestimento.png