-
Notifications
You must be signed in to change notification settings - Fork 156
/
ChartEntryVolume.cpp
71 lines (56 loc) · 2.23 KB
/
ChartEntryVolume.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
/************************************************************************
* Copyright(c) 2011, One Unified. All rights reserved. *
* *
* This file is provided as is WITHOUT ANY WARRANTY *
* without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* *
* This software may not be used nor distributed without proper license *
* agreement. *
* *
* See the file LICENSE.txt for redistribution information. *
************************************************************************/
//#include "StdAfx.h"
#include "ChartEntryVolume.h"
namespace ou { // One Unified
//
// CChartEntryVolume
//
ChartEntryVolume::ChartEntryVolume(void)
: ChartEntryPrice()
{
}
//ChartEntryVolume::ChartEntryVolume(size_type nSize)
//: ChartEntryPrice(nSize)
//{
//}
ChartEntryVolume::~ChartEntryVolume(void) {
}
void ChartEntryVolume::Reserve(size_type nSize ) {
ChartEntryPrice::Reserve( nSize );
}
void ChartEntryVolume::Append( boost::posix_time::ptime dt, int volume) {
ChartEntryPrice::Append( dt, (double) volume );
}
void ChartEntryVolume::Append( const ou::tf::Bar& bar ) {
Append( bar.DateTime(), bar.Volume() );
}
bool ChartEntryVolume::AddEntryToChart( XYChart *pXY, structChartAttributes *pAttributes ) {
bool bAdded( false );
ChartEntryPrice::ClearQueue();
if ( 0 != ChartEntryPrice::Size() ) {
DoubleArray daXData = ChartEntryTime::GetDateTimes();
if ( 0 != daXData.len ) {
BarLayer *bl = pXY->addBarLayer( this->GetPrices() );
bl->setXData( daXData );
pAttributes->dblXMin = daXData[0];
pAttributes->dblXMax = daXData[ daXData.len - 1 ];
DataSet *pds = bl->getDataSet(0);
pds->setDataColor( m_eColour, 0xff000000, 0xff000000 );
pds->setDataName( GetName().c_str() );
bAdded = true;
}
}
return bAdded;
}
} // ou namespace