思路:在src/Client/StkUI/View/StockGraph.cpp中新增加1个类DrawKLineData(pDC)
DrawKLineData(pDC)类负责读取画线二进制数据,并画出来。
step 1:添加画图指标类DrawKLineData(pDC);
src/Client/StkUI/View/StockGraph.cpp
复制 DrawKLine(pDC)->DrawKLineData(pDC);
复制 CStockGraph::DrawOneKLine->CStockGraph::DrawOneKLineData();
step 2:调用画图指标
src/Client/StkUI/View/StockGraph.cpp
void CStockGraph::DrawStock(CDC* pDC)
{
DrawTechLine(pDC); //画窗口底部的技术指标线
DrawKLine(pDC); //画K线图
DrawKData(); //画周期K线的左上角信息
/*custom extend 画线数据 by freeman*/
DrawKLineData(pDC);
/**********************************/
}
CStockGraph::DrawOneKLineData()类
/*custom extend 画线工具数据 by freeman*/
//画线数据 by freeman
void CStockGraph::DrawKLineData(CDC* pDC)
{
CStockInfo& info = m_CurStock.GetStockInfo();
if (info.IsIndex()) //是指数
return;
if (m_nCurKType != CKData::ktypeDay) //不是日K线
return;
DECLARE_COLOR_DEFINATION
CKData& kdata = m_CurStock.GetKData(m_nCurKType);
//得到要画区域的最大和最小值
double dMin = 0, dMax = 0;
if (!GetKLineMinMaxInfo(m_nIndexStart, m_nIndexEnd, &dMin, &dMax))
return;
m_dMaxPrice = dMax;
m_dMinPrice = dMin;
CFile file;
CString sFileName;
if ( file.Open(sFileName, CFile::modeCreate | CFile::modeReadWrite))
{
file.Close();
}
// Draw K Line 循环画K线
for (int k = m_nIndexStart; k <= m_nIndexEnd; k++)
{
// DrawOneKLineData(pDC, k, k, &kdata, dMin, dMax, FALSE);
}
}