HighSpeedCharting简单的使用

HighSpeedCharting动态绘图点击下载动态绘图

一、创建工程

第一步:将ChartCtrl放入工程文件夹之中,并导入ChartCtrl文件夹 点击下载

HighSpeedCharting简单的使用_第1张图片

第二步:添加控件:custom Control

HighSpeedCharting简单的使用_第2张图片

第三步:修改属性

HighSpeedCharting简单的使用_第3张图片

第四步:添加变量

HighSpeedCharting简单的使用_第4张图片

二、简单的使用

1、  创建坐标轴:

CChartAxis *pAxis = NULL;
pAxis= m_ChartCtrl.CreateStandardAxis(CChartCtrl::BottomAxis);
pAxis->SetAutomatic(false);  //不自适应
pAxis= m_ChartCtrl.CreateStandardAxis(CChartCtrl::LeftAxis);
pAxis->SetAutomatic(true);   //自适应

TChartString str1;
str1=_T("LineChart");
m_ChartCtrl.GetTitle()->AddString(str1);                 //設置標題

str1 =_T("num");
pAxis= m_BarChart.GetLeftAxis();
//  pAxis->SetMinMax(0.1,70);
if (pAxis)
    pLabel= pAxis->GetLabel();
if (pLabel)
    pLabel->SetText(str1);

str1=_T("数值坐标轴");
pAxis= m_BarChart.GetBottomAxis();
if (pAxis)
    pLabel= pAxis->GetLabel();
if (pLabel)
    pLabel->SetText(str1);
pAxis->SetMinMax(0,BARMAX);

2、  画图:

m_ChartCtrl.EnableRefresh(false);
CChartLineSerie *pLineSerie;
m_ChartCtrl.RemoveAllSeries();//先清空 
pLineSerie =m_ChartCtrl.CreateLineSerie();
pLineSerie->AddPoint(x[i], y[i]);                          //添加數值
m_ChartCtrl.EnableRefresh(true);

3、 保存图片:

TChartString fileName;
CRect crect;
crect.SetRect(0,0, 700, 400);                      //set the size of the image
m_ChartCtrl.SaveAsImage(_T(".\\lineChart.png"),crect,32,GUID_NULL); //savethe image

你可能感兴趣的:(学习笔记)