最近也在学习Teechart,看看这个,X轴显示的时间,Y轴显示的是随机数。
void CTestTeeChartDlg::InitChart()
{
m_ctrlChart.Series(0).Clear();
m_ctrlChart.GetPage().SetMaxPointsPerPage(1440);
COleDateTime CurTime = COleDateTime::GetCurrentTime();
COleDateTime tempTime ;
tempTime = CurTime;
CurTime.SetTime(0,0,0);
CurTime.SetDate(tempTime.GetYear(),tempTime.GetMonth(),tempTime.GetDay());
COleDateTimeSpan tmSpan = COleDateTimeSpan(0,0,1,0);
CString csTime ;
for(int i=0; i<80; i++)
{
csTime = CurTime.Format("%H:%M");
float fzVal = float(GetRandom(12000,28000)/100);
m_ctrlChart.Series(0).AddXY(i,fzVal,csTime,i);
CurTime += tmSpan;
}
m_ctrlChart.GetAxis().GetLeft().SetMinMax(100, 300);
}
希望对你有帮助。
建议去百度或GOOGLE搜索一下,看看有没有相关信息或资料可以帮你。