资源描述:
《vcMschart控件的使用》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、碰到一个东西要用MSChart控件的,呵呵,这不就学了怎么用哈!voidCMoreDMcode::OnCacluteDelta(intnRow){m_Chart.SetRedraw(false);m_Chart.SetRow(1);for(inti=1;i<=64;i++){m_Chart.GetDataGrid().SetData(i,1,nDelta[i-1],0);}CRgnrgn;m_Chart.GetUpdateRgn(&rgn);m_Chart.SetRedraw(true);m_Chart
2、.InvalidateRgn(&rgn,false);}voidCMoreDMcode::InitChart(){VARIANTvar;m_Chart.SetColumnCount(1);//设置曲线条数m_Chart.SetRowCount(64);//一条曲线有64个点m_Chart.SetTitleText("二位形态码△t变化趋势");m_Chart.SetChartType(1
3、2);////m_Chart.SetShowLegend(TRUE);//设置X轴m_Chart.GetPlot()
4、.GetAxis(0,var).GetCategoryScale().SetAuto(FALSE);//不自动标注X轴刻度m_Chart.GetPlot().GetAxis(0,var).GetCategoryScale().SetDivisionsPerLabel(8);//每四刻度一个标注m_Chart.GetPlot().GetAxis(0,var).GetCategoryScale().SetDivisionsPerTick(8);//每刻度一个刻度线//m_Chart.GetPlot().Ge
5、tAxis(0,var).GetValueScale().SetMinorDivision(1);//每刻度一个刻度线m_Chart.GetPlot().GetAxis(0,var).GetValueScale().SetMaximum(64);//X轴最大刻度m_Chart.GetPlot().GetAxis(0,var).GetValueScale().SetMinimum(0);//X轴最小刻度m_Chart.GetPlot().GetAxis(0,var).GetAxisTitle().SetT
6、ext("二位形态码");//设置Y轴m_Chart.GetPlot().GetAxis(1,var).GetValueScale().SetAuto(FALSE);//不自动标注Y轴刻度m_Chart.GetPlot().GetAxis(1,var).GetValueScale().SetMaximum(100);//Y轴最大刻度m_Chart.GetPlot().GetAxis(1,var).GetValueScale().SetMinimum(0);//Y轴最小刻度m_Chart.GetPlot(
7、).GetAxis(1,var).GetValueScale().SetMajorDivision(10);//Y轴刻度10等分m_Chart.GetPlot().GetAxis(1,var).GetValueScale().SetMinorDivision(1);//每刻度一个刻度线//m_Chart.GetPlot().GetAxis(1,var).GetAxisTitle().SetText("△t变化趋势");//Y轴名称//m_Chart.GetPlot().GetAxis(1,var).Ge
8、tAxisTitle().GetTextLayout().SetOrientation(2);//Y轴名称排列方式m_Chart.GetPlot().SetUniformAxis(FALSE);}voidCMoreDMcode::OnMSChartDraw(){CStringstr;intnRow=m_Grid.GetFocusCell().row;if(nRow<0){MessageBox("请在左表选择要排序的行!","操作错误",MB_OK
9、MB_ICONWARNING);return;}for(
10、inti=0;i<64;i++){str=m_Grid.GetItemText(nRow,i+3);nDelta[i]=atoi(str.GetBuffer(0));}InitChart();//初始化坐标轴//根据不同的数据设定不同的Y轴最大刻度intm=GetMaxData(nDelta);m=(m/50)*50+50;//取靠近M的比M大的50的倍数str=m_Grid.GetItemText(nRow,0);VARIANTvar;m