init
commit
37e595f0ce
Binary file not shown.
|
@ -0,0 +1,850 @@
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
* ChartAxis.cpp
|
||||||
|
*
|
||||||
|
* Written by Cédric Moonen (cedric_moonen@hotmail.com)
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* This code may be used for any non-commercial and commercial purposes in a compiled form.
|
||||||
|
* The code may be redistributed as long as it remains unmodified and providing that the
|
||||||
|
* author name and this disclaimer remain intact. The sources can be modified WITH the author
|
||||||
|
* consent only.
|
||||||
|
*
|
||||||
|
* This code is provided without any garanties. I cannot be held responsible for the damage or
|
||||||
|
* the loss of time it causes. Use it at your own risks
|
||||||
|
*
|
||||||
|
* An e-mail to notify me that you are using this code is appreciated also.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "stdafx.h"
|
||||||
|
#include "ChartAxis.h"
|
||||||
|
#include "ChartAxisLabel.h"
|
||||||
|
#include "ChartGrid.h"
|
||||||
|
#include "ChartCtrl.h"
|
||||||
|
|
||||||
|
#include "Math.h"
|
||||||
|
#include <sstream>
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
CChartAxis::CChartAxis()
|
||||||
|
: m_pParentCtrl(NULL), m_bIsHorizontal(true), m_bIsInverted(false),
|
||||||
|
m_AutoMode(NotAutomatic), m_bIsVisible(true), m_bIsSecondary(false),
|
||||||
|
m_MaxValue(0), m_MinValue(0), m_UnzoomMax(0), m_UnzoomMin(0),
|
||||||
|
m_bAutoTicks(true), m_bDiscrete(false),m_StartPos(0), m_EndPos(0),
|
||||||
|
m_nFontSize(80), m_strFontName(_T("Microsoft Sans Serif")), m_TextColor(0),
|
||||||
|
m_bAutoMargin(true), m_iMarginSize(0), m_bZoomEnabled(true),
|
||||||
|
m_dZoomLimit(0.001), m_pScrollBar(NULL), m_AxisColor(RGB(0,0,0))
|
||||||
|
{
|
||||||
|
m_pAxisGrid = new CChartGrid();
|
||||||
|
m_pAxisLabel = new CChartAxisLabel();
|
||||||
|
}
|
||||||
|
|
||||||
|
CChartAxis::~CChartAxis()
|
||||||
|
{
|
||||||
|
if (m_pAxisGrid)
|
||||||
|
{
|
||||||
|
delete m_pAxisGrid;
|
||||||
|
m_pAxisGrid = NULL;
|
||||||
|
}
|
||||||
|
if (m_pAxisLabel)
|
||||||
|
{
|
||||||
|
delete m_pAxisLabel;
|
||||||
|
m_pAxisLabel = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_pScrollBar)
|
||||||
|
{
|
||||||
|
delete m_pScrollBar;
|
||||||
|
m_pScrollBar = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int CChartAxis::GetPosition()
|
||||||
|
{
|
||||||
|
if (m_bIsHorizontal)
|
||||||
|
{
|
||||||
|
if (m_bIsSecondary)
|
||||||
|
return 0;
|
||||||
|
else
|
||||||
|
return 100;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (m_bIsSecondary)
|
||||||
|
return 100;
|
||||||
|
else
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartAxis::SetParent(CChartCtrl* pParent)
|
||||||
|
{
|
||||||
|
m_pParentCtrl = pParent;
|
||||||
|
m_pAxisGrid->m_pParentCtrl = pParent;
|
||||||
|
m_pAxisLabel->m_pParentCtrl = pParent;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartAxis::SetHorizontal(bool bHorizontal)
|
||||||
|
{
|
||||||
|
m_bIsHorizontal = bHorizontal;
|
||||||
|
m_pAxisGrid->m_bIsHorizontal = bHorizontal;
|
||||||
|
m_pAxisLabel->SetHorizontal(bHorizontal);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartAxis::Draw(CDC *pDC)
|
||||||
|
{
|
||||||
|
if (!m_bIsVisible)
|
||||||
|
return;
|
||||||
|
if (pDC->GetSafeHdc() == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Initialize the different GDI objects
|
||||||
|
CPen SolidPen(PS_SOLID,0,m_AxisColor);
|
||||||
|
CFont NewFont;
|
||||||
|
NewFont.CreatePointFont(m_nFontSize,m_strFontName.c_str(),pDC) ;
|
||||||
|
CPen* pOldPen = pDC->SelectObject(&SolidPen);
|
||||||
|
CFont* pOldFont = pDC->SelectObject(&NewFont);
|
||||||
|
COLORREF OldTextColor = pDC->SetTextColor(m_TextColor);
|
||||||
|
int iPrevMode = pDC->SetBkMode(TRANSPARENT);
|
||||||
|
|
||||||
|
// Draw the axis line
|
||||||
|
int Pos = 0;
|
||||||
|
if (m_bIsHorizontal)
|
||||||
|
{
|
||||||
|
if (!m_bIsSecondary)
|
||||||
|
Pos = m_AxisRect.top+1;
|
||||||
|
else
|
||||||
|
Pos = m_AxisRect.bottom-1;
|
||||||
|
pDC->MoveTo(m_StartPos,Pos);
|
||||||
|
pDC->LineTo(m_EndPos,Pos);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (!m_bIsSecondary)
|
||||||
|
Pos = m_AxisRect.right-1;
|
||||||
|
else
|
||||||
|
Pos = m_AxisRect.left+1;
|
||||||
|
pDC->MoveTo(Pos,m_StartPos);
|
||||||
|
pDC->LineTo(Pos,m_EndPos);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Draw the label
|
||||||
|
DrawLabel(pDC);
|
||||||
|
// Clear the ticks on the grid
|
||||||
|
m_pAxisGrid->ClearTicks();
|
||||||
|
|
||||||
|
// Now draw all the ticks and their label.
|
||||||
|
if (m_MaxValue == m_MinValue)
|
||||||
|
DrawTick(pDC,m_MinValue);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
double TickValue = GetFirstTickValue();
|
||||||
|
do
|
||||||
|
{
|
||||||
|
DrawTick(pDC,TickValue);
|
||||||
|
} while (GetNextTickValue(TickValue, TickValue));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Draw the grid.
|
||||||
|
m_pAxisGrid->Draw(pDC);
|
||||||
|
|
||||||
|
// Reset the GDI objects
|
||||||
|
pDC->SelectObject(pOldPen);
|
||||||
|
SolidPen.DeleteObject();
|
||||||
|
pDC->SelectObject(pOldFont);
|
||||||
|
NewFont.DeleteObject();
|
||||||
|
pDC->SetTextColor(OldTextColor);
|
||||||
|
pDC->SetBkMode(iPrevMode);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartAxis::DrawTick(CDC* pDC,
|
||||||
|
double dTickVal)
|
||||||
|
{
|
||||||
|
long TickPos = GetTickPos(dTickVal);
|
||||||
|
long lLabelPos = ValueToScreen(dTickVal);
|
||||||
|
TChartString strBuffer = GetTickLabel(dTickVal);
|
||||||
|
CSize TextSize = pDC->GetTextExtent(strBuffer.c_str());
|
||||||
|
CSize LabelSize = m_pAxisLabel->GetSize(pDC);
|
||||||
|
|
||||||
|
bool bLabelOnAxis = IsLabelOnAxis(dTickVal);
|
||||||
|
bool bTickOnAxis = true;
|
||||||
|
if (m_bIsHorizontal)
|
||||||
|
{
|
||||||
|
if (TickPos<m_StartPos || TickPos>m_EndPos)
|
||||||
|
bTickOnAxis = false;
|
||||||
|
if (!m_bIsSecondary)
|
||||||
|
{
|
||||||
|
if (bTickOnAxis)
|
||||||
|
{
|
||||||
|
pDC->MoveTo(TickPos,m_AxisRect.top+1);
|
||||||
|
pDC->LineTo(TickPos,m_AxisRect.top+4);
|
||||||
|
}
|
||||||
|
if (bLabelOnAxis)
|
||||||
|
{
|
||||||
|
pDC->ExtTextOut(lLabelPos-TextSize.cx/2,m_AxisRect.top+5,
|
||||||
|
ETO_CLIPPED|ETO_OPAQUE,NULL,strBuffer.c_str(),NULL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (bTickOnAxis)
|
||||||
|
{
|
||||||
|
pDC->MoveTo(TickPos,m_AxisRect.bottom-1);
|
||||||
|
pDC->LineTo(TickPos,m_AxisRect.bottom-4);
|
||||||
|
}
|
||||||
|
if (bLabelOnAxis)
|
||||||
|
{
|
||||||
|
pDC->ExtTextOut(lLabelPos-TextSize.cx/2,m_AxisRect.bottom-5-TextSize.cy,
|
||||||
|
ETO_CLIPPED|ETO_OPAQUE,NULL,strBuffer.c_str(),NULL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (TickPos>m_StartPos || TickPos<m_EndPos)
|
||||||
|
bTickOnAxis = false;
|
||||||
|
if (!m_bIsSecondary)
|
||||||
|
{
|
||||||
|
if (bTickOnAxis)
|
||||||
|
{
|
||||||
|
pDC->MoveTo(m_AxisRect.right-1,TickPos);
|
||||||
|
pDC->LineTo(m_AxisRect.right-4,TickPos);
|
||||||
|
}
|
||||||
|
if (bLabelOnAxis)
|
||||||
|
{
|
||||||
|
pDC->ExtTextOut(m_AxisRect.left+LabelSize.cx+4,lLabelPos-TextSize.cy/2,
|
||||||
|
ETO_CLIPPED|ETO_OPAQUE,NULL,strBuffer.c_str(),NULL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (bTickOnAxis)
|
||||||
|
{
|
||||||
|
pDC->MoveTo(m_AxisRect.left+1,TickPos);
|
||||||
|
pDC->LineTo(m_AxisRect.left+4,TickPos);
|
||||||
|
}
|
||||||
|
if (bLabelOnAxis)
|
||||||
|
{
|
||||||
|
pDC->ExtTextOut(m_AxisRect.left+6,lLabelPos-TextSize.cy/2,
|
||||||
|
ETO_CLIPPED|ETO_OPAQUE,NULL,strBuffer.c_str(),NULL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
m_pAxisGrid->AddTick(TickPos);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CChartAxis::IsLabelOnAxis(double TickVal)
|
||||||
|
{
|
||||||
|
long lLabelPos = ValueToScreen(TickVal);
|
||||||
|
bool bLabelOnAxis = true;
|
||||||
|
if (m_bIsHorizontal)
|
||||||
|
{
|
||||||
|
if (lLabelPos<m_StartPos || lLabelPos>m_EndPos)
|
||||||
|
bLabelOnAxis = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (lLabelPos>m_StartPos || lLabelPos<m_EndPos)
|
||||||
|
bLabelOnAxis = false;
|
||||||
|
}
|
||||||
|
return bLabelOnAxis;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartAxis::DrawLabel(CDC* pDC)
|
||||||
|
{
|
||||||
|
// Draw the axis label.
|
||||||
|
CSize LabelSize = m_pAxisLabel->GetSize(pDC);
|
||||||
|
int HalfAxisPos = (int)fabs((m_EndPos + m_StartPos)/2.0);
|
||||||
|
int XPos = 0;
|
||||||
|
int YPos = 0;
|
||||||
|
if (m_bIsHorizontal)
|
||||||
|
{
|
||||||
|
if (!m_bIsSecondary)
|
||||||
|
{
|
||||||
|
CSize TextSize = GetLargestTick(pDC);
|
||||||
|
YPos = m_AxisRect.top + TextSize.cy + 2;
|
||||||
|
XPos = HalfAxisPos - LabelSize.cx/2;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
YPos = m_AxisRect.top + 0;
|
||||||
|
XPos = HalfAxisPos - LabelSize.cx/2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (!m_bIsSecondary)
|
||||||
|
{
|
||||||
|
YPos = HalfAxisPos + LabelSize.cy/2;
|
||||||
|
XPos = m_AxisRect.left + 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
YPos = HalfAxisPos + LabelSize.cy/2;
|
||||||
|
XPos = m_AxisRect.right - LabelSize.cx - 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
m_pAxisLabel->SetPosition(XPos,YPos,pDC);
|
||||||
|
m_pAxisLabel->Draw(pDC);
|
||||||
|
}
|
||||||
|
|
||||||
|
CSize CChartAxis::GetLargestTick(CDC* pDC)
|
||||||
|
{
|
||||||
|
CFont NewFont;
|
||||||
|
NewFont.CreatePointFont(m_nFontSize,m_strFontName.c_str(),pDC);
|
||||||
|
CFont* pOldFont = pDC->SelectObject(&NewFont);
|
||||||
|
|
||||||
|
CSize MaxSize(0,0);
|
||||||
|
if (m_MaxValue == m_MinValue)
|
||||||
|
{
|
||||||
|
TChartString strLabel = GetTickLabel(m_MinValue);
|
||||||
|
MaxSize = pDC->GetTextExtent(strLabel.c_str(),strLabel.size());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
double TickValue = GetFirstTickValue();
|
||||||
|
do
|
||||||
|
{
|
||||||
|
if (IsLabelOnAxis(TickValue))
|
||||||
|
{
|
||||||
|
TChartString strLabel = GetTickLabel(TickValue);
|
||||||
|
CSize TextSize = pDC->GetTextExtent(strLabel.c_str(),strLabel.size());
|
||||||
|
if (TextSize.cy > MaxSize.cy)
|
||||||
|
MaxSize.cy = TextSize.cy;
|
||||||
|
if (TextSize.cx > MaxSize.cx)
|
||||||
|
MaxSize.cx = TextSize.cx;
|
||||||
|
}
|
||||||
|
} while (GetNextTickValue(TickValue, TickValue));
|
||||||
|
}
|
||||||
|
|
||||||
|
pDC->SelectObject(pOldFont);
|
||||||
|
NewFont.DeleteObject();
|
||||||
|
return MaxSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartAxis::SetInverted(bool bInverted)
|
||||||
|
{
|
||||||
|
m_bIsInverted = bInverted;
|
||||||
|
RefreshScrollBar();
|
||||||
|
m_pParentCtrl->RefreshCtrl();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartAxis::SetAutomatic(bool bAutomatic)
|
||||||
|
{
|
||||||
|
// m_bIsAutomatic = bAutomatic;
|
||||||
|
if (bAutomatic)
|
||||||
|
{
|
||||||
|
m_AutoMode = FullAutomatic;
|
||||||
|
m_MinValue = m_MaxValue = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
m_AutoMode = NotAutomatic;
|
||||||
|
|
||||||
|
if (RefreshAutoAxis())
|
||||||
|
m_pParentCtrl->RefreshCtrl();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartAxis::SetAutomaticMode(EAxisAutoModes AutoMode)
|
||||||
|
{
|
||||||
|
m_AutoMode = AutoMode;
|
||||||
|
if (m_AutoMode != NotAutomatic)
|
||||||
|
m_MinValue = m_MaxValue = 0;
|
||||||
|
|
||||||
|
if (RefreshAutoAxis())
|
||||||
|
m_pParentCtrl->RefreshCtrl();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartAxis::SetDiscrete(bool bDiscrete)
|
||||||
|
{
|
||||||
|
m_bDiscrete = bDiscrete;
|
||||||
|
m_pParentCtrl->RefreshCtrl();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartAxis::SetMinMax(double Minimum, double Maximum)
|
||||||
|
{
|
||||||
|
ASSERT(Maximum>=Minimum);
|
||||||
|
|
||||||
|
m_MinValue = m_UnzoomMin = Minimum;
|
||||||
|
m_MaxValue = m_UnzoomMax = Maximum;
|
||||||
|
RefreshScrollBar();
|
||||||
|
m_pParentCtrl->RefreshCtrl();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartAxis::RegisterSeries(CChartSerie* pSeries)
|
||||||
|
{
|
||||||
|
// First check if the series is already present in the list
|
||||||
|
SeriesList::iterator iter = m_pRelatedSeries.begin();
|
||||||
|
for (iter; iter!=m_pRelatedSeries.end(); iter++)
|
||||||
|
{
|
||||||
|
if ( (*iter) == pSeries)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_pRelatedSeries.push_back(pSeries);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartAxis::UnregisterSeries(CChartSerie* pSeries)
|
||||||
|
{
|
||||||
|
SeriesList::iterator iter = m_pRelatedSeries.begin();
|
||||||
|
for (iter; iter!=m_pRelatedSeries.end(); iter++)
|
||||||
|
{
|
||||||
|
if ( (*iter) == pSeries)
|
||||||
|
{
|
||||||
|
m_pRelatedSeries.erase(iter);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CChartAxis::RefreshAutoAxis()
|
||||||
|
{
|
||||||
|
RefreshScrollBar();
|
||||||
|
bool bNeedRefresh = false;
|
||||||
|
if (m_AutoMode == NotAutomatic)
|
||||||
|
return bNeedRefresh;
|
||||||
|
|
||||||
|
double SeriesMin = 0;
|
||||||
|
double SeriesMax = 0;
|
||||||
|
if (m_AutoMode == FullAutomatic)
|
||||||
|
GetSeriesMinMax(SeriesMin, SeriesMax);
|
||||||
|
if (m_AutoMode == ScreenAutomatic)
|
||||||
|
GetSeriesScreenMinMax(SeriesMin, SeriesMax);
|
||||||
|
|
||||||
|
if ( (SeriesMax!=m_MaxValue) || (SeriesMin!=m_MinValue) )
|
||||||
|
SetMinMax(SeriesMin,SeriesMax);
|
||||||
|
|
||||||
|
return bNeedRefresh;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CChartAxis::RefreshScreenAutoAxis()
|
||||||
|
{
|
||||||
|
RefreshScrollBar();
|
||||||
|
bool bNeedRefresh = false;
|
||||||
|
if (m_AutoMode != ScreenAutomatic)
|
||||||
|
return bNeedRefresh;
|
||||||
|
return RefreshAutoAxis();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartAxis::GetSeriesMinMax(double& Minimum, double& Maximum)
|
||||||
|
{
|
||||||
|
Minimum = 0;
|
||||||
|
Maximum = 0;
|
||||||
|
double TempMin = 0;
|
||||||
|
double TempMax = 0;
|
||||||
|
|
||||||
|
SeriesList::iterator iter = m_pRelatedSeries.begin();
|
||||||
|
if (iter != m_pRelatedSeries.end())
|
||||||
|
{
|
||||||
|
if (m_bIsHorizontal)
|
||||||
|
(*iter)->GetSerieXMinMax(Minimum,Maximum);
|
||||||
|
else
|
||||||
|
(*iter)->GetSerieYMinMax(Minimum,Maximum);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (iter; iter!=m_pRelatedSeries.end(); iter++)
|
||||||
|
{
|
||||||
|
if (m_bIsHorizontal)
|
||||||
|
(*iter)->GetSerieXMinMax(TempMin,TempMax);
|
||||||
|
else
|
||||||
|
(*iter)->GetSerieYMinMax(TempMin,TempMax);
|
||||||
|
|
||||||
|
if (TempMin < Minimum)
|
||||||
|
Minimum = TempMin;
|
||||||
|
if (TempMax > Maximum)
|
||||||
|
Maximum = TempMax;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartAxis::GetSeriesScreenMinMax(double& Minimum, double& Maximum)
|
||||||
|
{
|
||||||
|
Minimum = 0;
|
||||||
|
Maximum = 0;
|
||||||
|
double TempMin = 0;
|
||||||
|
double TempMax = 0;
|
||||||
|
|
||||||
|
SeriesList::iterator iter = m_pRelatedSeries.begin();
|
||||||
|
if (iter != m_pRelatedSeries.end())
|
||||||
|
{
|
||||||
|
if (m_bIsHorizontal)
|
||||||
|
(*iter)->GetSerieXScreenMinMax(Minimum,Maximum);
|
||||||
|
else
|
||||||
|
(*iter)->GetSerieYScreenMinMax(Minimum,Maximum);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (iter; iter!=m_pRelatedSeries.end(); iter++)
|
||||||
|
{
|
||||||
|
if (m_bIsHorizontal)
|
||||||
|
(*iter)->GetSerieXScreenMinMax(TempMin,TempMax);
|
||||||
|
else
|
||||||
|
(*iter)->GetSerieYScreenMinMax(TempMin,TempMax);
|
||||||
|
|
||||||
|
if (TempMin < Minimum)
|
||||||
|
Minimum = TempMin;
|
||||||
|
if (TempMax > Maximum)
|
||||||
|
Maximum = TempMax;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
long CChartAxis::ValueToScreen(double Value) const
|
||||||
|
{
|
||||||
|
long Offset = 0;
|
||||||
|
long retVal = 0;
|
||||||
|
if (m_MaxValue==m_MinValue)
|
||||||
|
{
|
||||||
|
Offset = (int)fabs((m_EndPos-m_StartPos)/2.0);
|
||||||
|
if (m_bIsHorizontal)
|
||||||
|
retVal = m_StartPos + Offset;
|
||||||
|
else
|
||||||
|
retVal = m_StartPos - Offset;
|
||||||
|
}
|
||||||
|
else if (!m_bDiscrete)
|
||||||
|
retVal = ValueToScreenStandard(Value);
|
||||||
|
else
|
||||||
|
retVal = ValueToScreenDiscrete(Value);
|
||||||
|
|
||||||
|
return retVal;
|
||||||
|
}
|
||||||
|
|
||||||
|
long CChartAxis::ValueToScreenStandard(double Value) const
|
||||||
|
{
|
||||||
|
long Offset = 0;
|
||||||
|
long retVal = 0;
|
||||||
|
|
||||||
|
Offset = (int)floor( (Value - m_MinValue) * GetAxisLenght()/(m_MaxValue-m_MinValue) );
|
||||||
|
if (m_bIsHorizontal)
|
||||||
|
{
|
||||||
|
if (!m_bIsInverted)
|
||||||
|
retVal = (m_StartPos + Offset);
|
||||||
|
else
|
||||||
|
retVal = (m_EndPos - Offset);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (!m_bIsInverted)
|
||||||
|
retVal = (m_StartPos - Offset);
|
||||||
|
else
|
||||||
|
retVal = (m_EndPos + Offset);
|
||||||
|
}
|
||||||
|
return retVal;
|
||||||
|
}
|
||||||
|
|
||||||
|
double CChartAxis::ScreenToValue(long ScreenVal) const
|
||||||
|
{
|
||||||
|
if (m_MaxValue==m_MinValue)
|
||||||
|
return m_MinValue;
|
||||||
|
|
||||||
|
int AxisOffset = 0;
|
||||||
|
if (!m_bIsHorizontal)
|
||||||
|
{
|
||||||
|
if (m_bIsInverted)
|
||||||
|
AxisOffset = ScreenVal - m_EndPos;
|
||||||
|
else
|
||||||
|
AxisOffset = m_StartPos - ScreenVal;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (!m_bIsInverted)
|
||||||
|
AxisOffset = ScreenVal - m_StartPos;
|
||||||
|
else
|
||||||
|
AxisOffset = m_EndPos - ScreenVal;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ( (AxisOffset * 1.0 / GetAxisLenght()*(m_MaxValue-m_MinValue)) + m_MinValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartAxis::PanAxis(long PanStart, long PanEnd)
|
||||||
|
{
|
||||||
|
double StartVal = ScreenToValue(PanStart);
|
||||||
|
double EndVal = ScreenToValue(PanEnd);
|
||||||
|
|
||||||
|
double Shift = StartVal - EndVal;
|
||||||
|
SetZoomMinMax(m_MinValue+Shift,m_MaxValue+Shift);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartAxis::SetZoomMinMax(double Minimum, double Maximum)
|
||||||
|
{
|
||||||
|
if (!m_bZoomEnabled)
|
||||||
|
return;
|
||||||
|
if (m_MinValue == m_MaxValue)
|
||||||
|
return;
|
||||||
|
|
||||||
|
ASSERT(Maximum>=Minimum);
|
||||||
|
|
||||||
|
m_MinValue = Minimum;
|
||||||
|
if ( (Maximum - Minimum) < m_dZoomLimit)
|
||||||
|
m_MaxValue = m_MinValue + m_dZoomLimit;
|
||||||
|
else
|
||||||
|
m_MaxValue = Maximum;
|
||||||
|
RefreshScrollBar();
|
||||||
|
}
|
||||||
|
|
||||||
|
long CChartAxis::GetAxisLenght() const
|
||||||
|
{
|
||||||
|
long Length = (long)fabs( (m_EndPos-m_StartPos) * 1.0);
|
||||||
|
return Length;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartAxis::SetVisible(bool bVisible)
|
||||||
|
{
|
||||||
|
m_bIsVisible = bVisible;
|
||||||
|
m_pParentCtrl->RefreshCtrl();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartAxis::CreateScrollBar()
|
||||||
|
{
|
||||||
|
m_pScrollBar = new CChartScrollBar(this);
|
||||||
|
m_pScrollBar->CreateScrollBar(m_pParentCtrl->GetPlottingRect());
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartAxis::UpdateScrollBarPos()
|
||||||
|
{
|
||||||
|
CRect PlottingRect = m_pParentCtrl->GetPlottingRect();
|
||||||
|
PlottingRect.top++; PlottingRect.left++;
|
||||||
|
|
||||||
|
// TODO: check if other toolbars are already present
|
||||||
|
// on other axes.
|
||||||
|
CRect Temp;
|
||||||
|
m_pScrollBar->GetWindowRect(&Temp);
|
||||||
|
if (m_bIsHorizontal && !m_bIsSecondary)
|
||||||
|
PlottingRect.top = PlottingRect.bottom - Temp.Height();
|
||||||
|
if (!m_bIsHorizontal && !m_bIsSecondary)
|
||||||
|
PlottingRect.right = PlottingRect.left + Temp.Width();
|
||||||
|
if (m_bIsHorizontal && m_bIsSecondary)
|
||||||
|
PlottingRect.bottom = PlottingRect.top + Temp.Height();
|
||||||
|
if (!m_bIsHorizontal && m_bIsSecondary)
|
||||||
|
PlottingRect.left = PlottingRect.right - Temp.Width();
|
||||||
|
|
||||||
|
m_pScrollBar->MoveWindow(&PlottingRect);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartAxis::RefreshScrollBar()
|
||||||
|
{
|
||||||
|
if (m_pScrollBar)
|
||||||
|
m_pScrollBar->Refresh();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartAxis::SetTextColor(COLORREF NewColor)
|
||||||
|
{
|
||||||
|
m_TextColor = NewColor;
|
||||||
|
m_pParentCtrl->RefreshCtrl();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartAxis::SetAxisColor(COLORREF NewColor)
|
||||||
|
{
|
||||||
|
m_AxisColor = NewColor;
|
||||||
|
m_pParentCtrl->RefreshCtrl();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartAxis::SetFont(int nPointSize,
|
||||||
|
const TChartString& strFaceName)
|
||||||
|
{
|
||||||
|
m_nFontSize = nPointSize;
|
||||||
|
m_strFontName = strFaceName;
|
||||||
|
m_pParentCtrl->RefreshCtrl();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartAxis::SetMarginSize(bool bAuto, int iNewSize)
|
||||||
|
{
|
||||||
|
m_bAutoMargin = bAuto;
|
||||||
|
m_iMarginSize = iNewSize;
|
||||||
|
m_pParentCtrl->RefreshCtrl();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartAxis::EnableScrollBar(bool bEnabled)
|
||||||
|
{
|
||||||
|
if (m_pScrollBar)
|
||||||
|
{
|
||||||
|
m_pScrollBar->SetEnabled(bEnabled);
|
||||||
|
if (bEnabled)
|
||||||
|
m_pScrollBar->ShowWindow(SW_SHOW);
|
||||||
|
else
|
||||||
|
m_pScrollBar->ShowWindow(SW_HIDE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartAxis::SetAutoHideScrollBar(bool bAutoHide)
|
||||||
|
{
|
||||||
|
if (m_pScrollBar)
|
||||||
|
m_pScrollBar->SetAutoHide(bAutoHide);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CChartAxis::GetAutoHideScrollBar() const
|
||||||
|
{
|
||||||
|
if (m_pScrollBar)
|
||||||
|
return (m_pScrollBar->GetAutoHide());
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartAxis::UndoZoom()
|
||||||
|
{
|
||||||
|
SetMinMax(m_UnzoomMin,m_UnzoomMax);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartAxis::SetAxisSize(const CRect& ControlRect,
|
||||||
|
const CRect& MarginRect)
|
||||||
|
{
|
||||||
|
if (m_bIsHorizontal)
|
||||||
|
{
|
||||||
|
m_StartPos = MarginRect.left;
|
||||||
|
m_EndPos = MarginRect.right;
|
||||||
|
|
||||||
|
if (!m_bIsSecondary)
|
||||||
|
{
|
||||||
|
m_AxisRect = ControlRect;
|
||||||
|
m_AxisRect.top = MarginRect.bottom;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_AxisRect = ControlRect;
|
||||||
|
m_AxisRect.bottom = MarginRect.top;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_StartPos = MarginRect.bottom;
|
||||||
|
m_EndPos = MarginRect.top;
|
||||||
|
|
||||||
|
if (!m_bIsSecondary)
|
||||||
|
{
|
||||||
|
m_AxisRect = ControlRect;
|
||||||
|
m_AxisRect.right = MarginRect.left;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_AxisRect = ControlRect;
|
||||||
|
m_AxisRect.left = MarginRect.right;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int CChartAxis::ClipMargin(CRect ControlRect, CRect& MarginRect,CDC* pDC)
|
||||||
|
{
|
||||||
|
if (!m_bIsVisible)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
int Size = 0;
|
||||||
|
CSize TickSize = GetLargestTick(pDC);
|
||||||
|
CSize LabelSize = m_pAxisLabel->GetSize(pDC);
|
||||||
|
|
||||||
|
if (m_bIsHorizontal)
|
||||||
|
{
|
||||||
|
if (!m_bAutoMargin)
|
||||||
|
Size = m_iMarginSize;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Size += 4 + 2; //Space above and under the text
|
||||||
|
|
||||||
|
Size += TickSize.cy;
|
||||||
|
Size += LabelSize.cy;
|
||||||
|
|
||||||
|
m_iMarginSize = Size;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!m_bIsSecondary)
|
||||||
|
{
|
||||||
|
ControlRect.bottom -= Size;
|
||||||
|
ControlRect.right -= TickSize.cx/2+3;
|
||||||
|
|
||||||
|
if (ControlRect.bottom < MarginRect.bottom)
|
||||||
|
MarginRect.bottom = ControlRect.bottom;
|
||||||
|
if (ControlRect.right < MarginRect.right)
|
||||||
|
MarginRect.right = ControlRect.right;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ControlRect.top += Size;
|
||||||
|
ControlRect.right -= TickSize.cx/2+3;
|
||||||
|
|
||||||
|
if (ControlRect.top > MarginRect.top)
|
||||||
|
MarginRect.top = ControlRect.top;
|
||||||
|
if (ControlRect.right < MarginRect.right)
|
||||||
|
MarginRect.right = ControlRect.right;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (!m_bAutoMargin)
|
||||||
|
Size = m_iMarginSize;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Size += 7 + 1; //Space before and after the text + Tick
|
||||||
|
|
||||||
|
Size += TickSize.cx;
|
||||||
|
Size += LabelSize.cx + 2;
|
||||||
|
m_iMarginSize = Size;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!m_bIsSecondary)
|
||||||
|
{
|
||||||
|
ControlRect.left += Size;
|
||||||
|
ControlRect.top += TickSize.cy/2+3;
|
||||||
|
|
||||||
|
if (ControlRect.top > MarginRect.top)
|
||||||
|
MarginRect.top = ControlRect.top;
|
||||||
|
if (ControlRect.left > MarginRect.left)
|
||||||
|
MarginRect.left = ControlRect.left;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ControlRect.right -= Size;
|
||||||
|
ControlRect.top += TickSize.cy/2+3;
|
||||||
|
|
||||||
|
if (ControlRect.top > MarginRect.top)
|
||||||
|
MarginRect.top = ControlRect.top;
|
||||||
|
if (ControlRect.right < MarginRect.right)
|
||||||
|
MarginRect.right = ControlRect.right;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return Size;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartAxis::Recalculate()
|
||||||
|
{
|
||||||
|
if (m_bAutoTicks)
|
||||||
|
RefreshTickIncrement();
|
||||||
|
RefreshFirstTick();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartAxis::GetScrollbarSteps(int& iTotalSteps,
|
||||||
|
int& iCurrentStep)
|
||||||
|
{
|
||||||
|
double SeriesMin=0, SeriesMax=0;
|
||||||
|
GetSeriesMinMax(SeriesMin,SeriesMax);
|
||||||
|
|
||||||
|
if ((m_MaxValue-m_MinValue) == 0 || (SeriesMax-SeriesMin)==0 )
|
||||||
|
{
|
||||||
|
iTotalSteps = 1;
|
||||||
|
iCurrentStep = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
double dStep = (m_MaxValue - m_MinValue) / 10.0;
|
||||||
|
iTotalSteps = (int)ceil((SeriesMax - SeriesMin)/dStep);
|
||||||
|
iCurrentStep = (int)(iTotalSteps * ((m_MinValue - SeriesMin)/(SeriesMax-SeriesMin)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartAxis::SetAxisToScrollStep(int iPreviousStep,
|
||||||
|
int iCurrentStep,
|
||||||
|
bool bScrollInverted)
|
||||||
|
{
|
||||||
|
double dStep = (m_MaxValue - m_MinValue) / 10.0;
|
||||||
|
double dOffset = (iCurrentStep - iPreviousStep) * dStep;
|
||||||
|
if (bScrollInverted)
|
||||||
|
SetZoomMinMax(m_MinValue-dOffset,m_MaxValue-dOffset);
|
||||||
|
else
|
||||||
|
SetZoomMinMax(m_MinValue+dOffset,m_MaxValue+dOffset);
|
||||||
|
m_pParentCtrl->RefreshScreenAutoAxes();
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL CChartAxis::IsPointInside(const CPoint& screenPoint) const
|
||||||
|
{
|
||||||
|
return m_AxisRect.PtInRect(screenPoint);
|
||||||
|
}
|
|
@ -0,0 +1,526 @@
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
* ChartAxis.h
|
||||||
|
*
|
||||||
|
* Written by Cédric Moonen (cedric_moonen@hotmail.com)
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* This code may be used for any non-commercial and commercial purposes in a compiled form.
|
||||||
|
* The code may be redistributed as long as it remains unmodified and providing that the
|
||||||
|
* author name and this disclaimer remain intact. The sources can be modified WITH the author
|
||||||
|
* consent only.
|
||||||
|
*
|
||||||
|
* This code is provided without any garanties. I cannot be held responsible for the damage or
|
||||||
|
* the loss of time it causes. Use it at your own risks
|
||||||
|
*
|
||||||
|
* An e-mail to notify me that you are using this code is appreciated also.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _CHARTAXIS_H_
|
||||||
|
#define _CHARTAXIS_H_
|
||||||
|
|
||||||
|
#include "ChartScrollBar.h"
|
||||||
|
#include "ChartString.h"
|
||||||
|
#include <afx.h>
|
||||||
|
|
||||||
|
#include <list>
|
||||||
|
|
||||||
|
class CChartCtrl;
|
||||||
|
class CChartGrid;
|
||||||
|
class CChartSerie;
|
||||||
|
class CChartAxisLabel;
|
||||||
|
|
||||||
|
//! Base class that takes care of the management of a chart axis.
|
||||||
|
/**
|
||||||
|
This class cannot be instanciated but should be overriden in order
|
||||||
|
to provide the required functionality (this is already done for
|
||||||
|
standard axis, date/time axis and logarithmic axis).<br>
|
||||||
|
The class provides already a lot of functionalities but delegate the
|
||||||
|
ticks positioning and labeling to the child classes.<br>
|
||||||
|
By default, the class manages a continues range of double values (which
|
||||||
|
is the case for standard axis and date/time axis) but in some cases, this
|
||||||
|
is not valid (for instance, a logarithmic scale). In that case, you should
|
||||||
|
in addition override some specific functions (e.g. those handling the scrollbar).
|
||||||
|
Take a look at the CChartLogarithmicAxis class for more details.
|
||||||
|
**/
|
||||||
|
class CChartAxis
|
||||||
|
{
|
||||||
|
friend CChartCtrl;
|
||||||
|
friend CChartGrid;
|
||||||
|
friend CChartSerie;
|
||||||
|
friend CChartScrollBar;
|
||||||
|
|
||||||
|
public:
|
||||||
|
//! Default constructor
|
||||||
|
CChartAxis();
|
||||||
|
//! Default destructor
|
||||||
|
virtual ~CChartAxis();
|
||||||
|
|
||||||
|
//! Retrieves the position (in %) of the axis.
|
||||||
|
int GetPosition();
|
||||||
|
|
||||||
|
//! Sets the axis in reverse.
|
||||||
|
/**
|
||||||
|
For an inverted axis, the values on the axis are
|
||||||
|
in decreasing order.
|
||||||
|
@param bInverted
|
||||||
|
true if the axis has to be inverted.
|
||||||
|
**/
|
||||||
|
void SetInverted(bool bInverted);
|
||||||
|
//! Retrieves if the axis is inverted or not.
|
||||||
|
bool IsInverted() const { return m_bIsInverted; }
|
||||||
|
|
||||||
|
//! Sets the axis in automatic or manual mode.
|
||||||
|
/**
|
||||||
|
In automatic mode, the axis min and max will be updated
|
||||||
|
depending on the series related to this axis.
|
||||||
|
@param bAutomatic
|
||||||
|
true if the axis should be automatic.
|
||||||
|
@deprecated You should use the SetAutomaticType instead.
|
||||||
|
**/
|
||||||
|
void SetAutomatic(bool bAutomatic);
|
||||||
|
//! Returns true if an automatic mode has been set on this axis.
|
||||||
|
/**
|
||||||
|
@deprecated You should use the GetAutomaticType instead.
|
||||||
|
**/
|
||||||
|
bool IsAutomatic() const { return m_AutoMode != NotAutomatic; }
|
||||||
|
|
||||||
|
//! The different modes of automatic modes for an axis.
|
||||||
|
enum EAxisAutoModes
|
||||||
|
{
|
||||||
|
//! The axis min and max values are set manually
|
||||||
|
NotAutomatic,
|
||||||
|
//! The axis min and max values of the axis are the min and max values of all series associated with this axis. This corresponds to the "standard" automatic mode that was implemented before version 3.0.
|
||||||
|
FullAutomatic,
|
||||||
|
//! The axis min and max values of the axis are the <b>visible</b> min and max values of all series associated with this axis. The end result will then depends on how the other axes are configured.
|
||||||
|
ScreenAutomatic
|
||||||
|
};
|
||||||
|
|
||||||
|
//! Sets the automatic mode of the axis
|
||||||
|
void SetAutomaticMode(EAxisAutoModes AutoMode);
|
||||||
|
//! Gets the automatic type of the axis
|
||||||
|
EAxisAutoModes GetAutomaticMode() const { return m_AutoMode; }
|
||||||
|
|
||||||
|
//! Sets the axis visible/invisible.
|
||||||
|
void SetVisible(bool bVisible);
|
||||||
|
//! Retrieves the axis automatic mode.
|
||||||
|
bool IsVisible() const { return m_bIsVisible; }
|
||||||
|
|
||||||
|
//! Sets the axis min and max values.
|
||||||
|
/**
|
||||||
|
This doesn't take into account the real type of the axis,
|
||||||
|
so double values should be provided.
|
||||||
|
@param Minimum
|
||||||
|
The min value of the axis
|
||||||
|
@param Maximum
|
||||||
|
The max value of the axis.
|
||||||
|
**/
|
||||||
|
void SetMinMax(double Minimum, double Maximum);
|
||||||
|
//! Gets the min anx max values of the axis.
|
||||||
|
void GetMinMax(double& Minimum, double& Maximum) const
|
||||||
|
{
|
||||||
|
Minimum = m_MinValue;
|
||||||
|
Maximum = m_MaxValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
//! Sets the axis color.
|
||||||
|
void SetAxisColor(COLORREF NewColor);
|
||||||
|
//! Sets the tick labels color.
|
||||||
|
void SetTextColor(COLORREF NewColor);
|
||||||
|
//! Gets the tick labels color.
|
||||||
|
COLORREF GetTextColor() const { return m_TextColor; }
|
||||||
|
//! Sets the tick labels font
|
||||||
|
/**
|
||||||
|
@param nPointSize
|
||||||
|
The font point size
|
||||||
|
@param strFaceName
|
||||||
|
The font face name
|
||||||
|
**/
|
||||||
|
void SetFont(int nPointSize, const TChartString& strFaceName);
|
||||||
|
|
||||||
|
//! Retrieves the chart axis label object
|
||||||
|
CChartAxisLabel* GetLabel() const { return m_pAxisLabel; }
|
||||||
|
//! Retrieves the chart axis grid object
|
||||||
|
CChartGrid* GetGrid() const { return m_pAxisGrid; }
|
||||||
|
|
||||||
|
//! Sets the margin size
|
||||||
|
/**
|
||||||
|
@param bAuto
|
||||||
|
Specifies if the margin size is automatic or not.
|
||||||
|
In automatic mode, the iNewSize parameter is ignored
|
||||||
|
and the margin size is calculated automatically.
|
||||||
|
@param iNewSize
|
||||||
|
The new size of the margin, in manual mode.
|
||||||
|
**/
|
||||||
|
void SetMarginSize(bool bAuto, int iNewSize);
|
||||||
|
|
||||||
|
//! Enable the pan and zoom for this axis.
|
||||||
|
void SetPanZoomEnabled(bool bEnabled) { m_bZoomEnabled = bEnabled; }
|
||||||
|
//! Sets the zoom limit.
|
||||||
|
/**
|
||||||
|
The zoom limit is the minimum lenght (in values) of the axis.
|
||||||
|
**/
|
||||||
|
void SetZoomLimit(double dLimit) { m_dZoomLimit = dLimit; }
|
||||||
|
|
||||||
|
//! Enables/disables the scroll bar.
|
||||||
|
void EnableScrollBar(bool bEnabled);
|
||||||
|
//! Retrieves if the scroll bar is enabled or not.
|
||||||
|
bool ScrollBarEnabled() const
|
||||||
|
{
|
||||||
|
if (m_pScrollBar)
|
||||||
|
return (m_pScrollBar->GetEnabled());
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
//! Specifies if the scroll bar is in auto-hide mode.
|
||||||
|
/**
|
||||||
|
In auto-hide mode, the scroll bar will be hidden until
|
||||||
|
you hover the mouse over it.
|
||||||
|
**/
|
||||||
|
void SetAutoHideScrollBar(bool bAutoHide);
|
||||||
|
//! Retrieves if the scroll bar is in auto-hide mode.
|
||||||
|
bool GetAutoHideScrollBar() const;
|
||||||
|
|
||||||
|
//! Sets the axis in discrete mode
|
||||||
|
/**
|
||||||
|
@param bDiscrete
|
||||||
|
true if the axis has to be discrete, false otherwise.
|
||||||
|
In discrete mode, the axis doesn't have a continuous range of values
|
||||||
|
but only steps which are defined by the tick interval. In this mode,
|
||||||
|
you won't be able to plot points at a different location that in the
|
||||||
|
middle of two ticks. For instance, if you have a tick interval of 1.0,
|
||||||
|
trying to plot a value of 0.9 will display the point at the same position
|
||||||
|
as if the value was 0.3: it will be displayed in the middle of tick 0.0 and
|
||||||
|
tick 1.0.
|
||||||
|
<br>It is mainly used to display the tick label in the middle of two ticks.
|
||||||
|
This is for instance nice with date/time axis.
|
||||||
|
**/
|
||||||
|
virtual void SetDiscrete(bool bDiscrete);
|
||||||
|
|
||||||
|
//! Converts a value on the axis to a screen position
|
||||||
|
/**
|
||||||
|
The functions takes care of the discrete mode (internally,
|
||||||
|
it calls ValueToScreenStandard or ValueToScreenDiscrete
|
||||||
|
depending on the discrete mode).
|
||||||
|
@param Value
|
||||||
|
The value to convert
|
||||||
|
@return the screen position of the value
|
||||||
|
**/
|
||||||
|
long ValueToScreen(double Value) const;
|
||||||
|
//! Converts a screen position to a value on the axis
|
||||||
|
/**
|
||||||
|
The function is implemented for an axis with a standard
|
||||||
|
behavior (the axis shows a continuous range of doubles).
|
||||||
|
It is the case for standard axis and date/time axis (date
|
||||||
|
are converted to doubles internally). Axis that needs a different
|
||||||
|
behavior should override this function (e.g. a logarithmic axis).
|
||||||
|
The function does not take care of the discrete mode.
|
||||||
|
@param ScreenVal
|
||||||
|
The screen value to convert
|
||||||
|
@return the double value
|
||||||
|
**/
|
||||||
|
virtual double ScreenToValue(long ScreenVal) const;
|
||||||
|
|
||||||
|
//! Returns true if the axis is horizontal
|
||||||
|
bool IsHorizontal() const { return m_bIsHorizontal; }
|
||||||
|
|
||||||
|
//! Returns true if a screen point is in the region of the axis.
|
||||||
|
BOOL IsPointInside(const CPoint& screenPoint) const;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
//! Returns the first tick value.
|
||||||
|
/**
|
||||||
|
This pure virtual function must be implemented for specific
|
||||||
|
axes type.
|
||||||
|
**/
|
||||||
|
virtual double GetFirstTickValue() const = 0;
|
||||||
|
//! Retrieves the next tick value after a given tick.
|
||||||
|
/**
|
||||||
|
This pure virtual function must be implemented for specific
|
||||||
|
axes type.
|
||||||
|
@param dCurrentTick
|
||||||
|
The value of the current tick
|
||||||
|
@param dNextTick
|
||||||
|
The value of the next tick will be stored in this parameter
|
||||||
|
@return true if there is a next or false when the current tick is the last one.
|
||||||
|
**/
|
||||||
|
virtual bool GetNextTickValue(double dCurrentTick, double& dNextTick) const = 0;
|
||||||
|
//! Retrieves the screen position of a certain tick.
|
||||||
|
/**
|
||||||
|
This pure virtual function must be implemented for specific
|
||||||
|
axes type.
|
||||||
|
@param Value
|
||||||
|
The value of the tick for which we want to retrieve the position
|
||||||
|
@return
|
||||||
|
the screen position of the tick
|
||||||
|
**/
|
||||||
|
virtual long GetTickPos(double Value) const = 0;
|
||||||
|
//! Converts a value on the axis to a screen position.
|
||||||
|
/**
|
||||||
|
This function is called internally only when the axis is in
|
||||||
|
discrete mode. This pure virtual function must be implemented for specific
|
||||||
|
axes type.
|
||||||
|
@param Value
|
||||||
|
The value to convert
|
||||||
|
@return the screen position of the value
|
||||||
|
**/
|
||||||
|
virtual long ValueToScreenDiscrete(double Value) const = 0;
|
||||||
|
//! Converts a value on the axis to a screen position.
|
||||||
|
/**
|
||||||
|
This function is called internally only when the axis is in
|
||||||
|
standard mode. This virtual function can be overriden when the
|
||||||
|
axis doesn't display a continuous range of values (e.g. log axis).
|
||||||
|
@param Value
|
||||||
|
The value to convert
|
||||||
|
@return the screen position of the value
|
||||||
|
**/
|
||||||
|
virtual long ValueToScreenStandard(double Value) const;
|
||||||
|
|
||||||
|
//! Retrieves the label for a specific tick.
|
||||||
|
/**
|
||||||
|
This pure virtual function must be implemented for specific
|
||||||
|
axes type.
|
||||||
|
@param TickValue
|
||||||
|
The tick value for which we need to get the label.
|
||||||
|
@return A TChartString containing the label for the tick.
|
||||||
|
**/
|
||||||
|
virtual TChartString GetTickLabel(double TickValue) const = 0;
|
||||||
|
|
||||||
|
//! Forces a recalculation of the tick increment.
|
||||||
|
virtual void RefreshTickIncrement() = 0;
|
||||||
|
//! Forces a recalculation of the first tick value.
|
||||||
|
virtual void RefreshFirstTick() = 0;
|
||||||
|
|
||||||
|
//! Retrieves the step information related to the scrollbar.
|
||||||
|
/**
|
||||||
|
This function can be implemented for specific axis types which
|
||||||
|
should provide a behavior different than the standard behavior
|
||||||
|
(for instance log axis).
|
||||||
|
@param iTotalSteps
|
||||||
|
Stores the total number of steps for the scrollbar
|
||||||
|
@param iCurrentStep
|
||||||
|
Stores the current step index for the scrollbar
|
||||||
|
**/
|
||||||
|
virtual void GetScrollbarSteps(int& iTotalSteps, int& iCurrentStep);
|
||||||
|
//! Sets the axis to the specified scrollbar step.
|
||||||
|
/**
|
||||||
|
This function can be implemented for specific axis types which
|
||||||
|
should provide a behavior different than the standard behavior
|
||||||
|
(for instance log axis).
|
||||||
|
@param iPreviousStep
|
||||||
|
The previous scroll step.
|
||||||
|
@param iCurrentStep
|
||||||
|
The current scroll step to which the axis should be moved.
|
||||||
|
@param bScrollInverted
|
||||||
|
Specifies if the scroll is inverted or not.
|
||||||
|
**/
|
||||||
|
virtual void SetAxisToScrollStep(int iPreviousStep, int iCurrentStep, bool bScrollInverted);
|
||||||
|
|
||||||
|
//! Pan the axis
|
||||||
|
/**
|
||||||
|
This function can be overriden in case the axis doesn't display
|
||||||
|
a continuous range of values (e.g. log axis).
|
||||||
|
@param PanStart
|
||||||
|
The position of the start of the pan
|
||||||
|
@param PanEnd
|
||||||
|
The position of the end of the pan
|
||||||
|
**/
|
||||||
|
virtual void PanAxis(long PanStart, long PanEnd);
|
||||||
|
//! Sets the min and max values of the axis due to a zoom operation.
|
||||||
|
virtual void SetZoomMinMax(double Minimum, double Maximum);
|
||||||
|
//! Reverts the zoom and pan settings.
|
||||||
|
void UndoZoom();
|
||||||
|
|
||||||
|
//! Retrieves the lenght (in pixels) of the axis
|
||||||
|
long GetAxisLenght() const;
|
||||||
|
//! Retrieves the min and max values for all the series related to this axis
|
||||||
|
void GetSeriesMinMax(double& Minimum, double& Maximum);
|
||||||
|
//! Retrieves the screen min and max values for all the series related to this axis
|
||||||
|
void GetSeriesScreenMinMax(double& Minimum, double& Maximum);
|
||||||
|
|
||||||
|
private:
|
||||||
|
//! Refresh the axis if it is automatic
|
||||||
|
/**
|
||||||
|
@return true if the axis has changed
|
||||||
|
**/
|
||||||
|
bool RefreshAutoAxis();
|
||||||
|
//! Refresh the axis if it is automatic for the screen only
|
||||||
|
/**
|
||||||
|
@return true if the axis has changed
|
||||||
|
**/
|
||||||
|
bool RefreshScreenAutoAxis();
|
||||||
|
|
||||||
|
//! Returns the largest tick width and the largest tick heigh.
|
||||||
|
/**
|
||||||
|
The function returns a CSize object for which the x value
|
||||||
|
is the largest width and the y value is the largest height.
|
||||||
|
They do not necessarily belong to the same tick.
|
||||||
|
**/
|
||||||
|
CSize GetLargestTick(CDC* pDC);
|
||||||
|
|
||||||
|
//! Sets the axis as a secondary axis.
|
||||||
|
/**
|
||||||
|
A secondary axis is on top for horizontal axis and on the
|
||||||
|
right for vertical axis.
|
||||||
|
**/
|
||||||
|
void SetSecondary(bool bSecondary) { m_bIsSecondary = bSecondary; }
|
||||||
|
//! Returns true if the axis is secondary.
|
||||||
|
bool IsSecondary() const { return m_bIsSecondary; }
|
||||||
|
//! Sets the axis to horizontal/vertical
|
||||||
|
void SetHorizontal(bool bHorizontal);
|
||||||
|
|
||||||
|
//! Draw the axis on the chart
|
||||||
|
/**
|
||||||
|
@param pDC
|
||||||
|
The DC used to draw the axis.
|
||||||
|
**/
|
||||||
|
void Draw(CDC* pDC);
|
||||||
|
//! Draw the axis label
|
||||||
|
/**
|
||||||
|
@param pDC
|
||||||
|
The DC used to draw the axis.
|
||||||
|
**/
|
||||||
|
void DrawLabel(CDC* pDC);
|
||||||
|
//! Draw a specific tick on the axis.
|
||||||
|
/**
|
||||||
|
@param pDC
|
||||||
|
The DC used to draw the axis.
|
||||||
|
@param dTickVal
|
||||||
|
The tick value.
|
||||||
|
The tick label will be drawn on the tick or between two ticks
|
||||||
|
depending if the axis is set as standard or discrete.
|
||||||
|
**/
|
||||||
|
void DrawTick(CDC* pDC, double dTickVal);
|
||||||
|
//! Check whether a specific label is still on the axis.
|
||||||
|
/**
|
||||||
|
@param dTickVal
|
||||||
|
The tick value.
|
||||||
|
The function returns false if the label is outside
|
||||||
|
the axis range (and thus, should not be drawn).
|
||||||
|
**/
|
||||||
|
bool IsLabelOnAxis(double TickVal);
|
||||||
|
|
||||||
|
//! Register a series that is associated with this axis.
|
||||||
|
/**
|
||||||
|
This is used when the axis is in automatic mode.
|
||||||
|
**/
|
||||||
|
void RegisterSeries(CChartSerie* pSeries);
|
||||||
|
//! Unregister a series with this axis.
|
||||||
|
void UnregisterSeries(CChartSerie* pSeries);
|
||||||
|
|
||||||
|
//! Creates and attach a new scroll bar to the axis
|
||||||
|
void CreateScrollBar();
|
||||||
|
//! Update the scroll bar position depending on the plotting rect.
|
||||||
|
void UpdateScrollBarPos();
|
||||||
|
//! Refreshes the scroll bar.
|
||||||
|
void RefreshScrollBar();
|
||||||
|
|
||||||
|
//! Sets the parent charting control.
|
||||||
|
void SetParent(CChartCtrl* pParent);
|
||||||
|
|
||||||
|
//! Sets the axis size
|
||||||
|
/**
|
||||||
|
@param ControlRect
|
||||||
|
The rectangle of the control
|
||||||
|
@param MarginRect
|
||||||
|
The rectangle in which the axis should be contained
|
||||||
|
**/
|
||||||
|
void SetAxisSize(const CRect& ControlRect, const CRect& MarginRect);
|
||||||
|
//! Removes the margin needed for the axis from the full control rect.
|
||||||
|
/**
|
||||||
|
@param ControlRect
|
||||||
|
The rectangle of the control
|
||||||
|
@param MarginRect
|
||||||
|
The rectangle in which the axis should be contained
|
||||||
|
@param pDC
|
||||||
|
The CDC used to draw the axis.
|
||||||
|
**/
|
||||||
|
int ClipMargin(CRect ControlRect,CRect& MarginRect,CDC* pDC);
|
||||||
|
//! Recalculate the axis properties.
|
||||||
|
/**
|
||||||
|
This function simply calls RefreshTickIncrement and
|
||||||
|
RefreshFirstTick.
|
||||||
|
**/
|
||||||
|
void Recalculate();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
//! The parent chart control.
|
||||||
|
CChartCtrl* m_pParentCtrl;
|
||||||
|
|
||||||
|
//! Indicates if this is an horizontal or vertical axis
|
||||||
|
bool m_bIsHorizontal;
|
||||||
|
//! Indicates if the axis is inverted
|
||||||
|
bool m_bIsInverted;
|
||||||
|
//! Indicates if the axis is automatic
|
||||||
|
// bool m_bIsAutomatic;
|
||||||
|
//! Indicates the automatic mode of the axis
|
||||||
|
EAxisAutoModes m_AutoMode;
|
||||||
|
|
||||||
|
//! Indicates if the axis is visible or not
|
||||||
|
bool m_bIsVisible;
|
||||||
|
|
||||||
|
//! Specifies if the axis is secondary
|
||||||
|
/**
|
||||||
|
The secondary axis is either on the top (for horizontal
|
||||||
|
axis) or on the right (for vertical axis) of the chart.
|
||||||
|
**/
|
||||||
|
bool m_bIsSecondary;
|
||||||
|
|
||||||
|
//! The axis max value
|
||||||
|
double m_MaxValue;
|
||||||
|
//! The axis min value
|
||||||
|
double m_MinValue;
|
||||||
|
//! Min value of the axis before it has been zoomed
|
||||||
|
double m_UnzoomMin;
|
||||||
|
//! Max value of the axis before it has been zoomed
|
||||||
|
double m_UnzoomMax;
|
||||||
|
|
||||||
|
//! Specify if the tick increment is manual or automatic
|
||||||
|
bool m_bAutoTicks;
|
||||||
|
//! Specify if the axis has to be in discrete mode or not
|
||||||
|
bool m_bDiscrete;
|
||||||
|
|
||||||
|
//! Start position of the axis (in pixels)
|
||||||
|
int m_StartPos;
|
||||||
|
//! End position of the axis (in pixels)
|
||||||
|
int m_EndPos;
|
||||||
|
//! The rectangle in which the axis is contained.
|
||||||
|
CRect m_AxisRect;
|
||||||
|
|
||||||
|
private:
|
||||||
|
//! The font size used for the axis labels
|
||||||
|
int m_nFontSize;
|
||||||
|
//! The font face name used for the axis labels
|
||||||
|
TChartString m_strFontName;
|
||||||
|
//! The color used for the axis labels
|
||||||
|
COLORREF m_TextColor;
|
||||||
|
//! The color used for the axis line
|
||||||
|
COLORREF m_AxisColor;
|
||||||
|
|
||||||
|
//! The grid related to this axis
|
||||||
|
CChartGrid* m_pAxisGrid;
|
||||||
|
//! The axis label associated with this axis
|
||||||
|
CChartAxisLabel* m_pAxisLabel;
|
||||||
|
|
||||||
|
typedef std::list<CChartSerie*> SeriesList;
|
||||||
|
//! List containing pointers to series related to this axis
|
||||||
|
SeriesList m_pRelatedSeries;
|
||||||
|
|
||||||
|
//! Specify if the margin size is calculated automatically
|
||||||
|
bool m_bAutoMargin;
|
||||||
|
//! The margin size, used in manual mode
|
||||||
|
int m_iMarginSize;
|
||||||
|
|
||||||
|
//! Specifies if the zoom is enabled for this axis
|
||||||
|
bool m_bZoomEnabled;
|
||||||
|
//! The zoom limit (axis can't be zoomed under this limit)
|
||||||
|
double m_dZoomLimit;
|
||||||
|
|
||||||
|
//! The axis scrollbar
|
||||||
|
CChartScrollBar* m_pScrollBar;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // _CHARTAXIS_H_
|
|
@ -0,0 +1,157 @@
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
* ChartAxisLabel.cpp
|
||||||
|
*
|
||||||
|
* Written by Cédric Moonen (cedric_moonen@hotmail.com)
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* This code may be used for any non-commercial and commercial purposes in a compiled form.
|
||||||
|
* The code may be redistributed as long as it remains unmodified and providing that the
|
||||||
|
* author name and this disclaimer remain intact. The sources can be modified WITH the author
|
||||||
|
* consent only.
|
||||||
|
*
|
||||||
|
* This code is provided without any garanties. I cannot be held responsible for the damage or
|
||||||
|
* the loss of time it causes. Use it at your own risks
|
||||||
|
*
|
||||||
|
* An e-mail to notify me that you are using this code is appreciated also.
|
||||||
|
*
|
||||||
|
* History:
|
||||||
|
* - 24/08/2007: Bug fix in color of the label (text was always black)
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "stdafx.h"
|
||||||
|
#include "ChartAxisLabel.h"
|
||||||
|
#include "ChartCtrl.h"
|
||||||
|
|
||||||
|
#ifdef _DEBUG
|
||||||
|
#undef THIS_FILE
|
||||||
|
static char THIS_FILE[]=__FILE__;
|
||||||
|
#define new DEBUG_NEW
|
||||||
|
#endif
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
// Construction/Destruction
|
||||||
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
CChartAxisLabel::CChartAxisLabel()
|
||||||
|
: m_pParentCtrl(NULL), m_bIsVisible(true), m_TextColor(RGB(0,0,0)),
|
||||||
|
m_bIsHorizontal(true), m_Font(), m_strLabelText(_T(""))
|
||||||
|
{
|
||||||
|
m_Font.SetVertical(!m_bIsHorizontal);
|
||||||
|
}
|
||||||
|
|
||||||
|
CChartAxisLabel::~CChartAxisLabel()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartAxisLabel::SetVisible(bool bVisible)
|
||||||
|
{
|
||||||
|
m_bIsVisible = bVisible;
|
||||||
|
if (m_pParentCtrl)
|
||||||
|
m_pParentCtrl->RefreshCtrl();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartAxisLabel::SetColor(COLORREF NewColor)
|
||||||
|
{
|
||||||
|
m_TextColor = NewColor;
|
||||||
|
if (m_pParentCtrl)
|
||||||
|
m_pParentCtrl->RefreshCtrl();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartAxisLabel::SetText(const TChartString& NewText)
|
||||||
|
{
|
||||||
|
m_strLabelText = NewText;
|
||||||
|
if (m_pParentCtrl)
|
||||||
|
m_pParentCtrl->RefreshCtrl();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartAxisLabel::SetFont(int nPointSize, const TChartString& strFaceName)
|
||||||
|
{
|
||||||
|
m_Font.SetFont(strFaceName, nPointSize);
|
||||||
|
if (m_pParentCtrl)
|
||||||
|
m_pParentCtrl->RefreshCtrl();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartAxisLabel::SetHorizontal(bool bHorizontal)
|
||||||
|
{
|
||||||
|
m_bIsHorizontal = bHorizontal;
|
||||||
|
m_Font.SetVertical(!m_bIsHorizontal);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartAxisLabel::SetFont(const CChartFont& newFont)
|
||||||
|
{
|
||||||
|
m_Font = newFont;
|
||||||
|
if (m_pParentCtrl)
|
||||||
|
m_pParentCtrl->RefreshCtrl();
|
||||||
|
}
|
||||||
|
|
||||||
|
CSize CChartAxisLabel::GetSize(CDC *pDC) const
|
||||||
|
{
|
||||||
|
CSize LabelSize;
|
||||||
|
LabelSize.cx = 0;
|
||||||
|
LabelSize.cy = 0;
|
||||||
|
|
||||||
|
if (!m_bIsVisible)
|
||||||
|
return LabelSize;
|
||||||
|
if (!pDC->GetSafeHdc())
|
||||||
|
return LabelSize;
|
||||||
|
if (m_strLabelText == _T(""))
|
||||||
|
return LabelSize;
|
||||||
|
|
||||||
|
m_Font.SelectFont(pDC);
|
||||||
|
|
||||||
|
LabelSize = pDC->GetTextExtent(m_strLabelText.c_str());
|
||||||
|
LabelSize.cx += 4;
|
||||||
|
LabelSize.cy += 4;
|
||||||
|
if (!m_bIsHorizontal)
|
||||||
|
{
|
||||||
|
int Width = LabelSize.cy;
|
||||||
|
int Height = LabelSize.cx;
|
||||||
|
LabelSize.cx = Width;
|
||||||
|
LabelSize.cy = Height;
|
||||||
|
}
|
||||||
|
m_Font.UnselectFont(pDC);
|
||||||
|
|
||||||
|
return LabelSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartAxisLabel::Draw(CDC *pDC)
|
||||||
|
{
|
||||||
|
if (!m_bIsVisible)
|
||||||
|
return;
|
||||||
|
if (!pDC->GetSafeHdc())
|
||||||
|
return;
|
||||||
|
if (m_strLabelText == _T(""))
|
||||||
|
return;
|
||||||
|
|
||||||
|
int iPrevMode = pDC->SetBkMode(TRANSPARENT);
|
||||||
|
COLORREF OldColor = pDC->SetTextColor(m_TextColor);
|
||||||
|
|
||||||
|
m_Font.SelectFont(pDC);
|
||||||
|
if (!m_bIsHorizontal)
|
||||||
|
{
|
||||||
|
pDC->ExtTextOut(m_TextRect.left + 2,m_TextRect.top,
|
||||||
|
ETO_CLIPPED,NULL,m_strLabelText.c_str(),NULL);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pDC->ExtTextOut(m_TextRect.left,m_TextRect.top + 2,
|
||||||
|
ETO_CLIPPED,NULL,m_strLabelText.c_str(),NULL);
|
||||||
|
}
|
||||||
|
m_Font.UnselectFont(pDC);
|
||||||
|
|
||||||
|
pDC->SetBkMode(iPrevMode);
|
||||||
|
pDC->SetTextColor(OldColor);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartAxisLabel::SetPosition(int LeftBorder, int TopBorder, CDC *pDC)
|
||||||
|
{
|
||||||
|
CSize NewSize = GetSize(pDC);
|
||||||
|
m_TextRect.top = TopBorder;
|
||||||
|
m_TextRect.bottom = TopBorder + NewSize.cy;
|
||||||
|
m_TextRect.left = LeftBorder;
|
||||||
|
m_TextRect.right = LeftBorder + NewSize.cx;
|
||||||
|
}
|
|
@ -0,0 +1,112 @@
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
* ChartAxisLabel.h
|
||||||
|
*
|
||||||
|
* Written by Cédric Moonen (cedric_moonen@hotmail.com)
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* This code may be used for any non-commercial and commercial purposes in a compiled form.
|
||||||
|
* The code may be redistributed as long as it remains unmodified and providing that the
|
||||||
|
* author name and this disclaimer remain intact. The sources can be modified WITH the author
|
||||||
|
* consent only.
|
||||||
|
*
|
||||||
|
* This code is provided without any garanties. I cannot be held responsible for the damage or
|
||||||
|
* the loss of time it causes. Use it at your own risks
|
||||||
|
*
|
||||||
|
* An e-mail to notify me that you are using this code is appreciated also.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if !defined(AFX_CHARTAXISLABEL_H__0E5519C8_A2F4_4CED_9681_32A56B25D0C5__INCLUDED_)
|
||||||
|
#define AFX_CHARTAXISLABEL_H__0E5519C8_A2F4_4CED_9681_32A56B25D0C5__INCLUDED_
|
||||||
|
|
||||||
|
#if _MSC_VER > 1000
|
||||||
|
#pragma once
|
||||||
|
#endif // _MSC_VER > 1000
|
||||||
|
|
||||||
|
#include "ChartString.h"
|
||||||
|
#include "ChartFont.h"
|
||||||
|
|
||||||
|
class CChartCtrl;
|
||||||
|
class CChartAxis;
|
||||||
|
|
||||||
|
//! Draws the label of an axis
|
||||||
|
/**
|
||||||
|
The label axis is displayed under or next to the tick values.
|
||||||
|
The label is retrieved by calling CChartAxis::GetAxisLabel.
|
||||||
|
**/
|
||||||
|
class CChartAxisLabel
|
||||||
|
{
|
||||||
|
friend CChartAxis;
|
||||||
|
|
||||||
|
public:
|
||||||
|
//! Sets the text of the axis label.
|
||||||
|
void SetText(const TChartString& NewText);
|
||||||
|
//! Retrieves the text of the axis label.
|
||||||
|
TChartString GetText() const { return m_strLabelText; }
|
||||||
|
|
||||||
|
//! Sets the font of the text.
|
||||||
|
/**
|
||||||
|
@param nPointSize
|
||||||
|
The font point size.
|
||||||
|
@param strFaceName
|
||||||
|
The font face name ("Times New Roman", "Arial", ...)
|
||||||
|
**/
|
||||||
|
void SetFont(int nPointSize, const TChartString& strFaceName);
|
||||||
|
//! Sets the font of the text.
|
||||||
|
/**
|
||||||
|
This function allows to set extended font style by passing
|
||||||
|
a CChartFont object.
|
||||||
|
@param newFont
|
||||||
|
The new font.
|
||||||
|
**/
|
||||||
|
void SetFont(const CChartFont& newFont);
|
||||||
|
|
||||||
|
//! Shows/hides the title.
|
||||||
|
void SetVisible(bool bVisible);
|
||||||
|
//! Returns true if the title is visible.
|
||||||
|
bool IsVisible() const { return m_bIsVisible; }
|
||||||
|
|
||||||
|
//! Retrieves the text color.
|
||||||
|
COLORREF GetColor() const { return m_TextColor; }
|
||||||
|
//! Sets the text color.
|
||||||
|
void SetColor(COLORREF NewColor);
|
||||||
|
|
||||||
|
private:
|
||||||
|
//! Constructor
|
||||||
|
CChartAxisLabel();
|
||||||
|
//! Destructor
|
||||||
|
virtual ~CChartAxisLabel();
|
||||||
|
|
||||||
|
//! Sets in horizontal or vertical mode.
|
||||||
|
void SetHorizontal(bool bHorizontal);
|
||||||
|
//! Sets the position of the label.
|
||||||
|
void SetPosition(int LeftBorder, int TopBorder, CDC *pDC);
|
||||||
|
//! Draws the label.
|
||||||
|
void Draw(CDC* pDC);
|
||||||
|
//! Retrieves the size of the label.
|
||||||
|
CSize GetSize(CDC* pDC) const;
|
||||||
|
|
||||||
|
|
||||||
|
//! The parent charting control.
|
||||||
|
CChartCtrl* m_pParentCtrl;
|
||||||
|
//! Specifies if the label is visible or not.
|
||||||
|
bool m_bIsVisible;
|
||||||
|
|
||||||
|
//! The rectangle in which the label is displayed.
|
||||||
|
CRect m_TextRect;
|
||||||
|
//! The text color.
|
||||||
|
COLORREF m_TextColor;
|
||||||
|
|
||||||
|
//! Specifies if the axis is horizontal or not.
|
||||||
|
bool m_bIsHorizontal;
|
||||||
|
//! The font used for the text label.
|
||||||
|
CChartFont m_Font;
|
||||||
|
|
||||||
|
//! The string to display for the label.
|
||||||
|
TChartString m_strLabelText;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // !defined(AFX_CHARTAXISLABEL_H__0E5519C8_A2F4_4CED_9681_32A56B25D0C5__INCLUDED_)
|
|
@ -0,0 +1,101 @@
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
* ChartBalloonLabel.h
|
||||||
|
*
|
||||||
|
* Written by Cédric Moonen (cedric_moonen@hotmail.com)
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* This code may be used for any non-commercial and commercial purposes in a compiled form.
|
||||||
|
* The code may be redistributed as long as it remains unmodified and providing that the
|
||||||
|
* author name and this disclaimer remain intact. The sources can be modified WITH the author
|
||||||
|
* consent only.
|
||||||
|
*
|
||||||
|
* This code is provided without any garanties. I cannot be held responsible for the damage or
|
||||||
|
* the loss of time it causes. Use it at your own risks
|
||||||
|
*
|
||||||
|
* An e-mail to notify me that you are using this code is appreciated also.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _CHARTBALLOONLABEL_H_
|
||||||
|
#define _CHARTBALLOONLABEL_H_
|
||||||
|
|
||||||
|
#include "ChartLabel.h"
|
||||||
|
#include "ChartFont.h"
|
||||||
|
|
||||||
|
//! Specialization of the CChartLabel to display a balloon label.
|
||||||
|
/**
|
||||||
|
A balloon label is a label with a rounded rectangle area in which the
|
||||||
|
text is displayed and which is connected with a line to the point to
|
||||||
|
which it is attached.
|
||||||
|
**/
|
||||||
|
template <class PointType>
|
||||||
|
class CChartBalloonLabel : public CChartLabel<PointType>
|
||||||
|
{
|
||||||
|
friend CChartSerieBase<PointType>;
|
||||||
|
|
||||||
|
public:
|
||||||
|
//! Sets the background color of the text area.
|
||||||
|
void SetBackgroundColor(COLORREF colBackground);
|
||||||
|
//! Retrieves the background color of the text area.
|
||||||
|
COLORREF GetBackgroundColor() const { return m_colBackground; }
|
||||||
|
//! Sets the color of the line connecting the point to the text area.
|
||||||
|
void SetLineColor(COLORREF colArrow);
|
||||||
|
//! Retrieves the color of the line connecting the point to the text area.
|
||||||
|
COLORREF GetLineColor() const { return m_colLine; }
|
||||||
|
//! Sets the color of border's text area.
|
||||||
|
void SetBorderColor(COLORREF colBorder);
|
||||||
|
//! Retrieves the color of border's text area.
|
||||||
|
COLORREF GetBorderColor() const { return m_colBorder; }
|
||||||
|
|
||||||
|
//! Specifies if the text area is rounded or not.
|
||||||
|
void SetRoundedRect(bool bRounded);
|
||||||
|
//! Returns true if the text area is rounded.
|
||||||
|
bool GetRoundedRect() const { return m_bRoundedRect; }
|
||||||
|
|
||||||
|
//! Sets the font of the text.
|
||||||
|
/**
|
||||||
|
@param nPointSize
|
||||||
|
The font point size.
|
||||||
|
@param strFaceName
|
||||||
|
The font face name ("Times New Roman", "Arial", ...)
|
||||||
|
**/
|
||||||
|
void SetFont(int nPointSize, const TChartString& strFaceName);
|
||||||
|
//! Sets the font of the text.
|
||||||
|
/**
|
||||||
|
This function allows to set extended font style by passing
|
||||||
|
a CChartFont object.
|
||||||
|
@param newFont
|
||||||
|
The new font.
|
||||||
|
**/
|
||||||
|
void SetFont(const CChartFont& newFont);
|
||||||
|
|
||||||
|
//! Constructor
|
||||||
|
CChartBalloonLabel(CChartCtrl* pParentCtrl, CChartSerieBase<PointType>* pParentSeries);
|
||||||
|
//! Destructor
|
||||||
|
~CChartBalloonLabel();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
//! Draw the label.
|
||||||
|
void Draw(CDC* pDC, unsigned uPointIndex);
|
||||||
|
|
||||||
|
private:
|
||||||
|
//! Color of the liune connecting the point to the text area.
|
||||||
|
COLORREF m_colLine;
|
||||||
|
//! Color of the text area's background.
|
||||||
|
COLORREF m_colBackground;
|
||||||
|
//! Color of border's text area.
|
||||||
|
COLORREF m_colBorder;
|
||||||
|
|
||||||
|
//! The font used for the text label.
|
||||||
|
CChartFont m_Font;
|
||||||
|
|
||||||
|
//! Specifies if the rectangle is rounded or not.
|
||||||
|
bool m_bRoundedRect;
|
||||||
|
};
|
||||||
|
|
||||||
|
#include "ChartBalloonLabel.inl"
|
||||||
|
|
||||||
|
#endif // _CHARTBALLOONLABEL_H_
|
|
@ -0,0 +1,138 @@
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
* ChartBalloonLabel.cpp
|
||||||
|
*
|
||||||
|
* Written by Cédric Moonen (cedric_moonen@hotmail.com)
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* This code may be used for any non-commercial and commercial purposes in a compiled form.
|
||||||
|
* The code may be redistributed as long as it remains unmodified and providing that the
|
||||||
|
* author name and this disclaimer remain intact. The sources can be modified WITH the author
|
||||||
|
* consent only.
|
||||||
|
*
|
||||||
|
* This code is provided without any garanties. I cannot be held responsible for the damage or
|
||||||
|
* the loss of time it causes. Use it at your own risks
|
||||||
|
*
|
||||||
|
* An e-mail to notify me that you are using this code is appreciated also.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "ChartCtrl.h"
|
||||||
|
#include "ChartSerie.h"
|
||||||
|
#include "ChartBalloonLabel.h"
|
||||||
|
|
||||||
|
template<class PointType>
|
||||||
|
CChartBalloonLabel<PointType>::CChartBalloonLabel(CChartCtrl* pParentCtrl,
|
||||||
|
CChartSerieBase<PointType>* pParentSeries)
|
||||||
|
: CChartLabel(pParentCtrl, pParentSeries), m_bRoundedRect(true)
|
||||||
|
{
|
||||||
|
m_colBackground = RGB(255,255,225);
|
||||||
|
m_colLine = RGB(255,255,255);
|
||||||
|
m_colBorder = RGB(0,0,0);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class PointType>
|
||||||
|
CChartBalloonLabel<PointType>::~CChartBalloonLabel()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class PointType>
|
||||||
|
void CChartBalloonLabel<PointType>::SetBackgroundColor(COLORREF colBackground)
|
||||||
|
{
|
||||||
|
m_colBackground = colBackground;
|
||||||
|
m_pParentCtrl->RefreshCtrl();
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class PointType>
|
||||||
|
void CChartBalloonLabel<PointType>::SetLineColor(COLORREF colArrow)
|
||||||
|
{
|
||||||
|
m_colLine = colArrow;
|
||||||
|
m_pParentCtrl->RefreshCtrl();
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class PointType>
|
||||||
|
void CChartBalloonLabel<PointType>::SetBorderColor(COLORREF colBorder)
|
||||||
|
{
|
||||||
|
m_colBorder = colBorder;
|
||||||
|
m_pParentCtrl->RefreshCtrl();
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class PointType>
|
||||||
|
void CChartBalloonLabel<PointType>::SetRoundedRect(bool bRounded)
|
||||||
|
{
|
||||||
|
m_bRoundedRect = bRounded;
|
||||||
|
m_pParentCtrl->RefreshCtrl();
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class PointType>
|
||||||
|
void CChartBalloonLabel<PointType>::SetFont(int nPointSize, const TChartString& strFaceName)
|
||||||
|
{
|
||||||
|
m_Font.SetFont(strFaceName, nPointSize);
|
||||||
|
if (m_pParentCtrl)
|
||||||
|
m_pParentCtrl->RefreshCtrl();
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class PointType>
|
||||||
|
void CChartBalloonLabel<PointType>::SetFont(const CChartFont& newFont)
|
||||||
|
{
|
||||||
|
m_Font = newFont;
|
||||||
|
if (m_pParentCtrl)
|
||||||
|
m_pParentCtrl->RefreshCtrl();
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class PointType>
|
||||||
|
void CChartBalloonLabel<PointType>::Draw(CDC* pDC, unsigned uPointIndex)
|
||||||
|
{
|
||||||
|
if (m_pLabelProvider)
|
||||||
|
{
|
||||||
|
PointType Point = m_pParentSeries->GetPoint(uPointIndex);
|
||||||
|
m_strLabelText = m_pLabelProvider->GetText(m_pParentSeries, uPointIndex);
|
||||||
|
}
|
||||||
|
if (m_strLabelText == _T(""))
|
||||||
|
return;
|
||||||
|
|
||||||
|
CPoint screenPt = m_pParentSeries->GetPointScreenCoord(uPointIndex);
|
||||||
|
|
||||||
|
// Create the pen for the arrow
|
||||||
|
CPen newPen(PS_SOLID, 1, m_colLine);
|
||||||
|
CPen* pOldPen = pDC->SelectObject(&newPen);
|
||||||
|
|
||||||
|
// Draw first the arrow
|
||||||
|
pDC->MoveTo(screenPt);
|
||||||
|
pDC->LineTo(screenPt.x,screenPt.y-20);
|
||||||
|
|
||||||
|
// Create and select a new pen for the border
|
||||||
|
newPen.DeleteObject();
|
||||||
|
newPen.CreatePen(PS_SOLID, 1, m_colBorder);
|
||||||
|
pDC->SelectObject(&newPen);
|
||||||
|
m_Font.SelectFont(pDC);
|
||||||
|
|
||||||
|
// Create the brush to fill the rectangle
|
||||||
|
CBrush newBrush(m_colBackground);
|
||||||
|
CBrush* pOldBrush = pDC->SelectObject(&newBrush);
|
||||||
|
|
||||||
|
// Calculate the size of the
|
||||||
|
CSize labelSize = pDC->GetTextExtent(m_strLabelText.c_str());
|
||||||
|
labelSize += CSize(10,10);
|
||||||
|
int x = screenPt.x;
|
||||||
|
int y = screenPt.y;
|
||||||
|
CRect labelRect(CPoint(x-labelSize.cx/2,y-19-labelSize.cy),labelSize);
|
||||||
|
|
||||||
|
// Draw the rectangle
|
||||||
|
if (m_bRoundedRect)
|
||||||
|
pDC->RoundRect(labelRect,CPoint(10,10));
|
||||||
|
else
|
||||||
|
pDC->Rectangle(labelRect);
|
||||||
|
|
||||||
|
// Draw the text
|
||||||
|
pDC->TextOut(labelRect.left+5,labelRect.top+5,m_strLabelText.c_str());
|
||||||
|
|
||||||
|
// Clean the objects
|
||||||
|
pDC->SelectObject(pOldPen);
|
||||||
|
pDC->SelectObject(pOldBrush);
|
||||||
|
newPen.DeleteObject();
|
||||||
|
newBrush.DeleteObject();
|
||||||
|
m_Font.UnselectFont(pDC);
|
||||||
|
}
|
|
@ -0,0 +1,392 @@
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
* ChartBarSerie.cpp
|
||||||
|
*
|
||||||
|
* Written by Cédric Moonen (cedric_moonen@hotmail.com)
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* This code may be used for any non-commercial and commercial purposes in a compiled form.
|
||||||
|
* The code may be redistributed as long as it remains unmodified and providing that the
|
||||||
|
* author name and this disclaimer remain intact. The sources can be modified WITH the author
|
||||||
|
* consent only.
|
||||||
|
*
|
||||||
|
* This code is provided without any garanties. I cannot be held responsible for the damage or
|
||||||
|
* the loss of time it causes. Use it at your own risks
|
||||||
|
*
|
||||||
|
* An e-mail to notify me that you are using this code is appreciated also.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "stdafx.h"
|
||||||
|
#include "ChartBarSerie.h"
|
||||||
|
#include "ChartCtrl.h"
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
int CChartBarSerie::m_iInterSpace = 0;
|
||||||
|
std::list<CChartBarSerie*> CChartBarSerie::m_lstBarSeries;
|
||||||
|
|
||||||
|
CChartBarSerie::CChartBarSerie(CChartCtrl* pParent)
|
||||||
|
: CChartXYSerie(pParent), m_iBarWidth(20), m_iBorderWidth(1),
|
||||||
|
m_BorderColor(RGB(0,0,0)), m_uGroupId(0), m_bGradient(true),
|
||||||
|
m_GradientColor(RGB(255,255,255)), m_GradientType(gtHorizontalDouble),
|
||||||
|
m_bHorizontal(false), m_dBaseLine(0), m_bAutoBaseLine(true), m_bStacked(false)
|
||||||
|
{
|
||||||
|
m_lstBarSeries.push_back(this);
|
||||||
|
m_iShadowDepth = 3;
|
||||||
|
m_bShadow = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
CChartBarSerie::~CChartBarSerie()
|
||||||
|
{
|
||||||
|
TBarSeriesList::iterator iter = m_lstBarSeries.begin();
|
||||||
|
while (iter!=m_lstBarSeries.end())
|
||||||
|
{
|
||||||
|
if ((*iter) == this)
|
||||||
|
iter = m_lstBarSeries.erase(iter);
|
||||||
|
else
|
||||||
|
iter++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartBarSerie::SetHorizontal(bool bHorizontal)
|
||||||
|
{
|
||||||
|
m_bHorizontal = bHorizontal;
|
||||||
|
if (m_bHorizontal)
|
||||||
|
SetSeriesOrdering(poYOrdering);
|
||||||
|
else
|
||||||
|
SetSeriesOrdering(poXOrdering);
|
||||||
|
m_pParentCtrl->RefreshCtrl();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartBarSerie::SetBorderColor(COLORREF BorderColor)
|
||||||
|
{
|
||||||
|
m_BorderColor = BorderColor;
|
||||||
|
m_pParentCtrl->RefreshCtrl();
|
||||||
|
}
|
||||||
|
void CChartBarSerie::SetBorderWidth(int Width)
|
||||||
|
{
|
||||||
|
m_iBorderWidth = Width;
|
||||||
|
m_pParentCtrl->RefreshCtrl();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartBarSerie::SetBarWidth(int Width)
|
||||||
|
{
|
||||||
|
m_iBarWidth = Width;
|
||||||
|
m_pParentCtrl->RefreshCtrl();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartBarSerie::SetGroupId(unsigned GroupId)
|
||||||
|
{
|
||||||
|
m_uGroupId = GroupId;
|
||||||
|
m_pParentCtrl->RefreshCtrl();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartBarSerie::ShowGradient(bool bShow)
|
||||||
|
{
|
||||||
|
m_bGradient = bShow;
|
||||||
|
m_pParentCtrl->RefreshCtrl();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartBarSerie::SetGradient(COLORREF GradientColor, EGradientType GradientType)
|
||||||
|
{
|
||||||
|
m_GradientColor = GradientColor;
|
||||||
|
m_GradientType = GradientType;
|
||||||
|
m_pParentCtrl->RefreshCtrl();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartBarSerie::SetStacked(bool bStacked)
|
||||||
|
{
|
||||||
|
m_bStacked = bStacked;
|
||||||
|
m_pParentCtrl->RefreshCtrl();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CChartBarSerie::IsStacked()
|
||||||
|
{
|
||||||
|
return m_bStacked;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartBarSerie::DrawBar(CDC* pDC, CBrush* pFillBrush, CBrush* pBorderBrush,
|
||||||
|
CRect BarRect)
|
||||||
|
{
|
||||||
|
if (m_bShadow)
|
||||||
|
{
|
||||||
|
CBrush ShadowBrush(m_ShadowColor);
|
||||||
|
CRect ShadowRect(BarRect);
|
||||||
|
ShadowRect.OffsetRect(m_iShadowDepth,m_iShadowDepth);
|
||||||
|
pDC->FillRect(ShadowRect,&ShadowBrush);
|
||||||
|
}
|
||||||
|
pDC->FillRect(BarRect,pBorderBrush);
|
||||||
|
|
||||||
|
CRect FillRect(BarRect);
|
||||||
|
FillRect.DeflateRect(m_iBorderWidth,m_iBorderWidth);
|
||||||
|
if (m_bGradient)
|
||||||
|
{
|
||||||
|
CChartGradient::DrawGradient(pDC,FillRect,m_SerieColor,m_GradientColor,
|
||||||
|
m_GradientType);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pDC->FillRect(FillRect,pFillBrush);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartBarSerie::Draw(CDC* pDC)
|
||||||
|
{
|
||||||
|
if (!m_bIsVisible)
|
||||||
|
return;
|
||||||
|
if (!pDC->GetSafeHdc())
|
||||||
|
return;
|
||||||
|
|
||||||
|
RefreshStackedCache();
|
||||||
|
int iMinorOffset = GetMinorOffset();
|
||||||
|
|
||||||
|
CRect TempClipRect(m_PlottingRect);
|
||||||
|
TempClipRect.DeflateRect(1,1);
|
||||||
|
pDC->SetBkMode(TRANSPARENT);
|
||||||
|
pDC->IntersectClipRect(TempClipRect);
|
||||||
|
|
||||||
|
CBrush BorderBrush(m_BorderColor);
|
||||||
|
CBrush FillBrush(m_SerieColor);
|
||||||
|
//Draw all points that haven't been drawn yet
|
||||||
|
for (m_uLastDrawnPoint;m_uLastDrawnPoint<(int)GetPointsCount();m_uLastDrawnPoint++)
|
||||||
|
{
|
||||||
|
CRect BarRect = GetBarRectangle(m_uLastDrawnPoint,iMinorOffset);
|
||||||
|
DrawBar(pDC, &FillBrush, &BorderBrush, BarRect);
|
||||||
|
}
|
||||||
|
|
||||||
|
pDC->SelectClipRgn(NULL);
|
||||||
|
DeleteObject(BorderBrush);
|
||||||
|
DeleteObject(FillBrush);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartBarSerie::DrawAll(CDC *pDC)
|
||||||
|
{
|
||||||
|
if (!m_bIsVisible)
|
||||||
|
return;
|
||||||
|
if (!pDC->GetSafeHdc())
|
||||||
|
return;
|
||||||
|
|
||||||
|
RefreshStackedCache();
|
||||||
|
int iMinorOffset = GetMinorOffset();
|
||||||
|
|
||||||
|
unsigned uFirst=0, uLast=0;
|
||||||
|
if (!GetVisiblePoints(uFirst,uLast))
|
||||||
|
return;
|
||||||
|
|
||||||
|
CRect TempClipRect(m_PlottingRect);
|
||||||
|
TempClipRect.DeflateRect(1,1);
|
||||||
|
if (uFirst>0)
|
||||||
|
uFirst--;
|
||||||
|
if (uLast<GetPointsCount()-1)
|
||||||
|
uLast++;
|
||||||
|
|
||||||
|
pDC->SetBkMode(TRANSPARENT);
|
||||||
|
pDC->IntersectClipRect(TempClipRect);
|
||||||
|
|
||||||
|
CBrush BorderBrush(m_BorderColor);
|
||||||
|
CBrush FillBrush(m_SerieColor);
|
||||||
|
for (m_uLastDrawnPoint=uFirst;m_uLastDrawnPoint<=uLast;m_uLastDrawnPoint++)
|
||||||
|
{
|
||||||
|
CRect BarRect = GetBarRectangle(m_uLastDrawnPoint,iMinorOffset);
|
||||||
|
DrawBar(pDC, &FillBrush, &BorderBrush, BarRect);
|
||||||
|
}
|
||||||
|
|
||||||
|
pDC->SelectClipRgn(NULL);
|
||||||
|
DeleteObject(BorderBrush);
|
||||||
|
DeleteObject(FillBrush);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartBarSerie::DrawLegend(CDC* pDC, const CRect& rectBitmap) const
|
||||||
|
{
|
||||||
|
if (m_strSerieName== _T(""))
|
||||||
|
return;
|
||||||
|
|
||||||
|
//Draw bar:
|
||||||
|
CBrush BorderBrush(m_BorderColor);
|
||||||
|
pDC->FillRect(rectBitmap,&BorderBrush);
|
||||||
|
|
||||||
|
CRect FillRect(rectBitmap);
|
||||||
|
CBrush FillBrush(m_SerieColor);
|
||||||
|
FillRect.DeflateRect(m_iBorderWidth,m_iBorderWidth);
|
||||||
|
if (m_bGradient)
|
||||||
|
{
|
||||||
|
CChartGradient::DrawGradient(pDC,FillRect,m_SerieColor,m_GradientColor,m_GradientType);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pDC->FillRect(FillRect,&FillBrush);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CChartBarSerie::IsPointOnSerie(const CPoint& screenPoint, unsigned& uIndex) const
|
||||||
|
{
|
||||||
|
uIndex = INVALID_POINT;
|
||||||
|
if (!m_bIsVisible)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
RefreshStackedCache();
|
||||||
|
int iMinorOffset = GetMinorOffset();
|
||||||
|
|
||||||
|
unsigned uFirst=0, uLast=0;
|
||||||
|
if (!GetVisiblePoints(uFirst,uLast))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
bool bResult = false;
|
||||||
|
for (unsigned i=uFirst ; i < uLast ; i++)
|
||||||
|
{
|
||||||
|
CRect BarRect = GetBarRectangle(i,iMinorOffset);
|
||||||
|
if (BarRect.PtInRect(screenPoint))
|
||||||
|
{
|
||||||
|
bResult = true;
|
||||||
|
uIndex = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return bResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
int CChartBarSerie::GetMinorOffset() const
|
||||||
|
{
|
||||||
|
int iOffset = 0;
|
||||||
|
int iTotalWidth = 0;
|
||||||
|
int iLargestStacked = 0;
|
||||||
|
bool bFound = false;
|
||||||
|
|
||||||
|
TBarSeriesList::const_iterator iter = m_lstBarSeries.begin();
|
||||||
|
for (iter; iter!=m_lstBarSeries.end(); iter++)
|
||||||
|
{
|
||||||
|
// Skip the series with a different group Id
|
||||||
|
if ((*iter)->GetGroupId() != m_uGroupId)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if ((*iter)->IsStacked() )
|
||||||
|
{
|
||||||
|
if ((*iter)->GetBarWidth() > iLargestStacked)
|
||||||
|
iLargestStacked = (*iter)->GetBarWidth();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (!bFound)
|
||||||
|
{
|
||||||
|
if ((*iter)==this)
|
||||||
|
bFound = true;
|
||||||
|
else
|
||||||
|
iOffset += (*iter)->GetBarWidth() + m_iInterSpace;
|
||||||
|
}
|
||||||
|
iTotalWidth += (*iter)->GetBarWidth() + m_iInterSpace;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Remove the interspace because it has been counted once too much.
|
||||||
|
iTotalWidth -= m_iInterSpace;
|
||||||
|
|
||||||
|
if (iLargestStacked > 0)
|
||||||
|
iTotalWidth += iLargestStacked + m_iInterSpace;
|
||||||
|
|
||||||
|
// If this series is a stacked series, it is put at the start
|
||||||
|
if (m_bStacked)
|
||||||
|
iOffset = 0;
|
||||||
|
else if (iLargestStacked > 0)
|
||||||
|
{
|
||||||
|
iOffset += iLargestStacked + m_iInterSpace;
|
||||||
|
}
|
||||||
|
return (iOffset - iTotalWidth/2);
|
||||||
|
}
|
||||||
|
|
||||||
|
CRect CChartBarSerie::GetBarRectangle(unsigned uPointIndex, int minorOffset) const
|
||||||
|
{
|
||||||
|
SChartXYPoint point = GetPoint(uPointIndex);
|
||||||
|
TBarSeriesList::const_iterator iter = m_lstStackedSeries.begin();
|
||||||
|
|
||||||
|
bool bCalcOffset = false;
|
||||||
|
if (m_bStacked && (*iter)!=this)
|
||||||
|
bCalcOffset = true;
|
||||||
|
|
||||||
|
double dXOffset = 0;
|
||||||
|
double dYOffset = 0;
|
||||||
|
if (bCalcOffset)
|
||||||
|
{
|
||||||
|
for (iter; iter!=m_lstStackedSeries.end(); iter++)
|
||||||
|
{
|
||||||
|
if ( (*iter)->GetPointsCount() <= uPointIndex)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if ( (*iter) == this)
|
||||||
|
break;
|
||||||
|
|
||||||
|
dXOffset += (*iter)->GetPoint(uPointIndex).GetX();
|
||||||
|
dYOffset += (*iter)->GetPoint(uPointIndex).GetY();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int barXStart, barXEnd, barYStart, barYEnd;
|
||||||
|
if (m_bHorizontal)
|
||||||
|
{
|
||||||
|
if (bCalcOffset)
|
||||||
|
{
|
||||||
|
barXStart = m_pHorizontalAxis->ValueToScreen(dXOffset);
|
||||||
|
barXEnd = m_pHorizontalAxis->ValueToScreen(dXOffset+point.X);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
barXEnd = m_pHorizontalAxis->ValueToScreen(point.X);
|
||||||
|
if (!m_bAutoBaseLine)
|
||||||
|
barXStart = m_pHorizontalAxis->ValueToScreen(m_dBaseLine);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
double Position = m_pVerticalAxis->GetPosition()/100.00;
|
||||||
|
barXStart = m_PlottingRect.left + (int)(Position * (m_PlottingRect.right-m_PlottingRect.left));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
barYStart = m_pVerticalAxis->ValueToScreen(point.Y) + minorOffset;
|
||||||
|
barYEnd = m_pVerticalAxis->ValueToScreen(point.Y) + minorOffset + m_iBarWidth;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (bCalcOffset)
|
||||||
|
{
|
||||||
|
barYStart = m_pVerticalAxis->ValueToScreen(dYOffset);
|
||||||
|
barYEnd = m_pVerticalAxis->ValueToScreen(dYOffset+point.Y);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
barYEnd = m_pVerticalAxis->ValueToScreen(point.Y);
|
||||||
|
if (!m_bAutoBaseLine)
|
||||||
|
barYStart = m_pVerticalAxis->ValueToScreen(m_dBaseLine);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
double Position = m_pHorizontalAxis->GetPosition()/100.00;
|
||||||
|
barYStart = m_PlottingRect.left + (int)(Position * (m_PlottingRect.bottom-m_PlottingRect.top));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
barXStart = m_pHorizontalAxis->ValueToScreen(point.X) + minorOffset;
|
||||||
|
barXEnd = m_pHorizontalAxis->ValueToScreen(point.X) + minorOffset + m_iBarWidth;
|
||||||
|
}
|
||||||
|
|
||||||
|
CRect barRect(min(barXStart, barXEnd), min(barYStart, barYEnd),
|
||||||
|
max(barXStart, barXEnd), max(barYStart, barYEnd) );
|
||||||
|
return barRect;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartBarSerie::RefreshStackedCache() const
|
||||||
|
{
|
||||||
|
m_lstStackedSeries.clear();
|
||||||
|
if (!m_bStacked)
|
||||||
|
return;
|
||||||
|
|
||||||
|
TBarSeriesList::const_iterator iter = m_lstBarSeries.begin();
|
||||||
|
for (iter; iter!=m_lstBarSeries.end(); iter++)
|
||||||
|
{
|
||||||
|
// Skip the series with a different group Id
|
||||||
|
if ((*iter)->GetGroupId() != m_uGroupId)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if ((*iter)->IsStacked() )
|
||||||
|
{
|
||||||
|
m_lstStackedSeries.push_back(*iter);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,203 @@
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
* ChartBarSerie.h
|
||||||
|
*
|
||||||
|
* Written by Cédric Moonen (cedric_moonen@hotmail.com)
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* This code may be used for any non-commercial and commercial purposes in a compiled form.
|
||||||
|
* The code may be redistributed as long as it remains unmodified and providing that the
|
||||||
|
* author name and this disclaimer remain intact. The sources can be modified WITH the author
|
||||||
|
* consent only.
|
||||||
|
*
|
||||||
|
* This code is provided without any garanties. I cannot be held responsible for the damage or
|
||||||
|
* the loss of time it causes. Use it at your own risks
|
||||||
|
*
|
||||||
|
* An e-mail to notify me that you are using this code is appreciated also.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
#include "ChartXYSerie.h"
|
||||||
|
#include "ChartGradient.h"
|
||||||
|
#include <list>
|
||||||
|
|
||||||
|
//! Specialization of a CChartSerie to display a bars series.
|
||||||
|
/**
|
||||||
|
This class is a specialized series class used to display vertical (default)
|
||||||
|
or horizontal bars. Each bar in the series is centered around its X value
|
||||||
|
(for vertical bars) or Y value (for horizontal bars). Bars can be grouped
|
||||||
|
together, so that they do not overlap but are stacked next to each other
|
||||||
|
(or on top of each other). This is done by specifying a group Id: bar series
|
||||||
|
with the same group Id will be grouped together (stacked). Series with different
|
||||||
|
group Id will be independant (they will be drawn as if they were the only one,
|
||||||
|
meaning that the different series will probably overlap).
|
||||||
|
**/
|
||||||
|
class CChartBarSerie : public CChartXYSerie
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
//! Constructor
|
||||||
|
CChartBarSerie(CChartCtrl* pParent);
|
||||||
|
//! Destructor
|
||||||
|
~CChartBarSerie();
|
||||||
|
|
||||||
|
//! Specifies if the bars are vertical or horizontal.
|
||||||
|
void SetHorizontal(bool bHorizontal);
|
||||||
|
//! Returns true if bars are horizontal, false otherwise.
|
||||||
|
bool GetHorizontal() const { return m_bHorizontal; }
|
||||||
|
|
||||||
|
//! Sets the bars border color
|
||||||
|
void SetBorderColor(COLORREF BorderColor);
|
||||||
|
//! Returns the bars border color
|
||||||
|
COLORREF GetBorderColor() const { return m_BorderColor; }
|
||||||
|
//! Sets the bars border width
|
||||||
|
void SetBorderWidth(int Width);
|
||||||
|
//! Returns the bars border width
|
||||||
|
int GetBorderWidth() const { return m_iBorderWidth; }
|
||||||
|
//! Sets the bars width (in pixels)
|
||||||
|
void SetBarWidth(int Width);
|
||||||
|
//! Returns the bars width (in pixels)
|
||||||
|
int GetBarWidth() const { return m_iBarWidth; }
|
||||||
|
|
||||||
|
//! Set the group Id of the series
|
||||||
|
/**
|
||||||
|
The group Id allows to stack series next to each other (or on top of
|
||||||
|
each other).
|
||||||
|
**/
|
||||||
|
void SetGroupId(unsigned GroupId);
|
||||||
|
//! Returns the group Id of the series
|
||||||
|
unsigned GetGroupId() const { return m_uGroupId; }
|
||||||
|
|
||||||
|
//! Specifies if the series is stacked with other bar series
|
||||||
|
/**
|
||||||
|
All bar series with the same group Id and with the stacked
|
||||||
|
flag to true will be drawn on top of each other (for vertical
|
||||||
|
bars).
|
||||||
|
**/
|
||||||
|
void SetStacked(bool bStacked);
|
||||||
|
//! Returns true if the series is stacked
|
||||||
|
bool IsStacked();
|
||||||
|
|
||||||
|
//! Specifies if a gradient is applied to the bars
|
||||||
|
void ShowGradient(bool bShow);
|
||||||
|
//! Sets the gradient style
|
||||||
|
/**
|
||||||
|
@param GradientColor
|
||||||
|
The second color used for the gradient (the first one being
|
||||||
|
the original series color).
|
||||||
|
@param GradientType
|
||||||
|
The type of gradient used between the two colors (vertical, horizontal, ...)
|
||||||
|
**/
|
||||||
|
void SetGradient(COLORREF GradientColor, EGradientType GradientType);
|
||||||
|
|
||||||
|
//! Static function used to specify the space (in pixels) between series of the same group
|
||||||
|
static void SetInterSpace(int Space) { m_iInterSpace = Space; }
|
||||||
|
//! Static function returning the space between series of the same group.
|
||||||
|
static int GetInterSpace() { return m_iInterSpace; }
|
||||||
|
|
||||||
|
//! Specifies a base line for the bars.
|
||||||
|
/**
|
||||||
|
If a baseline is specified, the bars will be drawn between that value
|
||||||
|
and the point value, instead of being drawn between the axis ans the
|
||||||
|
point value.
|
||||||
|
@param bAutomatic
|
||||||
|
If true, the bars are drawn between the axis and the point value.
|
||||||
|
@param dBaseLine
|
||||||
|
The value of the baseline. This parameter is ignored if bAutomatic is true.
|
||||||
|
**/
|
||||||
|
void SetBaseLine(bool bAutomatic, double dBaseLine)
|
||||||
|
{
|
||||||
|
m_bAutoBaseLine = bAutomatic;
|
||||||
|
m_dBaseLine = dBaseLine;
|
||||||
|
}
|
||||||
|
|
||||||
|
//! Check whether a screen point is on the series.
|
||||||
|
/**
|
||||||
|
This function returns true if the screen point is on one of the bars of
|
||||||
|
the series. In that case, the index of the point is stored in the uIndex
|
||||||
|
parameter.
|
||||||
|
@param screenPoint
|
||||||
|
The screen point to test
|
||||||
|
@param uIndex
|
||||||
|
If the point is close to a specific point of the series, its index is stored here.
|
||||||
|
@return true if the point is on the series
|
||||||
|
**/
|
||||||
|
bool IsPointOnSerie(const CPoint& screenPoint, unsigned& uIndex) const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
typedef std::list<CChartBarSerie*> TBarSeriesList;
|
||||||
|
|
||||||
|
//! Draws the legend icon for the series.
|
||||||
|
/**
|
||||||
|
This pure virtual function should be overriden by child classes.
|
||||||
|
@param pDC
|
||||||
|
The device context used to draw
|
||||||
|
@param rectBitmap
|
||||||
|
The rectangle in which to draw the legend icon
|
||||||
|
**/
|
||||||
|
void DrawLegend(CDC* pDC, const CRect& rectBitmap) const;
|
||||||
|
|
||||||
|
//! Draws the most recent points of the series.
|
||||||
|
/**
|
||||||
|
This pure virtual function should be overriden by child classes.
|
||||||
|
This function should only draw the points that were not previously
|
||||||
|
drawn.
|
||||||
|
@param pDC
|
||||||
|
The device context used to draw
|
||||||
|
**/
|
||||||
|
void Draw(CDC* pDC);
|
||||||
|
//! Redraws the full series.
|
||||||
|
/**
|
||||||
|
This pure virtual function should be overriden by child classes.
|
||||||
|
@param pDC
|
||||||
|
The device context used to draw
|
||||||
|
**/
|
||||||
|
void DrawAll(CDC *pDC);
|
||||||
|
|
||||||
|
void DrawBar(CDC* pDC, CBrush* pFillBrush, CBrush* pBorderBrush,
|
||||||
|
CRect BarRect);
|
||||||
|
|
||||||
|
// Retrieves the offset of the serie along the minor axis (horizontal
|
||||||
|
// axis for vertical bars). This offset is based on series with the
|
||||||
|
// same group Id.
|
||||||
|
int GetMinorOffset() const;
|
||||||
|
CRect GetBarRectangle(unsigned uPointIndex, int minorOffset) const;
|
||||||
|
|
||||||
|
void RefreshStackedCache() const;
|
||||||
|
|
||||||
|
|
||||||
|
//! Space between two series of the same group.
|
||||||
|
static int m_iInterSpace;
|
||||||
|
//! List of all bar series added to the control
|
||||||
|
static TBarSeriesList m_lstBarSeries;
|
||||||
|
|
||||||
|
//! Specifies if the bars are horizontal or vertical.
|
||||||
|
bool m_bHorizontal;
|
||||||
|
|
||||||
|
// The base line specifies the position (in terms of the value
|
||||||
|
// axis) where the bars start from. If m_bAutoBaseLine is true
|
||||||
|
// they start from the axis position.
|
||||||
|
double m_dBaseLine;
|
||||||
|
bool m_bAutoBaseLine;
|
||||||
|
|
||||||
|
// Specifies to which group this series belongs to. Series in the same group are
|
||||||
|
// 'stacked' next to each other.
|
||||||
|
unsigned m_uGroupId;
|
||||||
|
|
||||||
|
int m_iBarWidth;
|
||||||
|
int m_iBorderWidth;
|
||||||
|
COLORREF m_BorderColor;
|
||||||
|
|
||||||
|
bool m_bGradient;
|
||||||
|
COLORREF m_GradientColor;
|
||||||
|
EGradientType m_GradientType;
|
||||||
|
|
||||||
|
// Specifies if the bar series has to be stacked with other bar
|
||||||
|
// series with the same group Id
|
||||||
|
bool m_bStacked;
|
||||||
|
|
||||||
|
// Cache of the stacked series with the same group Id as this series.
|
||||||
|
mutable TBarSeriesList m_lstStackedSeries;
|
||||||
|
};
|
|
@ -0,0 +1,243 @@
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
* ChartCandlestickSerie.cpp
|
||||||
|
*
|
||||||
|
* Written by Cédric Moonen (cedric_moonen@hotmail.com)
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* This code may be used for any non-commercial and commercial purposes in a compiled form.
|
||||||
|
* The code may be redistributed as long as it remains unmodified and providing that the
|
||||||
|
* author name and this disclaimer remain intact. The sources can be modified WITH the author
|
||||||
|
* consent only.
|
||||||
|
*
|
||||||
|
* This code is provided without any garanties. I cannot be held responsible for the damage or
|
||||||
|
* the loss of time it causes. Use it at your own risks
|
||||||
|
*
|
||||||
|
* An e-mail to notify me that you are using this code is appreciated also.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "stdafx.h"
|
||||||
|
#include "ChartCandlestickSerie.h"
|
||||||
|
#include "ChartCtrl.h"
|
||||||
|
|
||||||
|
CChartCandlestickSerie::CChartCandlestickSerie(CChartCtrl* pParent)
|
||||||
|
: CChartSerieBase<SChartCandlestickPoint>(pParent), m_iCandlestickWidth(7)
|
||||||
|
{
|
||||||
|
m_bShadow = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
CChartCandlestickSerie::~CChartCandlestickSerie()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartCandlestickSerie::AddPoint(double XVal,
|
||||||
|
double Low,
|
||||||
|
double High,
|
||||||
|
double Open,
|
||||||
|
double Close)
|
||||||
|
{
|
||||||
|
SChartCandlestickPoint NewPoint(XVal, Low, High, Open, Close);
|
||||||
|
CChartSerieBase<SChartCandlestickPoint>::AddPoint(NewPoint);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartCandlestickSerie::SetWidth(int Width)
|
||||||
|
{
|
||||||
|
m_iCandlestickWidth = Width;
|
||||||
|
m_pParentCtrl->RefreshCtrl();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CChartCandlestickSerie::IsPointOnSerie(const CPoint& screenPoint,
|
||||||
|
unsigned& uIndex) const
|
||||||
|
{
|
||||||
|
uIndex = INVALID_POINT;
|
||||||
|
if (!m_bIsVisible)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
unsigned uFirst=0, uLast=0;
|
||||||
|
if (!GetVisiblePoints(uFirst,uLast))
|
||||||
|
return false;
|
||||||
|
if (uFirst>0)
|
||||||
|
uFirst--;
|
||||||
|
if (uLast<GetPointsCount())
|
||||||
|
uLast++;
|
||||||
|
|
||||||
|
bool bResult = false;
|
||||||
|
for (unsigned i=uFirst ; i < uLast ; i++)
|
||||||
|
{
|
||||||
|
SChartCandlestickPoint Point = GetPoint(i);
|
||||||
|
int ScreenXVal = m_pHorizontalAxis->ValueToScreen(Point.XVal);
|
||||||
|
int ScreenLow = m_pVerticalAxis->ValueToScreen(Point.Low);
|
||||||
|
int ScreenHigh = m_pVerticalAxis->ValueToScreen(Point.High);
|
||||||
|
|
||||||
|
int halfWidth = m_iCandlestickWidth/2;
|
||||||
|
CRect Rectangle;
|
||||||
|
if (ScreenLow > ScreenHigh)
|
||||||
|
Rectangle.SetRect(ScreenXVal-halfWidth, ScreenHigh,
|
||||||
|
ScreenXVal+halfWidth+1, ScreenLow+1);
|
||||||
|
else
|
||||||
|
Rectangle.SetRect(ScreenXVal-halfWidth, ScreenLow,
|
||||||
|
ScreenXVal+halfWidth+1, ScreenHigh+1);
|
||||||
|
if (Rectangle.PtInRect(screenPoint))
|
||||||
|
{
|
||||||
|
bResult = true;
|
||||||
|
uIndex = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return bResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartCandlestickSerie::DrawLegend(CDC* pDC, const CRect& rectBitmap) const
|
||||||
|
{
|
||||||
|
if (m_strSerieName == _T(""))
|
||||||
|
return;
|
||||||
|
if (!pDC->GetSafeHdc())
|
||||||
|
return;
|
||||||
|
|
||||||
|
NewPen.CreatePen(PS_SOLID,1,m_SerieColor);
|
||||||
|
BrushFill.CreateSolidBrush(m_SerieColor);
|
||||||
|
CBrush* pOldBrush = pDC->SelectObject(&BrushFill);
|
||||||
|
CPen* pOldPen = pDC->SelectObject(&NewPen);
|
||||||
|
int OldBkMode = pDC->SetBkMode(TRANSPARENT);
|
||||||
|
|
||||||
|
int margin = (rectBitmap.Width() - m_iCandlestickWidth)/2;
|
||||||
|
CRect CandleRect(rectBitmap.left+margin, rectBitmap.top+4,
|
||||||
|
rectBitmap.right-margin+1, rectBitmap.bottom-3);
|
||||||
|
pDC->Rectangle(CandleRect);
|
||||||
|
int MiddleX = rectBitmap.left + rectBitmap.Width()/2;
|
||||||
|
pDC->MoveTo(MiddleX, CandleRect.top);
|
||||||
|
pDC->LineTo(MiddleX, rectBitmap.top);
|
||||||
|
pDC->MoveTo(MiddleX, CandleRect.bottom);
|
||||||
|
pDC->LineTo(MiddleX, rectBitmap.bottom);
|
||||||
|
|
||||||
|
pDC->SetBkMode(OldBkMode);
|
||||||
|
pDC->SelectClipRgn(NULL);
|
||||||
|
pDC->SelectObject(pOldPen);
|
||||||
|
pDC->SelectObject(pOldBrush);
|
||||||
|
BrushFill.DeleteObject();
|
||||||
|
NewPen.DeleteObject();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartCandlestickSerie::Draw(CDC* pDC)
|
||||||
|
{
|
||||||
|
if (!m_bIsVisible)
|
||||||
|
return;
|
||||||
|
|
||||||
|
unsigned uFirst=0, uLast=0;
|
||||||
|
if (!GetVisiblePoints(uFirst,uLast))
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (pDC->GetSafeHdc())
|
||||||
|
{
|
||||||
|
ShadowBrush.CreateSolidBrush(m_ShadowColor);
|
||||||
|
NewPen.CreatePen(PS_SOLID,1,m_SerieColor);
|
||||||
|
ShadowPen.CreatePen(PS_SOLID,1,m_ShadowColor);
|
||||||
|
BrushFill.CreateSolidBrush(m_SerieColor);
|
||||||
|
BrushEmpty.CreateSolidBrush(RGB(255,255,255));
|
||||||
|
|
||||||
|
int OldBkMode = pDC->SetBkMode(TRANSPARENT);
|
||||||
|
//To have lines limited in the drawing rectangle :
|
||||||
|
pDC->IntersectClipRect(m_PlottingRect);
|
||||||
|
|
||||||
|
for (m_uLastDrawnPoint;m_uLastDrawnPoint<GetPointsCount();m_uLastDrawnPoint++)
|
||||||
|
{
|
||||||
|
SChartCandlestickPoint Point = GetPoint(m_uLastDrawnPoint);
|
||||||
|
DrawCandleStick(pDC, Point);
|
||||||
|
}
|
||||||
|
|
||||||
|
pDC->SetBkMode(OldBkMode);
|
||||||
|
pDC->SelectClipRgn(NULL);
|
||||||
|
BrushFill.DeleteObject();
|
||||||
|
BrushEmpty.DeleteObject();
|
||||||
|
NewPen.DeleteObject();
|
||||||
|
ShadowBrush.DeleteObject();
|
||||||
|
ShadowPen.DeleteObject();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartCandlestickSerie::DrawAll(CDC *pDC)
|
||||||
|
{
|
||||||
|
if (!m_bIsVisible)
|
||||||
|
return;
|
||||||
|
|
||||||
|
unsigned uFirst=0, uLast=0;
|
||||||
|
if (!GetVisiblePoints(uFirst,uLast))
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (pDC->GetSafeHdc())
|
||||||
|
{
|
||||||
|
ShadowBrush.CreateSolidBrush(m_ShadowColor);
|
||||||
|
NewPen.CreatePen(PS_SOLID,1,m_SerieColor);
|
||||||
|
ShadowPen.CreatePen(PS_SOLID,1,m_ShadowColor);
|
||||||
|
BrushFill.CreateSolidBrush(m_SerieColor);
|
||||||
|
BrushEmpty.CreateSolidBrush(RGB(255,255,255));
|
||||||
|
|
||||||
|
pDC->SetBkMode(TRANSPARENT);
|
||||||
|
//To have lines limited in the drawing rectangle :
|
||||||
|
pDC->IntersectClipRect(m_PlottingRect);
|
||||||
|
|
||||||
|
for (m_uLastDrawnPoint=uFirst;m_uLastDrawnPoint<=uLast;m_uLastDrawnPoint++)
|
||||||
|
{
|
||||||
|
SChartCandlestickPoint Point = GetPoint(m_uLastDrawnPoint);
|
||||||
|
DrawCandleStick(pDC, Point);
|
||||||
|
}
|
||||||
|
|
||||||
|
pDC->SelectClipRgn(NULL);
|
||||||
|
BrushFill.DeleteObject();
|
||||||
|
BrushEmpty.DeleteObject();
|
||||||
|
NewPen.DeleteObject();
|
||||||
|
ShadowBrush.DeleteObject();
|
||||||
|
ShadowPen.DeleteObject();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartCandlestickSerie::DrawCandleStick(CDC* pDC, SChartCandlestickPoint Point)
|
||||||
|
{
|
||||||
|
int ScreenXVal = m_pHorizontalAxis->ValueToScreen(Point.XVal);
|
||||||
|
int ScreenOpen = m_pVerticalAxis->ValueToScreen(Point.Open);
|
||||||
|
int ScreenClose = m_pVerticalAxis->ValueToScreen(Point.Close);
|
||||||
|
int ScreenLow = m_pVerticalAxis->ValueToScreen(Point.Low);
|
||||||
|
int ScreenHigh = m_pVerticalAxis->ValueToScreen(Point.High);
|
||||||
|
|
||||||
|
int halfWidth = m_iCandlestickWidth/2;
|
||||||
|
CPoint TopLeft, BottomRight;
|
||||||
|
CRect Body;
|
||||||
|
CRect ShadowBody;
|
||||||
|
if (ScreenOpen > ScreenClose)
|
||||||
|
Body.SetRect(ScreenXVal-halfWidth, ScreenClose,
|
||||||
|
ScreenXVal+halfWidth+1, ScreenOpen+1);
|
||||||
|
else
|
||||||
|
Body.SetRect(ScreenXVal-halfWidth, ScreenOpen,
|
||||||
|
ScreenXVal+halfWidth+1, ScreenClose+1);
|
||||||
|
|
||||||
|
ShadowBody = Body;
|
||||||
|
ShadowBody.OffsetRect(m_iShadowDepth, m_iShadowDepth);
|
||||||
|
|
||||||
|
CBrush* pOldBrush = pDC->SelectObject(&ShadowBrush);
|
||||||
|
CPen* pOldPen = pDC->SelectObject(&ShadowPen);
|
||||||
|
|
||||||
|
if (m_bShadow)
|
||||||
|
pDC->Rectangle(ShadowBody);
|
||||||
|
if (Point.Open > Point.Close)
|
||||||
|
pDC->SelectObject(&BrushFill);
|
||||||
|
else
|
||||||
|
pDC->SelectObject(&BrushEmpty);
|
||||||
|
|
||||||
|
if (m_bShadow)
|
||||||
|
{
|
||||||
|
pDC->MoveTo(ScreenXVal+m_iShadowDepth, ScreenOpen+m_iShadowDepth);
|
||||||
|
pDC->LineTo(ScreenXVal+m_iShadowDepth, ScreenHigh+m_iShadowDepth);
|
||||||
|
pDC->MoveTo(ScreenXVal+m_iShadowDepth, ScreenClose+m_iShadowDepth);
|
||||||
|
pDC->LineTo(ScreenXVal+m_iShadowDepth, ScreenLow+m_iShadowDepth);
|
||||||
|
}
|
||||||
|
pDC->SelectObject(&NewPen);
|
||||||
|
pDC->MoveTo(ScreenXVal, ScreenOpen); pDC->LineTo(ScreenXVal, ScreenHigh);
|
||||||
|
pDC->MoveTo(ScreenXVal, ScreenClose); pDC->LineTo(ScreenXVal, ScreenLow);
|
||||||
|
|
||||||
|
pDC->Rectangle(Body);
|
||||||
|
pDC->SelectObject(pOldBrush);
|
||||||
|
pDC->SelectObject(pOldPen);
|
||||||
|
}
|
|
@ -0,0 +1,142 @@
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
* ChartCandlestickSerie.h
|
||||||
|
*
|
||||||
|
* Written by Cédric Moonen (cedric_moonen@hotmail.com)
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* This code may be used for any non-commercial and commercial purposes in a compiled form.
|
||||||
|
* The code may be redistributed as long as it remains unmodified and providing that the
|
||||||
|
* author name and this disclaimer remain intact. The sources can be modified WITH the author
|
||||||
|
* consent only.
|
||||||
|
*
|
||||||
|
* This code is provided without any garanties. I cannot be held responsible for the damage or
|
||||||
|
* the loss of time it causes. Use it at your own risks
|
||||||
|
*
|
||||||
|
* An e-mail to notify me that you are using this code is appreciated also.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
#include "ChartSerieBase.h"
|
||||||
|
|
||||||
|
//! Point structure used as template parameter for candlestick series
|
||||||
|
struct SChartCandlestickPoint
|
||||||
|
{
|
||||||
|
SChartCandlestickPoint() { }
|
||||||
|
SChartCandlestickPoint(double XValue, double LowVal,
|
||||||
|
double HighVal, double OpenVal, double CloseVal):
|
||||||
|
XVal(XValue), Low(LowVal), High(HighVal),
|
||||||
|
Open(OpenVal), Close(CloseVal) { }
|
||||||
|
|
||||||
|
//! The X value of the point (usually, a time)
|
||||||
|
double XVal;
|
||||||
|
//! The low market price
|
||||||
|
double Low;
|
||||||
|
//! The high market price
|
||||||
|
double High;
|
||||||
|
//! The open market price
|
||||||
|
double Open;
|
||||||
|
//! The close market price
|
||||||
|
double Close;
|
||||||
|
|
||||||
|
//! Returns the X value of the point
|
||||||
|
double GetX() const { return XVal; }
|
||||||
|
//! Returns the Y value of the point, which is the average between low and high
|
||||||
|
double GetY() const { return (Low+High)/2; }
|
||||||
|
//! Returns the minimum X value of the point
|
||||||
|
double GetXMin() const { return XVal; }
|
||||||
|
//! Returns the maximum X value of the point
|
||||||
|
double GetXMax() const { return XVal; }
|
||||||
|
//! Returns the minimum Y value of the point (the low value)
|
||||||
|
double GetYMin() const { return Low; }
|
||||||
|
//! Returns the maximum Y value of the point (the high value)
|
||||||
|
double GetYMax() const { return High; }
|
||||||
|
};
|
||||||
|
|
||||||
|
//! Specialization of a CChartSerieBase to display a candlestick series.
|
||||||
|
/**
|
||||||
|
Each point in the series has an X value (the time), a high value
|
||||||
|
(the highest market price), a low value (the lowest market price),
|
||||||
|
an open value (the market price at the opening) and a close value
|
||||||
|
(the market price at the closing).
|
||||||
|
**/
|
||||||
|
class CChartCandlestickSerie : public CChartSerieBase<SChartCandlestickPoint>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
//! Constructor
|
||||||
|
CChartCandlestickSerie(CChartCtrl* pParent);
|
||||||
|
//! Destructor
|
||||||
|
~CChartCandlestickSerie();
|
||||||
|
|
||||||
|
//! Tests if a certain screen point is on the series.
|
||||||
|
/**
|
||||||
|
@param screenPoint
|
||||||
|
The screen point to test
|
||||||
|
@param uIndex
|
||||||
|
If the point is close to a specific point of the series, its index is stored here.
|
||||||
|
@return true if the point is on the series
|
||||||
|
**/
|
||||||
|
bool IsPointOnSerie(const CPoint& screenPoint, unsigned& uIndex) const;
|
||||||
|
|
||||||
|
//! Adds a new point in the series
|
||||||
|
/**
|
||||||
|
@param XVal
|
||||||
|
The X value of the point (the time)
|
||||||
|
@param Low
|
||||||
|
The lowest market price
|
||||||
|
@param High
|
||||||
|
The highest market price
|
||||||
|
@param Open
|
||||||
|
The market price at the opening
|
||||||
|
@param Close
|
||||||
|
The market price at the closing
|
||||||
|
**/
|
||||||
|
void AddPoint(double XVal, double Low, double High,
|
||||||
|
double Open, double Close);
|
||||||
|
//! Sets the width (in pixels) of all candlestick points in the series
|
||||||
|
void SetWidth(int Width);
|
||||||
|
//! Returns the width (in pixels) of a point in the series
|
||||||
|
int GetWidth() { return m_iCandlestickWidth; }
|
||||||
|
|
||||||
|
protected:
|
||||||
|
//! Draws the legend icon for the series.
|
||||||
|
/**
|
||||||
|
@param pDC
|
||||||
|
The device context used to draw
|
||||||
|
@param rectBitmap
|
||||||
|
The rectangle in which to draw the legend icon
|
||||||
|
**/
|
||||||
|
void DrawLegend(CDC* pDC, const CRect& rectBitmap) const;
|
||||||
|
|
||||||
|
//! Draws the most recent points of the series.
|
||||||
|
/**
|
||||||
|
This function should only draw the points that were not previously
|
||||||
|
drawn.
|
||||||
|
@param pDC
|
||||||
|
The device context used to draw
|
||||||
|
**/
|
||||||
|
void Draw(CDC* pDC);
|
||||||
|
//! Redraws the full series.
|
||||||
|
/**
|
||||||
|
@param pDC
|
||||||
|
The device context used to draw
|
||||||
|
**/
|
||||||
|
void DrawAll(CDC *pDC);
|
||||||
|
|
||||||
|
private:
|
||||||
|
//! Draws a candle stick point
|
||||||
|
void DrawCandleStick(CDC *pDC, SChartCandlestickPoint Point);
|
||||||
|
|
||||||
|
//! The candlestick width
|
||||||
|
int m_iCandlestickWidth;
|
||||||
|
|
||||||
|
// Caches the pen and brushes to avoid creating them for each point
|
||||||
|
mutable CBrush ShadowBrush;
|
||||||
|
mutable CPen NewPen;
|
||||||
|
mutable CPen ShadowPen;
|
||||||
|
mutable CBrush BrushFill;
|
||||||
|
mutable CBrush BrushEmpty;
|
||||||
|
};
|
|
@ -0,0 +1,62 @@
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
* ChartCrossHairCursor.cpp
|
||||||
|
*
|
||||||
|
* Written by Cédric Moonen (cedric_moonen@hotmail.com)
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* This code may be used for any non-commercial and commercial purposes in a compiled form.
|
||||||
|
* The code may be redistributed as long as it remains unmodified and providing that the
|
||||||
|
* author name and this disclaimer remain intact. The sources can be modified WITH the author
|
||||||
|
* consent only.
|
||||||
|
*
|
||||||
|
* This code is provided without any garanties. I cannot be held responsible for the damage or
|
||||||
|
* the loss of time it causes. Use it at your own risks
|
||||||
|
*
|
||||||
|
* An e-mail to notify me that you are using this code is appreciated also.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "stdafx.h"
|
||||||
|
#include "ChartCrossHairCursor.h"
|
||||||
|
#include "ChartCtrl.h"
|
||||||
|
|
||||||
|
CChartCrossHairCursor::CChartCrossHairCursor(CChartCtrl* pParent,
|
||||||
|
CChartAxis* pHorizAxis,
|
||||||
|
CChartAxis* pVertAxis)
|
||||||
|
: CChartCursor(pParent), m_pHorizontalAxis(pHorizAxis), m_pVerticalAxis(pVertAxis),
|
||||||
|
m_lXPos(0), m_lYPos(0)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
CChartCrossHairCursor::~CChartCrossHairCursor()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartCrossHairCursor::Draw(CDC* pDC)
|
||||||
|
{
|
||||||
|
CPen NewPen(PS_SOLID,1,m_colCursor);
|
||||||
|
CPen* pOldPen = pDC->SelectObject(&NewPen);
|
||||||
|
|
||||||
|
CRect plottingRect = m_pParentCtrl->GetPlottingRect();
|
||||||
|
|
||||||
|
pDC->MoveTo(m_lXPos, plottingRect.top);
|
||||||
|
pDC->LineTo(m_lXPos, plottingRect.bottom);
|
||||||
|
pDC->MoveTo(plottingRect.left, m_lYPos);
|
||||||
|
pDC->LineTo(plottingRect.right, m_lYPos);
|
||||||
|
|
||||||
|
pDC->SelectObject(pOldPen);
|
||||||
|
NewPen.DeleteObject();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartCrossHairCursor::OnMouseMove(CPoint mousePoint)
|
||||||
|
{
|
||||||
|
m_lXPos = mousePoint.x;
|
||||||
|
m_lYPos = mousePoint.y;
|
||||||
|
|
||||||
|
double XVal = m_pHorizontalAxis->ScreenToValue(m_lXPos);
|
||||||
|
double YVal = m_pVerticalAxis->ScreenToValue(m_lYPos);
|
||||||
|
CursorMoved(XVal, YVal);
|
||||||
|
}
|
|
@ -0,0 +1,72 @@
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
* ChartCrossHairCursor.h
|
||||||
|
*
|
||||||
|
* Written by Cédric Moonen (cedric_moonen@hotmail.com)
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* This code may be used for any non-commercial and commercial purposes in a compiled form.
|
||||||
|
* The code may be redistributed as long as it remains unmodified and providing that the
|
||||||
|
* author name and this disclaimer remain intact. The sources can be modified WITH the author
|
||||||
|
* consent only.
|
||||||
|
*
|
||||||
|
* This code is provided without any garanties. I cannot be held responsible for the damage or
|
||||||
|
* the loss of time it causes. Use it at your own risks
|
||||||
|
*
|
||||||
|
* An e-mail to notify me that you are using this code is appreciated also.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _CHARTCROSSHAIRCURSOR_H_
|
||||||
|
#define _CHARTCROSSHAIRCURSOR_H_
|
||||||
|
|
||||||
|
#include "ChartCursor.h"
|
||||||
|
|
||||||
|
class CChartAxis;
|
||||||
|
|
||||||
|
//! Specialization of a CChartCursor class for a cross-hair cursor.
|
||||||
|
/**
|
||||||
|
A cross-hair cursor is a simple cross displayed in the plotting area.
|
||||||
|
The cursor moves along with the mouse (but stay within the bounds of
|
||||||
|
the plot area).<br>
|
||||||
|
To create a cross-hair cursor, call the CreateCrossHairCursor from the
|
||||||
|
CChartCtrl class.
|
||||||
|
**/
|
||||||
|
class CChartCrossHairCursor : public CChartCursor
|
||||||
|
{
|
||||||
|
friend CChartCtrl;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
//! Called when the mouse is moved over the plot area.
|
||||||
|
void OnMouseMove(CPoint mousePoint);
|
||||||
|
//! Draws the cursor.
|
||||||
|
void Draw(CDC* pDC);
|
||||||
|
|
||||||
|
private:
|
||||||
|
//! Constructor
|
||||||
|
/**
|
||||||
|
@param pParent
|
||||||
|
The parent charting control
|
||||||
|
@param pHorizAxis
|
||||||
|
The associated horizontal axis
|
||||||
|
@param pVertAxis
|
||||||
|
The associated vertical axis
|
||||||
|
**/
|
||||||
|
CChartCrossHairCursor(CChartCtrl* pParent, CChartAxis* pHorizAxis, CChartAxis* pVertAxis);
|
||||||
|
//! Destructor
|
||||||
|
~CChartCrossHairCursor();
|
||||||
|
|
||||||
|
//! The associated horizontal axis
|
||||||
|
CChartAxis* m_pHorizontalAxis;
|
||||||
|
//! The associated vertical axis
|
||||||
|
CChartAxis* m_pVerticalAxis;
|
||||||
|
|
||||||
|
//! The current X screen position
|
||||||
|
long m_lXPos;
|
||||||
|
//! The current Y screen position
|
||||||
|
long m_lYPos;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // _CHARTCROSSHAIRCURSOR_H_
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,586 @@
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
* ChartCtrl.h
|
||||||
|
*
|
||||||
|
* Written by Cédric Moonen (cedric_moonen@hotmail.com)
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* This code may be used for any non-commercial and commercial purposes in a compiled form.
|
||||||
|
* The code may be redistributed as long as it remains unmodified and providing that the
|
||||||
|
* author name and this disclaimer remain intact. The sources can be modified WITH the author
|
||||||
|
* consent only.
|
||||||
|
*
|
||||||
|
* This code is provided without any garanties. I cannot be held responsible for the damage or
|
||||||
|
* the loss of time it causes. Use it at your own risks
|
||||||
|
*
|
||||||
|
* An e-mail to notify me that you are using this code is appreciated also.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#if _MSC_VER >= 1000
|
||||||
|
#pragma once
|
||||||
|
#endif // _MSC_VER >= 1000
|
||||||
|
|
||||||
|
#include "ChartSerie.h"
|
||||||
|
#include "ChartAxis.h"
|
||||||
|
#include "ChartGrid.h"
|
||||||
|
#include "ChartLegend.h"
|
||||||
|
#include "ChartTitle.h"
|
||||||
|
#include "ChartGradient.h"
|
||||||
|
#include "ChartCursor.h"
|
||||||
|
#include "ChartMouseListener.h"
|
||||||
|
#include "ChartStandardAxis.h"
|
||||||
|
#include "ChartLogarithmicAxis.h"
|
||||||
|
#include "ChartDateTimeAxis.h"
|
||||||
|
#include "ChartCrossHairCursor.h"
|
||||||
|
#include "ChartDragLineCursor.h"
|
||||||
|
|
||||||
|
#include <map>
|
||||||
|
|
||||||
|
|
||||||
|
class CChartStandardAxis;
|
||||||
|
class CChartLogarithmicAxis;
|
||||||
|
class CChartDateTimeAxis;
|
||||||
|
class CChartCrossHairCursor;
|
||||||
|
class CChartDragLineCursor;
|
||||||
|
|
||||||
|
class CChartPointsSerie;
|
||||||
|
class CChartLineSerie;
|
||||||
|
class CChartSurfaceSerie;
|
||||||
|
class CChartBarSerie;
|
||||||
|
class CChartCandlestickSerie;
|
||||||
|
class CChartGanttSerie;
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CChartCtrl window
|
||||||
|
|
||||||
|
//! The main chart control class.
|
||||||
|
/**
|
||||||
|
|
||||||
|
**/
|
||||||
|
class CChartCtrl : public CWnd
|
||||||
|
{
|
||||||
|
|
||||||
|
public:
|
||||||
|
//! Retrieves de device context.
|
||||||
|
/**
|
||||||
|
This function is used for internal purposes only.
|
||||||
|
**/
|
||||||
|
CDC* GetDC();
|
||||||
|
//! Retrieves the plotting rectangle.
|
||||||
|
CRect GetPlottingRect() const { return m_PlottingRect; }
|
||||||
|
|
||||||
|
//! Returns a pointer to the legend object.
|
||||||
|
CChartLegend* GetLegend() const { return m_pLegend; }
|
||||||
|
//! Returns a pointer to the title object.
|
||||||
|
CChartTitle* GetTitle() const { return m_pTitles; }
|
||||||
|
|
||||||
|
//! An enumeration of the different axis positions.
|
||||||
|
enum EAxisPos
|
||||||
|
{
|
||||||
|
LeftAxis = 0,
|
||||||
|
BottomAxis,
|
||||||
|
RightAxis,
|
||||||
|
TopAxis
|
||||||
|
};
|
||||||
|
|
||||||
|
//! Create and attach a standard axis to the control.
|
||||||
|
/**
|
||||||
|
@param axisPos
|
||||||
|
The position of the axis.
|
||||||
|
@return The created standard axis.
|
||||||
|
**/
|
||||||
|
CChartStandardAxis* CreateStandardAxis(EAxisPos axisPos);
|
||||||
|
//! Create and attach a logarithmic axis to the control.
|
||||||
|
/**
|
||||||
|
@param axisPos
|
||||||
|
The position of the axis.
|
||||||
|
@return The created logarithmic axis.
|
||||||
|
**/
|
||||||
|
CChartLogarithmicAxis* CreateLogarithmicAxis(EAxisPos axisPos);
|
||||||
|
//! Create and attach a date/time axis to the control.
|
||||||
|
/**
|
||||||
|
@param axisPos
|
||||||
|
The position of the axis.
|
||||||
|
@return The created date/time axis.
|
||||||
|
**/
|
||||||
|
CChartDateTimeAxis* CreateDateTimeAxis(EAxisPos axisPos);
|
||||||
|
//! Attach a custom axis to the control.
|
||||||
|
/**
|
||||||
|
This function takes ownership of the axis pointer, so you
|
||||||
|
must not destroy it. If the axis is alread attached to a
|
||||||
|
chart control (even this one), the function will fail with
|
||||||
|
an assertion. This function should be used only when you want
|
||||||
|
to provide a custom axis to the control, otherwise you should
|
||||||
|
use the AttachStandardAxis, AttachLogarithmicAxis and
|
||||||
|
AttachDateTimeAxis instead.
|
||||||
|
@param pAxis
|
||||||
|
The axis to attach to the control.
|
||||||
|
@param axisPos
|
||||||
|
The position of the axis. This value can be:
|
||||||
|
- LeftAxis
|
||||||
|
- BottomAxis
|
||||||
|
- RightAxis
|
||||||
|
- TopAxis
|
||||||
|
**/
|
||||||
|
void AttachCustomAxis(CChartAxis* pAxis, EAxisPos axisPos);
|
||||||
|
|
||||||
|
//! Create and attach a point series to the control
|
||||||
|
/**
|
||||||
|
@param bSecondaryHorizAxis
|
||||||
|
Specifies if the horizontal axis is the secondary axis or not.
|
||||||
|
@param bSecondaryVertAxis
|
||||||
|
Specifies if the vertical axis is the secondary axis or not.
|
||||||
|
@return The created chart point series.
|
||||||
|
@remark The function will assert if the associated axes are not attached
|
||||||
|
to the control.
|
||||||
|
@see AttachCustomSerie for more info about the parameters of the function.
|
||||||
|
**/
|
||||||
|
CChartPointsSerie* CreatePointsSerie(bool bSecondaryHorizAxis=false, bool bSecondaryVertAxis=false);
|
||||||
|
//! Create and attach a line series to the control
|
||||||
|
/**
|
||||||
|
The function will assert if the associated axes are not attached
|
||||||
|
to the control.
|
||||||
|
@param bSecondaryHorizAxis
|
||||||
|
Specifies if the horizontal axis is the secondary axis or not.
|
||||||
|
@param bSecondaryVertAxis
|
||||||
|
Specifies if the vertical axis is the secondary axis or not.
|
||||||
|
@return The created chart line series.
|
||||||
|
@remark The function will assert if the associated axes are not attached
|
||||||
|
to the control.
|
||||||
|
@see AttachCustomSerie for more info about the parameters of the function.
|
||||||
|
**/
|
||||||
|
CChartLineSerie* CreateLineSerie(bool bSecondaryHorizAxis=false, bool bSecondaryVertAxis=false);
|
||||||
|
//! Create and attach a surface series to the control
|
||||||
|
/**
|
||||||
|
The function will assert if the associated axes are not attached
|
||||||
|
to the control.
|
||||||
|
@param bSecondaryHorizAxis
|
||||||
|
Specifies if the horizontal axis is the secondary axis or not.
|
||||||
|
@param bSecondaryVertAxis
|
||||||
|
Specifies if the vertical axis is the secondary axis or not.
|
||||||
|
@return The created chart surface series.
|
||||||
|
@remark The function will assert if the associated axes are not attached
|
||||||
|
to the control.
|
||||||
|
@see AttachCustomSerie for more info about the parameters of the function.
|
||||||
|
**/
|
||||||
|
CChartSurfaceSerie* CreateSurfaceSerie(bool bSecondaryHorizAxis=false, bool bSecondaryVertAxis=false);
|
||||||
|
//! Create and attach a bar series to the control
|
||||||
|
/**
|
||||||
|
@param bSecondaryHorizAxis
|
||||||
|
Specifies if the horizontal axis is the secondary axis or not.
|
||||||
|
@param bSecondaryVertAxis
|
||||||
|
Specifies if the vertical axis is the secondary axis or not.
|
||||||
|
@return The created chart bar series.
|
||||||
|
@remark The function will assert if the associated axes are not attached
|
||||||
|
to the control.
|
||||||
|
@see AttachCustomSerie for more info about the parameters of the function.
|
||||||
|
**/
|
||||||
|
CChartBarSerie* CreateBarSerie(bool bSecondaryHorizAxis=false, bool bSecondaryVertAxis=false);
|
||||||
|
//! Create and attach a candlestick series to the control
|
||||||
|
/**
|
||||||
|
@param bSecondaryHorizAxis
|
||||||
|
Specifies if the horizontal axis is the secondary axis or not.
|
||||||
|
@param bSecondaryVertAxis
|
||||||
|
Specifies if the vertical axis is the secondary axis or not.
|
||||||
|
@return The created chart candlestick series.
|
||||||
|
@remark The function will assert if the associated axes are not attached
|
||||||
|
to the control.
|
||||||
|
@see AttachCustomSerie for more info about the parameters of the function.
|
||||||
|
**/
|
||||||
|
CChartCandlestickSerie* CreateCandlestickSerie(bool bSecondaryHorizAxis=false, bool bSecondaryVertAxis=false);
|
||||||
|
//! Create and attach a gantt series to the control
|
||||||
|
/**
|
||||||
|
@param bSecondaryHorizAxis
|
||||||
|
Specifies if the horizontal axis is the secondary axis or not.
|
||||||
|
@param bSecondaryVertAxis
|
||||||
|
Specifies if the vertical axis is the secondary axis or not.
|
||||||
|
@return The created chart gantt series.
|
||||||
|
@remark The function will assert if the associated axes are not attached
|
||||||
|
to the control.
|
||||||
|
@see AttachCustomSerie for more info about the parameters of the function.
|
||||||
|
**/
|
||||||
|
CChartGanttSerie* CreateGanttSerie(bool bSecondaryHorizAxis=false, bool bSecondaryVertAxis=false);
|
||||||
|
//! Attaches a custom series to the chart
|
||||||
|
/**
|
||||||
|
You should only use this function if you want to attach a custom series
|
||||||
|
to the control. Otherwise, you should use the CreateXXXSerie helper functions.
|
||||||
|
The function will assert if the associated axes are not attached
|
||||||
|
to the control.
|
||||||
|
@param pNewSeries
|
||||||
|
The new series to be added. The control will take ownership of
|
||||||
|
the pointer, so dont't delete it yourself.
|
||||||
|
@param bSecondaryHorizAxis
|
||||||
|
Specifies if the associated horizontal axis is secondary or not.
|
||||||
|
If this value is false, the associated horizontal axis is the
|
||||||
|
bottom axis, otherwise it is the top axis.
|
||||||
|
@param bSecondaryVertAxis
|
||||||
|
Specifies if the associated vertical axis is secondary or not.
|
||||||
|
If this value is false, the associated vertical axis is the
|
||||||
|
left axis, otherwise it is the right axis.
|
||||||
|
**/
|
||||||
|
void AttachCustomSerie(CChartSerie* pNewSeries, bool bSecondaryHorizAxis=false, bool bSecondaryVertAxis=false);
|
||||||
|
//! Retrieves a specific series from the chart
|
||||||
|
/**
|
||||||
|
@param uSerieId
|
||||||
|
The Id of the series to retrieve
|
||||||
|
@return The series or NULL if uSerieId is not attributed.
|
||||||
|
**/
|
||||||
|
CChartSerie* GetSerie(unsigned uSerieId) const;
|
||||||
|
//! Removes a specific series from the chart
|
||||||
|
/**
|
||||||
|
@param uSerieId
|
||||||
|
The Id of the series to be removed.
|
||||||
|
**/
|
||||||
|
void RemoveSerie(unsigned uSerieId);
|
||||||
|
//! Removes all the series from the chart
|
||||||
|
void RemoveAllSeries();
|
||||||
|
//! Returns the number of series in the chart
|
||||||
|
size_t GetSeriesCount() const;
|
||||||
|
|
||||||
|
//! Create and attach a cross-hair cursor to the control
|
||||||
|
/**
|
||||||
|
A cross-hair cursor display a cross on the control and move accordingly
|
||||||
|
to the mouse. It is attached to an horizontal and a vertical axis.
|
||||||
|
@param bSecondaryHorizAxis
|
||||||
|
Specifies if the horizontal axis is the secondary axis or not.
|
||||||
|
@param bSecondaryVertAxis
|
||||||
|
Specifies if the vertical axis is the secondary axis or not.
|
||||||
|
@return The created cross-hair cursor.
|
||||||
|
@remark The function will assert if the associated axes are not attached
|
||||||
|
to the control.
|
||||||
|
**/
|
||||||
|
CChartCrossHairCursor* CreateCrossHairCursor(bool bSecondaryHorizAxis=false, bool bSecondaryVertAxis=false);
|
||||||
|
//! Create and attach a drag-line cursor to the control
|
||||||
|
/**
|
||||||
|
A drag-line cursor is a simple line (horizontal or vertical) that can be
|
||||||
|
dragged with the mouse by clicking on it. It is attached to a specific axis.
|
||||||
|
@param relatedAxis
|
||||||
|
The axis position to which the cursor is attached to.
|
||||||
|
@return The created drag-line cursor.
|
||||||
|
@remark The function will assert if the associated axis is not attached
|
||||||
|
to the control.
|
||||||
|
**/
|
||||||
|
CChartDragLineCursor* CreateDragLineCursor(EAxisPos relatedAxis);
|
||||||
|
//! Attach a custom cursor to the control
|
||||||
|
/**
|
||||||
|
You should only use this function if you want to attach a custom cursor
|
||||||
|
to the control. Otherwise, you should use the CreateXXXCursor helper functions.
|
||||||
|
@param pCursor
|
||||||
|
The custom cursor to be attached to the control.
|
||||||
|
**/
|
||||||
|
void AttachCustomCursor(CChartCursor* pCursor);
|
||||||
|
//! Removes a cursor with a specific Id from the control.
|
||||||
|
/**
|
||||||
|
The cursor Id can be retrieved on through the CChartCursor::GetCursorId function.
|
||||||
|
@param cursorId
|
||||||
|
The Id of the cursor to remove from the control.
|
||||||
|
**/
|
||||||
|
void RemoveCursor(unsigned cursorId);
|
||||||
|
|
||||||
|
//! Shows/hides the mouse cursor when it is over the plotting area.
|
||||||
|
void ShowMouseCursor(bool bShow);
|
||||||
|
|
||||||
|
CChartAxis* GetBottomAxis() const;
|
||||||
|
CChartAxis* GetLeftAxis() const;
|
||||||
|
CChartAxis* GetTopAxis() const;
|
||||||
|
CChartAxis* GetRightAxis() const;
|
||||||
|
//! Returns a specific axis attached to the control
|
||||||
|
/**
|
||||||
|
If the specified axis does not exist, NULL is returned.
|
||||||
|
@param axisPos
|
||||||
|
The axis position (left, bottom, right or top).
|
||||||
|
**/
|
||||||
|
CChartAxis* GetAxis(EAxisPos axisPos) const
|
||||||
|
{
|
||||||
|
return m_pAxes[axisPos];
|
||||||
|
}
|
||||||
|
|
||||||
|
//! Returns the type of the edge used as border.
|
||||||
|
UINT GetEdgeType() const { return EdgeType; }
|
||||||
|
//! Sets the edge type.
|
||||||
|
/**
|
||||||
|
@param NewEdge
|
||||||
|
The type of the edge. See the DrawEdge function in MSDN for
|
||||||
|
a list of the different types.
|
||||||
|
**/
|
||||||
|
void SetEdgeType(UINT NewEdge)
|
||||||
|
{
|
||||||
|
EdgeType = NewEdge;
|
||||||
|
RefreshCtrl();
|
||||||
|
}
|
||||||
|
|
||||||
|
//! Returns the background color
|
||||||
|
COLORREF GetBackColor() const { return m_BackColor; }
|
||||||
|
//! Sets the background color.
|
||||||
|
void SetBackColor(COLORREF NewCol)
|
||||||
|
{
|
||||||
|
m_BackColor = NewCol;
|
||||||
|
m_bBackGradient = false;
|
||||||
|
RefreshCtrl();
|
||||||
|
}
|
||||||
|
//! Returns the color of the plotting area's border
|
||||||
|
COLORREF GetBorderColor() const { return m_BorderColor; }
|
||||||
|
//! Sets the color of the plotting area's border
|
||||||
|
void SetBorderColor(COLORREF NewCol) { m_BorderColor = NewCol; RefreshCtrl(); }
|
||||||
|
//! Returns the color of the zoom rectangle
|
||||||
|
COLORREF GetZoomRectColor() const { return m_ZoomRectColor; }
|
||||||
|
//! Sets the color of the zoom rectangle
|
||||||
|
void SetZoomRectColor(COLORREF NewCol) { m_ZoomRectColor = NewCol; RefreshCtrl(); }
|
||||||
|
//! Sets a gradient background
|
||||||
|
/**
|
||||||
|
@param Col1
|
||||||
|
The first gradient color
|
||||||
|
@param Col2
|
||||||
|
The second gradient color
|
||||||
|
@param GradientType
|
||||||
|
The type of gradient used from Col1 to Col2. It can take the following values:
|
||||||
|
- gtHorizontal: a simple left-to-right gradient, from Col1 to Col2.
|
||||||
|
- gtVertical: a simple top-to-bottom gradient, from Col1 to Col2.
|
||||||
|
- gtHorizontalDouble: a left-to-middle-to-right gradient, with Col2 in the middle.
|
||||||
|
- gtVerticalDouble: a top-to-middle-to-bottom gradient, with Col2 in the middle.
|
||||||
|
**/
|
||||||
|
void SetBackGradient(COLORREF Col1, COLORREF Col2, EGradientType GradientType);
|
||||||
|
|
||||||
|
//! Enables/disables the pan feature
|
||||||
|
void SetPanEnabled(bool bEnabled) { m_bPanEnabled = bEnabled; }
|
||||||
|
//! Returns true if the pan feature is enabled
|
||||||
|
bool GetPanEnabled() const { return m_bPanEnabled; }
|
||||||
|
//! Enables/disables the zoom feature
|
||||||
|
void SetZoomEnabled(bool bEnabled) { m_bZoomEnabled = bEnabled; }
|
||||||
|
//! Returns true if the zoom feature is enabled
|
||||||
|
bool GetZoomEnabled() const { return m_bZoomEnabled; }
|
||||||
|
//! Undo all pan and zoom operations that were done on the chart
|
||||||
|
void UndoPanZoom();
|
||||||
|
|
||||||
|
//! Forces a refresh of the control.
|
||||||
|
/**
|
||||||
|
This function is used for internal purposes.
|
||||||
|
**/
|
||||||
|
void RefreshCtrl();
|
||||||
|
//! Enables/disables the refresh of the control
|
||||||
|
/**
|
||||||
|
This function is used when several settings have to be changed at the same
|
||||||
|
time on the control. This way we can avoid refreshing the control when it
|
||||||
|
is not needed.
|
||||||
|
@param bEnable
|
||||||
|
false to disable the refresh and true to re-enable the refresh.
|
||||||
|
**/
|
||||||
|
void EnableRefresh(bool bEnable);
|
||||||
|
//! Creates the control dynamically.
|
||||||
|
/**
|
||||||
|
@param pParentWnd
|
||||||
|
Parent window of the control
|
||||||
|
@param rect
|
||||||
|
Position of the control
|
||||||
|
@param nID
|
||||||
|
ID of the control
|
||||||
|
@param dwStyle
|
||||||
|
Style of the control
|
||||||
|
**/
|
||||||
|
int Create(CWnd* pParentWnd, const RECT& rect, UINT nID, DWORD dwStyle=WS_VISIBLE);
|
||||||
|
|
||||||
|
//! Helper function to convert a date to a double value
|
||||||
|
static double DateToValue(const COleDateTime& Date);
|
||||||
|
//! Helper function to convert a double value to a date
|
||||||
|
static COleDateTime ValueToDate(double Value);
|
||||||
|
|
||||||
|
//! Print the chart
|
||||||
|
/**
|
||||||
|
@param strTitle
|
||||||
|
The title of the print document.
|
||||||
|
@param pPrntDialog
|
||||||
|
A pointer to a CPrintDialog.
|
||||||
|
If NULL is passed, the default print dialog will be displayed.
|
||||||
|
**/
|
||||||
|
virtual void Print(const TChartString& strTitle, CPrintDialog* pPrntDialog = NULL);
|
||||||
|
|
||||||
|
#if _MFC_VER > 0x0600
|
||||||
|
//! Saves the chart to an image file
|
||||||
|
/**
|
||||||
|
This function is not available for VC6 and earlier.
|
||||||
|
@param strFilename
|
||||||
|
The name of the file in which to save the image.
|
||||||
|
@param rect
|
||||||
|
The size of the image. If an empty rectangle is provided, the
|
||||||
|
size of the chart on screen will be used (this results in an identical
|
||||||
|
image as what is seen on the screen).
|
||||||
|
@param nBPP
|
||||||
|
The numbers of bits per pixel in the bitmap. Usually 4, 8, 16, 24, or 32.
|
||||||
|
@param guidFileType
|
||||||
|
The file type to save the image as. See the CImage::Save in MSDN
|
||||||
|
for more information.
|
||||||
|
**/
|
||||||
|
void SaveAsImage(const TChartString& strFilename, const CRect& rect,
|
||||||
|
int nBPP, REFGUID guidFileType= GUID_NULL);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
//! Default constructor
|
||||||
|
CChartCtrl();
|
||||||
|
//! Default destructor
|
||||||
|
virtual ~CChartCtrl();
|
||||||
|
|
||||||
|
//! Register a mouse listener with the control.
|
||||||
|
/**
|
||||||
|
This listener will be notified each time a mouse event occurs on the control.
|
||||||
|
@param pMouseListener
|
||||||
|
The mouse listener to register with this control.
|
||||||
|
**/
|
||||||
|
void RegisterMouseListener(CChartMouseListener* pMouseListener) { m_pMouseListener = pMouseListener;}
|
||||||
|
|
||||||
|
//! Tell the control to set the current series to the first series.
|
||||||
|
/**
|
||||||
|
This function is used with the GetNextSerie to iterate over all
|
||||||
|
series in the control.
|
||||||
|
**/
|
||||||
|
void GoToFirstSerie();
|
||||||
|
//! Returns the next series in the control.
|
||||||
|
/**
|
||||||
|
This function is used with the GoToFirstSerie to iterate over all
|
||||||
|
series in the control. First call GoToFirstSerie and then call this
|
||||||
|
function until it returns NULL to iterate over all series.
|
||||||
|
Warning: calling this function without calling GoToFirstSerie before
|
||||||
|
might lead to unpredicted results. The same if you add or remove
|
||||||
|
series between the call to GetFirstSerie and the call to GetNextSerie.
|
||||||
|
@return the next series or NULL if we already are at the last series.
|
||||||
|
**/
|
||||||
|
CChartSerie* GetNextSerie();
|
||||||
|
|
||||||
|
//! Refreshes all the axes which are automatic for the screen.
|
||||||
|
void RefreshScreenAutoAxes();
|
||||||
|
|
||||||
|
// Generated message map functions
|
||||||
|
protected:
|
||||||
|
//{{AFX_MSG(CChartCtrl)
|
||||||
|
afx_msg void OnPaint();
|
||||||
|
afx_msg BOOL OnEraseBkgnd(CDC* pDC);
|
||||||
|
afx_msg void OnSize(UINT nType, int cx, int cy);
|
||||||
|
afx_msg void OnMouseMove(UINT nFlags, CPoint point);
|
||||||
|
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
|
||||||
|
afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
|
||||||
|
afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
|
||||||
|
afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
|
||||||
|
afx_msg void OnRButtonUp(UINT nFlags, CPoint point);
|
||||||
|
afx_msg void OnRButtonDblClk(UINT nFlags, CPoint point);
|
||||||
|
afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
|
||||||
|
afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
|
||||||
|
//}}AFX_MSG
|
||||||
|
DECLARE_MESSAGE_MAP()
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual void OnBeginPrinting(CDC *pDC, CPrintInfo *pInfo);
|
||||||
|
virtual void OnPrint(CDC *pDC, CPrintInfo *pInfo);
|
||||||
|
virtual void OnEndPrinting(CDC *pDC, CPrintInfo *pInfo);
|
||||||
|
|
||||||
|
// This function can be called to draw the chart
|
||||||
|
// on the screen or for printing.
|
||||||
|
virtual void DrawChart(CDC* pDC, CRect ChartRect);
|
||||||
|
virtual void DrawBackground(CDC* pDC, CRect ChartRect);
|
||||||
|
|
||||||
|
private:
|
||||||
|
//! Register the window class used for this control
|
||||||
|
bool RegisterWindowClass();
|
||||||
|
|
||||||
|
//! Notifies the mouse listeners about a mouse event on the control.
|
||||||
|
/**
|
||||||
|
The function detects on which part of the control the event happened.
|
||||||
|
@param mouseEvent
|
||||||
|
The type of the mouse event
|
||||||
|
@param screenPoint
|
||||||
|
The screen point on which the event occured.
|
||||||
|
**/
|
||||||
|
void SendMouseEvent(CChartMouseListener::MouseEvent mouseEvent, const CPoint& screenPoint) const;
|
||||||
|
|
||||||
|
//! Specifies if the refresh is currently enabled or not.
|
||||||
|
int m_iEnableRefresh ;
|
||||||
|
//! Specifies if there is a pending refresh.
|
||||||
|
/**
|
||||||
|
If true, once EnableRefresh(true) is called, a refresh of the control
|
||||||
|
will be done.
|
||||||
|
**/
|
||||||
|
bool m_bPendingRefresh;
|
||||||
|
//! Memory bitmap on which the chart background is drawn (axis, grid, title, ...)
|
||||||
|
CDC m_BackgroundDC;
|
||||||
|
//! Specifies if the memory bitmap has already been created.
|
||||||
|
bool m_bMemDCCreated;
|
||||||
|
|
||||||
|
//! Specifies if the background is gradient or solid
|
||||||
|
bool m_bBackGradient;
|
||||||
|
//! First gradient color for the background
|
||||||
|
COLORREF m_BackGradientCol1;
|
||||||
|
//! Second gradient color for the background
|
||||||
|
COLORREF m_BackGradientCol2;
|
||||||
|
//! The gradient type used for the background
|
||||||
|
EGradientType m_BackGradientType;
|
||||||
|
//! The background color (if no gradient used)
|
||||||
|
COLORREF m_BackColor;
|
||||||
|
//! The border color
|
||||||
|
COLORREF m_BorderColor;
|
||||||
|
//! The type of edge
|
||||||
|
UINT EdgeType;
|
||||||
|
|
||||||
|
//! Zone in wich the series will be plotted
|
||||||
|
CRect m_PlottingRect;
|
||||||
|
|
||||||
|
typedef std::map<unsigned, CChartSerie*> TSeriesMap;
|
||||||
|
//! Map containing all the series added to the chart.
|
||||||
|
TSeriesMap m_mapSeries;
|
||||||
|
//! The four axis of the control.
|
||||||
|
CChartAxis* m_pAxes[4];
|
||||||
|
|
||||||
|
//! The chart legend
|
||||||
|
CChartLegend* m_pLegend;
|
||||||
|
//! The chart titles
|
||||||
|
CChartTitle* m_pTitles;
|
||||||
|
|
||||||
|
//! Specifies if the mouse panning is enabled
|
||||||
|
bool m_bPanEnabled;
|
||||||
|
//! Specifies if the right mouse button is currently pressed
|
||||||
|
bool m_bRMouseDown;
|
||||||
|
//! The point on which the panning started
|
||||||
|
CPoint m_PanAnchor;
|
||||||
|
|
||||||
|
//! Specifies if the zoom is enabled
|
||||||
|
bool m_bZoomEnabled;
|
||||||
|
//! Specifies if the left mouse button is currently pressed
|
||||||
|
bool m_bLMouseDown;
|
||||||
|
//! The rectangle of the zoom area
|
||||||
|
CRect m_rectZoomArea;
|
||||||
|
//! The color of the zoom rectangle
|
||||||
|
COLORREF m_ZoomRectColor;
|
||||||
|
|
||||||
|
//! Specifies if the toolbars have already been created
|
||||||
|
bool m_bToolBarCreated;
|
||||||
|
|
||||||
|
//! The font used for printing
|
||||||
|
CFont m_PrinterFont;
|
||||||
|
//! Page size in chartctrl units.
|
||||||
|
CSize m_LogicalPageSize;
|
||||||
|
//! Page size in device units.
|
||||||
|
CSize m_PaperSize;
|
||||||
|
|
||||||
|
typedef std::map<unsigned, CChartCursor*> TCursorMap;
|
||||||
|
//! The map containing all the cursors
|
||||||
|
TCursorMap m_mapCursors;
|
||||||
|
|
||||||
|
//! The mouse listener registered with this control
|
||||||
|
CChartMouseListener* m_pMouseListener;
|
||||||
|
|
||||||
|
//! Specifies if the mouse is visible when over the plotting area.
|
||||||
|
bool m_bMouseVisible;
|
||||||
|
|
||||||
|
typedef TSeriesMap::const_iterator TSeriesMapIter;
|
||||||
|
//! The iterator of the current series
|
||||||
|
TSeriesMapIter m_currentSeries;
|
||||||
|
};
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
//{{AFX_INSERT_LOCATION}}
|
||||||
|
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
|
||||||
|
|
Binary file not shown.
|
@ -0,0 +1,56 @@
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
* ChartCursor.cpp
|
||||||
|
*
|
||||||
|
* Written by Cédric Moonen (cedric_moonen@hotmail.com)
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* This code may be used for any non-commercial and commercial purposes in a compiled form.
|
||||||
|
* The code may be redistributed as long as it remains unmodified and providing that the
|
||||||
|
* author name and this disclaimer remain intact. The sources can be modified WITH the author
|
||||||
|
* consent only.
|
||||||
|
*
|
||||||
|
* This code is provided without any garanties. I cannot be held responsible for the damage or
|
||||||
|
* the loss of time it causes. Use it at your own risks
|
||||||
|
*
|
||||||
|
* An e-mail to notify me that you are using this code is appreciated also.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "stdafx.h"
|
||||||
|
#include "ChartCursor.h"
|
||||||
|
#include "ChartCtrl.h"
|
||||||
|
|
||||||
|
unsigned CChartCursor::m_uNextFreeId = 0;
|
||||||
|
|
||||||
|
CChartCursor::CChartCursor(CChartCtrl* pParent)
|
||||||
|
: m_colCursor(RGB(0,0,0)), m_pParentCtrl(pParent), m_uCursorId(0),
|
||||||
|
m_lstListeners()
|
||||||
|
{
|
||||||
|
m_uCursorId = m_uNextFreeId;
|
||||||
|
m_uNextFreeId++;
|
||||||
|
}
|
||||||
|
|
||||||
|
CChartCursor::~CChartCursor()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartCursor::SetColor(COLORREF cursorColor)
|
||||||
|
{
|
||||||
|
m_colCursor = cursorColor;
|
||||||
|
m_pParentCtrl->RefreshCtrl();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartCursor::RegisterListener(CChartCursorListener* pListener)
|
||||||
|
{
|
||||||
|
m_lstListeners.push_back(pListener);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartCursor::CursorMoved(double newXValue, double newYValue)
|
||||||
|
{
|
||||||
|
TListenerList::iterator iter = m_lstListeners.begin();
|
||||||
|
for (iter; iter!=m_lstListeners.end(); iter++)
|
||||||
|
(*iter)->OnCursorMoved(this, newXValue, newYValue);
|
||||||
|
}
|
|
@ -0,0 +1,125 @@
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
* ChartCursor.h
|
||||||
|
*
|
||||||
|
* Written by Cédric Moonen (cedric_moonen@hotmail.com)
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* This code may be used for any non-commercial and commercial purposes in a compiled form.
|
||||||
|
* The code may be redistributed as long as it remains unmodified and providing that the
|
||||||
|
* author name and this disclaimer remain intact. The sources can be modified WITH the author
|
||||||
|
* consent only.
|
||||||
|
*
|
||||||
|
* This code is provided without any garanties. I cannot be held responsible for the damage or
|
||||||
|
* the loss of time it causes. Use it at your own risks
|
||||||
|
*
|
||||||
|
* An e-mail to notify me that you are using this code is appreciated also.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _CHARTCURSOR_H_
|
||||||
|
#define _CHARTCURSOR_H_
|
||||||
|
|
||||||
|
#include <list>
|
||||||
|
|
||||||
|
class CChartCtrl;
|
||||||
|
class CChartCursor;
|
||||||
|
|
||||||
|
//! Interface to implement in order to be notified about a cursor movement.
|
||||||
|
/**
|
||||||
|
This class must be overriden and registered with a CChartCursor by
|
||||||
|
calling RegisterListener.
|
||||||
|
**/
|
||||||
|
class CChartCursorListener
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
//! Default constructor
|
||||||
|
CChartCursorListener() { }
|
||||||
|
//! Destructor
|
||||||
|
virtual ~CChartCursorListener() { }
|
||||||
|
|
||||||
|
//! Pure virtual function to implement in order to be notified about a cursor movement.
|
||||||
|
/**
|
||||||
|
Note that not all cursor types have an X and a Y value, in which case, only
|
||||||
|
the relevant information is passed, the other value will be 0.
|
||||||
|
@param pCursor
|
||||||
|
The cursor which was moved
|
||||||
|
@param xValue
|
||||||
|
The cursor xValue
|
||||||
|
@param yValue
|
||||||
|
The cursor yValue
|
||||||
|
**/
|
||||||
|
virtual void OnCursorMoved(CChartCursor* pCursor, double xValue, double yValue) = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
//! Base class for cursors which can be added to the chart control.
|
||||||
|
/**
|
||||||
|
This class must be overriden for specific cursor types. This is already done
|
||||||
|
for a cross-hair cursor and a dragline cursor. Each cursor is assigned an Id
|
||||||
|
when it is added to the control.
|
||||||
|
**/
|
||||||
|
class CChartCursor
|
||||||
|
{
|
||||||
|
friend CChartCtrl;
|
||||||
|
|
||||||
|
public:
|
||||||
|
//! Sets the cursor color.
|
||||||
|
void SetColor(COLORREF cursorColor);
|
||||||
|
//! Retrieves the cursor Id.
|
||||||
|
unsigned GetCursorId() const { return m_uCursorId; }
|
||||||
|
|
||||||
|
//! Registers a cursor listener with this cursor.
|
||||||
|
void RegisterListener(CChartCursorListener* pListener);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
//! Default constructor
|
||||||
|
CChartCursor(CChartCtrl* pParent);
|
||||||
|
//! Default destructor
|
||||||
|
virtual ~CChartCursor();
|
||||||
|
|
||||||
|
//! Pure virtual function that is called when the mouse moved on the plot area.
|
||||||
|
/**
|
||||||
|
This function must be overriden by child classes to take appropriate
|
||||||
|
actions on the mouse move event.
|
||||||
|
**/
|
||||||
|
virtual void OnMouseMove(CPoint mousePoint) = 0;
|
||||||
|
//! Virtual function that is called when the left mouse button is pressed.
|
||||||
|
/**
|
||||||
|
This function can be overriden by child classes to take appropriate
|
||||||
|
actions on the mouse click event.
|
||||||
|
**/
|
||||||
|
virtual void OnMouseButtonDown(CPoint /*mousePoint*/) { }
|
||||||
|
//! Virtual function that is called when the left mouse button is released.
|
||||||
|
/**
|
||||||
|
This function can be overriden by child classes to take appropriate
|
||||||
|
actions on the mouse click event.
|
||||||
|
**/
|
||||||
|
virtual void OnMouseButtonUp(CPoint /*mousePoint*/) { }
|
||||||
|
|
||||||
|
//! Pure virtual function that draws the cursor.
|
||||||
|
virtual void Draw(CDC* pDC) = 0;
|
||||||
|
//! Function that is called by the child classes when the cursor has been moved.
|
||||||
|
/**
|
||||||
|
This will notify all the listeners registered with the cursor.
|
||||||
|
**/
|
||||||
|
void CursorMoved(double newXValue, double newYValue);
|
||||||
|
|
||||||
|
|
||||||
|
//! The color of the cursor.
|
||||||
|
COLORREF m_colCursor;
|
||||||
|
//! The parent charting control.
|
||||||
|
CChartCtrl* m_pParentCtrl;
|
||||||
|
|
||||||
|
//! Static variable holding the next free cursor Id.
|
||||||
|
static unsigned m_uNextFreeId;
|
||||||
|
//! The Id of this curosr.
|
||||||
|
unsigned m_uCursorId;
|
||||||
|
|
||||||
|
typedef std::list<CChartCursorListener*> TListenerList;
|
||||||
|
//! List of all listeners registered with this cursor.
|
||||||
|
TListenerList m_lstListeners;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // _CHARTCURSOR_H_
|
|
@ -0,0 +1,411 @@
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
* ChartDateTimeAxis.cpp
|
||||||
|
*
|
||||||
|
* Written by Cédric Moonen (cedric_moonen@hotmail.com)
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* This code may be used for any non-commercial and commercial purposes in a compiled form.
|
||||||
|
* The code may be redistributed as long as it remains unmodified and providing that the
|
||||||
|
* author name and this disclaimer remain intact. The sources can be modified WITH the author
|
||||||
|
* consent only.
|
||||||
|
*
|
||||||
|
* This code is provided without any garanties. I cannot be held responsible for the damage or
|
||||||
|
* the loss of time it causes. Use it at your own risks
|
||||||
|
*
|
||||||
|
* An e-mail to notify me that you are using this code is appreciated also.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "stdafx.h"
|
||||||
|
#include "ChartDateTimeAxis.h"
|
||||||
|
#include "ChartCtrl.h"
|
||||||
|
#include <sstream>
|
||||||
|
#include <iostream>
|
||||||
|
#include <iomanip>
|
||||||
|
#include <math.h>
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
CChartDateTimeAxis::CChartDateTimeAxis()
|
||||||
|
: CChartAxis(), m_strDTTickFormat(),
|
||||||
|
m_bAutoTickFormat(true), m_BaseInterval(tiDay),
|
||||||
|
m_iDTTickIntervalMult(1), m_dFirstTickValue(0)
|
||||||
|
{
|
||||||
|
m_ReferenceTick.SetDate(2000,1,1);
|
||||||
|
}
|
||||||
|
|
||||||
|
CChartDateTimeAxis::~CChartDateTimeAxis()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CChartDateTimeAxis::SetTickIncrement(bool bAuto,
|
||||||
|
TimeInterval Interval,
|
||||||
|
int Multiplier)
|
||||||
|
{
|
||||||
|
m_bAutoTicks = bAuto;
|
||||||
|
if (!m_bAutoTicks)
|
||||||
|
{
|
||||||
|
m_BaseInterval = Interval;
|
||||||
|
m_iDTTickIntervalMult = Multiplier;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartDateTimeAxis::SetTickLabelFormat(bool bAutomatic,
|
||||||
|
const TChartString& strFormat)
|
||||||
|
{
|
||||||
|
m_bAutoTickFormat = bAutomatic;
|
||||||
|
m_strDTTickFormat = strFormat;
|
||||||
|
m_pParentCtrl->RefreshCtrl();
|
||||||
|
}
|
||||||
|
|
||||||
|
double CChartDateTimeAxis::GetFirstTickValue() const
|
||||||
|
{
|
||||||
|
double dRetVal = m_dFirstTickValue;
|
||||||
|
if (m_bDiscrete)
|
||||||
|
{
|
||||||
|
COleDateTime dtTick((DATE)m_dFirstTickValue);
|
||||||
|
COleDateTimeSpan dtSpan;
|
||||||
|
switch (m_BaseInterval)
|
||||||
|
{
|
||||||
|
case tiSecond:
|
||||||
|
dtSpan.SetDateTimeSpan(0,0,0,m_iDTTickIntervalMult);
|
||||||
|
dtTick -= dtSpan;
|
||||||
|
break;
|
||||||
|
case tiMinute:
|
||||||
|
dtSpan.SetDateTimeSpan(0,0,m_iDTTickIntervalMult,0);
|
||||||
|
dtTick -= dtSpan;
|
||||||
|
break;
|
||||||
|
case tiHour:
|
||||||
|
dtSpan.SetDateTimeSpan(0,m_iDTTickIntervalMult,0,0);
|
||||||
|
dtTick -= dtSpan;
|
||||||
|
break;
|
||||||
|
case tiDay:
|
||||||
|
dtSpan.SetDateTimeSpan(m_iDTTickIntervalMult,0,0,0);
|
||||||
|
dtTick -= dtSpan;
|
||||||
|
break;
|
||||||
|
case tiMonth:
|
||||||
|
dtTick = AddMonthToDate(dtTick,-m_iDTTickIntervalMult);
|
||||||
|
break;
|
||||||
|
case tiYear:
|
||||||
|
dtTick = AddMonthToDate(dtTick,-12*m_iDTTickIntervalMult);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return dRetVal;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CChartDateTimeAxis::GetNextTickValue(double dCurrentTick, double& dNextTick) const
|
||||||
|
{
|
||||||
|
if (m_MinValue == m_MaxValue)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
COleDateTime dtTick((DATE)dCurrentTick);
|
||||||
|
COleDateTimeSpan dtSpan;
|
||||||
|
switch (m_BaseInterval)
|
||||||
|
{
|
||||||
|
case tiSecond:
|
||||||
|
dtSpan.SetDateTimeSpan(0,0,0,m_iDTTickIntervalMult);
|
||||||
|
dtTick += dtSpan;
|
||||||
|
break;
|
||||||
|
case tiMinute:
|
||||||
|
dtSpan.SetDateTimeSpan(0,0,m_iDTTickIntervalMult,0);
|
||||||
|
dtTick += dtSpan;
|
||||||
|
break;
|
||||||
|
case tiHour:
|
||||||
|
dtSpan.SetDateTimeSpan(0,m_iDTTickIntervalMult,0,0);
|
||||||
|
dtTick += dtSpan;
|
||||||
|
break;
|
||||||
|
case tiDay:
|
||||||
|
dtSpan.SetDateTimeSpan(m_iDTTickIntervalMult,0,0,0);
|
||||||
|
dtTick += dtSpan;
|
||||||
|
break;
|
||||||
|
case tiMonth:
|
||||||
|
dtTick = AddMonthToDate(dtTick,m_iDTTickIntervalMult);
|
||||||
|
break;
|
||||||
|
case tiYear:
|
||||||
|
dtTick = AddMonthToDate(dtTick,12*m_iDTTickIntervalMult);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
dNextTick = (DATE)dtTick;
|
||||||
|
if (dNextTick <= m_MaxValue)
|
||||||
|
return true;
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
TChartString CChartDateTimeAxis::GetTickLabel(double TickValue) const
|
||||||
|
{
|
||||||
|
COleDateTime tickTime((DATE)TickValue);
|
||||||
|
TChartString strLabel = tickTime.Format(m_strDTTickFormat.c_str());
|
||||||
|
return strLabel;
|
||||||
|
}
|
||||||
|
|
||||||
|
long CChartDateTimeAxis::ValueToScreenDiscrete(double dValue) const
|
||||||
|
{
|
||||||
|
// In discrete mode, all values between two ticks relates
|
||||||
|
// to the middle of the interval (there's no other values than
|
||||||
|
// the tick values).
|
||||||
|
double tickAfter;
|
||||||
|
double tickBefore = GetTickBeforeVal(dValue);
|
||||||
|
GetNextTickValue(tickBefore, tickAfter);
|
||||||
|
|
||||||
|
long tickPosBefore = ValueToScreenStandard(tickBefore);
|
||||||
|
long tickPosAfter = ValueToScreenStandard(tickAfter);
|
||||||
|
return tickPosBefore + (tickPosAfter-tickPosBefore)/2;
|
||||||
|
}
|
||||||
|
|
||||||
|
long CChartDateTimeAxis::GetTickPos(double TickVal) const
|
||||||
|
{
|
||||||
|
// The tick is always at the same position,
|
||||||
|
// even if the axis is discrete.
|
||||||
|
return ValueToScreenStandard(TickVal);
|
||||||
|
}
|
||||||
|
|
||||||
|
COleDateTime CChartDateTimeAxis::AddMonthToDate(const COleDateTime& Date,
|
||||||
|
int iMonthsToAdd) const
|
||||||
|
{
|
||||||
|
COleDateTime newDate;
|
||||||
|
int nMonths = Date.GetMonth()-1 + iMonthsToAdd;
|
||||||
|
int nYear = Date.GetYear() + nMonths/12;;
|
||||||
|
// We can 'add' a negative number of months
|
||||||
|
if (nMonths<0)
|
||||||
|
{
|
||||||
|
nYear = Date.GetYear() - (-nMonths)/12;
|
||||||
|
nMonths += (-nMonths)/12 * 12;
|
||||||
|
}
|
||||||
|
|
||||||
|
newDate.SetDateTime(nYear,nMonths%12+1,Date.GetDay(),Date.GetHour(),
|
||||||
|
Date.GetMinute(),Date.GetSecond());
|
||||||
|
return newDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartDateTimeAxis::RefreshTickIncrement()
|
||||||
|
{
|
||||||
|
if (!m_bAutoTicks)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (m_MaxValue == m_MinValue)
|
||||||
|
{
|
||||||
|
m_iDTTickIntervalMult = 1;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
int PixelSpace;
|
||||||
|
if (m_bIsHorizontal)
|
||||||
|
PixelSpace = 60;
|
||||||
|
else
|
||||||
|
PixelSpace = 20;
|
||||||
|
|
||||||
|
int MaxTickNumber = (int)fabs((m_EndPos-m_StartPos)/PixelSpace * 1.0);
|
||||||
|
if (MaxTickNumber == 0)
|
||||||
|
MaxTickNumber = 1;
|
||||||
|
|
||||||
|
COleDateTime StartDate(m_MinValue);
|
||||||
|
COleDateTime EndDate(m_MaxValue);
|
||||||
|
|
||||||
|
COleDateTimeSpan minTickInterval = (EndDate - StartDate)/MaxTickNumber;
|
||||||
|
double Seconds = minTickInterval.GetTotalSeconds();
|
||||||
|
double Minutes = minTickInterval.GetTotalMinutes();
|
||||||
|
double Hours = minTickInterval.GetTotalHours();
|
||||||
|
double Days = minTickInterval.GetTotalDays();
|
||||||
|
if (Seconds < 60)
|
||||||
|
{
|
||||||
|
m_BaseInterval = tiSecond;
|
||||||
|
if (Seconds > 30)
|
||||||
|
{
|
||||||
|
m_BaseInterval = tiMinute;
|
||||||
|
m_iDTTickIntervalMult = 1;
|
||||||
|
}
|
||||||
|
else if (Seconds > 10)
|
||||||
|
m_iDTTickIntervalMult = 30;
|
||||||
|
else if (Seconds > 5)
|
||||||
|
m_iDTTickIntervalMult = 10;
|
||||||
|
else if (Seconds > 2)
|
||||||
|
m_iDTTickIntervalMult = 5;
|
||||||
|
else
|
||||||
|
m_iDTTickIntervalMult = 1;
|
||||||
|
}
|
||||||
|
else if (Minutes < 60)
|
||||||
|
{
|
||||||
|
m_BaseInterval = tiMinute;
|
||||||
|
if (Minutes > 30)
|
||||||
|
{
|
||||||
|
m_BaseInterval = tiHour;
|
||||||
|
m_iDTTickIntervalMult = 1;
|
||||||
|
}
|
||||||
|
else if (Minutes > 10)
|
||||||
|
m_iDTTickIntervalMult = 30;
|
||||||
|
else if (Minutes > 5)
|
||||||
|
m_iDTTickIntervalMult = 10;
|
||||||
|
else if (Minutes > 2)
|
||||||
|
m_iDTTickIntervalMult = 5;
|
||||||
|
else
|
||||||
|
m_iDTTickIntervalMult = 2;
|
||||||
|
}
|
||||||
|
else if (Hours < 24)
|
||||||
|
{
|
||||||
|
m_BaseInterval = tiHour;
|
||||||
|
if (Hours > 12)
|
||||||
|
{
|
||||||
|
m_BaseInterval = tiDay;
|
||||||
|
m_iDTTickIntervalMult = 1;
|
||||||
|
}
|
||||||
|
else if (Hours > 6)
|
||||||
|
m_iDTTickIntervalMult = 12;
|
||||||
|
else if (Hours > 2)
|
||||||
|
m_iDTTickIntervalMult = 6;
|
||||||
|
else
|
||||||
|
m_iDTTickIntervalMult = 2;
|
||||||
|
}
|
||||||
|
else if (Days < 31)
|
||||||
|
{
|
||||||
|
m_BaseInterval = tiDay;
|
||||||
|
if (Days > 7)
|
||||||
|
{
|
||||||
|
m_BaseInterval = tiMonth;
|
||||||
|
m_iDTTickIntervalMult = 1;
|
||||||
|
}
|
||||||
|
else if (Days > 2)
|
||||||
|
{
|
||||||
|
m_BaseInterval = tiDay;
|
||||||
|
m_iDTTickIntervalMult = 7;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
m_iDTTickIntervalMult = 2;
|
||||||
|
}
|
||||||
|
else if (Days < 365)
|
||||||
|
{
|
||||||
|
m_BaseInterval = tiMonth;
|
||||||
|
if (Days > 186) // Approx 6 months
|
||||||
|
{
|
||||||
|
m_BaseInterval = tiYear;
|
||||||
|
m_iDTTickIntervalMult = 1;
|
||||||
|
}
|
||||||
|
else if (Days > 124)
|
||||||
|
m_iDTTickIntervalMult = 6;
|
||||||
|
else if (Days > 62)
|
||||||
|
m_iDTTickIntervalMult = 4;
|
||||||
|
else
|
||||||
|
m_iDTTickIntervalMult = 2;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_BaseInterval = tiYear;
|
||||||
|
m_iDTTickIntervalMult = (int)Days/365 + 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartDateTimeAxis::RefreshFirstTick()
|
||||||
|
{
|
||||||
|
m_dFirstTickValue = GetTickBeforeVal(m_MinValue);
|
||||||
|
if (m_bAutoTickFormat)
|
||||||
|
RefreshDTTickFormat();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartDateTimeAxis::SetReferenceTick(COleDateTime referenceTick)
|
||||||
|
{
|
||||||
|
m_ReferenceTick = referenceTick;
|
||||||
|
m_pParentCtrl->RefreshCtrl();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartDateTimeAxis::RefreshDTTickFormat()
|
||||||
|
{
|
||||||
|
switch (m_BaseInterval)
|
||||||
|
{
|
||||||
|
case tiSecond:
|
||||||
|
m_strDTTickFormat = _T("%H:%M:%S");
|
||||||
|
break;
|
||||||
|
case tiMinute:
|
||||||
|
m_strDTTickFormat = _T("%H:%M");
|
||||||
|
break;
|
||||||
|
case tiHour:
|
||||||
|
m_strDTTickFormat = _T("%H:00");
|
||||||
|
break;
|
||||||
|
case tiDay:
|
||||||
|
m_strDTTickFormat = _T("%d %b");
|
||||||
|
break;
|
||||||
|
case tiMonth:
|
||||||
|
m_strDTTickFormat = _T("%b %Y");
|
||||||
|
break;
|
||||||
|
case tiYear:
|
||||||
|
m_strDTTickFormat = _T("%Y");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
double CChartDateTimeAxis::GetTickBeforeVal(double dValue) const
|
||||||
|
{
|
||||||
|
double precision = 0.0000000001;
|
||||||
|
if (dValue < 0)
|
||||||
|
precision = -0.0000000001;
|
||||||
|
|
||||||
|
COleDateTime tickBefore;
|
||||||
|
COleDateTime valueTime = COleDateTime(DATE(dValue+precision));
|
||||||
|
COleDateTimeSpan dtSpan = valueTime - m_ReferenceTick;
|
||||||
|
switch (m_BaseInterval)
|
||||||
|
{
|
||||||
|
case tiSecond:
|
||||||
|
{
|
||||||
|
int totalSecs = (int)dtSpan.GetTotalSeconds();
|
||||||
|
totalSecs = (totalSecs/m_iDTTickIntervalMult) * m_iDTTickIntervalMult;
|
||||||
|
int Days = totalSecs/86400; // 86400 seconds in one day
|
||||||
|
int Hours = (totalSecs%86400)/3600; // 3600 seconds in one hour
|
||||||
|
int Minutes = ((totalSecs%86400)%3600)/60; // 60 seconds in one minute
|
||||||
|
int Seconds = ((totalSecs%86400)%3600)%60;
|
||||||
|
dtSpan.SetDateTimeSpan(Days, Hours, Minutes, Seconds);
|
||||||
|
tickBefore = m_ReferenceTick + dtSpan;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case tiMinute:
|
||||||
|
{
|
||||||
|
int totalMinutes = (int)dtSpan.GetTotalMinutes();
|
||||||
|
totalMinutes = (totalMinutes/m_iDTTickIntervalMult) * m_iDTTickIntervalMult;
|
||||||
|
int Days = totalMinutes/1440; // 1440 minutes in one day
|
||||||
|
int Hours = (totalMinutes%1440)/60; // 60 minutes in one hour
|
||||||
|
int Minutes = (totalMinutes%1440)%60;
|
||||||
|
dtSpan.SetDateTimeSpan(Days, Hours, Minutes, 0);
|
||||||
|
tickBefore = m_ReferenceTick + dtSpan;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case tiHour:
|
||||||
|
{
|
||||||
|
int totalHours = (int)dtSpan.GetTotalHours();
|
||||||
|
totalHours = (totalHours/m_iDTTickIntervalMult) * m_iDTTickIntervalMult;
|
||||||
|
int Days = totalHours/24; // 24 hours in one day
|
||||||
|
int Hours = totalHours%24;
|
||||||
|
dtSpan.SetDateTimeSpan(Days, Hours, 0, 0);
|
||||||
|
tickBefore = m_ReferenceTick + dtSpan;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case tiDay:
|
||||||
|
{
|
||||||
|
int totalDays = (int)dtSpan.GetTotalDays();
|
||||||
|
totalDays = (totalDays/m_iDTTickIntervalMult) * m_iDTTickIntervalMult;
|
||||||
|
dtSpan.SetDateTimeSpan(totalDays, 0, 0, 0);
|
||||||
|
tickBefore = m_ReferenceTick + dtSpan;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case tiMonth:
|
||||||
|
{
|
||||||
|
int yearDiff = valueTime.GetYear() - m_ReferenceTick.GetYear();
|
||||||
|
int monthDiff = valueTime.GetMonth() - m_ReferenceTick.GetMonth();
|
||||||
|
int totalMonths = ((yearDiff*12+monthDiff)/m_iDTTickIntervalMult) * m_iDTTickIntervalMult;
|
||||||
|
tickBefore = AddMonthToDate(m_ReferenceTick,totalMonths);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case tiYear:
|
||||||
|
{
|
||||||
|
int yearDiff = valueTime.GetYear() - m_ReferenceTick.GetYear();
|
||||||
|
int year = ((yearDiff)/m_iDTTickIntervalMult) * m_iDTTickIntervalMult;
|
||||||
|
tickBefore = AddMonthToDate(m_ReferenceTick,year*12);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (DATE)tickBefore;
|
||||||
|
}
|
|
@ -0,0 +1,150 @@
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
* ChartDateTimeAxis.h
|
||||||
|
*
|
||||||
|
* Written by Cédric Moonen (cedric_moonen@hotmail.com)
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* This code may be used for any non-commercial and commercial purposes in a compiled form.
|
||||||
|
* The code may be redistributed as long as it remains unmodified and providing that the
|
||||||
|
* author name and this disclaimer remain intact. The sources can be modified WITH the author
|
||||||
|
* consent only.
|
||||||
|
*
|
||||||
|
* This code is provided without any garanties. I cannot be held responsible for the damage or
|
||||||
|
* the loss of time it causes. Use it at your own risks
|
||||||
|
*
|
||||||
|
* An e-mail to notify me that you are using this code is appreciated also.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _CHARTDATETIMEAXIS_H_
|
||||||
|
#define _CHARTDATETIMEAXIS_H_
|
||||||
|
|
||||||
|
#include "ChartAxis.h"
|
||||||
|
#include "ChartString.h"
|
||||||
|
|
||||||
|
//! A specialization of the CChartAxis class for displaying date and time data.
|
||||||
|
class CChartDateTimeAxis : public CChartAxis
|
||||||
|
{
|
||||||
|
friend CChartCtrl;
|
||||||
|
|
||||||
|
public:
|
||||||
|
//! Enum listing the different base intervals.
|
||||||
|
enum TimeInterval
|
||||||
|
{
|
||||||
|
tiSecond,
|
||||||
|
tiMinute,
|
||||||
|
tiHour,
|
||||||
|
tiDay,
|
||||||
|
tiMonth,
|
||||||
|
tiYear
|
||||||
|
};
|
||||||
|
|
||||||
|
//! Sets the tick increment.
|
||||||
|
/**
|
||||||
|
The tick increment is the value between two adjacents
|
||||||
|
ticks on the axis. In case of a date time axis, the interval
|
||||||
|
is specified by a time period because this interval might not
|
||||||
|
be constant (for instance, if a tick interval of one month is
|
||||||
|
specified, the distance between two adjacents ticks is not
|
||||||
|
constant: it depends on the number of days in the month).
|
||||||
|
The full tick interval is made of a base interval (day, month,
|
||||||
|
hour, ...) and a multiplier, that is applied to this base interval.
|
||||||
|
So, for an interval of three months between two ticks, you have to
|
||||||
|
specify tiMonth for the interval and 3 for the multiplier.
|
||||||
|
@param bAuto
|
||||||
|
Specifies if the tick increment is automatically calculated.
|
||||||
|
@param Interval
|
||||||
|
The base interval.
|
||||||
|
@param Multiplier
|
||||||
|
The multiplier applied to the base interval.
|
||||||
|
**/
|
||||||
|
void SetTickIncrement(bool bAuto, TimeInterval Interval, int Multiplier);
|
||||||
|
//! Sets the format of the tick labels.
|
||||||
|
/**
|
||||||
|
@param bAutomatic
|
||||||
|
Specifies if the format is calculated automatically.
|
||||||
|
@param strFormat
|
||||||
|
The format to apply to the tick label if bAutomatic is false.
|
||||||
|
<br>Check the documentation of the COleDateTime::Format function on
|
||||||
|
MSDN for more information about the format string.
|
||||||
|
**/
|
||||||
|
void SetTickLabelFormat(bool bAutomatic, const TChartString& strFormat);
|
||||||
|
//! Sets the reference tick.
|
||||||
|
/**
|
||||||
|
The reference tick is a date/time which specifies a tick which should
|
||||||
|
always be displayed on the axis. This is needed when the tick
|
||||||
|
interval multiplier is not 1 (e.g. the interval between two ticks is 3
|
||||||
|
months). In that specific case, there is no way for the control to know
|
||||||
|
which ticks should be displayed (in our example, the chart doesn't know
|
||||||
|
if the first tick will be january, february or march). This is particularly
|
||||||
|
annoying when the axis is panned (in that case, if we always take the first
|
||||||
|
month on the axis as first tick, the ticks will always switch from one month
|
||||||
|
to another). By having a refence tick, this forces the control to calculate
|
||||||
|
all tick intervals based on this reference. It is set to January 1st 2000 by
|
||||||
|
default.
|
||||||
|
**/
|
||||||
|
void SetReferenceTick(COleDateTime referenceTick);
|
||||||
|
|
||||||
|
private:
|
||||||
|
//! Default constructor
|
||||||
|
CChartDateTimeAxis();
|
||||||
|
//! Default destructor
|
||||||
|
~CChartDateTimeAxis();
|
||||||
|
|
||||||
|
double GetFirstTickValue() const;
|
||||||
|
bool GetNextTickValue(double dCurrentTick, double& dNextTick) const;
|
||||||
|
TChartString GetTickLabel(double TickValue) const;
|
||||||
|
long ValueToScreenDiscrete(double Value) const;
|
||||||
|
long GetTickPos(double TickVal) const;
|
||||||
|
|
||||||
|
void RefreshTickIncrement();
|
||||||
|
void RefreshFirstTick();
|
||||||
|
//! Forces a refresh of the date/time tick label format
|
||||||
|
void RefreshDTTickFormat();
|
||||||
|
|
||||||
|
//! Add a number of months to a date.
|
||||||
|
/**
|
||||||
|
The function takes care of 'overflow' (total number
|
||||||
|
of months higher than 12) error when adding the months.
|
||||||
|
@param Date
|
||||||
|
The date to which months will be added.
|
||||||
|
@param iMonthsToAdd
|
||||||
|
The number of months to add to the date.
|
||||||
|
@return the resulting date.
|
||||||
|
**/
|
||||||
|
COleDateTime AddMonthToDate(const COleDateTime& Date,
|
||||||
|
int iMonthsToAdd) const;
|
||||||
|
|
||||||
|
double GetTickBeforeVal(double dValue) const;
|
||||||
|
|
||||||
|
//! Format of the date/time tick labels
|
||||||
|
TChartString m_strDTTickFormat;
|
||||||
|
//! Specifies if the tick labels format is automatic
|
||||||
|
bool m_bAutoTickFormat;
|
||||||
|
//! Specifies the base time interval for ticks
|
||||||
|
/**
|
||||||
|
This specifies an base interval in sec, min, hour,
|
||||||
|
day, month or year. The total tick increment is
|
||||||
|
a mutliple of this base interval (specified by
|
||||||
|
m_iDTTickIntervalMult). E.g: 2 days
|
||||||
|
**/
|
||||||
|
TimeInterval m_BaseInterval;
|
||||||
|
//! Specifies the multiplicator for the base interval
|
||||||
|
/**
|
||||||
|
This multiplies the base interval for the ticks, resulting
|
||||||
|
in something like 3 minutes (a multiplicator of 1 can also
|
||||||
|
be specified).
|
||||||
|
**/
|
||||||
|
int m_iDTTickIntervalMult;
|
||||||
|
|
||||||
|
//! Caches the value of the first tick.
|
||||||
|
double m_dFirstTickValue;
|
||||||
|
|
||||||
|
//! The reference tick. See the SetReferenceTick function for details.
|
||||||
|
COleDateTime m_ReferenceTick;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // _CHARTDATETIMEAXIS_H_
|
|
@ -0,0 +1,103 @@
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
* ChartDragLineCursor.cpp
|
||||||
|
*
|
||||||
|
* Written by Cédric Moonen (cedric_moonen@hotmail.com)
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* This code may be used for any non-commercial and commercial purposes in a compiled form.
|
||||||
|
* The code may be redistributed as long as it remains unmodified and providing that the
|
||||||
|
* author name and this disclaimer remain intact. The sources can be modified WITH the author
|
||||||
|
* consent only.
|
||||||
|
*
|
||||||
|
* This code is provided without any garanties. I cannot be held responsible for the damage or
|
||||||
|
* the loss of time it causes. Use it at your own risks
|
||||||
|
*
|
||||||
|
* An e-mail to notify me that you are using this code is appreciated also.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "stdafx.h"
|
||||||
|
#include "ChartDragLineCursor.h"
|
||||||
|
#include "ChartCtrl.h"
|
||||||
|
|
||||||
|
CChartDragLineCursor::CChartDragLineCursor(CChartCtrl* pParent,
|
||||||
|
CChartAxis* pRelatedAxis)
|
||||||
|
: CChartCursor(pParent), m_pRelatedAxis(pRelatedAxis), m_lPosition(0),
|
||||||
|
m_bDragged(false)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
CChartDragLineCursor::~CChartDragLineCursor()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartDragLineCursor::Draw(CDC* pDC)
|
||||||
|
{
|
||||||
|
CPen NewPen(PS_SOLID,1,m_colCursor);
|
||||||
|
CPen* pOldPen = pDC->SelectObject(&NewPen);
|
||||||
|
|
||||||
|
CRect plottingRect = m_pParentCtrl->GetPlottingRect();
|
||||||
|
|
||||||
|
if (m_pRelatedAxis->IsHorizontal())
|
||||||
|
{
|
||||||
|
pDC->MoveTo(m_lPosition, plottingRect.top);
|
||||||
|
pDC->LineTo(m_lPosition, plottingRect.bottom);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pDC->MoveTo(plottingRect.left, m_lPosition);
|
||||||
|
pDC->LineTo(plottingRect.right, m_lPosition);
|
||||||
|
}
|
||||||
|
|
||||||
|
pDC->SelectObject(pOldPen);
|
||||||
|
NewPen.DeleteObject();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartDragLineCursor::OnMouseButtonDown(CPoint mousePoint)
|
||||||
|
{
|
||||||
|
long position = 0;
|
||||||
|
if (m_pRelatedAxis->IsHorizontal())
|
||||||
|
position = mousePoint.x;
|
||||||
|
else
|
||||||
|
position = mousePoint.y;
|
||||||
|
|
||||||
|
if ( (position >= m_lPosition-3) &&
|
||||||
|
(position <= m_lPosition+3) )
|
||||||
|
{
|
||||||
|
m_bDragged = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartDragLineCursor::OnMouseButtonUp(CPoint /*mousePoint*/)
|
||||||
|
{
|
||||||
|
m_bDragged = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartDragLineCursor::OnMouseMove(CPoint mousePoint)
|
||||||
|
{
|
||||||
|
if (!m_bDragged)
|
||||||
|
return;
|
||||||
|
|
||||||
|
double XVal = 0;
|
||||||
|
double YVal = 0;
|
||||||
|
if (m_pRelatedAxis->IsHorizontal())
|
||||||
|
{
|
||||||
|
m_lPosition = mousePoint.x;
|
||||||
|
XVal = m_pRelatedAxis->ScreenToValue(m_lPosition);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_lPosition = mousePoint.y;
|
||||||
|
YVal = m_pRelatedAxis->ScreenToValue(m_lPosition);
|
||||||
|
}
|
||||||
|
|
||||||
|
CursorMoved(XVal, YVal);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartDragLineCursor::SetPosition(double dPosition)
|
||||||
|
{
|
||||||
|
m_lPosition = m_pRelatedAxis->ValueToScreen(dPosition);
|
||||||
|
}
|
|
@ -0,0 +1,72 @@
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
* ChartDragLineCursor.h
|
||||||
|
*
|
||||||
|
* Written by Cédric Moonen (cedric_moonen@hotmail.com)
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* This code may be used for any non-commercial and commercial purposes in a compiled form.
|
||||||
|
* The code may be redistributed as long as it remains unmodified and providing that the
|
||||||
|
* author name and this disclaimer remain intact. The sources can be modified WITH the author
|
||||||
|
* consent only.
|
||||||
|
*
|
||||||
|
* This code is provided without any garanties. I cannot be held responsible for the damage or
|
||||||
|
* the loss of time it causes. Use it at your own risks
|
||||||
|
*
|
||||||
|
* An e-mail to notify me that you are using this code is appreciated also.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _CHARTDRAGLINECURSOR_H_
|
||||||
|
#define _CHARTDRAGLINECURSOR_H_
|
||||||
|
|
||||||
|
#include "ChartCursor.h"
|
||||||
|
|
||||||
|
class CChartAxis;
|
||||||
|
|
||||||
|
//! Specialization of a CChartCursor class for a dragline cursor.
|
||||||
|
/**
|
||||||
|
A dragline cursor is a simple vertical or horizontal line associated
|
||||||
|
with a specific axis. The line can be moved if the user clicks on the
|
||||||
|
line (and keeps the button pressed) and moves the mouse. Once the mouse
|
||||||
|
button is released, the line doesn't move anymore.<br>
|
||||||
|
To create a dragline cursor, call the CreateDragLineCursor from the
|
||||||
|
CChartCtrl class.
|
||||||
|
**/
|
||||||
|
class CChartDragLineCursor : public CChartCursor
|
||||||
|
{
|
||||||
|
friend CChartCtrl;
|
||||||
|
|
||||||
|
public:
|
||||||
|
//! Sets the position (by value) of the cursor.
|
||||||
|
void SetPosition(double dPosition);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
//! Called when the mouse is moved over the plot area.
|
||||||
|
void OnMouseMove(CPoint mousePoint);
|
||||||
|
//! Called when the mouse button is pressed over the plot area.
|
||||||
|
void OnMouseButtonDown(CPoint mousePoint);
|
||||||
|
//! Called when the mouse button is released over the plot area.
|
||||||
|
void OnMouseButtonUp(CPoint mousePoint);
|
||||||
|
|
||||||
|
//! Draw the cursor.
|
||||||
|
void Draw(CDC* pDC);
|
||||||
|
|
||||||
|
private:
|
||||||
|
//! Constructor
|
||||||
|
CChartDragLineCursor(CChartCtrl* pParent, CChartAxis* pRelatedAxis);
|
||||||
|
//! Destructor
|
||||||
|
~CChartDragLineCursor();
|
||||||
|
|
||||||
|
//! The axis to which this cursor is attached.
|
||||||
|
CChartAxis* m_pRelatedAxis;
|
||||||
|
|
||||||
|
//! flag specifying if the cursor is currently being dragged.
|
||||||
|
bool m_bDragged;
|
||||||
|
//! The current screen position of the cursor.
|
||||||
|
long m_lPosition;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // _CHARTDRAGLINECURSOR_H_
|
|
@ -0,0 +1,145 @@
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
* ChartFont.cpp
|
||||||
|
*
|
||||||
|
* Written by Cédric Moonen (cedric_moonen@hotmail.com)
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* This code may be used for any non-commercial and commercial purposes in a compiled form.
|
||||||
|
* The code may be redistributed as long as it remains unmodified and providing that the
|
||||||
|
* author name and this disclaimer remain intact. The sources can be modified WITH the author
|
||||||
|
* consent only.
|
||||||
|
*
|
||||||
|
* This code is provided without any garanties. I cannot be held responsible for the damage or
|
||||||
|
* the loss of time it causes. Use it at your own risks
|
||||||
|
*
|
||||||
|
* An e-mail to notify me that you are using this code is appreciated also.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "stdafx.h"
|
||||||
|
#include "ChartFont.h"
|
||||||
|
|
||||||
|
CChartFont::CChartFont(const TChartString& strFaceName, int iPointSize)
|
||||||
|
: m_strFaceName(strFaceName), m_iPointSize(iPointSize), m_bItalic(false),
|
||||||
|
m_bBold(false), m_bUnderline(false), m_bVertical(false), m_Font(), m_bDirty(true),
|
||||||
|
m_pOldFont(NULL)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
CChartFont::CChartFont(const CChartFont& copy)
|
||||||
|
{
|
||||||
|
*this = copy;
|
||||||
|
}
|
||||||
|
|
||||||
|
CChartFont::CChartFont()
|
||||||
|
: m_strFaceName(_T("Microsoft Sans Serif")), m_iPointSize(100), m_bItalic(false),
|
||||||
|
m_bBold(false), m_bUnderline(false), m_bVertical(false), m_Font(), m_bDirty(true),
|
||||||
|
m_pOldFont(NULL)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
CChartFont::~CChartFont()
|
||||||
|
{
|
||||||
|
m_Font.DeleteObject();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*CFont* CChartFont::GetFont(CDC* pDC)
|
||||||
|
{
|
||||||
|
if (!m_pFont)
|
||||||
|
m_pFont = new CFont();
|
||||||
|
|
||||||
|
if (m_bDirty)
|
||||||
|
{
|
||||||
|
LOGFONT lf;
|
||||||
|
memset(&lf, 0, sizeof(LOGFONT));
|
||||||
|
lf.lfHeight = m_iPointSize;
|
||||||
|
_tcscpy_s(lf.lfFaceName,LF_FACESIZE-1 , m_strFaceName.c_str());
|
||||||
|
lf.lfItalic = m_bItalic;
|
||||||
|
lf.lfUnderline = m_bUnderline;
|
||||||
|
if (m_bBold)
|
||||||
|
lf.lfWeight = FW_BOLD;
|
||||||
|
else
|
||||||
|
lf.lfWeight = FW_NORMAL;
|
||||||
|
|
||||||
|
m_pFont->CreatePointFontIndirect(&lf, pDC);
|
||||||
|
}
|
||||||
|
|
||||||
|
return m_pFont;
|
||||||
|
}*/
|
||||||
|
|
||||||
|
void CChartFont::operator=(const CChartFont& objectSrc)
|
||||||
|
{
|
||||||
|
m_strFaceName = objectSrc.m_strFaceName;
|
||||||
|
m_iPointSize = objectSrc.m_iPointSize;
|
||||||
|
|
||||||
|
m_bItalic = objectSrc.m_bItalic;
|
||||||
|
m_bBold = objectSrc.m_bBold;
|
||||||
|
m_bUnderline = objectSrc.m_bUnderline;
|
||||||
|
m_bVertical = objectSrc.m_bVertical;
|
||||||
|
|
||||||
|
m_bDirty = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartFont::SelectFont(CDC* pDC) const
|
||||||
|
{
|
||||||
|
if (m_bDirty)
|
||||||
|
{
|
||||||
|
LOGFONT lf;
|
||||||
|
memset(&lf, 0, sizeof(LOGFONT));
|
||||||
|
lf.lfHeight = m_iPointSize;
|
||||||
|
#ifdef _CRT_INSECURE_DEPRECATE
|
||||||
|
_tcscpy_s(lf.lfFaceName,LF_FACESIZE-1 , m_strFaceName.c_str());
|
||||||
|
#else
|
||||||
|
_tcscpy(lf.lfFaceName, m_strFaceName.c_str());
|
||||||
|
#endif
|
||||||
|
lf.lfItalic = m_bItalic;
|
||||||
|
lf.lfUnderline = m_bUnderline;
|
||||||
|
if (m_bBold)
|
||||||
|
lf.lfWeight = FW_BOLD;
|
||||||
|
else
|
||||||
|
lf.lfWeight = FW_NORMAL;
|
||||||
|
|
||||||
|
if (m_bVertical)
|
||||||
|
{
|
||||||
|
lf.lfOrientation = 900;
|
||||||
|
lf.lfEscapement = 900;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_Font.DeleteObject();
|
||||||
|
m_Font.CreatePointFontIndirect(&lf, pDC);
|
||||||
|
m_bDirty = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_pOldFont = pDC->SelectObject(&m_Font);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartFont::UnselectFont(CDC* pDC) const
|
||||||
|
{
|
||||||
|
ASSERT(m_pOldFont);
|
||||||
|
pDC->SelectObject(m_pOldFont);
|
||||||
|
m_pOldFont = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartFont::SetFont(const TChartString& strFaceName,
|
||||||
|
int iPointSize,
|
||||||
|
bool bItalic,
|
||||||
|
bool bBold,
|
||||||
|
bool bUnderline)
|
||||||
|
{
|
||||||
|
m_strFaceName = strFaceName;
|
||||||
|
m_iPointSize = iPointSize;
|
||||||
|
|
||||||
|
m_bItalic = bItalic;
|
||||||
|
m_bBold = bBold;
|
||||||
|
m_bUnderline = bUnderline;
|
||||||
|
|
||||||
|
m_bDirty = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartFont::SetVertical(bool bVertical)
|
||||||
|
{
|
||||||
|
m_bVertical = bVertical;
|
||||||
|
m_bDirty = true;
|
||||||
|
}
|
|
@ -0,0 +1,111 @@
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
* ChartFont.h
|
||||||
|
*
|
||||||
|
* Written by Cédric Moonen (cedric_moonen@hotmail.com)
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* This code may be used for any non-commercial and commercial purposes in a compiled form.
|
||||||
|
* The code may be redistributed as long as it remains unmodified and providing that the
|
||||||
|
* author name and this disclaimer remain intact. The sources can be modified WITH the author
|
||||||
|
* consent only.
|
||||||
|
*
|
||||||
|
* This code is provided without any garanties. I cannot be held responsible for the damage or
|
||||||
|
* the loss of time it causes. Use it at your own risks
|
||||||
|
*
|
||||||
|
* An e-mail to notify me that you are using this code is appreciated also.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _CHARTFONT_H_
|
||||||
|
#define _CHARTFONT_H_
|
||||||
|
|
||||||
|
#include "ChartString.h"
|
||||||
|
#include <afx.h>
|
||||||
|
|
||||||
|
//! Wrapper class for fonts with advanced properties (italic, bold or underlined).
|
||||||
|
class CChartFont
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
//! Copy constructor.
|
||||||
|
CChartFont(const CChartFont& copy);
|
||||||
|
//! Constructor
|
||||||
|
/**
|
||||||
|
@param strFaceName
|
||||||
|
The font face name
|
||||||
|
@param iPointSize
|
||||||
|
The font point size
|
||||||
|
**/
|
||||||
|
CChartFont(const TChartString& strFaceName, int iPointSize);
|
||||||
|
//! Default constructor
|
||||||
|
/**
|
||||||
|
Construct a font with the "Microsoft Sans Serif" face name and
|
||||||
|
with a point size of 100.
|
||||||
|
**/
|
||||||
|
CChartFont();
|
||||||
|
//! Destructor
|
||||||
|
~CChartFont();
|
||||||
|
|
||||||
|
//! Sets the font with extended properties.
|
||||||
|
/**
|
||||||
|
@param strFaceName
|
||||||
|
The font face name
|
||||||
|
@param iPointSize
|
||||||
|
The font point size
|
||||||
|
@param bItalic
|
||||||
|
Specifies if the text is in italic
|
||||||
|
@param bBold
|
||||||
|
Specifies if the text is in bold
|
||||||
|
@param bUnderline
|
||||||
|
Specifies if the text is underlined
|
||||||
|
**/
|
||||||
|
void SetFont(const TChartString& strFaceName, int iPointSize,
|
||||||
|
bool bItalic=false, bool bBold=false, bool bUnderline=false);
|
||||||
|
|
||||||
|
//! Select this font in the device context passed in argument.
|
||||||
|
/**
|
||||||
|
This function stores the current font selected in the DC to
|
||||||
|
set it back when calling UnselectFont. This function is mainly
|
||||||
|
used internally.
|
||||||
|
**/
|
||||||
|
void SelectFont(CDC* pDC) const;
|
||||||
|
//! Reset the font to its original in the device context.
|
||||||
|
void UnselectFont(CDC* pDC) const;
|
||||||
|
|
||||||
|
//! Sets the text in vertical mode.
|
||||||
|
/**
|
||||||
|
This function is mainly used internally.
|
||||||
|
**/
|
||||||
|
void SetVertical(bool bVertical);
|
||||||
|
|
||||||
|
//! Assignement operator.
|
||||||
|
void operator=(const CChartFont& objectSrc);
|
||||||
|
|
||||||
|
private:
|
||||||
|
//! The font face name
|
||||||
|
TChartString m_strFaceName;
|
||||||
|
//! The font point size
|
||||||
|
int m_iPointSize;
|
||||||
|
|
||||||
|
//! Specifies if the font is italic
|
||||||
|
bool m_bItalic;
|
||||||
|
//! Specifies if the font is bold
|
||||||
|
bool m_bBold;
|
||||||
|
//! Specifies if the font is underlined
|
||||||
|
bool m_bUnderline;
|
||||||
|
|
||||||
|
//! Specifies if the font is vertical
|
||||||
|
bool m_bVertical;
|
||||||
|
|
||||||
|
//! Caches the current font
|
||||||
|
mutable CFont m_Font;
|
||||||
|
//! Specifies if the font information has been modified
|
||||||
|
mutable bool m_bDirty;
|
||||||
|
|
||||||
|
//! The old font which is stored when calling SelectFont
|
||||||
|
mutable CFont* m_pOldFont;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // _CHARTFONT_H_
|
|
@ -0,0 +1,228 @@
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
* ChartGanttSerie.cpp
|
||||||
|
*
|
||||||
|
* Written by Cédric Moonen (cedric_moonen@hotmail.com)
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* This code may be used for any non-commercial and commercial purposes in a compiled form.
|
||||||
|
* The code may be redistributed as long as it remains unmodified and providing that the
|
||||||
|
* author name and this disclaimer remain intact. The sources can be modified WITH the author
|
||||||
|
* consent only.
|
||||||
|
*
|
||||||
|
* This code is provided without any garanties. I cannot be held responsible for the damage or
|
||||||
|
* the loss of time it causes. Use it at your own risks
|
||||||
|
*
|
||||||
|
* An e-mail to notify me that you are using this code is appreciated also.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "stdafx.h"
|
||||||
|
#include "ChartGanttSerie.h"
|
||||||
|
#include "ChartCtrl.h"
|
||||||
|
|
||||||
|
CChartGanttSerie::CChartGanttSerie(CChartCtrl* pParent)
|
||||||
|
: CChartSerieBase<SChartGanttPoint>(pParent), m_iBarWidth(10), m_iBorderWidth(1),
|
||||||
|
m_BorderColor(RGB(0,0,0)), m_bGradient(true),
|
||||||
|
m_GradientColor(RGB(255,255,255)), m_GradientType(gtHorizontalDouble)
|
||||||
|
{
|
||||||
|
m_bShadow = true;
|
||||||
|
this->SetSeriesOrdering(poYOrdering);
|
||||||
|
}
|
||||||
|
|
||||||
|
CChartGanttSerie::~CChartGanttSerie()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartGanttSerie::AddPoint(double StartTime, double EndTime, double YValue)
|
||||||
|
{
|
||||||
|
SChartGanttPoint newPoint(StartTime, EndTime, YValue);
|
||||||
|
CChartSerieBase<SChartGanttPoint>::AddPoint(newPoint);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CChartGanttSerie::IsPointOnSerie(const CPoint& screenPoint,
|
||||||
|
unsigned& uIndex) const
|
||||||
|
{
|
||||||
|
uIndex = INVALID_POINT;
|
||||||
|
if (!m_bIsVisible)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
unsigned uFirst=0, uLast=0;
|
||||||
|
if (!GetVisiblePoints(uFirst,uLast))
|
||||||
|
return false;
|
||||||
|
if (uFirst>0)
|
||||||
|
uFirst--;
|
||||||
|
if (uLast<GetPointsCount()-1)
|
||||||
|
uLast++;
|
||||||
|
|
||||||
|
bool bResult = false;
|
||||||
|
for (unsigned i=uFirst ; i <= uLast ; i++)
|
||||||
|
{
|
||||||
|
CRect BarRect = GetBarRectangle(i);
|
||||||
|
if (BarRect.PtInRect(screenPoint))
|
||||||
|
{
|
||||||
|
bResult = true;
|
||||||
|
uIndex = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return bResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartGanttSerie::DrawLegend(CDC* pDC, const CRect& rectBitmap) const
|
||||||
|
{
|
||||||
|
if (m_strSerieName == _T(""))
|
||||||
|
return;
|
||||||
|
if (!pDC->GetSafeHdc())
|
||||||
|
return;
|
||||||
|
|
||||||
|
//Draw bar:
|
||||||
|
CBrush BorderBrush(m_BorderColor);
|
||||||
|
pDC->FillRect(rectBitmap,&BorderBrush);
|
||||||
|
|
||||||
|
CRect FillRect(rectBitmap);
|
||||||
|
CBrush FillBrush(m_SerieColor);
|
||||||
|
FillRect.DeflateRect(m_iBorderWidth,m_iBorderWidth);
|
||||||
|
if (m_bGradient)
|
||||||
|
{
|
||||||
|
CChartGradient::DrawGradient(pDC,FillRect,m_SerieColor,m_GradientColor,m_GradientType);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pDC->FillRect(FillRect,&FillBrush);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartGanttSerie::Draw(CDC* pDC)
|
||||||
|
{
|
||||||
|
if (!m_bIsVisible)
|
||||||
|
return;
|
||||||
|
if (!pDC->GetSafeHdc())
|
||||||
|
return;
|
||||||
|
|
||||||
|
unsigned uFirst=0, uLast=0;
|
||||||
|
if (!GetVisiblePoints(uFirst,uLast))
|
||||||
|
return;
|
||||||
|
|
||||||
|
CRect TempClipRect(m_PlottingRect);
|
||||||
|
TempClipRect.DeflateRect(1,1);
|
||||||
|
pDC->SetBkMode(TRANSPARENT);
|
||||||
|
pDC->IntersectClipRect(TempClipRect);
|
||||||
|
|
||||||
|
CBrush BorderBrush(m_BorderColor);
|
||||||
|
CBrush FillBrush(m_SerieColor);
|
||||||
|
//Draw all points that haven't been drawn yet
|
||||||
|
for (m_uLastDrawnPoint;m_uLastDrawnPoint<(int)GetPointsCount();m_uLastDrawnPoint++)
|
||||||
|
{
|
||||||
|
CRect BarRect = GetBarRectangle(m_uLastDrawnPoint);
|
||||||
|
DrawBar(pDC, &FillBrush, &BorderBrush, BarRect);
|
||||||
|
}
|
||||||
|
|
||||||
|
pDC->SelectClipRgn(NULL);
|
||||||
|
DeleteObject(BorderBrush);
|
||||||
|
DeleteObject(FillBrush);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartGanttSerie::DrawAll(CDC *pDC)
|
||||||
|
{
|
||||||
|
if (!m_bIsVisible)
|
||||||
|
return;
|
||||||
|
if (!pDC->GetSafeHdc())
|
||||||
|
return;
|
||||||
|
|
||||||
|
unsigned uFirst=0, uLast=0;
|
||||||
|
if (!GetVisiblePoints(uFirst,uLast))
|
||||||
|
return;
|
||||||
|
|
||||||
|
CRect TempClipRect(m_PlottingRect);
|
||||||
|
TempClipRect.DeflateRect(1,1);
|
||||||
|
if (uFirst>0)
|
||||||
|
uFirst--;
|
||||||
|
if (uLast<GetPointsCount()-1)
|
||||||
|
uLast++;
|
||||||
|
|
||||||
|
pDC->SetBkMode(TRANSPARENT);
|
||||||
|
pDC->IntersectClipRect(TempClipRect);
|
||||||
|
|
||||||
|
CBrush BorderBrush(m_BorderColor);
|
||||||
|
CBrush FillBrush(m_SerieColor);
|
||||||
|
for (m_uLastDrawnPoint=uFirst;m_uLastDrawnPoint<=uLast;m_uLastDrawnPoint++)
|
||||||
|
{
|
||||||
|
CRect BarRect = GetBarRectangle(m_uLastDrawnPoint);
|
||||||
|
DrawBar(pDC, &FillBrush, &BorderBrush, BarRect);
|
||||||
|
}
|
||||||
|
|
||||||
|
pDC->SelectClipRgn(NULL);
|
||||||
|
DeleteObject(BorderBrush);
|
||||||
|
DeleteObject(FillBrush);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartGanttSerie::SetBorderColor(COLORREF BorderColor)
|
||||||
|
{
|
||||||
|
m_BorderColor = BorderColor;
|
||||||
|
m_pParentCtrl->RefreshCtrl();
|
||||||
|
}
|
||||||
|
void CChartGanttSerie::SetBorderWidth(int Width)
|
||||||
|
{
|
||||||
|
m_iBorderWidth = Width;
|
||||||
|
m_pParentCtrl->RefreshCtrl();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartGanttSerie::SetBarWidth(int Width)
|
||||||
|
{
|
||||||
|
m_iBarWidth = Width;
|
||||||
|
m_pParentCtrl->RefreshCtrl();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartGanttSerie::ShowGradient(bool bShow)
|
||||||
|
{
|
||||||
|
m_bGradient = bShow;
|
||||||
|
m_pParentCtrl->RefreshCtrl();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartGanttSerie::SetGradient(COLORREF GradientColor, EGradientType GradientType)
|
||||||
|
{
|
||||||
|
m_GradientColor = GradientColor;
|
||||||
|
m_GradientType = GradientType;
|
||||||
|
m_pParentCtrl->RefreshCtrl();
|
||||||
|
}
|
||||||
|
|
||||||
|
CRect CChartGanttSerie::GetBarRectangle(unsigned uPointIndex) const
|
||||||
|
{
|
||||||
|
SChartGanttPoint point = GetPoint(uPointIndex);
|
||||||
|
int PointXStart = m_pHorizontalAxis->ValueToScreen(point.StartTime);
|
||||||
|
int PointXEnd = m_pHorizontalAxis->ValueToScreen(point.EndTime);
|
||||||
|
int YVal = m_pVerticalAxis->ValueToScreen(point.YValue);
|
||||||
|
int PointYStart = YVal - m_iBarWidth;
|
||||||
|
int PointYEnd = YVal + m_iBarWidth;
|
||||||
|
CRect PointRect(min(PointXStart, PointXEnd), min(PointYStart, PointYEnd),
|
||||||
|
max(PointXStart, PointXEnd), max(PointYStart, PointYEnd) );
|
||||||
|
return PointRect;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartGanttSerie::DrawBar(CDC* pDC, CBrush* pFillBrush, CBrush* pBorderBrush,
|
||||||
|
CRect BarRect)
|
||||||
|
{
|
||||||
|
if (m_bShadow)
|
||||||
|
{
|
||||||
|
CBrush ShadowBrush(m_ShadowColor);
|
||||||
|
CRect ShadowRect(BarRect);
|
||||||
|
ShadowRect.OffsetRect(m_iShadowDepth,m_iShadowDepth);
|
||||||
|
pDC->FillRect(ShadowRect,&ShadowBrush);
|
||||||
|
}
|
||||||
|
pDC->FillRect(BarRect,pBorderBrush);
|
||||||
|
|
||||||
|
CRect FillRect(BarRect);
|
||||||
|
FillRect.DeflateRect(m_iBorderWidth,m_iBorderWidth);
|
||||||
|
if (m_bGradient)
|
||||||
|
{
|
||||||
|
CChartGradient::DrawGradient(pDC,FillRect,m_SerieColor,m_GradientColor,
|
||||||
|
m_GradientType);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pDC->FillRect(FillRect,pFillBrush);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,162 @@
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
* ChartGanttSerie.h
|
||||||
|
*
|
||||||
|
* Written by Cédric Moonen (cedric_moonen@hotmail.com)
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* This code may be used for any non-commercial and commercial purposes in a compiled form.
|
||||||
|
* The code may be redistributed as long as it remains unmodified and providing that the
|
||||||
|
* author name and this disclaimer remain intact. The sources can be modified WITH the author
|
||||||
|
* consent only.
|
||||||
|
*
|
||||||
|
* This code is provided without any garanties. I cannot be held responsible for the damage or
|
||||||
|
* the loss of time it causes. Use it at your own risks
|
||||||
|
*
|
||||||
|
* An e-mail to notify me that you are using this code is appreciated also.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
#include "ChartSerieBase.h"
|
||||||
|
|
||||||
|
//! Point structure used as template parameter for gantt series
|
||||||
|
struct SChartGanttPoint
|
||||||
|
{
|
||||||
|
//! Default constructor
|
||||||
|
SChartGanttPoint() : StartTime(0.0), EndTime(0.0), YValue(0.0) { }
|
||||||
|
//! Construct a new gantt point with the specifed values
|
||||||
|
SChartGanttPoint(double Start, double End, double YVal)
|
||||||
|
: StartTime(Start), EndTime(End), YValue(YVal) { }
|
||||||
|
|
||||||
|
//! The start time of the gantt point
|
||||||
|
double StartTime;
|
||||||
|
//! The end time of the gantt point
|
||||||
|
double EndTime;
|
||||||
|
//! The Y value of the gantt point
|
||||||
|
double YValue;
|
||||||
|
|
||||||
|
//! Returns the X value of the point, which is the average between start time and end time
|
||||||
|
double GetX() const { return (EndTime-StartTime)/2; }
|
||||||
|
//! Returns the Y value
|
||||||
|
double GetY() const { return YValue; }
|
||||||
|
//! Returns the start time
|
||||||
|
double GetXMin() const { return StartTime; }
|
||||||
|
//! Returns the end time
|
||||||
|
double GetXMax() const { return EndTime; }
|
||||||
|
//! Returns the Y value
|
||||||
|
double GetYMin() const { return YValue; }
|
||||||
|
//! Returns the Y value
|
||||||
|
double GetYMax() const { return YValue; }
|
||||||
|
};
|
||||||
|
|
||||||
|
//! Specialization of a CChartSerieBase to display a gantt series.
|
||||||
|
/**
|
||||||
|
Each point in a gantt series is amde of three values: a start and
|
||||||
|
end time and an Y value. The points are displayed as horizontal bars
|
||||||
|
that are positionned on the Y axis depending on their Y value and
|
||||||
|
which starts at the start time and end at the end time along the X
|
||||||
|
axis.
|
||||||
|
**/
|
||||||
|
class CChartGanttSerie : public CChartSerieBase<SChartGanttPoint>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
//! Constructor
|
||||||
|
CChartGanttSerie(CChartCtrl* pParent);
|
||||||
|
//! Destructor
|
||||||
|
~CChartGanttSerie();
|
||||||
|
|
||||||
|
//! Adds a new point to the series.
|
||||||
|
/**
|
||||||
|
@param StartTime
|
||||||
|
The start time of the Gantt bar
|
||||||
|
@param EndTime
|
||||||
|
The end time of the Gantt bar
|
||||||
|
@param YValue
|
||||||
|
The YValue of the Gantt bar
|
||||||
|
**/
|
||||||
|
void AddPoint(double StartTime, double EndTime, double YValue);
|
||||||
|
|
||||||
|
//! Tests if a certain screen point is on the series.
|
||||||
|
/**
|
||||||
|
@param screenPoint
|
||||||
|
The screen point to test
|
||||||
|
@param uIndex
|
||||||
|
If the point is close to a specific point of the series, its index is stored here.
|
||||||
|
@return true if the point is on the series
|
||||||
|
**/
|
||||||
|
bool IsPointOnSerie(const CPoint& screenPoint, unsigned& uIndex) const;
|
||||||
|
|
||||||
|
//! Sets the bars border color
|
||||||
|
void SetBorderColor(COLORREF BorderColor);
|
||||||
|
//! Returns the bars border color
|
||||||
|
COLORREF GetBorderColor() const { return m_BorderColor; }
|
||||||
|
//! Sets the bars border width
|
||||||
|
void SetBorderWidth(int Width);
|
||||||
|
//! Returns the bars border width
|
||||||
|
int GetBorderWidth() const { return m_iBorderWidth; }
|
||||||
|
//! Sets the bars width (in pixels)
|
||||||
|
void SetBarWidth(int Width);
|
||||||
|
//! Returns the bars width (in pixels)
|
||||||
|
int GetBarWidth() const { return m_iBarWidth; }
|
||||||
|
|
||||||
|
//! Specifies if a gradient is applied to the bars
|
||||||
|
void ShowGradient(bool bShow);
|
||||||
|
//! Sets the gradient style
|
||||||
|
/**
|
||||||
|
@param GradientColor
|
||||||
|
The second color used for the gradient (the first one being
|
||||||
|
the original series color).
|
||||||
|
@param GradientType
|
||||||
|
The type of gradient used between the two colors (vertical, horizontal, ...)
|
||||||
|
**/
|
||||||
|
void SetGradient(COLORREF GradientColor, EGradientType GradientType);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
//! Draws the legend icon for the series.
|
||||||
|
/**
|
||||||
|
@param pDC
|
||||||
|
The device context used to draw
|
||||||
|
@param rectBitmap
|
||||||
|
The rectangle in which to draw the legend icon
|
||||||
|
**/
|
||||||
|
void DrawLegend(CDC* pDC, const CRect& rectBitmap) const;
|
||||||
|
|
||||||
|
//! Draws the most recent points of the series.
|
||||||
|
/**
|
||||||
|
This function should only draw the points that were not previously
|
||||||
|
drawn.
|
||||||
|
@param pDC
|
||||||
|
The device context used to draw
|
||||||
|
**/
|
||||||
|
void Draw(CDC* pDC);
|
||||||
|
//! Redraws the full series.
|
||||||
|
/**
|
||||||
|
@param pDC
|
||||||
|
The device context used to draw
|
||||||
|
**/
|
||||||
|
void DrawAll(CDC *pDC);
|
||||||
|
|
||||||
|
private:
|
||||||
|
//! Returns the rectangle of a specific point of the series.
|
||||||
|
CRect GetBarRectangle(unsigned uPointIndex) const;
|
||||||
|
|
||||||
|
void DrawBar(CDC* pDC, CBrush* pFillBrush, CBrush* pBorderBrush,
|
||||||
|
CRect BarRect);
|
||||||
|
|
||||||
|
//! The bar width
|
||||||
|
int m_iBarWidth;
|
||||||
|
//! The bar border width
|
||||||
|
int m_iBorderWidth;
|
||||||
|
//! The bar border color
|
||||||
|
COLORREF m_BorderColor;
|
||||||
|
|
||||||
|
//! True if a gradient is applied to fill the bar
|
||||||
|
bool m_bGradient;
|
||||||
|
//! The second color of the gradient
|
||||||
|
COLORREF m_GradientColor;
|
||||||
|
//! The type of gradient to apply
|
||||||
|
EGradientType m_GradientType;
|
||||||
|
};
|
|
@ -0,0 +1,127 @@
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
* ChartGradient.cpp
|
||||||
|
*
|
||||||
|
* Written by Cédric Moonen (cedric_moonen@hotmail.com)
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* This code may be used for any non-commercial and commercial purposes in a compiled form.
|
||||||
|
* The code may be redistributed as long as it remains unmodified and providing that the
|
||||||
|
* author name and this disclaimer remain intact. The sources can be modified WITH the author
|
||||||
|
* consent only.
|
||||||
|
*
|
||||||
|
* This code is provided without any garanties. I cannot be held responsible for the damage or
|
||||||
|
* the loss of time it causes. Use it at your own risks
|
||||||
|
*
|
||||||
|
* An e-mail to notify me that you are using this code is appreciated also.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "stdafx.h"
|
||||||
|
#include "ChartGradient.h"
|
||||||
|
|
||||||
|
CChartGradient::CChartGradient()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
CChartGradient::~CChartGradient()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartGradient::DrawGradient(CDC* pDC, const CRect& GradientRect, COLORREF Color1,
|
||||||
|
COLORREF Color2, EGradientType GradientType)
|
||||||
|
{
|
||||||
|
#if _MFC_VER > 0x0600
|
||||||
|
if ( (GradientType == gtHorizontal) || (GradientType == gtVertical) )
|
||||||
|
{
|
||||||
|
TRIVERTEX vertex[2] ;
|
||||||
|
vertex[0].x = GradientRect.left;
|
||||||
|
vertex[0].y = GradientRect.top;
|
||||||
|
vertex[0].Red = ((COLOR16)GetRValue(Color1))<<8;
|
||||||
|
vertex[0].Green = ((COLOR16)GetGValue(Color1))<<8;
|
||||||
|
vertex[0].Blue = ((COLOR16)GetBValue(Color1))<<8;
|
||||||
|
vertex[0].Alpha = 0x0000;
|
||||||
|
vertex[1].x = GradientRect.right;
|
||||||
|
vertex[1].y = GradientRect.bottom;
|
||||||
|
vertex[1].Red = ((COLOR16)GetRValue(Color2))<<8;
|
||||||
|
vertex[1].Green = ((COLOR16)GetGValue(Color2))<<8;
|
||||||
|
vertex[1].Blue = ((COLOR16)GetBValue(Color2))<<8;
|
||||||
|
vertex[1].Alpha = 0x0000;
|
||||||
|
GRADIENT_RECT gRect;
|
||||||
|
gRect.UpperLeft = 0;
|
||||||
|
gRect.LowerRight = 1;
|
||||||
|
if (GradientType == gtHorizontal)
|
||||||
|
pDC->GradientFill(vertex,2,&gRect,1,GRADIENT_FILL_RECT_H);
|
||||||
|
else
|
||||||
|
pDC->GradientFill(vertex,2,&gRect,1,GRADIENT_FILL_RECT_V);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (int i=0;i<2; i++)
|
||||||
|
{
|
||||||
|
TRIVERTEX vertex[2] ;
|
||||||
|
if (GradientType == gtHorizontalDouble)
|
||||||
|
{
|
||||||
|
vertex[0].x = GradientRect.left + (GradientRect.Width()/2) * i;
|
||||||
|
vertex[0].y = GradientRect.top;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
vertex[0].x = GradientRect.left;
|
||||||
|
vertex[0].y = GradientRect.top + (GradientRect.Height()/2) * i;
|
||||||
|
}
|
||||||
|
if (i==0)
|
||||||
|
{
|
||||||
|
vertex[0].Red = ((COLOR16)GetRValue(Color1))<<8;
|
||||||
|
vertex[0].Green = ((COLOR16)GetGValue(Color1))<<8;
|
||||||
|
vertex[0].Blue = ((COLOR16)GetBValue(Color1))<<8;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
vertex[0].Red = ((COLOR16)GetRValue(Color2))<<8;
|
||||||
|
vertex[0].Green = ((COLOR16)GetGValue(Color2))<<8;
|
||||||
|
vertex[0].Blue = ((COLOR16)GetBValue(Color2))<<8;
|
||||||
|
}
|
||||||
|
vertex[0].Alpha = 0x0000;
|
||||||
|
if (GradientType == gtHorizontalDouble)
|
||||||
|
{
|
||||||
|
vertex[1].x = GradientRect.left + (GradientRect.Width()/2) * (i+1);
|
||||||
|
vertex[1].y = GradientRect.bottom;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
vertex[1].x = GradientRect.right;
|
||||||
|
vertex[1].y = GradientRect.top + (GradientRect.Height()/2) * (i+1);
|
||||||
|
}
|
||||||
|
if (i==0)
|
||||||
|
{
|
||||||
|
vertex[1].Red = ((COLOR16)GetRValue(Color2))<<8;
|
||||||
|
vertex[1].Green = ((COLOR16)GetGValue(Color2))<<8;
|
||||||
|
vertex[1].Blue = ((COLOR16)GetBValue(Color2))<<8;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
vertex[1].Red = ((COLOR16)GetRValue(Color1))<<8;
|
||||||
|
vertex[1].Green = ((COLOR16)GetGValue(Color1))<<8;
|
||||||
|
vertex[1].Blue = ((COLOR16)GetBValue(Color1))<<8;
|
||||||
|
}
|
||||||
|
vertex[1].Alpha = 0x0000;
|
||||||
|
|
||||||
|
GRADIENT_RECT gRect;
|
||||||
|
gRect.UpperLeft = 0;
|
||||||
|
gRect.LowerRight = 1;
|
||||||
|
if (GradientType == gtHorizontalDouble)
|
||||||
|
pDC->GradientFill(vertex,2,&gRect,1,GRADIENT_FILL_RECT_H);
|
||||||
|
else
|
||||||
|
pDC->GradientFill(vertex,2,&gRect,1,GRADIENT_FILL_RECT_V);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
CBrush NewBrush(Color1);
|
||||||
|
pDC->FillRect(GradientRect,&NewBrush);
|
||||||
|
DeleteObject(NewBrush);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,65 @@
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
* ChartGradient.h
|
||||||
|
*
|
||||||
|
* Written by Cédric Moonen (cedric_moonen@hotmail.com)
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* This code may be used for any non-commercial and commercial purposes in a compiled form.
|
||||||
|
* The code may be redistributed as long as it remains unmodified and providing that the
|
||||||
|
* author name and this disclaimer remain intact. The sources can be modified WITH the author
|
||||||
|
* consent only.
|
||||||
|
*
|
||||||
|
* This code is provided without any garanties. I cannot be held responsible for the damage or
|
||||||
|
* the loss of time it causes. Use it at your own risks
|
||||||
|
*
|
||||||
|
* An e-mail to notify me that you are using this code is appreciated also.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
//! Types of gradients that can be used
|
||||||
|
enum EGradientType
|
||||||
|
{
|
||||||
|
//! A simple horizontal gradient (from the first color to the second)
|
||||||
|
gtHorizontal,
|
||||||
|
//! A simple Vertical gradient (from the first color to the second)
|
||||||
|
gtVertical,
|
||||||
|
//! A double horizontal gradient (first color to second and back to first)
|
||||||
|
gtHorizontalDouble,
|
||||||
|
//! A double vertical gradient (first color to second and back to first)
|
||||||
|
gtVerticalDouble
|
||||||
|
};
|
||||||
|
|
||||||
|
//! Helper class to draw gradient.
|
||||||
|
/**
|
||||||
|
It only contains a static function to draw the gradient. This is
|
||||||
|
mainly used internally.
|
||||||
|
**/
|
||||||
|
class CChartGradient
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
//! Constructor
|
||||||
|
CChartGradient();
|
||||||
|
//! Destructor
|
||||||
|
~CChartGradient();
|
||||||
|
|
||||||
|
//! Draws a gradient between two colors inside a rectangle.
|
||||||
|
/**
|
||||||
|
@param pDC
|
||||||
|
The device context with which to draw.
|
||||||
|
@param GradientRect
|
||||||
|
The rectangle in which to draw the gradient
|
||||||
|
@param Color1
|
||||||
|
The first gradient color
|
||||||
|
@param Color2
|
||||||
|
The second gradient color
|
||||||
|
@param GradientType
|
||||||
|
The type of gradient to use in the rectangle
|
||||||
|
**/
|
||||||
|
static void DrawGradient(CDC* pDC, const CRect& GradientRect, COLORREF Color1,
|
||||||
|
COLORREF Color2, EGradientType GradientType);
|
||||||
|
};
|
|
@ -0,0 +1,123 @@
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
* ChartGrid.cpp
|
||||||
|
*
|
||||||
|
* Written by Cédric Moonen (cedric_moonen@hotmail.com)
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* This code may be used for any non-commercial and commercial purposes in a compiled form.
|
||||||
|
* The code may be redistributed as long as it remains unmodified and providing that the
|
||||||
|
* author name and this disclaimer remain intact. The sources can be modified WITH the author
|
||||||
|
* consent only.
|
||||||
|
*
|
||||||
|
* This code is provided without any garanties. I cannot be held responsible for the damage or
|
||||||
|
* the loss of time it causes. Use it at your own risks
|
||||||
|
*
|
||||||
|
* An e-mail to notify me that you are using this code is appreciated also.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "stdafx.h"
|
||||||
|
#include "ChartGrid.h"
|
||||||
|
#include "ChartAxis.h"
|
||||||
|
|
||||||
|
#ifdef _DEBUG
|
||||||
|
#undef THIS_FILE
|
||||||
|
static char THIS_FILE[]=__FILE__;
|
||||||
|
#define new DEBUG_NEW
|
||||||
|
#endif
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
// Construction/Destruction
|
||||||
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
CChartGrid::CChartGrid()
|
||||||
|
: m_GridColor(RGB(128,128,128)), m_pParentCtrl(NULL), m_bIsVisible(true),
|
||||||
|
m_bIsHorizontal(true), m_lstTickPos()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
CChartGrid::~CChartGrid()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartGrid::AddTick(int Position)
|
||||||
|
{
|
||||||
|
m_lstTickPos.push_back(Position);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartGrid::ClearTicks()
|
||||||
|
{
|
||||||
|
m_lstTickPos.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartGrid::Draw(CDC *pDC)
|
||||||
|
{
|
||||||
|
if (!m_bIsVisible)
|
||||||
|
return;
|
||||||
|
if (!pDC->GetSafeHdc() )
|
||||||
|
return;
|
||||||
|
|
||||||
|
CRect plottingRect = m_pParentCtrl->GetPlottingRect();
|
||||||
|
pDC->IntersectClipRect(plottingRect);
|
||||||
|
|
||||||
|
CPen* pOldPen;
|
||||||
|
CPen NewPen(PS_SOLID,0,m_GridColor);
|
||||||
|
pOldPen = pDC->SelectObject(&NewPen);
|
||||||
|
|
||||||
|
list<int>::iterator iter = m_lstTickPos.begin();
|
||||||
|
int ActuPosition = 0;
|
||||||
|
|
||||||
|
for (iter; iter!=m_lstTickPos.end(); iter++)
|
||||||
|
{
|
||||||
|
ActuPosition = *iter;
|
||||||
|
if (!m_bIsHorizontal)
|
||||||
|
{
|
||||||
|
int ActuX = plottingRect.left;
|
||||||
|
|
||||||
|
while (ActuX<plottingRect.right)
|
||||||
|
{
|
||||||
|
pDC->MoveTo(ActuX,ActuPosition);
|
||||||
|
ActuX += 3;
|
||||||
|
pDC->LineTo(ActuX,ActuPosition);
|
||||||
|
ActuX += 3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
int ActuY = plottingRect.bottom;
|
||||||
|
|
||||||
|
while (ActuY>plottingRect.top)
|
||||||
|
{
|
||||||
|
pDC->MoveTo(ActuPosition,ActuY);
|
||||||
|
ActuY -= 3;
|
||||||
|
pDC->LineTo(ActuPosition,ActuY);
|
||||||
|
ActuY -= 3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pDC->SelectClipRgn(NULL);
|
||||||
|
pDC->SelectObject(pOldPen);
|
||||||
|
NewPen.DeleteObject();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartGrid::SetVisible(bool bVisible)
|
||||||
|
{
|
||||||
|
m_bIsVisible = bVisible;
|
||||||
|
if (m_pParentCtrl)
|
||||||
|
m_pParentCtrl->RefreshCtrl();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartGrid::SetColor(COLORREF NewColor)
|
||||||
|
{
|
||||||
|
m_GridColor = NewColor;
|
||||||
|
if (m_pParentCtrl)
|
||||||
|
m_pParentCtrl->RefreshCtrl();
|
||||||
|
}
|
|
@ -0,0 +1,83 @@
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
* ChartGrid.h
|
||||||
|
*
|
||||||
|
* Written by Cédric Moonen (cedric_moonen@hotmail.com)
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* This code may be used for any non-commercial and commercial purposes in a compiled form.
|
||||||
|
* The code may be redistributed as long as it remains unmodified and providing that the
|
||||||
|
* author name and this disclaimer remain intact. The sources can be modified WITH the author
|
||||||
|
* consent only.
|
||||||
|
*
|
||||||
|
* This code is provided without any garanties. I cannot be held responsible for the damage or
|
||||||
|
* the loss of time it causes. Use it at your own risks
|
||||||
|
*
|
||||||
|
* An e-mail to notify me that you are using this code is appreciated also.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if !defined(AFX_CHARTGRID_H__ECCBEFF4_2365_49CD_A865_F1B4DD8CA138__INCLUDED_)
|
||||||
|
#define AFX_CHARTGRID_H__ECCBEFF4_2365_49CD_A865_F1B4DD8CA138__INCLUDED_
|
||||||
|
|
||||||
|
#if _MSC_VER > 1000
|
||||||
|
#pragma once
|
||||||
|
#endif // _MSC_VER > 1000
|
||||||
|
|
||||||
|
#include <list>
|
||||||
|
#include "ChartCtrl.h"
|
||||||
|
|
||||||
|
|
||||||
|
class CChartAxis;
|
||||||
|
|
||||||
|
//! Class which draws the grid associated with a specific axis.
|
||||||
|
/**
|
||||||
|
This object is retrieved through the CChartAxis::GetGrid function.
|
||||||
|
**/
|
||||||
|
class CChartGrid
|
||||||
|
{
|
||||||
|
friend CChartAxis;
|
||||||
|
|
||||||
|
public:
|
||||||
|
//! Shows/hides the grid.
|
||||||
|
void SetVisible(bool bVisible);
|
||||||
|
//! Returns true if the grid is visible.
|
||||||
|
bool IsVisible() const { return m_bIsVisible; }
|
||||||
|
|
||||||
|
//! Sets the color of the grid.
|
||||||
|
void SetColor(COLORREF NewColor);
|
||||||
|
//! Returns the grid color.
|
||||||
|
COLORREF GetColor() const { return m_GridColor; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
//! Constructor
|
||||||
|
CChartGrid();
|
||||||
|
//! Destructor
|
||||||
|
virtual ~CChartGrid();
|
||||||
|
|
||||||
|
//! Draws the grid
|
||||||
|
void Draw(CDC* pDC);
|
||||||
|
|
||||||
|
//! Add a tick at a certain position
|
||||||
|
void AddTick(int Position);
|
||||||
|
//! Removes all the ticks.
|
||||||
|
void ClearTicks();
|
||||||
|
|
||||||
|
|
||||||
|
//! The grid color.
|
||||||
|
COLORREF m_GridColor;
|
||||||
|
|
||||||
|
//! The parent charting control.
|
||||||
|
CChartCtrl* m_pParentCtrl;
|
||||||
|
//! Specifies if the grid is visible or not.
|
||||||
|
bool m_bIsVisible;
|
||||||
|
|
||||||
|
//! List containing all the tick positions.
|
||||||
|
std::list<int> m_lstTickPos;
|
||||||
|
//! Specifies if the grid is associated with a vertical or horizontal axis.
|
||||||
|
bool m_bIsHorizontal;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // !defined(AFX_CHARTGRID_H__ECCBEFF4_2365_49CD_A865_F1B4DD8CA138__INCLUDED_)
|
|
@ -0,0 +1,122 @@
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
* ChartLabel.h
|
||||||
|
*
|
||||||
|
* Written by Cédric Moonen (cedric_moonen@hotmail.com)
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* This code may be used for any non-commercial and commercial purposes in a compiled form.
|
||||||
|
* The code may be redistributed as long as it remains unmodified and providing that the
|
||||||
|
* author name and this disclaimer remain intact. The sources can be modified WITH the author
|
||||||
|
* consent only.
|
||||||
|
*
|
||||||
|
* This code is provided without any garanties. I cannot be held responsible for the damage or
|
||||||
|
* the loss of time it causes. Use it at your own risks
|
||||||
|
*
|
||||||
|
* An e-mail to notify me that you are using this code is appreciated also.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _CHARTLABEL_H_
|
||||||
|
#define _CHARTLABEL_H_
|
||||||
|
|
||||||
|
template <class PointType>
|
||||||
|
class CChartSerieBase;
|
||||||
|
|
||||||
|
//! Interface which should be implemented in order to provide text to a label.
|
||||||
|
/**
|
||||||
|
This class is a template class with the template parameter being the point
|
||||||
|
type of the series to which the label is attached.
|
||||||
|
|
||||||
|
Using a CChartLabelProvider provides more flexibility in the way to
|
||||||
|
supply text to the label. You can for instance embedd in the string some
|
||||||
|
information about the point (XValue, YValue, index, ...). In that case, a
|
||||||
|
single CChartLabelProvider object can be provided for all labels. Changing
|
||||||
|
the displayed text of all labels becomes also easier: you only have to adapt
|
||||||
|
the string returned by this object and refresh the control and all labels will
|
||||||
|
be updated.
|
||||||
|
**/
|
||||||
|
template <class PointType>
|
||||||
|
class CChartLabelProvider
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
//! Constructor
|
||||||
|
CChartLabelProvider() { }
|
||||||
|
//! Destructor
|
||||||
|
virtual ~CChartLabelProvider() { }
|
||||||
|
|
||||||
|
//! Method to override in order to provide the text of the label.
|
||||||
|
/**
|
||||||
|
@param pSerie
|
||||||
|
The series to which the label is attached
|
||||||
|
@param uPtIndex
|
||||||
|
The index of the point in the series to which the label is attached
|
||||||
|
@return a string which will be the text displayed in the label.
|
||||||
|
**/
|
||||||
|
virtual TChartString GetText(CChartSerieBase<PointType>* pSerie,
|
||||||
|
unsigned PointIndex) = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
//! Draws a label containing some text which is attached to a point of a series.
|
||||||
|
/**
|
||||||
|
This is a base class which should be overriden for specific label types.
|
||||||
|
**/
|
||||||
|
template <class PointType>
|
||||||
|
class CChartLabel
|
||||||
|
{
|
||||||
|
friend CChartSerieBase<PointType>;
|
||||||
|
|
||||||
|
public:
|
||||||
|
//! Sets a static text to be displayed in the label.
|
||||||
|
void SetLabelText(const TChartString& strText);
|
||||||
|
//! Sets the font of the text label.
|
||||||
|
/**
|
||||||
|
@param nPointSize
|
||||||
|
The font point size
|
||||||
|
@param strFaceName
|
||||||
|
The font face name
|
||||||
|
**/
|
||||||
|
void SetFont(int nPointSize, const TChartString& strFaceName);
|
||||||
|
//! Shows/hides the label.
|
||||||
|
void SetVisisble(bool bVisible);
|
||||||
|
//! Sets a label provider for more flexibility in how the text is supplied.
|
||||||
|
void SetLabelProvider(CChartLabelProvider<PointType>* pProvider)
|
||||||
|
{
|
||||||
|
m_pLabelProvider = pProvider;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
//! Constructor
|
||||||
|
CChartLabel(CChartCtrl* pParentCtrl, CChartSerieBase<PointType>* pParentSeries);
|
||||||
|
//! Destructor
|
||||||
|
virtual ~CChartLabel();
|
||||||
|
|
||||||
|
//! Draws the label.
|
||||||
|
/**
|
||||||
|
This pure virtual function must be overriden by all child classes.
|
||||||
|
**/
|
||||||
|
virtual void Draw(CDC* pDC, unsigned uPointIndex) = 0;
|
||||||
|
|
||||||
|
//! Specifies if the label is visible or not.
|
||||||
|
bool m_bIsVisible;
|
||||||
|
//! The text font size.
|
||||||
|
int m_iFontSize;
|
||||||
|
//! The text font face name.
|
||||||
|
TChartString m_strFontName;
|
||||||
|
|
||||||
|
//! The static text of the label.
|
||||||
|
TChartString m_strLabelText;
|
||||||
|
//! The text provider.
|
||||||
|
CChartLabelProvider<PointType>* m_pLabelProvider;
|
||||||
|
|
||||||
|
//! The parent charting control.
|
||||||
|
CChartCtrl* m_pParentCtrl;
|
||||||
|
//! The parent series.
|
||||||
|
CChartSerieBase<PointType>* m_pParentSeries;
|
||||||
|
};
|
||||||
|
|
||||||
|
#include "ChartLabel.inl"
|
||||||
|
|
||||||
|
#endif // _CHARTLABEL_H_
|
|
@ -0,0 +1,59 @@
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
* ChartLabel.cpp
|
||||||
|
*
|
||||||
|
* Written by Cédric Moonen (cedric_moonen@hotmail.com)
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* This code may be used for any non-commercial and commercial purposes in a compiled form.
|
||||||
|
* The code may be redistributed as long as it remains unmodified and providing that the
|
||||||
|
* author name and this disclaimer remain intact. The sources can be modified WITH the author
|
||||||
|
* consent only.
|
||||||
|
*
|
||||||
|
* This code is provided without any garanties. I cannot be held responsible for the damage or
|
||||||
|
* the loss of time it causes. Use it at your own risks
|
||||||
|
*
|
||||||
|
* An e-mail to notify me that you are using this code is appreciated also.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "ChartCtrl.h"
|
||||||
|
|
||||||
|
template<class PointType>
|
||||||
|
CChartLabel<PointType>::CChartLabel(CChartCtrl* pParentCtrl,
|
||||||
|
CChartSerieBase<PointType>* pParentSeries)
|
||||||
|
: m_iFontSize(100),m_strFontName(_T("Microsoft Sans Serif")),
|
||||||
|
m_strLabelText(_T("")), m_pLabelProvider(NULL), m_pParentCtrl(pParentCtrl),
|
||||||
|
m_pParentSeries(pParentSeries)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class PointType>
|
||||||
|
CChartLabel<PointType>::~CChartLabel()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class PointType>
|
||||||
|
void CChartLabel<PointType>::SetLabelText(const TChartString& strText)
|
||||||
|
{
|
||||||
|
m_strLabelText = strText;
|
||||||
|
m_pParentCtrl->RefreshCtrl();
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class PointType>
|
||||||
|
void CChartLabel<PointType>::SetFont(int nPointSize, const TChartString& strFaceName)
|
||||||
|
{
|
||||||
|
m_iFontSize = nPointSize;
|
||||||
|
m_strFontName = strFaceName;
|
||||||
|
m_pParentCtrl->RefreshCtrl();
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class PointType>
|
||||||
|
void CChartLabel<PointType>::SetVisisble(bool bVisible)
|
||||||
|
{
|
||||||
|
m_bIsVisible = bVisible;
|
||||||
|
m_pParentCtrl->RefreshCtrl();
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,357 @@
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
* ChartLegend.cpp
|
||||||
|
*
|
||||||
|
* Written by Cédric Moonen (cedric_moonen@hotmail.com)
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* This code may be used for any non-commercial and commercial purposes in a compiled form.
|
||||||
|
* The code may be redistributed as long as it remains unmodified and providing that the
|
||||||
|
* author name and this disclaimer remain intact. The sources can be modified WITH the author
|
||||||
|
* consent only.
|
||||||
|
*
|
||||||
|
* This code is provided without any garanties. I cannot be held responsible for the damage or
|
||||||
|
* the loss of time it causes. Use it at your own risks
|
||||||
|
*
|
||||||
|
* An e-mail to notify me that you are using this code is appreciated also.
|
||||||
|
*
|
||||||
|
* History:
|
||||||
|
* - 02/03/2008: Legend can now be docked on any side or can be floating.
|
||||||
|
* - 02/03/2008: Added support for transparent legend.
|
||||||
|
* - 24/03/2008: Bug fix for invisible series.
|
||||||
|
* - 28/03/2008: Support for horizontal legend.
|
||||||
|
* - 28/03/2008: Bitmap size is now the same for all series.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "stdafx.h"
|
||||||
|
#include "ChartLegend.h"
|
||||||
|
#include "ChartSerie.h"
|
||||||
|
#include "ChartCtrl.h"
|
||||||
|
|
||||||
|
#ifdef _DEBUG
|
||||||
|
#undef THIS_FILE
|
||||||
|
static char THIS_FILE[]=__FILE__;
|
||||||
|
#define new DEBUG_NEW
|
||||||
|
#endif
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
// Construction/Destruction
|
||||||
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
CChartLegend::CChartLegend(CChartCtrl* pParent)
|
||||||
|
{
|
||||||
|
m_pParentCtrl = pParent;
|
||||||
|
m_BackColor = RGB(255,255,255);
|
||||||
|
m_iFontSize = 100;
|
||||||
|
m_strFontName = _T("Times New Roman");
|
||||||
|
|
||||||
|
m_bIsVisible = false;
|
||||||
|
|
||||||
|
m_bDocked = true;
|
||||||
|
m_DockSide = dsDockRight;
|
||||||
|
m_iLeftPos = m_iTopPos = 0;
|
||||||
|
m_bIsTransparent = false;
|
||||||
|
m_bIsHorizontal = false;
|
||||||
|
|
||||||
|
m_bShadow = true;
|
||||||
|
m_iShadowDepth = 3;
|
||||||
|
m_BitmapSize.cx = 16;
|
||||||
|
m_BitmapSize.cy = 16;
|
||||||
|
}
|
||||||
|
|
||||||
|
CChartLegend::~CChartLegend()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartLegend::SetVisible(bool bVisible)
|
||||||
|
{
|
||||||
|
m_bIsVisible = bVisible;
|
||||||
|
m_pParentCtrl->RefreshCtrl();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartLegend::SetBackColor(COLORREF NewColor)
|
||||||
|
{
|
||||||
|
m_BackColor = NewColor;
|
||||||
|
m_pParentCtrl->RefreshCtrl();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartLegend::SetShadowColor(COLORREF NewColor)
|
||||||
|
{
|
||||||
|
m_ShadowColor = NewColor;
|
||||||
|
m_pParentCtrl->RefreshCtrl();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartLegend::EnableShadow(bool bEnable)
|
||||||
|
{
|
||||||
|
m_bShadow = bEnable;
|
||||||
|
m_pParentCtrl->RefreshCtrl();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartLegend::SetShadowDepth(int Depth)
|
||||||
|
{
|
||||||
|
m_iShadowDepth = Depth;
|
||||||
|
m_pParentCtrl->RefreshCtrl();
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL CChartLegend::IsPointInside(const CPoint& screenPoint) const
|
||||||
|
{
|
||||||
|
return m_LegendRect.PtInRect(screenPoint);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartLegend::SetFont(int iPointSize, const TChartString& strFaceName)
|
||||||
|
{
|
||||||
|
m_iFontSize = iPointSize;
|
||||||
|
m_strFontName = strFaceName;
|
||||||
|
m_pParentCtrl->RefreshCtrl();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartLegend::SetTransparent(bool bTransparent)
|
||||||
|
{
|
||||||
|
m_bIsTransparent = bTransparent;
|
||||||
|
m_pParentCtrl->RefreshCtrl();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartLegend::SetHorizontalMode(bool bHorizontal)
|
||||||
|
{
|
||||||
|
m_bIsHorizontal = bHorizontal;
|
||||||
|
m_pParentCtrl->RefreshCtrl();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartLegend::DockLegend(DockSide dsSide)
|
||||||
|
{
|
||||||
|
m_bDocked = true;
|
||||||
|
m_DockSide = dsSide;
|
||||||
|
m_pParentCtrl->RefreshCtrl();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartLegend::UndockLegend(int iLeftPos, int iTopPos)
|
||||||
|
{
|
||||||
|
m_bDocked = false;
|
||||||
|
m_iLeftPos = iLeftPos;
|
||||||
|
m_iTopPos = iTopPos;
|
||||||
|
m_pParentCtrl->RefreshCtrl();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartLegend::ClipArea(CRect& rcControl, CDC* pDC)
|
||||||
|
{
|
||||||
|
UpdatePosition(pDC,rcControl);
|
||||||
|
if (m_LegendRect.IsRectEmpty())
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (m_bDocked)
|
||||||
|
{
|
||||||
|
switch (m_DockSide)
|
||||||
|
{
|
||||||
|
case dsDockRight:
|
||||||
|
rcControl.right = m_LegendRect.left + 2;
|
||||||
|
break;
|
||||||
|
case dsDockLeft:
|
||||||
|
rcControl.left = m_LegendRect.right - 2;
|
||||||
|
break;
|
||||||
|
case dsDockTop:
|
||||||
|
rcControl.top = m_LegendRect.bottom + 2;
|
||||||
|
break;
|
||||||
|
case dsDockBottom:
|
||||||
|
rcControl.bottom = m_LegendRect.top - 2;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartLegend::UpdatePosition(CDC* pDC, const CRect& rcControl)
|
||||||
|
{
|
||||||
|
CRect NewPosition;
|
||||||
|
NewPosition.SetRectEmpty();
|
||||||
|
if (!m_bIsVisible)
|
||||||
|
{
|
||||||
|
m_LegendRect = NewPosition;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
CFont* pOldFont;
|
||||||
|
CFont NewFont;
|
||||||
|
NewFont.CreatePointFont(m_iFontSize,m_strFontName.c_str(),pDC);
|
||||||
|
pOldFont = pDC->SelectObject(&NewFont);
|
||||||
|
|
||||||
|
int Height = 0;
|
||||||
|
int Width = 0;
|
||||||
|
int MaxText = 0;
|
||||||
|
CSize TextSize;
|
||||||
|
|
||||||
|
m_pParentCtrl->GoToFirstSerie();
|
||||||
|
int Drawn = 0;
|
||||||
|
while (CChartSerie* pSerie=m_pParentCtrl->GetNextSerie())
|
||||||
|
{
|
||||||
|
if ( (pSerie->GetName() == _T("")) || !pSerie->IsVisible() )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
Drawn++;
|
||||||
|
TextSize = pDC->GetTextExtent(pSerie->GetName().c_str());
|
||||||
|
|
||||||
|
if (!m_bIsHorizontal)
|
||||||
|
{
|
||||||
|
if (TextSize.cy>m_BitmapSize.cy)
|
||||||
|
Height += TextSize.cy + 2;
|
||||||
|
else
|
||||||
|
Height += m_BitmapSize.cy + 2;
|
||||||
|
|
||||||
|
if (TextSize.cx > MaxText)
|
||||||
|
MaxText = TextSize.cx;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Width += TextSize.cx + 4 + m_BitmapSize.cx + 10;
|
||||||
|
if (TextSize.cy > MaxText)
|
||||||
|
MaxText = TextSize.cy;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
pDC->SelectObject(pOldFont);
|
||||||
|
DeleteObject(NewFont);
|
||||||
|
|
||||||
|
if (!Drawn)
|
||||||
|
{
|
||||||
|
m_LegendRect = NewPosition;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!m_bIsHorizontal)
|
||||||
|
{
|
||||||
|
Width += MaxText + m_BitmapSize.cx + 12;
|
||||||
|
Height += 4 + 4 - 2; // Top and bottom margins. -2 because space counted once too much
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Width += 2 + 2 - 10;
|
||||||
|
Height = 4 + max(m_BitmapSize.cy,MaxText) + 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!m_bDocked)
|
||||||
|
{
|
||||||
|
NewPosition.top = m_iTopPos;
|
||||||
|
NewPosition.left = m_iLeftPos;
|
||||||
|
NewPosition.bottom = m_iTopPos + Height + 2;
|
||||||
|
NewPosition.right = m_iLeftPos + Width;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
switch (m_DockSide)
|
||||||
|
{
|
||||||
|
case dsDockRight:
|
||||||
|
NewPosition.top = ((rcControl.bottom-rcControl.top)/2) - ((Height + 2)/2);
|
||||||
|
NewPosition.left = rcControl.right - (Width + 6);
|
||||||
|
NewPosition.bottom = NewPosition.top + Height;
|
||||||
|
NewPosition.right = NewPosition.left + Width;
|
||||||
|
break;
|
||||||
|
case dsDockLeft:
|
||||||
|
NewPosition.top = ((rcControl.bottom-rcControl.top)/2) - ((Height + 2)/2);
|
||||||
|
NewPosition.left = rcControl.left + 3;
|
||||||
|
NewPosition.bottom = NewPosition.top + Height;
|
||||||
|
NewPosition.right = NewPosition.left + Width;
|
||||||
|
break;
|
||||||
|
case dsDockTop:
|
||||||
|
NewPosition.top = rcControl.top + 3; //((rcControl.bottom-rcControl.top)/2) - ((Height + 2)/2);
|
||||||
|
NewPosition.left = ((rcControl.right-rcControl.left)/2) - (Width/2); // rcControl.left + 3;
|
||||||
|
NewPosition.bottom = NewPosition.top + Height;
|
||||||
|
NewPosition.right = NewPosition.left + Width;
|
||||||
|
break;
|
||||||
|
case dsDockBottom:
|
||||||
|
NewPosition.top = rcControl.bottom - (Height + 2); //((rcControl.bottom-rcControl.top)/2) - ((Height + 2)/2);
|
||||||
|
NewPosition.left = ((rcControl.right-rcControl.left)/2) - (Width/2); // rcControl.left + 3;
|
||||||
|
NewPosition.bottom = NewPosition.top + Height;
|
||||||
|
NewPosition.right = NewPosition.left + Width;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
m_LegendRect = NewPosition;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartLegend::Draw(CDC *pDC)
|
||||||
|
{
|
||||||
|
if (!pDC->GetSafeHdc())
|
||||||
|
return;
|
||||||
|
if (!m_bIsVisible)
|
||||||
|
return;
|
||||||
|
if (m_LegendRect.IsRectEmpty())
|
||||||
|
return;
|
||||||
|
|
||||||
|
CPen SolidPen(PS_SOLID,0,RGB(0,0,0));
|
||||||
|
CPen* pOldPen;
|
||||||
|
CFont* pOldFont;
|
||||||
|
CFont NewFont;
|
||||||
|
NewFont.CreatePointFont(m_iFontSize,m_strFontName.c_str(),pDC);
|
||||||
|
|
||||||
|
// Draw the shadow
|
||||||
|
if (m_bShadow)
|
||||||
|
{
|
||||||
|
CRect ShadowRect = m_LegendRect;
|
||||||
|
ShadowRect.OffsetRect(m_iShadowDepth,m_iShadowDepth);
|
||||||
|
CBrush BrushShadow;
|
||||||
|
BrushShadow.CreateSolidBrush(m_ShadowColor) ;
|
||||||
|
pDC->FillRect(ShadowRect,&BrushShadow);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!m_bIsTransparent)
|
||||||
|
{
|
||||||
|
//Fill back color
|
||||||
|
CBrush BrushBack;
|
||||||
|
BrushBack.CreateSolidBrush(m_BackColor) ;
|
||||||
|
pDC->FillRect(m_LegendRect,&BrushBack);
|
||||||
|
}
|
||||||
|
|
||||||
|
pOldFont = pDC->SelectObject(&NewFont);
|
||||||
|
pOldPen = pDC->SelectObject(&SolidPen);
|
||||||
|
|
||||||
|
//Draw rectangle:
|
||||||
|
pDC->MoveTo(m_LegendRect.left,m_LegendRect.top);
|
||||||
|
pDC->LineTo(m_LegendRect.right,m_LegendRect.top);
|
||||||
|
pDC->LineTo(m_LegendRect.right,m_LegendRect.bottom);
|
||||||
|
pDC->LineTo(m_LegendRect.left,m_LegendRect.bottom);
|
||||||
|
pDC->LineTo(m_LegendRect.left,m_LegendRect.top);
|
||||||
|
|
||||||
|
int iPrevMode = pDC->SetBkMode(TRANSPARENT);
|
||||||
|
CRect rectBitmap(m_LegendRect.left+2,m_LegendRect.top+5,
|
||||||
|
m_LegendRect.left+2+m_BitmapSize.cx,
|
||||||
|
m_LegendRect.top+6+m_BitmapSize.cy);
|
||||||
|
m_pParentCtrl->GoToFirstSerie();
|
||||||
|
while (CChartSerie* pSerie=m_pParentCtrl->GetNextSerie())
|
||||||
|
{
|
||||||
|
if ( (pSerie->GetName() == _T("")) || !pSerie->IsVisible() )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
int MaxHeight = 0;
|
||||||
|
CSize TextSize = pDC->GetTextExtent(pSerie->GetName().c_str());
|
||||||
|
if (TextSize.cy > m_BitmapSize.cy)
|
||||||
|
{
|
||||||
|
pDC->ExtTextOut(rectBitmap.right+4,rectBitmap.top,ETO_CLIPPED,NULL,pSerie->GetName().c_str(),NULL);
|
||||||
|
CRect rectTemp(rectBitmap);
|
||||||
|
int YOffset = TextSize.cy/2 - rectBitmap.Height()/2;
|
||||||
|
rectTemp.OffsetRect(0,YOffset);
|
||||||
|
pSerie->DrawLegend(pDC,rectTemp);
|
||||||
|
MaxHeight = TextSize.cy;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
int YOffset = rectBitmap.CenterPoint().y - TextSize.cy/2;
|
||||||
|
pDC->ExtTextOut(rectBitmap.right+4,YOffset,ETO_CLIPPED,NULL,pSerie->GetName().c_str(),NULL);
|
||||||
|
MaxHeight = m_BitmapSize.cy;
|
||||||
|
pSerie->DrawLegend(pDC,rectBitmap);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (!m_bIsHorizontal)
|
||||||
|
rectBitmap.OffsetRect(0,MaxHeight+2);
|
||||||
|
else
|
||||||
|
rectBitmap.OffsetRect(m_BitmapSize.cx+4+TextSize.cx+10,0);
|
||||||
|
}
|
||||||
|
|
||||||
|
pDC->SetBkMode(iPrevMode);
|
||||||
|
pDC->SelectObject(pOldFont);
|
||||||
|
DeleteObject(NewFont);
|
||||||
|
pDC->SelectObject(pOldPen);
|
||||||
|
DeleteObject(SolidPen);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,155 @@
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
* ChartLegend.h
|
||||||
|
*
|
||||||
|
* Written by Cédric Moonen (cedric_moonen@hotmail.com)
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* This code may be used for any non-commercial and commercial purposes in a compiled form.
|
||||||
|
* The code may be redistributed as long as it remains unmodified and providing that the
|
||||||
|
* author name and this disclaimer remain intact. The sources can be modified WITH the author
|
||||||
|
* consent only.
|
||||||
|
*
|
||||||
|
* This code is provided without any garanties. I cannot be held responsible for the damage or
|
||||||
|
* the loss of time it causes. Use it at your own risks
|
||||||
|
*
|
||||||
|
* An e-mail to notify me that you are using this code is appreciated also.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if !defined(AFX_CHARTLEGEND_H__CD72E5A0_8F52_472A_A611_C588F642080B__INCLUDED_)
|
||||||
|
#define AFX_CHARTLEGEND_H__CD72E5A0_8F52_472A_A611_C588F642080B__INCLUDED_
|
||||||
|
|
||||||
|
#if _MSC_VER > 1000
|
||||||
|
#pragma once
|
||||||
|
#endif // _MSC_VER > 1000
|
||||||
|
|
||||||
|
#include "ChartCtrl.h"
|
||||||
|
|
||||||
|
#include "ChartString.h"
|
||||||
|
|
||||||
|
class CChartSerie;
|
||||||
|
|
||||||
|
//! This class is responsible for the legend displayed on the control.
|
||||||
|
/**
|
||||||
|
Series which are named will be displayed in the legend. The legend
|
||||||
|
object is retrieved by calling the GetLegend() function on the
|
||||||
|
CChartCtrl class.
|
||||||
|
**/
|
||||||
|
class CChartLegend
|
||||||
|
{
|
||||||
|
friend CChartCtrl;
|
||||||
|
|
||||||
|
public:
|
||||||
|
//! Sets the font used to display the series names.
|
||||||
|
void SetFont(int iPointSize, const TChartString& strFaceName);
|
||||||
|
|
||||||
|
//! Enumeration specifying on which side of the control the legend is docked.
|
||||||
|
enum DockSide
|
||||||
|
{
|
||||||
|
dsDockRight,
|
||||||
|
dsDockLeft,
|
||||||
|
dsDockTop,
|
||||||
|
dsDockBottom
|
||||||
|
};
|
||||||
|
|
||||||
|
//! Dock the legend on a specific side of the control. Default is right.
|
||||||
|
void DockLegend(DockSide dsSide);
|
||||||
|
//! Undock the legend.
|
||||||
|
/**
|
||||||
|
When the legend is undocked (floating), it doesn't take any margin size
|
||||||
|
but is drawn on top of the control at the specified location (it can be
|
||||||
|
above the plotting area for instance).
|
||||||
|
@param iLeftPos
|
||||||
|
The left position of the legend, in pixels (from the left of the control)
|
||||||
|
@param iTopPos
|
||||||
|
The top position of the legend, in pixels (from the top of the control)
|
||||||
|
**/
|
||||||
|
void UndockLegend(int iLeftPos, int iTopPos);
|
||||||
|
|
||||||
|
//! Sets the background of the legend transparent.
|
||||||
|
void SetTransparent(bool bTransparent);
|
||||||
|
//! Sets the legend in horizontal/vertical mode.
|
||||||
|
/**
|
||||||
|
In horizontal mode, the names are drawn next to each other
|
||||||
|
instead of on top of each other.
|
||||||
|
**/
|
||||||
|
void SetHorizontalMode(bool bHorizontal);
|
||||||
|
|
||||||
|
//! Sets the legend visible/invisible.
|
||||||
|
void SetVisible(bool bVisible);
|
||||||
|
//! Returns true if the legend is visible.
|
||||||
|
bool IsVisible() const { return m_bIsVisible; }
|
||||||
|
|
||||||
|
//! Returns the back color of the legend.
|
||||||
|
COLORREF GetBackColor() const { return m_BackColor; }
|
||||||
|
//! Sets the back color of the legend.
|
||||||
|
void SetBackColor(COLORREF NewColor);
|
||||||
|
//! Returns the shadow color.
|
||||||
|
COLORREF GetShadowColor() const { return m_ShadowColor; }
|
||||||
|
//! Sets the shadow color.
|
||||||
|
void SetShadowColor(COLORREF NewColor);
|
||||||
|
//! Enables/disables the shadow.
|
||||||
|
void EnableShadow(bool bEnable);
|
||||||
|
//! Sets the shadow depth (in pixels).
|
||||||
|
void SetShadowDepth(int Depth);
|
||||||
|
|
||||||
|
//! Returns true if the screen point is on the legend region.
|
||||||
|
BOOL IsPointInside(const CPoint& screenPoint) const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
//! Constructor
|
||||||
|
CChartLegend(CChartCtrl* pParent);
|
||||||
|
//! Destructor
|
||||||
|
virtual ~CChartLegend();
|
||||||
|
|
||||||
|
//! Draw the legend.
|
||||||
|
void Draw(CDC* pDC);
|
||||||
|
//! Remove the area needed for the legend from the chart rectangle.
|
||||||
|
void ClipArea(CRect& rcControl, CDC* pDC);
|
||||||
|
//! Recalculate the legend size and position.
|
||||||
|
void UpdatePosition(CDC* pDC, const CRect& rcControl);
|
||||||
|
|
||||||
|
//! The parent charting control.
|
||||||
|
CChartCtrl* m_pParentCtrl;
|
||||||
|
//! The rectangle used to draw the legend.
|
||||||
|
CRect m_LegendRect;
|
||||||
|
|
||||||
|
//! The font face name used to display the series names.
|
||||||
|
TChartString m_strFontName;
|
||||||
|
//! The font point size.
|
||||||
|
int m_iFontSize;
|
||||||
|
|
||||||
|
//! True if the legend is docked
|
||||||
|
bool m_bDocked;
|
||||||
|
//! The side of the control on which the legend is docked.
|
||||||
|
DockSide m_DockSide;
|
||||||
|
|
||||||
|
//! The left position of the legend if in floating mode.
|
||||||
|
int m_iLeftPos;
|
||||||
|
//! The top position of the legend if in floating mode.
|
||||||
|
int m_iTopPos;
|
||||||
|
|
||||||
|
//! Specifies if the legend is visible.
|
||||||
|
bool m_bIsVisible;
|
||||||
|
//! Specifies if the background of the legend is transparent.
|
||||||
|
bool m_bIsTransparent;
|
||||||
|
//! Specifies if the legend is in horizontal mode.
|
||||||
|
bool m_bIsHorizontal;
|
||||||
|
//! Specifies if the legend shadow should be displayed.
|
||||||
|
bool m_bShadow;
|
||||||
|
//! Specifies the shadow depth (in pixels).
|
||||||
|
int m_iShadowDepth;
|
||||||
|
|
||||||
|
//! Specifies the legend back color.
|
||||||
|
COLORREF m_BackColor;
|
||||||
|
//! Specifies the shadow color.
|
||||||
|
COLORREF m_ShadowColor;
|
||||||
|
|
||||||
|
//! Specifies the size of the bitmap used by each series.
|
||||||
|
CSize m_BitmapSize;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // !defined(AFX_CHARTLEGEND_H__CD72E5A0_8F52_472A_A611_C588F642080B__INCLUDED_)
|
|
@ -0,0 +1,360 @@
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
* ChartLineSerie.cpp
|
||||||
|
*
|
||||||
|
* Written by Cédric Moonen (cedric_moonen@hotmail.com)
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* This code may be used for any non-commercial and commercial purposes in a compiled form.
|
||||||
|
* The code may be redistributed as long as it remains unmodified and providing that the
|
||||||
|
* author name and this disclaimer remain intact. The sources can be modified WITH the author
|
||||||
|
* consent only.
|
||||||
|
*
|
||||||
|
* This code is provided without any garanties. I cannot be held responsible for the damage or
|
||||||
|
* the loss of time it causes. Use it at your own risks
|
||||||
|
*
|
||||||
|
* An e-mail to notify me that you are using this code is appreciated also.
|
||||||
|
*
|
||||||
|
* History:
|
||||||
|
* - 25/03/2008: Line series with a width > 1 can now have a style other than solid
|
||||||
|
* (thanks to Bruno Lavier).
|
||||||
|
* - 12/08/2008: Performance fix: pen use the PS_GEOMETRIC style only when necessary
|
||||||
|
* (thanks to Nick Holgate).
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "stdafx.h"
|
||||||
|
#include "ChartLineSerie.h"
|
||||||
|
#include "ChartCtrl.h"
|
||||||
|
|
||||||
|
#include "Math.h"
|
||||||
|
|
||||||
|
#ifdef _DEBUG
|
||||||
|
#undef THIS_FILE
|
||||||
|
static char THIS_FILE[]=__FILE__;
|
||||||
|
#define new DEBUG_NEW
|
||||||
|
#endif
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
// Construction/Destruction
|
||||||
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
CChartLineSerie::CChartLineSerie(CChartCtrl* pParent) : CChartXYSerie(pParent)
|
||||||
|
{
|
||||||
|
m_iLineWidth = 1;
|
||||||
|
m_iPenStyle = PS_SOLID;
|
||||||
|
m_bSmooth = false;
|
||||||
|
m_bShadow = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
CChartLineSerie::~CChartLineSerie()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartLineSerie::SetPenStyle(int NewStyle)
|
||||||
|
{
|
||||||
|
m_iPenStyle = NewStyle;
|
||||||
|
m_pParentCtrl->RefreshCtrl();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartLineSerie::SetWidth(int PenWidth)
|
||||||
|
{
|
||||||
|
m_iLineWidth = PenWidth;
|
||||||
|
m_pParentCtrl->RefreshCtrl();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartLineSerie::SetSmooth(bool bSmooth)
|
||||||
|
{
|
||||||
|
m_bSmooth = bSmooth;
|
||||||
|
m_pParentCtrl->RefreshCtrl();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartLineSerie::DrawAll(CDC *pDC)
|
||||||
|
{
|
||||||
|
if (!m_bIsVisible)
|
||||||
|
return;
|
||||||
|
if (!pDC->GetSafeHdc())
|
||||||
|
return;
|
||||||
|
|
||||||
|
unsigned uFirst=0, uLast=0;
|
||||||
|
if (!GetVisiblePoints(uFirst,uLast))
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (uFirst>0)
|
||||||
|
uFirst--;
|
||||||
|
if (uLast<GetPointsCount()-1)
|
||||||
|
uLast++;
|
||||||
|
if (uLast-uFirst < 1)
|
||||||
|
return;
|
||||||
|
|
||||||
|
CPen NewPen;
|
||||||
|
CPen ShadowPen;
|
||||||
|
if (m_iPenStyle != PS_SOLID)
|
||||||
|
{
|
||||||
|
LOGBRUSH lb;
|
||||||
|
lb.lbStyle = BS_SOLID;
|
||||||
|
lb.lbColor = m_SerieColor;
|
||||||
|
NewPen.CreatePen(PS_GEOMETRIC | m_iPenStyle, m_iLineWidth, &lb);
|
||||||
|
lb.lbColor = m_ShadowColor;
|
||||||
|
ShadowPen.CreatePen(PS_GEOMETRIC | m_iPenStyle, m_iLineWidth, &lb);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
NewPen.CreatePen(m_iPenStyle, m_iLineWidth, m_SerieColor);
|
||||||
|
ShadowPen.CreatePen(m_iPenStyle, m_iLineWidth, m_ShadowColor);
|
||||||
|
}
|
||||||
|
CPen* pOldPen;
|
||||||
|
|
||||||
|
pDC->SetBkMode(TRANSPARENT);
|
||||||
|
//To have lines limited in the drawing rectangle :
|
||||||
|
pDC->IntersectClipRect(m_PlottingRect);
|
||||||
|
pOldPen = pDC->SelectObject(&NewPen);
|
||||||
|
|
||||||
|
if (m_bSmooth)
|
||||||
|
{
|
||||||
|
// For a Bezier curve, all points must be drawn.
|
||||||
|
uFirst = 0;
|
||||||
|
uLast = GetPointsCount() - 1;
|
||||||
|
SChartXYPoint* pKnots = NULL;
|
||||||
|
SChartXYPoint* pFirstControlPts = NULL;
|
||||||
|
SChartXYPoint* pSecondControlPts = NULL;
|
||||||
|
GetBezierControlPoints(uFirst,uLast,pKnots,pFirstControlPts,pSecondControlPts);
|
||||||
|
|
||||||
|
unsigned Count = uLast - uFirst;
|
||||||
|
CPoint* pBezierPts = new CPoint[3*(Count-1)+1];
|
||||||
|
CPoint* pShadowPts = NULL;
|
||||||
|
if (m_bShadow)
|
||||||
|
pShadowPts = new CPoint[3*(Count-1)+1];
|
||||||
|
|
||||||
|
unsigned index = 0;
|
||||||
|
for (unsigned n=0; n<Count-1; n++)
|
||||||
|
{
|
||||||
|
ValueToScreen(pKnots[n].X, pKnots[n].Y, pBezierPts[index]);
|
||||||
|
ValueToScreen(pFirstControlPts[n].X, pFirstControlPts[n].Y, pBezierPts[index+1]);
|
||||||
|
ValueToScreen(pSecondControlPts[n].X, pSecondControlPts[n].Y, pBezierPts[index+2]);
|
||||||
|
|
||||||
|
if (m_bShadow)
|
||||||
|
{
|
||||||
|
pShadowPts[index] = pBezierPts[index];
|
||||||
|
pShadowPts[index].Offset(m_iShadowDepth,m_iShadowDepth);
|
||||||
|
pShadowPts[index+1] = pBezierPts[index+1];
|
||||||
|
pShadowPts[index+1].Offset(m_iShadowDepth,m_iShadowDepth);
|
||||||
|
pShadowPts[index+2] = pBezierPts[index+2];
|
||||||
|
pShadowPts[index+2].Offset(m_iShadowDepth,m_iShadowDepth);
|
||||||
|
}
|
||||||
|
index += 3;
|
||||||
|
}
|
||||||
|
ValueToScreen(pKnots[Count-1].X, pKnots[Count-1].Y, pBezierPts[index]);
|
||||||
|
if (m_bShadow)
|
||||||
|
{
|
||||||
|
pShadowPts[index] = pBezierPts[index];
|
||||||
|
pShadowPts[index].Offset(m_iShadowDepth,m_iShadowDepth);
|
||||||
|
pDC->SelectObject(&ShadowPen);
|
||||||
|
pDC->PolyBezier(pShadowPts,3*(Count-1)+1);
|
||||||
|
pDC->SelectObject(&NewPen);
|
||||||
|
delete[] pShadowPts;
|
||||||
|
}
|
||||||
|
pDC->PolyBezier(pBezierPts,3*(Count-1)+1);
|
||||||
|
|
||||||
|
delete[] pKnots;
|
||||||
|
delete[] pFirstControlPts;
|
||||||
|
delete[] pSecondControlPts;
|
||||||
|
delete[] pBezierPts;
|
||||||
|
}
|
||||||
|
else // Non-smoothed curve
|
||||||
|
{
|
||||||
|
if (uLast-uFirst >= 1)
|
||||||
|
{
|
||||||
|
CPoint* pPoints = new CPoint[uLast-uFirst+1];
|
||||||
|
CPoint* pShadow = NULL;
|
||||||
|
if (m_bShadow)
|
||||||
|
pShadow = new CPoint[uLast-uFirst+1];
|
||||||
|
|
||||||
|
unsigned long pointsCount = 0;
|
||||||
|
CPoint LastScreenPoint;
|
||||||
|
for (m_uLastDrawnPoint=uFirst;m_uLastDrawnPoint<=uLast;m_uLastDrawnPoint++)
|
||||||
|
{
|
||||||
|
//We don't draw a line between the origin and the first point -> we must have
|
||||||
|
// a least 2 points before begining drawing
|
||||||
|
SChartXYPoint Point = GetPoint(m_uLastDrawnPoint);
|
||||||
|
CPoint ScreenPoint;
|
||||||
|
ValueToScreen(Point.X, Point.Y, ScreenPoint);
|
||||||
|
|
||||||
|
if(LastScreenPoint != ScreenPoint)
|
||||||
|
{
|
||||||
|
//Only collate the unique points
|
||||||
|
pPoints[pointsCount] = ScreenPoint;
|
||||||
|
LastScreenPoint = ScreenPoint;
|
||||||
|
|
||||||
|
if (m_bShadow)
|
||||||
|
{
|
||||||
|
ScreenPoint.Offset(m_iShadowDepth,m_iShadowDepth);
|
||||||
|
pShadow[pointsCount] = ScreenPoint;
|
||||||
|
}
|
||||||
|
pointsCount++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// We have to do that in order for the Draw function to work properly.
|
||||||
|
m_uLastDrawnPoint--;
|
||||||
|
if (m_bShadow)
|
||||||
|
{
|
||||||
|
pDC->SelectObject(&ShadowPen);
|
||||||
|
pDC->Polyline(pShadow, pointsCount);
|
||||||
|
}
|
||||||
|
pDC->SelectObject(&NewPen);
|
||||||
|
pDC->Polyline(pPoints, pointsCount);
|
||||||
|
|
||||||
|
delete[] pPoints;
|
||||||
|
delete[] pShadow;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pDC->SelectClipRgn(NULL);
|
||||||
|
pDC->SelectObject(pOldPen);
|
||||||
|
NewPen.DeleteObject();
|
||||||
|
ShadowPen.DeleteObject();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartLineSerie::Draw(CDC* pDC)
|
||||||
|
{
|
||||||
|
if (!m_bIsVisible)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// If shadow or smooth is enabled, then the complete series
|
||||||
|
// must be redrawn.
|
||||||
|
if (m_bShadow || m_bSmooth)
|
||||||
|
{
|
||||||
|
DrawAll(pDC);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pDC->GetSafeHdc())
|
||||||
|
{
|
||||||
|
CPen NewPen;
|
||||||
|
if (m_iPenStyle != PS_SOLID)
|
||||||
|
{
|
||||||
|
LOGBRUSH lb;
|
||||||
|
lb.lbStyle = BS_SOLID;
|
||||||
|
lb.lbColor = m_SerieColor;
|
||||||
|
NewPen.CreatePen(PS_GEOMETRIC | m_iPenStyle, m_iLineWidth, &lb);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
NewPen.CreatePen(m_iPenStyle, m_iLineWidth, m_SerieColor);
|
||||||
|
}
|
||||||
|
CPen* pOldPen;
|
||||||
|
|
||||||
|
pDC->SetBkMode(TRANSPARENT);
|
||||||
|
//To have lines limited in the drawing rectangle :
|
||||||
|
pDC->IntersectClipRect(m_pParentCtrl->GetPlottingRect());
|
||||||
|
pOldPen = pDC->SelectObject(&NewPen);
|
||||||
|
|
||||||
|
//Draw all points that haven't been drawn yet
|
||||||
|
for (m_uLastDrawnPoint;m_uLastDrawnPoint<GetPointsCount()-1;m_uLastDrawnPoint++)
|
||||||
|
{
|
||||||
|
SChartXYPoint Point = GetPoint(m_uLastDrawnPoint);
|
||||||
|
CPoint ScreenPoint;
|
||||||
|
ValueToScreen(Point.X, Point.Y, ScreenPoint);
|
||||||
|
pDC->MoveTo(ScreenPoint.x,ScreenPoint.y);
|
||||||
|
|
||||||
|
Point = GetPoint(m_uLastDrawnPoint+1);
|
||||||
|
ValueToScreen(Point.X, Point.Y, ScreenPoint);
|
||||||
|
pDC->LineTo(ScreenPoint.x,ScreenPoint.y);
|
||||||
|
}
|
||||||
|
|
||||||
|
pDC->SelectClipRgn(NULL);
|
||||||
|
pDC->SelectObject(pOldPen);
|
||||||
|
DeleteObject(NewPen);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartLineSerie::DrawLegend(CDC *pDC, const CRect& rectBitmap) const
|
||||||
|
{
|
||||||
|
if (m_strSerieName== _T(""))
|
||||||
|
return;
|
||||||
|
|
||||||
|
//Draw line:
|
||||||
|
LOGBRUSH lb;
|
||||||
|
lb.lbStyle = BS_SOLID;
|
||||||
|
lb.lbColor = m_SerieColor;
|
||||||
|
CPen NewPen(PS_GEOMETRIC | m_iPenStyle,m_iLineWidth,&lb);
|
||||||
|
CPen* pOldPen = pDC->SelectObject(&NewPen);
|
||||||
|
pDC->MoveTo(rectBitmap.left,rectBitmap.CenterPoint().y);
|
||||||
|
pDC->LineTo(rectBitmap.right,rectBitmap.CenterPoint().y);
|
||||||
|
pDC->SelectObject(pOldPen);
|
||||||
|
DeleteObject(NewPen);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CChartLineSerie::IsPointOnSerie(const CPoint& screenPoint, unsigned& uIndex) const
|
||||||
|
{
|
||||||
|
uIndex = INVALID_POINT;
|
||||||
|
if (!m_bIsVisible)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
unsigned uFirst=0, uLast=0;
|
||||||
|
if (!GetVisiblePoints(uFirst, uLast))
|
||||||
|
return false;
|
||||||
|
if (uFirst>0)
|
||||||
|
uFirst--;
|
||||||
|
if (uLast<GetPointsCount()-1)
|
||||||
|
uLast++;
|
||||||
|
|
||||||
|
bool bResult = false;
|
||||||
|
for (unsigned i=uFirst ; i < uLast ; i++)
|
||||||
|
{
|
||||||
|
SChartXYPoint PointOrig = GetPoint(i);
|
||||||
|
SChartXYPoint PointDest = GetPoint(i+1);
|
||||||
|
CPoint ScreenPointOrig, ScreenPointDest;
|
||||||
|
ValueToScreen(PointOrig.X, PointOrig.Y, ScreenPointOrig);
|
||||||
|
ValueToScreen(PointDest.X, PointDest.Y, ScreenPointDest);
|
||||||
|
|
||||||
|
if (IsNearLine(ScreenPointOrig.x, ScreenPointOrig.y, ScreenPointDest.x, ScreenPointDest.y, screenPoint.x, screenPoint.y))
|
||||||
|
{
|
||||||
|
// Check if the click is close to one of the two points.
|
||||||
|
int xDist = abs(screenPoint.x - ScreenPointOrig.x);
|
||||||
|
int yDist = abs(screenPoint.y - ScreenPointOrig.y);
|
||||||
|
if (xDist<=5 && yDist<=5)
|
||||||
|
uIndex = i;
|
||||||
|
xDist = abs(screenPoint.x - ScreenPointDest.x);
|
||||||
|
yDist = abs(screenPoint.y - ScreenPointDest.y);
|
||||||
|
if (xDist<=5 && yDist<=5)
|
||||||
|
uIndex = i+1;
|
||||||
|
|
||||||
|
bResult = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return bResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CChartLineSerie::IsNearLine(long Axl, long Ayl, long Bxl,
|
||||||
|
long Byl, long Cxl, long Cyl) const
|
||||||
|
{
|
||||||
|
double Ax = Axl;
|
||||||
|
double Ay = Ayl;
|
||||||
|
double Bx = Bxl;
|
||||||
|
double By = Byl;
|
||||||
|
double Cx = Cxl;
|
||||||
|
double Cy = Cyl;
|
||||||
|
|
||||||
|
// Make a perpendicular projection of point C on line AB
|
||||||
|
// algorithm from http://www.exaflop.org/docs/cgafaq/cga1.html#Subject%201.02:%20How%20do%20I%20find%20the%20distance%20from%20a%20point%20to%20a%20line?
|
||||||
|
double L = sqrt((Bx-Ax)*(Bx-Ax) + (By-Ay)*(By-Ay));
|
||||||
|
double r = (Ay-Cy)*(Ay-By)-(Ax-Cx)*(Bx-Ax);
|
||||||
|
r = r /(L*L);
|
||||||
|
if ((0 <= r) && (r <= 1))
|
||||||
|
{
|
||||||
|
double Px = Ax + r*(Bx-Ax);
|
||||||
|
double Py = Ay + r*(By-Ay);
|
||||||
|
if ((abs(Cx - Px) <= 3.0) &&
|
||||||
|
(abs(Cy - Py) <= 3.0))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
|
@ -0,0 +1,114 @@
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
* ChartLineSerie.h
|
||||||
|
*
|
||||||
|
* Written by Cédric Moonen (cedric_moonen@hotmail.com)
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* This code may be used for any non-commercial and commercial purposes in a compiled form.
|
||||||
|
* The code may be redistributed as long as it remains unmodified and providing that the
|
||||||
|
* author name and this disclaimer remain intact. The sources can be modified WITH the author
|
||||||
|
* consent only.
|
||||||
|
*
|
||||||
|
* This code is provided without any garanties. I cannot be held responsible for the damage or
|
||||||
|
* the loss of time it causes. Use it at your own risks
|
||||||
|
*
|
||||||
|
* An e-mail to notify me that you are using this code is appreciated also.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if !defined(AFX_CHARTLINESERIE_H__792C2F20_9650_42FA_B13D_E63911C98CE5__INCLUDED_)
|
||||||
|
#define AFX_CHARTLINESERIE_H__792C2F20_9650_42FA_B13D_E63911C98CE5__INCLUDED_
|
||||||
|
|
||||||
|
#if _MSC_VER > 1000
|
||||||
|
#pragma once
|
||||||
|
#endif // _MSC_VER > 1000
|
||||||
|
|
||||||
|
#include "ChartXYSerie.h"
|
||||||
|
|
||||||
|
//! Specialization of a CChartSerie to display a line series.
|
||||||
|
/**
|
||||||
|
The data points are connected by line segments. The curve can also
|
||||||
|
be smoothed.
|
||||||
|
**/
|
||||||
|
class CChartLineSerie : public CChartXYSerie
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
//! Returns the pen style (plain, dashed, dotted, ...)
|
||||||
|
/**
|
||||||
|
For a list of pen styles available, see the CreatePen function in MSDN.
|
||||||
|
**/
|
||||||
|
int GetPenStyle() const { return m_iPenStyle; }
|
||||||
|
//! Sets the pen style (plain, dashed, dotted, ...)
|
||||||
|
/**
|
||||||
|
For a list of pen styles available, see the CreatePen function in MSDN.
|
||||||
|
**/
|
||||||
|
void SetPenStyle(int NewStyle);
|
||||||
|
|
||||||
|
//! Returns the pen width
|
||||||
|
int GetWidth() const { return m_iLineWidth; }
|
||||||
|
//! Sets the pen width
|
||||||
|
void SetWidth(int PenWidth);
|
||||||
|
//! Enables the smoothing of the curve (slower).
|
||||||
|
void SetSmooth(bool bSmooth);
|
||||||
|
|
||||||
|
//! Constructor
|
||||||
|
CChartLineSerie(CChartCtrl* pParent);
|
||||||
|
//! Destructor
|
||||||
|
virtual ~CChartLineSerie();
|
||||||
|
|
||||||
|
//! Check whether a screen point is on the series.
|
||||||
|
/**
|
||||||
|
This function returns true if the screen point is close to a line segment.
|
||||||
|
If the screen point is also close to a specific point of the series, the
|
||||||
|
index of the point is stored in the uIndex parameter. Otherwise, this
|
||||||
|
parameter contains INVALID_POINT.
|
||||||
|
@param screenPoint
|
||||||
|
The screen point to test
|
||||||
|
@param uIndex
|
||||||
|
If the point is close to a specific point of the series, its index is stored here.
|
||||||
|
@return true if the point is on the series
|
||||||
|
**/
|
||||||
|
bool IsPointOnSerie(const CPoint& screenPoint, unsigned& uIndex) const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
//! Draws the legend icon for the series.
|
||||||
|
/**
|
||||||
|
@param pDC
|
||||||
|
The device context used to draw
|
||||||
|
@param rectBitmap
|
||||||
|
The rectangle in which to draw the legend icon
|
||||||
|
**/
|
||||||
|
void DrawLegend(CDC* pDC, const CRect& rectBitmap) const;
|
||||||
|
|
||||||
|
//! Draws the most recent points of the series.
|
||||||
|
/**
|
||||||
|
This function should only draw the points that were not previously
|
||||||
|
drawn.
|
||||||
|
@param pDC
|
||||||
|
The device context used to draw
|
||||||
|
**/
|
||||||
|
void Draw(CDC* pDC);
|
||||||
|
//! Redraws the full series.
|
||||||
|
/**
|
||||||
|
@param pDC
|
||||||
|
The device context used to draw
|
||||||
|
**/
|
||||||
|
void DrawAll(CDC *pDC);
|
||||||
|
|
||||||
|
//! Checks whether a point is close to a line segment
|
||||||
|
bool IsNearLine(long Axl, long Ayl,long Bxl,
|
||||||
|
long Byl, long Cxl, long Cyl) const;
|
||||||
|
|
||||||
|
|
||||||
|
//! The pen width
|
||||||
|
int m_iLineWidth;
|
||||||
|
//! The pen style
|
||||||
|
int m_iPenStyle;
|
||||||
|
//! Specifies if the curve is smoothed
|
||||||
|
bool m_bSmooth;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // !defined(AFX_CHARTLINESERIE_H__792C2F20_9650_42FA_B13D_E63911C98CE5__INCLUDED_)
|
|
@ -0,0 +1,190 @@
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
* ChartLogarithmicAxis.cpp
|
||||||
|
*
|
||||||
|
* Written by Cédric Moonen (cedric_moonen@hotmail.com)
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* This code may be used for any non-commercial and commercial purposes in a compiled form.
|
||||||
|
* The code may be redistributed as long as it remains unmodified and providing that the
|
||||||
|
* author name and this disclaimer remain intact. The sources can be modified WITH the author
|
||||||
|
* consent only.
|
||||||
|
*
|
||||||
|
* This code is provided without any garanties. I cannot be held responsible for the damage or
|
||||||
|
* the loss of time it causes. Use it at your own risks
|
||||||
|
*
|
||||||
|
* An e-mail to notify me that you are using this code is appreciated also.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "stdafx.h"
|
||||||
|
#include "ChartLogarithmicAxis.h"
|
||||||
|
#include "ChartCtrl.h"
|
||||||
|
#include <sstream>
|
||||||
|
#include <iostream>
|
||||||
|
#include <iomanip>
|
||||||
|
#include <math.h>
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
CChartLogarithmicAxis::CChartLogarithmicAxis()
|
||||||
|
: CChartAxis(), m_dFirstTickValue(1)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
CChartLogarithmicAxis::~CChartLogarithmicAxis()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
double CChartLogarithmicAxis::GetFirstTickValue() const
|
||||||
|
{
|
||||||
|
double dRetVal = m_dFirstTickValue;
|
||||||
|
if (m_bDiscrete)
|
||||||
|
dRetVal = m_dFirstTickValue/10;
|
||||||
|
return dRetVal;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CChartLogarithmicAxis::GetNextTickValue(double dCurrentTick,
|
||||||
|
double& dNextTick) const
|
||||||
|
{
|
||||||
|
dNextTick = dCurrentTick * 10;
|
||||||
|
if (dNextTick <= m_MaxValue)
|
||||||
|
return true;
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
TChartString CChartLogarithmicAxis::GetTickLabel(double TickValue) const
|
||||||
|
{
|
||||||
|
double fLogDecCount;
|
||||||
|
int nLogDecCount;
|
||||||
|
|
||||||
|
fLogDecCount = log10(TickValue);
|
||||||
|
|
||||||
|
if (fLogDecCount < 0.0)
|
||||||
|
nLogDecCount = (int)(fabs(fLogDecCount) + 0.1);
|
||||||
|
else
|
||||||
|
nLogDecCount = 0;
|
||||||
|
|
||||||
|
TChartStringStream ssLabel;
|
||||||
|
ssLabel << fixed << setprecision(nLogDecCount) << TickValue;
|
||||||
|
return ssLabel.str();
|
||||||
|
}
|
||||||
|
|
||||||
|
long CChartLogarithmicAxis::ValueToScreenStandard(double Value) const
|
||||||
|
{
|
||||||
|
long Offset = 0;
|
||||||
|
long retVal = 0;
|
||||||
|
|
||||||
|
Offset = (int)floor((log10(Value)-log10(m_MinValue)) * GetAxisLenght()/(log10(m_MaxValue)-log10(m_MinValue)) );
|
||||||
|
if (m_bIsHorizontal)
|
||||||
|
{
|
||||||
|
if (!m_bIsInverted)
|
||||||
|
retVal = (m_StartPos + Offset);
|
||||||
|
else
|
||||||
|
retVal = (m_EndPos - Offset);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (!m_bIsInverted)
|
||||||
|
retVal = (m_StartPos - Offset);
|
||||||
|
else
|
||||||
|
retVal = (m_EndPos + Offset);
|
||||||
|
}
|
||||||
|
return retVal;
|
||||||
|
}
|
||||||
|
|
||||||
|
long CChartLogarithmicAxis::ValueToScreenDiscrete(double Value) const
|
||||||
|
{
|
||||||
|
// In discrete mode, al values between two ticks are "directed"
|
||||||
|
// to the middle of the interval.
|
||||||
|
double lowTick = pow(10,floor(log10(Value)));
|
||||||
|
double highTick = pow(10,floor(log10(Value*10)));
|
||||||
|
|
||||||
|
long lowTickPos = ValueToScreenStandard(lowTick);
|
||||||
|
long highTickPos = ValueToScreenStandard(highTick);
|
||||||
|
return (lowTickPos + (highTickPos-lowTickPos)/2);
|
||||||
|
}
|
||||||
|
|
||||||
|
double CChartLogarithmicAxis::ScreenToValue(long ScreenVal) const
|
||||||
|
{
|
||||||
|
if (m_MaxValue==m_MinValue)
|
||||||
|
return m_MinValue;
|
||||||
|
|
||||||
|
int AxisOffset = 0;
|
||||||
|
if (!m_bIsHorizontal)
|
||||||
|
{
|
||||||
|
if (m_bIsInverted)
|
||||||
|
AxisOffset = ScreenVal - m_EndPos;
|
||||||
|
else
|
||||||
|
AxisOffset = m_StartPos - ScreenVal;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (!m_bIsInverted)
|
||||||
|
AxisOffset = ScreenVal - m_StartPos;
|
||||||
|
else
|
||||||
|
AxisOffset = m_EndPos - ScreenVal;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (pow(10.0,(AxisOffset *1.0 / GetAxisLenght()*(log10(m_MaxValue)-log10(m_MinValue)) ) + log10(m_MinValue)) );
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartLogarithmicAxis::PanAxis(long PanStart, long PanEnd)
|
||||||
|
{
|
||||||
|
double StartVal = ScreenToValue(PanStart);
|
||||||
|
double EndVal = ScreenToValue(PanEnd);
|
||||||
|
|
||||||
|
double Factor = StartVal/EndVal;
|
||||||
|
SetZoomMinMax(m_MinValue*Factor,m_MaxValue*Factor);
|
||||||
|
}
|
||||||
|
|
||||||
|
long CChartLogarithmicAxis::GetTickPos(double TickVal) const
|
||||||
|
{
|
||||||
|
// The tick is always at the same position,
|
||||||
|
// even if the axis is discrete.
|
||||||
|
return ValueToScreenStandard(TickVal);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartLogarithmicAxis::RefreshTickIncrement()
|
||||||
|
{
|
||||||
|
// Do nothing. This is done by the user.
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartLogarithmicAxis::RefreshFirstTick()
|
||||||
|
{
|
||||||
|
int LogBase = (int)log10(m_MinValue);
|
||||||
|
m_dFirstTickValue = pow(10.0,LogBase);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartLogarithmicAxis::GetScrollbarSteps(int& iTotalSteps, int& iCurrentStep)
|
||||||
|
{
|
||||||
|
double SeriesMin=0, SeriesMax=0;
|
||||||
|
GetSeriesMinMax(SeriesMin,SeriesMax);
|
||||||
|
|
||||||
|
if ((m_MaxValue-m_MinValue) == 0 || (SeriesMax-SeriesMin)==0 ||
|
||||||
|
(SeriesMin<=0) )
|
||||||
|
{
|
||||||
|
iTotalSteps = 1;
|
||||||
|
iCurrentStep = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
double dStep = pow(m_MaxValue/m_MinValue,0.1);
|
||||||
|
iTotalSteps = (int)ceil(log(SeriesMax/SeriesMin)/log10(dStep));
|
||||||
|
iCurrentStep = (int)(log(m_MinValue/SeriesMin)/log10(dStep));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartLogarithmicAxis::SetAxisToScrollStep(int iPreviousStep,
|
||||||
|
int iCurrentStep,
|
||||||
|
bool bScrollInverted)
|
||||||
|
{
|
||||||
|
double dStep = pow(m_MaxValue/m_MinValue,0.1);
|
||||||
|
double dFactor = pow(dStep,(iCurrentStep - iPreviousStep));
|
||||||
|
if (bScrollInverted)
|
||||||
|
SetZoomMinMax(m_MinValue/dFactor,m_MaxValue/dFactor);
|
||||||
|
else
|
||||||
|
SetZoomMinMax(m_MinValue*dFactor,m_MaxValue*dFactor);
|
||||||
|
}
|
|
@ -0,0 +1,62 @@
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
* ChartLogarithmicAxis.h
|
||||||
|
*
|
||||||
|
* Written by Cédric Moonen (cedric_moonen@hotmail.com)
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* This code may be used for any non-commercial and commercial purposes in a compiled form.
|
||||||
|
* The code may be redistributed as long as it remains unmodified and providing that the
|
||||||
|
* author name and this disclaimer remain intact. The sources can be modified WITH the author
|
||||||
|
* consent only.
|
||||||
|
*
|
||||||
|
* This code is provided without any garanties. I cannot be held responsible for the damage or
|
||||||
|
* the loss of time it causes. Use it at your own risks
|
||||||
|
*
|
||||||
|
* An e-mail to notify me that you are using this code is appreciated also.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _CHARTLOGARITHMICAXIS_H_
|
||||||
|
#define _CHARTLOGARITHMICAXIS_H_
|
||||||
|
|
||||||
|
#include "ChartAxis.h"
|
||||||
|
|
||||||
|
//! Specialization of a CChartAxis to display a logarithmic scale.
|
||||||
|
/**
|
||||||
|
Currently this class only allows to have a logarithmic axis with a
|
||||||
|
base of 10.
|
||||||
|
**/
|
||||||
|
class CChartLogarithmicAxis : public CChartAxis
|
||||||
|
{
|
||||||
|
friend CChartCtrl;
|
||||||
|
|
||||||
|
private:
|
||||||
|
//! Constructor
|
||||||
|
CChartLogarithmicAxis();
|
||||||
|
//! Destructor
|
||||||
|
~CChartLogarithmicAxis();
|
||||||
|
|
||||||
|
double ScreenToValue(long ScreenVal) const;
|
||||||
|
void PanAxis(long PanStart, long PanEnd);
|
||||||
|
|
||||||
|
double GetFirstTickValue() const;
|
||||||
|
bool GetNextTickValue(double dCurrentTick, double& dNextTick) const;
|
||||||
|
TChartString GetTickLabel(double TickValue) const;
|
||||||
|
long ValueToScreenStandard(double Value) const;
|
||||||
|
long ValueToScreenDiscrete(double Value) const;
|
||||||
|
long GetTickPos(double TickVal) const;
|
||||||
|
|
||||||
|
void RefreshTickIncrement();
|
||||||
|
void RefreshFirstTick();
|
||||||
|
|
||||||
|
void GetScrollbarSteps(int& iTotalSteps, int& iCurrentStep);
|
||||||
|
void SetAxisToScrollStep(int iPreviousStep, int iCurrentStep, bool bScrollInverted);
|
||||||
|
|
||||||
|
//! Caches the value of the first tick.
|
||||||
|
double m_dFirstTickValue;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // _CHARTLOGARITHMICAXIS_H_
|
|
@ -0,0 +1,90 @@
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
* ChartMouseListener.h
|
||||||
|
*
|
||||||
|
* Written by Cédric Moonen (cedric_moonen@hotmail.com)
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* This code may be used for any non-commercial and commercial purposes in a compiled form.
|
||||||
|
* The code may be redistributed as long as it remains unmodified and providing that the
|
||||||
|
* author name and this disclaimer remain intact. The sources can be modified WITH the author
|
||||||
|
* consent only.
|
||||||
|
*
|
||||||
|
* This code is provided without any garanties. I cannot be held responsible for the damage or
|
||||||
|
* the loss of time it causes. Use it at your own risks
|
||||||
|
*
|
||||||
|
* An e-mail to notify me that you are using this code is appreciated also.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _CHARTMOUSELISTENER_H_
|
||||||
|
#define _CHARTMOUSELISTENER_H_
|
||||||
|
|
||||||
|
#pragma warning( disable : 4100 )
|
||||||
|
|
||||||
|
//! Listener for mouse events occuring on the chart control.
|
||||||
|
/**
|
||||||
|
This is an interface which must be implemented in order to receive
|
||||||
|
mouse notifications. You can then register your class with the chart
|
||||||
|
control by calling RegisterMouseListener.
|
||||||
|
**/
|
||||||
|
class CChartMouseListener
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
//! Constructor
|
||||||
|
CChartMouseListener() { }
|
||||||
|
//! Destructor
|
||||||
|
virtual ~CChartMouseListener() { }
|
||||||
|
|
||||||
|
//! Enumeration listing the type of mouse events
|
||||||
|
enum MouseEvent
|
||||||
|
{
|
||||||
|
MouseMove,
|
||||||
|
LButtonUp,
|
||||||
|
LButtonDown,
|
||||||
|
LButtonDoubleClick,
|
||||||
|
RButtonUp,
|
||||||
|
RButtonDown,
|
||||||
|
RButtonDoubleClick,
|
||||||
|
};
|
||||||
|
|
||||||
|
//! Virtual function to implement in order to be notified when the title is clicked.
|
||||||
|
/**
|
||||||
|
@param mouseEvent
|
||||||
|
The mouse event which occured
|
||||||
|
@param point
|
||||||
|
The screen point on which the event occured
|
||||||
|
**/
|
||||||
|
virtual void OnMouseEventTitle(MouseEvent mouseEvent, CPoint point) { }
|
||||||
|
//! Virtual function to implement in order to be notified when an axis is clicked.
|
||||||
|
/**
|
||||||
|
@param mouseEvent
|
||||||
|
The mouse event which occured
|
||||||
|
@param point
|
||||||
|
The screen point on which the event occured
|
||||||
|
@param pAxisClicked
|
||||||
|
The axis on which the event occured
|
||||||
|
**/
|
||||||
|
virtual void OnMouseEventAxis(MouseEvent mouseEvent, CPoint point,
|
||||||
|
CChartAxis* pAxisClicked) { }
|
||||||
|
//! Virtual function to implement in order to be notified when the legend is clicked.
|
||||||
|
/**
|
||||||
|
@param mouseEvent
|
||||||
|
The mouse event which occured
|
||||||
|
@param point
|
||||||
|
The screen point on which the event occured
|
||||||
|
**/
|
||||||
|
virtual void OnMouseEventLegend(MouseEvent mouseEvent, CPoint point) { }
|
||||||
|
//! Virtual function to implement in order to be notified when the plotting area is clicked.
|
||||||
|
/**
|
||||||
|
@param mouseEvent
|
||||||
|
The mouse event which occured
|
||||||
|
@param point
|
||||||
|
The screen point on which the event occured
|
||||||
|
**/
|
||||||
|
virtual void OnMouseEventPlotArea(MouseEvent mouseEvent, CPoint point) { }
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // _CHARTMOUSELISTENER_H_
|
|
@ -0,0 +1,170 @@
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
* ChartPointsArray.h
|
||||||
|
*
|
||||||
|
* Written by Cédric Moonen (cedric_moonen@hotmail.com)
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* This code may be used for any non-commercial and commercial purposes in a compiled form.
|
||||||
|
* The code may be redistributed as long as it remains unmodified and providing that the
|
||||||
|
* author name and this disclaimer remain intact. The sources can be modified WITH the author
|
||||||
|
* consent only.
|
||||||
|
*
|
||||||
|
* This code is provided without any garanties. I cannot be held responsible for the damage or
|
||||||
|
* the loss of time it causes. Use it at your own risks
|
||||||
|
*
|
||||||
|
* An e-mail to notify me that you are using this code is appreciated also.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "PointsOrdering.h"
|
||||||
|
|
||||||
|
//! Manages an array of points which supports fast resizing.
|
||||||
|
/**
|
||||||
|
This class is used internally to store the data for all the points. The data
|
||||||
|
is stored in a C-style array. The internal buffer can grow dynamically depending
|
||||||
|
on the needs.
|
||||||
|
|
||||||
|
The class is a template class with the template parameter being the type of
|
||||||
|
the points to be stored. The points have to provide the following methods:
|
||||||
|
<ul><li>double GetXMin()</li>
|
||||||
|
<li>double GetX()</li>
|
||||||
|
<li>double GetXMax()</li>
|
||||||
|
<li>double GetYMin()</li>
|
||||||
|
<li>double GetY()</li>
|
||||||
|
<li>double GetYMax()</li></ul>
|
||||||
|
**/
|
||||||
|
template <class T>
|
||||||
|
class CChartPointsArray
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
//! Constructor
|
||||||
|
/**
|
||||||
|
@param iResize
|
||||||
|
The size by which the internal buffer is increased when reallocation occurs
|
||||||
|
**/
|
||||||
|
CChartPointsArray(unsigned iResize = 1000);
|
||||||
|
//! Destructor
|
||||||
|
~CChartPointsArray();
|
||||||
|
|
||||||
|
//! Returns the number of points currently stored.
|
||||||
|
unsigned GetPointsCount() const { return m_iCurrentPoints; }
|
||||||
|
//! Sets the size by which the internal buffer is increased when reallocation occurs
|
||||||
|
void SetResize(int iResize) { m_iResize = iResize; }
|
||||||
|
|
||||||
|
//! Adds a new point in the array.
|
||||||
|
/**
|
||||||
|
@param newPoint
|
||||||
|
The new point to add
|
||||||
|
**/
|
||||||
|
void AddPoint(const T& newPoint);
|
||||||
|
//! Adds multiple points in the array.
|
||||||
|
/**
|
||||||
|
The points are added to the ones currently stored in the array.
|
||||||
|
@param pPoints
|
||||||
|
Array containing the points
|
||||||
|
@param uCount
|
||||||
|
The number of points to add
|
||||||
|
**/
|
||||||
|
void AddPoints(T* pPoints, unsigned uCount);
|
||||||
|
//! Sets multiple points in the array.
|
||||||
|
/**
|
||||||
|
The points currently stored in the array are first removed
|
||||||
|
before adding the new points.
|
||||||
|
@param pPoints
|
||||||
|
Array containing the new points
|
||||||
|
@param uCount
|
||||||
|
The number of points to add
|
||||||
|
**/
|
||||||
|
void SetPoints(T* pPoints, unsigned uCount);
|
||||||
|
//! Removes all the points from the array.
|
||||||
|
void Clear();
|
||||||
|
//! Removes a certain amount of points from the begining of the series.
|
||||||
|
void RemovePointsFromBegin(unsigned Count);
|
||||||
|
//! Removes a certain amount of points from the end of the series.
|
||||||
|
void RemovePointsFromEnd(unsigned Count);
|
||||||
|
//! Retrieves the points at the specified index
|
||||||
|
T& operator[](unsigned Index);
|
||||||
|
//! Retrieves the points at the specified index
|
||||||
|
const T& operator[](unsigned Index) const;
|
||||||
|
|
||||||
|
//! Retrieves the minimum and maximum X values of the points stored in the array.
|
||||||
|
bool GetSerieXMinMax(double& Min, double& Max) const;
|
||||||
|
//! Retrieves the minimum and maximum Y values of the points stored in the array.
|
||||||
|
bool GetSerieYMinMax(double& Min, double& Max) const;
|
||||||
|
|
||||||
|
//! Specifies how the points should be ordered in the array.
|
||||||
|
/**
|
||||||
|
This specifies if the points should be ordered on their X values,
|
||||||
|
on their Y values or not ordered (kept in order they are added to
|
||||||
|
the control). Ordering can improve performances a lot but makes it
|
||||||
|
impossible to draw some specific curves (for instance, drawing an
|
||||||
|
ellipse is only possible if no ordering is set).
|
||||||
|
**/
|
||||||
|
void SetOrdering(PointsOrdering newOrdering);
|
||||||
|
//! Retrieves the ordering of the points in the array.
|
||||||
|
PointsOrdering GetOrdering() const { return m_Ordering; }
|
||||||
|
//! Refreshes the point ordering.
|
||||||
|
void ReorderPoints();
|
||||||
|
|
||||||
|
//! Retrieves the index of the points which are between two given values.
|
||||||
|
/**
|
||||||
|
If the points are not ordered, uFirstPt will contain 0 and uLastPt
|
||||||
|
will contain the index of the last point in the array.
|
||||||
|
@param dAxisMin
|
||||||
|
The minimum value to retrieve the first visible point
|
||||||
|
@param dAxisMax
|
||||||
|
The maximum value to retrieve the last visible point
|
||||||
|
@param uFirstPt
|
||||||
|
This parameter will store the index of the first visible point
|
||||||
|
@param uLastPt
|
||||||
|
This parameter will store the index of the last visible point
|
||||||
|
@return false if no points are in the array.
|
||||||
|
**/
|
||||||
|
bool GetVisiblePoints(double dAxisMin, double dAxisMax,
|
||||||
|
unsigned& uFirstPt, unsigned& uLastPt) const;
|
||||||
|
|
||||||
|
|
||||||
|
//! Returns the internal buffer of the array
|
||||||
|
T* GetInternalBuffer() const { return m_pPoints; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
//! Caches the minimum X value.
|
||||||
|
double m_dXMinVal;
|
||||||
|
//! Caches the maximum X value.
|
||||||
|
double m_dXMaxVal;
|
||||||
|
//! Caches the minimum Y value.
|
||||||
|
double m_dYMinVal;
|
||||||
|
//! Caches the maximum Y value.
|
||||||
|
double m_dYMaxVal;
|
||||||
|
|
||||||
|
//! Recalculates the min and max values.
|
||||||
|
void RefreshMinMax();
|
||||||
|
//! Inserts a new point in the array.
|
||||||
|
void InsertNewPoint(const T& newPoint);
|
||||||
|
//! Inserts a new point at a specific position in the array.
|
||||||
|
void InsertPointAtPos(const T& newPoint, int iPos);
|
||||||
|
//! Comparison function which compares two points based on their X values.
|
||||||
|
static int ComparePointsOnX(void const* pA, void const* pB);
|
||||||
|
//! Comparison function which compares two points based on their Y values.
|
||||||
|
static int ComparePointsOnY(void const* pA, void const* pB);
|
||||||
|
//! Implements a binary search used to find the index of a points give the X or Y value.
|
||||||
|
int BinarySearch(unsigned uLeft, unsigned uRight, double dFind) const;
|
||||||
|
|
||||||
|
//! The array of points
|
||||||
|
T* m_pPoints;
|
||||||
|
//! The number of allocated points
|
||||||
|
unsigned m_iMaxPoints;
|
||||||
|
//! The number of points currently used
|
||||||
|
unsigned m_iCurrentPoints;
|
||||||
|
//! The size by which the array is incremented once it is full
|
||||||
|
unsigned m_iResize;
|
||||||
|
//! The ordering of the points
|
||||||
|
PointsOrdering m_Ordering;
|
||||||
|
};
|
||||||
|
|
||||||
|
#include "ChartPointsArray.inl"
|
|
@ -0,0 +1,351 @@
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
* ChartPointsArray.cpp
|
||||||
|
*
|
||||||
|
* Written by Cédric Moonen (cedric_moonen@hotmail.com)
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* This code may be used for any non-commercial and commercial purposes in a compiled form.
|
||||||
|
* The code may be redistributed as long as it remains unmodified and providing that the
|
||||||
|
* author name and this disclaimer remain intact. The sources can be modified WITH the author
|
||||||
|
* consent only.
|
||||||
|
*
|
||||||
|
* This code is provided without any garanties. I cannot be held responsible for the damage or
|
||||||
|
* the loss of time it causes. Use it at your own risks
|
||||||
|
*
|
||||||
|
* An e-mail to notify me that you are using this code is appreciated also.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "ChartPointsArray.h"
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
CChartPointsArray<T>::CChartPointsArray(unsigned iResize)
|
||||||
|
: m_pPoints(NULL), m_iMaxPoints(iResize), m_iCurrentPoints(0),
|
||||||
|
m_iResize(iResize), m_Ordering(poXOrdering)
|
||||||
|
{
|
||||||
|
m_pPoints = new T[iResize];
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
CChartPointsArray<T>::~CChartPointsArray()
|
||||||
|
{
|
||||||
|
if (m_pPoints)
|
||||||
|
{
|
||||||
|
delete[] m_pPoints;
|
||||||
|
m_pPoints = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
void CChartPointsArray<T>::AddPoint(const T& newPoint)
|
||||||
|
{
|
||||||
|
if (m_iCurrentPoints == m_iMaxPoints)
|
||||||
|
{
|
||||||
|
m_iMaxPoints += m_iResize;
|
||||||
|
T* pOldPoints = m_pPoints;
|
||||||
|
m_pPoints = new T[m_iMaxPoints];
|
||||||
|
memcpy(m_pPoints,pOldPoints,m_iCurrentPoints*sizeof(T));
|
||||||
|
delete[] pOldPoints;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_iCurrentPoints == 0)
|
||||||
|
{
|
||||||
|
m_dXMinVal = newPoint.GetXMin();
|
||||||
|
m_dXMaxVal = newPoint.GetXMax();
|
||||||
|
m_dYMinVal = newPoint.GetYMin();
|
||||||
|
m_dYMaxVal = newPoint.GetYMax();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (newPoint.GetXMax() > m_dXMaxVal) m_dXMaxVal = newPoint.GetXMax();
|
||||||
|
if (newPoint.GetXMin() < m_dXMinVal) m_dXMinVal = newPoint.GetXMin();
|
||||||
|
if (newPoint.GetYMax() > m_dYMaxVal) m_dYMaxVal = newPoint.GetYMax();
|
||||||
|
if (newPoint.GetYMin() < m_dYMinVal) m_dYMinVal = newPoint.GetYMin();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_Ordering==poNoOrdering)
|
||||||
|
{
|
||||||
|
m_pPoints[m_iCurrentPoints] = newPoint;
|
||||||
|
m_iCurrentPoints++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
InsertNewPoint(newPoint);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
void CChartPointsArray<T>::AddPoints(T* pPoints,
|
||||||
|
unsigned uCount)
|
||||||
|
{
|
||||||
|
if (m_iCurrentPoints+uCount > m_iMaxPoints)
|
||||||
|
{
|
||||||
|
m_iMaxPoints = m_iCurrentPoints+uCount;
|
||||||
|
T* pOldPoints = m_pPoints;
|
||||||
|
m_pPoints = new T[m_iMaxPoints];
|
||||||
|
memcpy(m_pPoints,pOldPoints,m_iCurrentPoints*sizeof(T));
|
||||||
|
delete[] pOldPoints;
|
||||||
|
}
|
||||||
|
for (unsigned i=0; i<uCount; i++)
|
||||||
|
AddPoint(pPoints[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
void CChartPointsArray<T>::SetPoints(T* pPoints,
|
||||||
|
unsigned uCount)
|
||||||
|
{
|
||||||
|
if (uCount > m_iMaxPoints)
|
||||||
|
{
|
||||||
|
if (m_pPoints)
|
||||||
|
delete[] m_pPoints;
|
||||||
|
m_pPoints = new T[uCount];
|
||||||
|
m_iMaxPoints = uCount;
|
||||||
|
}
|
||||||
|
m_iCurrentPoints = uCount;
|
||||||
|
|
||||||
|
for (unsigned i=0;i<uCount;i++)
|
||||||
|
{
|
||||||
|
m_pPoints[i] = pPoints[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
ReorderPoints();
|
||||||
|
RefreshMinMax();
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
void CChartPointsArray<T>::Clear()
|
||||||
|
{
|
||||||
|
if (m_pPoints)
|
||||||
|
delete[] m_pPoints;
|
||||||
|
m_pPoints = new T[m_iResize];
|
||||||
|
m_iMaxPoints = m_iResize;
|
||||||
|
m_iCurrentPoints = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
void CChartPointsArray<T>::RemovePointsFromBegin(unsigned Count)
|
||||||
|
{
|
||||||
|
ASSERT (Count < m_iCurrentPoints);
|
||||||
|
T* pSource = m_pPoints + Count;
|
||||||
|
memmove(m_pPoints, pSource, sizeof(T) * (m_iCurrentPoints-Count));
|
||||||
|
m_iCurrentPoints -= Count;
|
||||||
|
RefreshMinMax();
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
void CChartPointsArray<T>::RemovePointsFromEnd(unsigned Count)
|
||||||
|
{
|
||||||
|
ASSERT (Count < m_iCurrentPoints);
|
||||||
|
m_iCurrentPoints -= Count;
|
||||||
|
RefreshMinMax();
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
T& CChartPointsArray<T>::operator[](unsigned Index)
|
||||||
|
{
|
||||||
|
ASSERT(Index < m_iCurrentPoints);
|
||||||
|
return m_pPoints[Index];
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
const T& CChartPointsArray<T>::operator[](unsigned Index) const
|
||||||
|
{
|
||||||
|
ASSERT(Index < m_iCurrentPoints);
|
||||||
|
return m_pPoints[Index];
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
bool CChartPointsArray<T>::GetSerieXMinMax(double& Min, double& Max) const
|
||||||
|
{
|
||||||
|
if (m_iCurrentPoints==0)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
Min = m_dXMinVal;
|
||||||
|
Max = m_dXMaxVal;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
bool CChartPointsArray<T>::GetSerieYMinMax(double& Min, double& Max) const
|
||||||
|
{
|
||||||
|
if (m_iCurrentPoints==0)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
Min = m_dYMinVal;
|
||||||
|
Max = m_dYMaxVal;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
void CChartPointsArray<T>::SetOrdering(PointsOrdering newOrdering)
|
||||||
|
{
|
||||||
|
m_Ordering = newOrdering;
|
||||||
|
ReorderPoints();
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
bool CChartPointsArray<T>::GetVisiblePoints(double dAxisMin,
|
||||||
|
double dAxisMax,
|
||||||
|
unsigned& uFirstPt,
|
||||||
|
unsigned& uLastPt) const
|
||||||
|
{
|
||||||
|
if (m_iCurrentPoints == 0)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (m_Ordering == poNoOrdering)
|
||||||
|
{
|
||||||
|
uFirstPt = 0;
|
||||||
|
uLastPt = m_iCurrentPoints - 1;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
uFirstPt = BinarySearch(0,m_iCurrentPoints-1,dAxisMin);
|
||||||
|
uLastPt = BinarySearch(uFirstPt,m_iCurrentPoints-1,dAxisMax);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
void CChartPointsArray<T>::ReorderPoints()
|
||||||
|
{
|
||||||
|
switch (m_Ordering)
|
||||||
|
{
|
||||||
|
case poNoOrdering:
|
||||||
|
break;
|
||||||
|
case poXOrdering:
|
||||||
|
qsort(m_pPoints, m_iCurrentPoints, sizeof(T),
|
||||||
|
CChartPointsArray::ComparePointsOnX);
|
||||||
|
break;
|
||||||
|
case poYOrdering:
|
||||||
|
qsort(m_pPoints, m_iCurrentPoints, sizeof(T),
|
||||||
|
CChartPointsArray::ComparePointsOnY);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
void CChartPointsArray<T>::InsertNewPoint(const T& newPoint)
|
||||||
|
{
|
||||||
|
if (m_iCurrentPoints == 0)
|
||||||
|
{
|
||||||
|
m_pPoints[0] = newPoint;
|
||||||
|
m_iCurrentPoints++;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_Ordering == poXOrdering)
|
||||||
|
{
|
||||||
|
if (newPoint.GetX() >= m_pPoints[m_iCurrentPoints-1].GetX())
|
||||||
|
m_pPoints[m_iCurrentPoints] = newPoint;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (unsigned i=0; i<m_iCurrentPoints; i++)
|
||||||
|
{
|
||||||
|
if (newPoint.GetX() < m_pPoints[i].GetX())
|
||||||
|
{
|
||||||
|
InsertPointAtPos(newPoint,i);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (m_Ordering == poYOrdering)
|
||||||
|
{
|
||||||
|
if (newPoint.GetY() >= m_pPoints[m_iCurrentPoints-1].GetY())
|
||||||
|
m_pPoints[m_iCurrentPoints] = newPoint;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (unsigned i=0; i<m_iCurrentPoints; i++)
|
||||||
|
{
|
||||||
|
if (newPoint.GetY() < m_pPoints[i].GetY())
|
||||||
|
{
|
||||||
|
InsertPointAtPos(newPoint,i);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
m_iCurrentPoints++;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
void CChartPointsArray<T>::InsertPointAtPos(const T& newPoint, int iPos)
|
||||||
|
{
|
||||||
|
// Find the address of the insert point
|
||||||
|
T* pPointPos = m_pPoints + iPos;
|
||||||
|
// Move all remaining points one place to the right.
|
||||||
|
memmove(pPointPos+1,pPointPos,(m_iCurrentPoints-iPos)*sizeof(T));
|
||||||
|
// Store the new point
|
||||||
|
*pPointPos = newPoint;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
int CChartPointsArray<T>::ComparePointsOnX(void const* pA, void const* pB)
|
||||||
|
{
|
||||||
|
T* pPointA = (T *) pA;
|
||||||
|
T* pPointB = (T *) pB;
|
||||||
|
|
||||||
|
if (pPointA->GetX() < pPointB->GetX()) return -1;
|
||||||
|
if (pPointA->GetX() > pPointB->GetX()) return 1;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
int CChartPointsArray<T>::ComparePointsOnY(void const* pA, void const* pB)
|
||||||
|
{
|
||||||
|
T* pPointA = (T *) pA;
|
||||||
|
T* pPointB = (T *) pB;
|
||||||
|
|
||||||
|
if (pPointA->GetY() < pPointB->GetY()) return -1;
|
||||||
|
if (pPointA->GetY() > pPointB->GetY()) return 1;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
void CChartPointsArray<T>::RefreshMinMax()
|
||||||
|
{
|
||||||
|
m_dXMinVal = m_pPoints[0].GetXMin();
|
||||||
|
m_dXMaxVal = m_pPoints[0].GetXMax();
|
||||||
|
m_dYMinVal = m_pPoints[0].GetYMin();
|
||||||
|
m_dYMaxVal = m_pPoints[0].GetYMax();
|
||||||
|
for (unsigned uIndex=0; uIndex<m_iCurrentPoints; uIndex++)
|
||||||
|
{
|
||||||
|
if (m_pPoints[uIndex].GetXMax() > m_dXMaxVal)
|
||||||
|
m_dXMaxVal = m_pPoints[uIndex].GetXMax();
|
||||||
|
if (m_pPoints[uIndex].GetXMin() < m_dXMinVal)
|
||||||
|
m_dXMinVal = m_pPoints[uIndex].GetXMin();
|
||||||
|
if (m_pPoints[uIndex].GetYMax() > m_dYMaxVal)
|
||||||
|
m_dYMaxVal = m_pPoints[uIndex].GetYMax();
|
||||||
|
if (m_pPoints[uIndex].GetYMin() < m_dYMinVal)
|
||||||
|
m_dYMinVal = m_pPoints[uIndex].GetYMin();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
int CChartPointsArray<T>::BinarySearch(unsigned uLeft,
|
||||||
|
unsigned uRight,
|
||||||
|
double dFind) const
|
||||||
|
{
|
||||||
|
unsigned middle = uLeft + ((uRight - uLeft) /2);
|
||||||
|
double midVal = 0;
|
||||||
|
if (m_Ordering == poXOrdering)
|
||||||
|
midVal = m_pPoints[middle].GetX();
|
||||||
|
if (m_Ordering == poYOrdering)
|
||||||
|
midVal = m_pPoints[middle].GetY();
|
||||||
|
|
||||||
|
if(midVal > dFind)
|
||||||
|
{
|
||||||
|
if(uLeft < middle)
|
||||||
|
return BinarySearch(uLeft,middle-1,dFind);
|
||||||
|
else
|
||||||
|
return uLeft;
|
||||||
|
}
|
||||||
|
else if(middle < uRight)
|
||||||
|
return BinarySearch(middle+1,uRight,dFind);
|
||||||
|
else
|
||||||
|
return uRight;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,335 @@
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
* ChartPointsSerie.cpp
|
||||||
|
*
|
||||||
|
* Written by Cédric Moonen (cedric_moonen@hotmail.com)
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* This code may be used for any non-commercial and commercial purposes in a compiled form.
|
||||||
|
* The code may be redistributed as long as it remains unmodified and providing that the
|
||||||
|
* author name and this disclaimer remain intact. The sources can be modified WITH the author
|
||||||
|
* consent only.
|
||||||
|
*
|
||||||
|
* This code is provided without any garanties. I cannot be held responsible for the damage or
|
||||||
|
* the loss of time it causes. Use it at your own risks
|
||||||
|
*
|
||||||
|
* An e-mail to notify me that you are using this code is appreciated also.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* History:
|
||||||
|
* - 07/07/2008: Last point of the series was not displayed. Fixed.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "stdafx.h"
|
||||||
|
#include "ChartPointsSerie.h"
|
||||||
|
#include "ChartCtrl.h"
|
||||||
|
#include "Math.h"
|
||||||
|
|
||||||
|
#ifdef _DEBUG
|
||||||
|
#undef THIS_FILE
|
||||||
|
static char THIS_FILE[]=__FILE__;
|
||||||
|
#define new DEBUG_NEW
|
||||||
|
#endif
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
// Construction/Destruction
|
||||||
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
CChartPointsSerie::CChartPointsSerie(CChartCtrl* pParent)
|
||||||
|
: CChartXYSerie(pParent), m_iPointType(ptEllipse), m_iXPointSize(5),
|
||||||
|
m_iYPointSize(5), m_colBorder(RGB(0,0,0))
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
CChartPointsSerie::~CChartPointsSerie()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
void CChartPointsSerie::SetPointSize(int XSize, int YSize)
|
||||||
|
{
|
||||||
|
m_iXPointSize = XSize;
|
||||||
|
m_iYPointSize = YSize;
|
||||||
|
m_pParentCtrl->RefreshCtrl();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartPointsSerie::SetPointType(PointType Type)
|
||||||
|
{
|
||||||
|
m_iPointType = Type;
|
||||||
|
m_pParentCtrl->RefreshCtrl();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartPointsSerie::SetBorderColor(COLORREF Color)
|
||||||
|
{
|
||||||
|
m_colBorder = Color;
|
||||||
|
m_pParentCtrl->RefreshCtrl();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartPointsSerie::Draw(CDC *pDC)
|
||||||
|
{
|
||||||
|
if (!m_bIsVisible)
|
||||||
|
return;
|
||||||
|
if (!pDC->GetSafeHdc())
|
||||||
|
return;
|
||||||
|
|
||||||
|
CBrush NewBrush(m_SerieColor);
|
||||||
|
CPen BorderPen(PS_SOLID, 1, m_colBorder);
|
||||||
|
CBrush ShadowBrush(m_ShadowColor);
|
||||||
|
CPen ShadowPen(PS_SOLID, 1, m_ShadowColor);
|
||||||
|
CPen* pOldPen = pDC->SelectObject(&BorderPen);
|
||||||
|
CBrush* pOldBrush = pDC->SelectObject(&NewBrush);
|
||||||
|
|
||||||
|
pDC->SetBkMode(TRANSPARENT);
|
||||||
|
//To have lines limited in the drawing rectangle :
|
||||||
|
pDC->IntersectClipRect(m_PlottingRect);
|
||||||
|
|
||||||
|
//Draw all points that haven't been drawn yet
|
||||||
|
for (m_uLastDrawnPoint;m_uLastDrawnPoint<(int)GetPointsCount();m_uLastDrawnPoint++)
|
||||||
|
{
|
||||||
|
SChartXYPoint Point = GetPoint(m_uLastDrawnPoint);
|
||||||
|
CPoint ScreenPoint;
|
||||||
|
ValueToScreen(Point.X, Point.Y, ScreenPoint);
|
||||||
|
|
||||||
|
CRect PointRect;
|
||||||
|
PointRect.SetRect(ScreenPoint.x-m_iXPointSize/2,ScreenPoint.y-m_iYPointSize/2,ScreenPoint.x+m_iXPointSize/2,ScreenPoint.y+m_iYPointSize/2);
|
||||||
|
CRect ShadowRect = PointRect + CSize(m_iShadowDepth,m_iShadowDepth);
|
||||||
|
|
||||||
|
switch(m_iPointType)
|
||||||
|
{
|
||||||
|
case ptEllipse:
|
||||||
|
if (m_bShadow)
|
||||||
|
{
|
||||||
|
pOldPen = pDC->SelectObject(&ShadowPen);
|
||||||
|
pDC->SelectObject(&ShadowBrush);
|
||||||
|
pDC->Ellipse(ShadowRect);
|
||||||
|
pDC->SelectObject(&NewBrush);
|
||||||
|
pDC->SelectObject(&BorderPen);
|
||||||
|
}
|
||||||
|
pDC->Ellipse(PointRect);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case ptRectangle:
|
||||||
|
if (m_bShadow)
|
||||||
|
{
|
||||||
|
pOldPen = pDC->SelectObject(&ShadowPen);
|
||||||
|
pDC->SelectObject(&ShadowBrush);
|
||||||
|
pDC->Rectangle(ShadowRect);
|
||||||
|
pDC->SelectObject(&NewBrush);
|
||||||
|
pDC->SelectObject(&BorderPen);
|
||||||
|
}
|
||||||
|
pDC->Rectangle(PointRect);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case ptTriangle:
|
||||||
|
{
|
||||||
|
CPoint TrPoints[3];
|
||||||
|
TrPoints[0].x = PointRect.left;
|
||||||
|
TrPoints[0].y = PointRect.bottom;
|
||||||
|
TrPoints[1].x = PointRect.right;
|
||||||
|
TrPoints[1].y = PointRect.bottom;
|
||||||
|
TrPoints[2].x = PointRect.left + (int)fabs((PointRect.left-PointRect.right)/2.0);
|
||||||
|
TrPoints[2].y = PointRect.top;
|
||||||
|
|
||||||
|
if (m_bShadow)
|
||||||
|
{
|
||||||
|
CPoint ShadowPoints[3];
|
||||||
|
for (int i=0;i<3;i++)
|
||||||
|
{
|
||||||
|
ShadowPoints[i] = TrPoints[i] + CSize(m_iShadowDepth,m_iShadowDepth);
|
||||||
|
}
|
||||||
|
|
||||||
|
pOldPen = pDC->SelectObject(&ShadowPen);
|
||||||
|
pDC->SelectObject(&ShadowBrush);
|
||||||
|
pDC->Polygon(ShadowPoints,3);
|
||||||
|
pDC->SelectObject(&NewBrush);
|
||||||
|
pDC->SelectObject(&BorderPen);
|
||||||
|
}
|
||||||
|
pDC->Polygon(TrPoints,3);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
pDC->SelectClipRgn(NULL);
|
||||||
|
pDC->SelectObject(pOldPen);
|
||||||
|
pDC->SelectObject(pOldBrush);
|
||||||
|
DeleteObject(BorderPen);
|
||||||
|
DeleteObject(NewBrush);
|
||||||
|
DeleteObject(ShadowBrush);
|
||||||
|
DeleteObject(ShadowPen);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartPointsSerie::DrawAll(CDC *pDC)
|
||||||
|
{
|
||||||
|
if (!m_bIsVisible)
|
||||||
|
return;
|
||||||
|
if (!pDC->GetSafeHdc())
|
||||||
|
return;
|
||||||
|
|
||||||
|
CBrush NewBrush(m_SerieColor);
|
||||||
|
CPen BorderPen(PS_SOLID, 1, m_colBorder);
|
||||||
|
CBrush ShadowBrush(m_ShadowColor);
|
||||||
|
CPen ShadowPen(PS_SOLID, 1, m_ShadowColor);
|
||||||
|
CPen* pOldPen = pDC->SelectObject(&BorderPen);
|
||||||
|
CBrush* pOldBrush = pDC->SelectObject(&NewBrush);
|
||||||
|
|
||||||
|
unsigned uFirst=0, uLast=0;
|
||||||
|
if (!GetVisiblePoints(uFirst,uLast))
|
||||||
|
return;
|
||||||
|
|
||||||
|
pDC->SetBkMode(TRANSPARENT);
|
||||||
|
//To have lines limited in the drawing rectangle :
|
||||||
|
pDC->IntersectClipRect(m_PlottingRect);
|
||||||
|
|
||||||
|
for (m_uLastDrawnPoint=uFirst;m_uLastDrawnPoint<=uLast;m_uLastDrawnPoint++)
|
||||||
|
{
|
||||||
|
SChartXYPoint Point = GetPoint(m_uLastDrawnPoint);
|
||||||
|
CPoint ScreenPoint;
|
||||||
|
ValueToScreen(Point.X, Point.Y, ScreenPoint);
|
||||||
|
|
||||||
|
CRect PointRect;
|
||||||
|
PointRect.SetRect(ScreenPoint.x-m_iXPointSize/2,ScreenPoint.y-m_iYPointSize/2,ScreenPoint.x+m_iXPointSize/2,ScreenPoint.y+m_iYPointSize/2);
|
||||||
|
CRect ShadowRect = PointRect + CSize(m_iShadowDepth,m_iShadowDepth);
|
||||||
|
|
||||||
|
switch(m_iPointType)
|
||||||
|
{
|
||||||
|
case ptEllipse:
|
||||||
|
if (m_bShadow)
|
||||||
|
{
|
||||||
|
pOldPen = pDC->SelectObject(&ShadowPen);
|
||||||
|
pDC->SelectObject(&ShadowBrush);
|
||||||
|
pDC->Ellipse(ShadowRect);
|
||||||
|
pDC->SelectObject(&NewBrush);
|
||||||
|
pDC->SelectObject(&BorderPen);
|
||||||
|
}
|
||||||
|
pDC->Ellipse(PointRect);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case ptRectangle:
|
||||||
|
if (m_bShadow)
|
||||||
|
{
|
||||||
|
pOldPen = pDC->SelectObject(&ShadowPen);
|
||||||
|
pDC->SelectObject(&ShadowBrush);
|
||||||
|
pDC->Rectangle(ShadowRect);
|
||||||
|
pDC->SelectObject(&NewBrush);
|
||||||
|
pDC->SelectObject(&BorderPen);
|
||||||
|
}
|
||||||
|
pDC->Rectangle(PointRect);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case ptTriangle:
|
||||||
|
{
|
||||||
|
CPoint TrPoints[3];
|
||||||
|
TrPoints[0].x = PointRect.left;
|
||||||
|
TrPoints[0].y = PointRect.bottom;
|
||||||
|
TrPoints[1].x = PointRect.right;
|
||||||
|
TrPoints[1].y = PointRect.bottom;
|
||||||
|
TrPoints[2].x = PointRect.left + (int)fabs((PointRect.left-PointRect.right)/2.0);
|
||||||
|
TrPoints[2].y = PointRect.top;
|
||||||
|
|
||||||
|
if (m_bShadow)
|
||||||
|
{
|
||||||
|
CPoint ShadowPoints[3];
|
||||||
|
for (int i=0;i<3;i++)
|
||||||
|
{
|
||||||
|
ShadowPoints[i] = TrPoints[i] + CSize(m_iShadowDepth,m_iShadowDepth);
|
||||||
|
}
|
||||||
|
|
||||||
|
pOldPen = pDC->SelectObject(&ShadowPen);
|
||||||
|
pDC->SelectObject(&ShadowBrush);
|
||||||
|
pDC->Polygon(ShadowPoints,3);
|
||||||
|
pDC->SelectObject(&NewBrush);
|
||||||
|
pDC->SelectObject(&BorderPen);
|
||||||
|
}
|
||||||
|
pDC->Polygon(TrPoints,3);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pDC->SelectClipRgn(NULL);
|
||||||
|
pDC->SelectObject(pOldPen);
|
||||||
|
pDC->SelectObject(pOldBrush);
|
||||||
|
DeleteObject(BorderPen);
|
||||||
|
DeleteObject(NewBrush);
|
||||||
|
DeleteObject(ShadowBrush);
|
||||||
|
DeleteObject(ShadowPen);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartPointsSerie::DrawLegend(CDC *pDC, const CRect& rectBitmap) const
|
||||||
|
{
|
||||||
|
if (m_strSerieName== _T(""))
|
||||||
|
return;
|
||||||
|
|
||||||
|
CRect PointRect(0,0,m_iXPointSize,m_iYPointSize);
|
||||||
|
if ( (rectBitmap.Height()>m_iYPointSize) && (rectBitmap.Width()>m_iXPointSize) )
|
||||||
|
{
|
||||||
|
int XOffset = rectBitmap.left + rectBitmap.Width()/2 - m_iXPointSize/2;
|
||||||
|
int YOffset = rectBitmap.top + rectBitmap.Height()/2 - m_iYPointSize/2;
|
||||||
|
PointRect.OffsetRect(XOffset,YOffset);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
PointRect = rectBitmap;
|
||||||
|
|
||||||
|
CBrush NewBrush(m_SerieColor);
|
||||||
|
CBrush* pOldBrush = pDC->SelectObject(&NewBrush);
|
||||||
|
|
||||||
|
switch(m_iPointType)
|
||||||
|
{
|
||||||
|
case ptEllipse:
|
||||||
|
pDC->Ellipse(PointRect);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case ptRectangle:
|
||||||
|
pDC->Rectangle(PointRect);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case ptTriangle:
|
||||||
|
{
|
||||||
|
CPoint TrPoints[3];
|
||||||
|
TrPoints[0].x = PointRect.left;
|
||||||
|
TrPoints[0].y = PointRect.bottom;
|
||||||
|
TrPoints[1].x = PointRect.right;
|
||||||
|
TrPoints[1].y = PointRect.bottom;
|
||||||
|
TrPoints[2].x = PointRect.left + (int)fabs((PointRect.left-PointRect.right)/2.0);
|
||||||
|
TrPoints[2].y = PointRect.top;
|
||||||
|
|
||||||
|
pDC->Polygon(TrPoints,3);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
pDC->SelectObject(pOldBrush);
|
||||||
|
DeleteObject(NewBrush);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CChartPointsSerie::IsPointOnSerie(const CPoint& screenPoint, unsigned& uIndex) const
|
||||||
|
{
|
||||||
|
uIndex = INVALID_POINT;
|
||||||
|
if (!m_bIsVisible)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
unsigned uFirst=0, uLast=0;
|
||||||
|
if (!GetVisiblePoints(uFirst, uLast))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
bool bResult = false;
|
||||||
|
for (unsigned i=uFirst ; i < uLast ; i++)
|
||||||
|
{
|
||||||
|
SChartXYPoint Point = GetPoint(i);
|
||||||
|
CPoint ValuePoint;
|
||||||
|
ValueToScreen(Point.X, Point.Y, ValuePoint);
|
||||||
|
|
||||||
|
int xDist = abs(screenPoint.x - ValuePoint.x);
|
||||||
|
int yDist = abs(screenPoint.y - ValuePoint.y);
|
||||||
|
if (xDist<=5 && yDist<=5)
|
||||||
|
{
|
||||||
|
uIndex = i;
|
||||||
|
bResult = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return bResult;
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,117 @@
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
* ChartPointsSerie.h
|
||||||
|
*
|
||||||
|
* Written by Cédric Moonen (cedric_moonen@hotmail.com)
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* This code may be used for any non-commercial and commercial purposes in a compiled form.
|
||||||
|
* The code may be redistributed as long as it remains unmodified and providing that the
|
||||||
|
* author name and this disclaimer remain intact. The sources can be modified WITH the author
|
||||||
|
* consent only.
|
||||||
|
*
|
||||||
|
* This code is provided without any garanties. I cannot be held responsible for the damage or
|
||||||
|
* the loss of time it causes. Use it at your own risks
|
||||||
|
*
|
||||||
|
* An e-mail to notify me that you are using this code is appreciated also.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if !defined(AFX_CHARTPOINTSSERIE_H__F66C180F_F04C_4E2D_878C_08BDBCE91863__INCLUDED_)
|
||||||
|
#define AFX_CHARTPOINTSSERIE_H__F66C180F_F04C_4E2D_878C_08BDBCE91863__INCLUDED_
|
||||||
|
|
||||||
|
#if _MSC_VER > 1000
|
||||||
|
#pragma once
|
||||||
|
#endif // _MSC_VER > 1000
|
||||||
|
|
||||||
|
#include "ChartXYSerie.h"
|
||||||
|
|
||||||
|
//! Specialization of a CChartSerie to display a points series.
|
||||||
|
/**
|
||||||
|
The data points are simply displayed as independant points.
|
||||||
|
**/
|
||||||
|
class CChartPointsSerie : public CChartXYSerie
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
//! The different point shapes
|
||||||
|
enum PointType
|
||||||
|
{
|
||||||
|
ptEllipse=0,
|
||||||
|
ptRectangle=1,
|
||||||
|
ptTriangle=2
|
||||||
|
};
|
||||||
|
|
||||||
|
//! Sets the width and height of each points
|
||||||
|
void SetPointSize(int XSize, int YSize);
|
||||||
|
//! Retrieves the width and height of each points
|
||||||
|
void GetPointSize(int& XSize, int& YSize) const
|
||||||
|
{
|
||||||
|
XSize = m_iXPointSize;
|
||||||
|
YSize = m_iYPointSize;
|
||||||
|
}
|
||||||
|
//! Sets the points shape
|
||||||
|
void SetPointType(PointType Type);
|
||||||
|
//! Returns the points shape
|
||||||
|
PointType GetPointType() const { return m_iPointType; }
|
||||||
|
|
||||||
|
//! Sets the border color of the points
|
||||||
|
void SetBorderColor(COLORREF Color);
|
||||||
|
//! Returns the border color of the points
|
||||||
|
COLORREF GetBorderColor() { return m_colBorder; }
|
||||||
|
|
||||||
|
//! Constructor
|
||||||
|
CChartPointsSerie(CChartCtrl* pParent);
|
||||||
|
//! Destructor
|
||||||
|
virtual ~CChartPointsSerie();
|
||||||
|
|
||||||
|
//! Check whether a screen point is on the series.
|
||||||
|
/**
|
||||||
|
@param screenPoint
|
||||||
|
The screen point to test
|
||||||
|
@param uIndex
|
||||||
|
If the point is close to a specific point of the series, its index is stored here.
|
||||||
|
@return true if the point is on the series
|
||||||
|
**/
|
||||||
|
bool IsPointOnSerie(const CPoint& screenPoint, unsigned& uIndex) const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
//! Draws the legend icon for the series.
|
||||||
|
/**
|
||||||
|
This pure virtual function should be overriden by child classes.
|
||||||
|
@param pDC
|
||||||
|
The device context used to draw
|
||||||
|
@param rectBitmap
|
||||||
|
The rectangle in which to draw the legend icon
|
||||||
|
**/
|
||||||
|
void DrawLegend(CDC* pDC, const CRect& rectBitmap) const;
|
||||||
|
|
||||||
|
//! Draws the most recent points of the series.
|
||||||
|
/**
|
||||||
|
This pure virtual function should be overriden by child classes.
|
||||||
|
This function should only draw the points that were not previously
|
||||||
|
drawn.
|
||||||
|
@param pDC
|
||||||
|
The device context used to draw
|
||||||
|
**/
|
||||||
|
void Draw(CDC* pDC);
|
||||||
|
//! Redraws the full series.
|
||||||
|
/**
|
||||||
|
This pure virtual function should be overriden by child classes.
|
||||||
|
@param pDC
|
||||||
|
The device context used to draw
|
||||||
|
**/
|
||||||
|
void DrawAll(CDC *pDC);
|
||||||
|
|
||||||
|
//! Width of the points
|
||||||
|
int m_iXPointSize;
|
||||||
|
//! Height of the points
|
||||||
|
int m_iYPointSize;
|
||||||
|
//! Shape of the points
|
||||||
|
PointType m_iPointType;
|
||||||
|
//! The border color
|
||||||
|
COLORREF m_colBorder;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // !defined(AFX_CHARTPOINTSSERIE_H__F66C180F_F04C_4E2D_878C_08BDBCE91863__INCLUDED_)
|
|
@ -0,0 +1,222 @@
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
* ChartScrollBar.h
|
||||||
|
*
|
||||||
|
* Written by Cédric Moonen (cedric_moonen@hotmail.com)
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* This code may be used for any non-commercial and commercial purposes in a compiled form.
|
||||||
|
* The code may be redistributed as long as it remains unmodified and providing that the
|
||||||
|
* author name and this disclaimer remain intact. The sources can be modified WITH the author
|
||||||
|
* consent only.
|
||||||
|
*
|
||||||
|
* This code is provided without any garanties. I cannot be held responsible for the damage or
|
||||||
|
* the loss of time it causes. Use it at your own risks
|
||||||
|
*
|
||||||
|
* An e-mail to notify me that you are using this code is appreciated also.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "stdafx.h"
|
||||||
|
#include "ChartScrollBar.h"
|
||||||
|
#include "ChartAxis.h"
|
||||||
|
#include "ChartCtrl.h"
|
||||||
|
#include "math.h"
|
||||||
|
|
||||||
|
CChartScrollBar::CChartScrollBar(CChartAxis* pParentAxis)
|
||||||
|
: CScrollBar(), m_pParentAxis(pParentAxis), m_bEnabled(false),
|
||||||
|
m_bAutoHide(true)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
CChartScrollBar::~CChartScrollBar()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartScrollBar::CreateScrollBar(const CRect& PlottingRect)
|
||||||
|
{
|
||||||
|
CRect Temp = PlottingRect;
|
||||||
|
Temp.top++; Temp.left++;
|
||||||
|
|
||||||
|
DWORD dwStyle = SBS_HORZ | WS_CHILD;
|
||||||
|
if (m_pParentAxis->IsHorizontal())
|
||||||
|
{
|
||||||
|
if (m_pParentAxis->IsSecondary())
|
||||||
|
dwStyle |= SBS_TOPALIGN;
|
||||||
|
else
|
||||||
|
dwStyle += SBS_BOTTOMALIGN;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (m_pParentAxis->IsSecondary())
|
||||||
|
dwStyle |= SBS_VERT | SBS_RIGHTALIGN;
|
||||||
|
else
|
||||||
|
dwStyle += SBS_VERT | SBS_LEFTALIGN;
|
||||||
|
}
|
||||||
|
CScrollBar::Create(dwStyle, Temp, m_pParentAxis->m_pParentCtrl,100);
|
||||||
|
SCROLLINFO info;
|
||||||
|
info.cbSize = sizeof(SCROLLINFO);
|
||||||
|
info.fMask = SIF_ALL;
|
||||||
|
info.nMin = 1;
|
||||||
|
info.nMax = 1;
|
||||||
|
info.nPage = 1;
|
||||||
|
info.nPos = 1;
|
||||||
|
CScrollBar::SetScrollInfo(&info);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CChartScrollBar::IsScrollInverted() const
|
||||||
|
{
|
||||||
|
bool bInverted = false;
|
||||||
|
if (m_pParentAxis->IsInverted() && m_pParentAxis->IsHorizontal())
|
||||||
|
bInverted = true;
|
||||||
|
if (!m_pParentAxis->IsInverted() && !m_pParentAxis->IsHorizontal())
|
||||||
|
bInverted = true;
|
||||||
|
|
||||||
|
return bInverted;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartScrollBar::Refresh()
|
||||||
|
{
|
||||||
|
int iTotalSteps = 0;
|
||||||
|
int iCurrentStep = 0;
|
||||||
|
m_pParentAxis->GetScrollbarSteps(iTotalSteps,iCurrentStep);
|
||||||
|
|
||||||
|
SCROLLINFO info;
|
||||||
|
info.cbSize = sizeof(SCROLLINFO);
|
||||||
|
info.fMask = SIF_ALL;
|
||||||
|
|
||||||
|
info.nMin = 0;
|
||||||
|
info.nMax = iTotalSteps-1;
|
||||||
|
info.nPage = 10;
|
||||||
|
info.nPos = iCurrentStep;
|
||||||
|
|
||||||
|
if (IsScrollInverted())
|
||||||
|
info.nPos = iTotalSteps - 9 - iCurrentStep;
|
||||||
|
else
|
||||||
|
info.nPos = iCurrentStep;
|
||||||
|
CScrollBar::SetScrollInfo(&info);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartScrollBar::OnHScroll(UINT nSBCode, UINT nPos)
|
||||||
|
{
|
||||||
|
int MinPos;
|
||||||
|
int MaxPos;
|
||||||
|
int PreviousPos = CScrollBar::GetScrollPos();
|
||||||
|
CScrollBar::GetScrollRange(&MinPos, &MaxPos);
|
||||||
|
int CurPos = PreviousPos;
|
||||||
|
|
||||||
|
bool bUpdate = true;
|
||||||
|
switch (nSBCode)
|
||||||
|
{
|
||||||
|
case SB_LEFT:
|
||||||
|
CurPos = 0;
|
||||||
|
break;
|
||||||
|
case SB_RIGHT:
|
||||||
|
CurPos = MaxPos;
|
||||||
|
break;
|
||||||
|
case SB_ENDSCROLL:
|
||||||
|
bUpdate = false;
|
||||||
|
break;
|
||||||
|
case SB_LINELEFT:
|
||||||
|
if (CurPos > MinPos)
|
||||||
|
CurPos--;
|
||||||
|
break;
|
||||||
|
case SB_LINERIGHT:
|
||||||
|
if (CurPos < MaxPos-9)
|
||||||
|
CurPos++;
|
||||||
|
break;
|
||||||
|
case SB_PAGELEFT:
|
||||||
|
if (CurPos > MinPos)
|
||||||
|
CurPos = max(MinPos, CurPos - 10);
|
||||||
|
break;
|
||||||
|
case SB_PAGERIGHT:
|
||||||
|
if (CurPos < MaxPos-9)
|
||||||
|
CurPos = min(MaxPos, CurPos + 10);
|
||||||
|
break;
|
||||||
|
case SB_THUMBPOSITION:
|
||||||
|
CurPos = nPos;
|
||||||
|
break;
|
||||||
|
case SB_THUMBTRACK:
|
||||||
|
CurPos = nPos;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (bUpdate)
|
||||||
|
{
|
||||||
|
// Set the new position of the thumb (scroll box).
|
||||||
|
CScrollBar::SetScrollPos(CurPos);
|
||||||
|
MoveAxisToPos(PreviousPos,CurPos);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartScrollBar::OnVScroll(UINT nSBCode, UINT nPos)
|
||||||
|
{
|
||||||
|
int MinPos;
|
||||||
|
int MaxPos;
|
||||||
|
int PreviousPos = CScrollBar::GetScrollPos();
|
||||||
|
CScrollBar::GetScrollRange(&MinPos, &MaxPos);
|
||||||
|
int CurPos = PreviousPos;
|
||||||
|
bool bUpdate = true;
|
||||||
|
|
||||||
|
switch (nSBCode)
|
||||||
|
{
|
||||||
|
case SB_BOTTOM:
|
||||||
|
CurPos = MaxPos;
|
||||||
|
break;
|
||||||
|
case SB_TOP:
|
||||||
|
CurPos = 0;
|
||||||
|
break;
|
||||||
|
case SB_ENDSCROLL:
|
||||||
|
bUpdate = false;
|
||||||
|
break;
|
||||||
|
case SB_LINEDOWN:
|
||||||
|
if (CurPos < MaxPos-9)
|
||||||
|
CurPos++;
|
||||||
|
break;
|
||||||
|
case SB_LINEUP:
|
||||||
|
if (CurPos > MinPos)
|
||||||
|
CurPos--;
|
||||||
|
break;
|
||||||
|
case SB_PAGEUP:
|
||||||
|
if (CurPos > MinPos)
|
||||||
|
CurPos = max(MinPos, CurPos - 10);
|
||||||
|
break;
|
||||||
|
case SB_PAGEDOWN:
|
||||||
|
if (CurPos < MaxPos-9)
|
||||||
|
CurPos = min(MaxPos, CurPos + 10);
|
||||||
|
break;
|
||||||
|
case SB_THUMBPOSITION:
|
||||||
|
CurPos = nPos;
|
||||||
|
break;
|
||||||
|
case SB_THUMBTRACK:
|
||||||
|
CurPos = nPos;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (bUpdate)
|
||||||
|
{
|
||||||
|
// Set the new position of the thumb (scroll box).
|
||||||
|
CScrollBar::SetScrollPos(CurPos);
|
||||||
|
MoveAxisToPos(PreviousPos,CurPos);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartScrollBar::MoveAxisToPos(int PreviousPos, int CurPos)
|
||||||
|
{
|
||||||
|
m_pParentAxis->SetAxisToScrollStep(PreviousPos,CurPos,IsScrollInverted());
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartScrollBar::OnMouseEnter()
|
||||||
|
{
|
||||||
|
if (m_bEnabled && m_bAutoHide)
|
||||||
|
ShowWindow(SW_SHOW);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartScrollBar::OnMouseLeave()
|
||||||
|
{
|
||||||
|
if (m_bEnabled && m_bAutoHide)
|
||||||
|
ShowWindow(SW_HIDE);
|
||||||
|
}
|
|
@ -0,0 +1,75 @@
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
* ChartScrollBar.h
|
||||||
|
*
|
||||||
|
* Written by Cédric Moonen (cedric_moonen@hotmail.com)
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* This code may be used for any non-commercial and commercial purposes in a compiled form.
|
||||||
|
* The code may be redistributed as long as it remains unmodified and providing that the
|
||||||
|
* author name and this disclaimer remain intact. The sources can be modified WITH the author
|
||||||
|
* consent only.
|
||||||
|
*
|
||||||
|
* This code is provided without any garanties. I cannot be held responsible for the damage or
|
||||||
|
* the loss of time it causes. Use it at your own risks
|
||||||
|
*
|
||||||
|
* An e-mail to notify me that you are using this code is appreciated also.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
class CChartAxis;
|
||||||
|
|
||||||
|
//! Class which manages the interaction with the axis scroll bar.
|
||||||
|
/**
|
||||||
|
This class is used internally by the CChartAxis class.
|
||||||
|
**/
|
||||||
|
class CChartScrollBar : public CScrollBar
|
||||||
|
{
|
||||||
|
friend CChartAxis;
|
||||||
|
|
||||||
|
public:
|
||||||
|
//! Creates the scroll bar within a specified rectangle.
|
||||||
|
void CreateScrollBar(const CRect& PlottingRect);
|
||||||
|
|
||||||
|
//! Called on horizontal scrolling.
|
||||||
|
void OnHScroll(UINT nSBCode, UINT nPos);
|
||||||
|
//! Called on vertical scrolling.
|
||||||
|
void OnVScroll(UINT nSBCode, UINT nPos);
|
||||||
|
//! Refreshes the scroll bar position.
|
||||||
|
void Refresh();
|
||||||
|
|
||||||
|
//! Enables/disables the scroll bar.
|
||||||
|
void SetEnabled(bool bEnabled) { m_bEnabled = bEnabled; }
|
||||||
|
//! Returns true if the scroll bar is enabled
|
||||||
|
bool GetEnabled() const { return m_bEnabled; }
|
||||||
|
//! Enables/disables the auto-hide mode.
|
||||||
|
/**
|
||||||
|
In auto-hide mode, the scroll bar is not visible unless the mouse
|
||||||
|
is over the region of the scroll bar.
|
||||||
|
**/
|
||||||
|
void SetAutoHide(bool bAutoHide) { m_bAutoHide = bAutoHide; }
|
||||||
|
//! Returns true if the auto-hide mode is activated.
|
||||||
|
bool GetAutoHide() const { return m_bAutoHide; }
|
||||||
|
|
||||||
|
//! Called when the mouse enters the scroll bar area.
|
||||||
|
void OnMouseEnter();
|
||||||
|
//! Called when the mouse leaves the scroll bar area.
|
||||||
|
void OnMouseLeave();
|
||||||
|
|
||||||
|
private:
|
||||||
|
//! Constructor
|
||||||
|
CChartScrollBar(CChartAxis* pParentAxis);
|
||||||
|
//! Destructor
|
||||||
|
~CChartScrollBar();
|
||||||
|
|
||||||
|
bool IsScrollInverted() const;
|
||||||
|
void MoveAxisToPos(int PreviousPos, int CurPos);
|
||||||
|
|
||||||
|
CChartAxis* m_pParentAxis;
|
||||||
|
bool m_bEnabled;
|
||||||
|
bool m_bAutoHide;
|
||||||
|
};
|
|
@ -0,0 +1,150 @@
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
* ChartSerie.cpp
|
||||||
|
*
|
||||||
|
* Written by Cédric Moonen (cedric_moonen@hotmail.com)
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* This code may be used for any non-commercial and commercial purposes in a compiled form.
|
||||||
|
* The code may be redistributed as long as it remains unmodified and providing that the
|
||||||
|
* author name and this disclaimer remain intact. The sources can be modified WITH the author
|
||||||
|
* consent only.
|
||||||
|
*
|
||||||
|
* This code is provided without any garanties. I cannot be held responsible for the damage or
|
||||||
|
* the loss of time it causes. Use it at your own risks
|
||||||
|
*
|
||||||
|
* An e-mail to notify me that you are using this code is appreciated also.
|
||||||
|
*
|
||||||
|
* History:
|
||||||
|
* - 11/08/2006: Management of the auto axis now done in the axis. Series Register
|
||||||
|
* Unregister themselves to their respective axes .
|
||||||
|
* - 29/02/2008: Taking into account that RefreshAutoAxis doesn't refresh the control.
|
||||||
|
* - 01/03/2008: RemovePointsFromBegin and RemovePointsFromEnd functions added.
|
||||||
|
* - 08/03/2008: AddPoints function added (thanks to Bruno Lavier).
|
||||||
|
* - 11/03/2008: Min and max values are now cached.
|
||||||
|
* - 14/03/2008: Series can be ordered. Speed improvement done in that case.
|
||||||
|
* - 13/08/2008: Bug fix: calling AddPoint was not drawing the new points.
|
||||||
|
* - 27/11/2008: Points are now stored into the CChartPointsArray class instead of
|
||||||
|
* std::vector for efficiency.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "stdafx.h"
|
||||||
|
#include "ChartCtrl.h"
|
||||||
|
#include "ChartSerie.h"
|
||||||
|
#include "ChartAxis.h"
|
||||||
|
|
||||||
|
#include "Math.h"
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
|
#ifdef _DEBUG
|
||||||
|
#undef THIS_FILE
|
||||||
|
static char THIS_FILE[]=__FILE__;
|
||||||
|
#define new DEBUG_NEW
|
||||||
|
#endif
|
||||||
|
|
||||||
|
unsigned CChartSerie::m_uNextFreeId = 0;
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
// Construction/Destruction
|
||||||
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
CChartSerie::CChartSerie(CChartCtrl* pParent)
|
||||||
|
{
|
||||||
|
m_pParentCtrl = pParent;
|
||||||
|
// m_uLastDrawnPoint = 0;
|
||||||
|
m_strSerieName = _T("");
|
||||||
|
|
||||||
|
m_pHorizontalAxis = m_pVerticalAxis = NULL;
|
||||||
|
m_uSerieId = m_uNextFreeId;
|
||||||
|
m_uNextFreeId++;
|
||||||
|
|
||||||
|
m_bIsVisible = true;
|
||||||
|
m_bShadow = false;
|
||||||
|
m_SerieColor = RGB(0, 0, 0);
|
||||||
|
m_ShadowColor = RGB(150,150,150);
|
||||||
|
m_iShadowDepth = 2;
|
||||||
|
|
||||||
|
m_bMouseClickNotifications = true;
|
||||||
|
m_bMouseMoveNotifications = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
CChartSerie::~CChartSerie()
|
||||||
|
{
|
||||||
|
m_pHorizontalAxis->UnregisterSeries(this);
|
||||||
|
m_pVerticalAxis->UnregisterSeries(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
//void CChartSerie::SetSeriesOrdering(CChartPointsArray::PointsOrdering newOrdering)
|
||||||
|
//{
|
||||||
|
// m_vPoints.SetOrdering(newOrdering);
|
||||||
|
//}
|
||||||
|
|
||||||
|
void CChartSerie::SetName(const TChartString& NewName)
|
||||||
|
{
|
||||||
|
m_strSerieName = NewName;
|
||||||
|
m_pParentCtrl->RefreshCtrl();
|
||||||
|
}
|
||||||
|
|
||||||
|
double CChartSerie::XScreenToValue(long XScreenCoord) const
|
||||||
|
{
|
||||||
|
return m_pHorizontalAxis->ScreenToValue(XScreenCoord);
|
||||||
|
}
|
||||||
|
|
||||||
|
double CChartSerie::YScreenToValue(long YScreenCoord) const
|
||||||
|
{
|
||||||
|
return m_pVerticalAxis->ScreenToValue(YScreenCoord);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartSerie::ValueToScreen(double XValue, double YValue, CPoint &ScreenPoint) const
|
||||||
|
{
|
||||||
|
ScreenPoint.x = m_pHorizontalAxis->ValueToScreen(XValue);
|
||||||
|
ScreenPoint.y = m_pVerticalAxis->ValueToScreen(YValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartSerie::SetVisible(bool bVisible)
|
||||||
|
{
|
||||||
|
m_bIsVisible = bVisible;
|
||||||
|
m_pParentCtrl->RefreshCtrl();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartSerie::SetColor(COLORREF NewColor)
|
||||||
|
{
|
||||||
|
m_SerieColor = NewColor;
|
||||||
|
m_pParentCtrl->RefreshCtrl();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartSerie::SetShadowColor(COLORREF NewColor)
|
||||||
|
{
|
||||||
|
m_ShadowColor = NewColor;
|
||||||
|
m_pParentCtrl->RefreshCtrl();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartSerie::EnableShadow(bool bEnable)
|
||||||
|
{
|
||||||
|
m_bShadow = bEnable;
|
||||||
|
m_pParentCtrl->RefreshCtrl();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartSerie::SetShadowDepth(int Depth)
|
||||||
|
{
|
||||||
|
m_iShadowDepth = Depth;
|
||||||
|
m_pParentCtrl->RefreshCtrl();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartSerie::EnableMouseNotifications(bool bClickEnabled, bool bMoveEnabled)
|
||||||
|
{
|
||||||
|
m_bMouseClickNotifications = bClickEnabled;
|
||||||
|
m_bMouseMoveNotifications = bMoveEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartSerie::RefreshAutoAxes(bool bForceRefresh)
|
||||||
|
{
|
||||||
|
m_pParentCtrl->EnableRefresh(false);
|
||||||
|
m_pHorizontalAxis->RefreshAutoAxis();
|
||||||
|
m_pVerticalAxis->RefreshAutoAxis();
|
||||||
|
if (bForceRefresh)
|
||||||
|
m_pParentCtrl->RefreshCtrl();
|
||||||
|
m_pParentCtrl->EnableRefresh(true);
|
||||||
|
}
|
|
@ -0,0 +1,283 @@
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
* ChartSerie.h
|
||||||
|
*
|
||||||
|
* Written by Cédric Moonen (cedric_moonen@hotmail.com)
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* This code may be used for any non-commercial and commercial purposes in a compiled form.
|
||||||
|
* The code may be redistributed as long as it remains unmodified and providing that the
|
||||||
|
* author name and this disclaimer remain intact. The sources can be modified WITH the author
|
||||||
|
* consent only.
|
||||||
|
*
|
||||||
|
* This code is provided without any garanties. I cannot be held responsible for the damage or
|
||||||
|
* the loss of time it causes. Use it at your own risks
|
||||||
|
*
|
||||||
|
* An e-mail to notify me that you are using this code is appreciated also.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if !defined(AFX_CHARTSERIE_H__FFCF0E32_10E7_4A4D_9FF3_3C6177EDE4B1__INCLUDED_)
|
||||||
|
#define AFX_CHARTSERIE_H__FFCF0E32_10E7_4A4D_9FF3_3C6177EDE4B1__INCLUDED_
|
||||||
|
|
||||||
|
#if _MSC_VER > 1000
|
||||||
|
#pragma once
|
||||||
|
#endif // _MSC_VER > 1000
|
||||||
|
|
||||||
|
|
||||||
|
#define INVALID_POINT UINT_MAX
|
||||||
|
|
||||||
|
#include "ChartAxis.h"
|
||||||
|
#include "ChartSeriesMouseListener.h"
|
||||||
|
|
||||||
|
#include <map>
|
||||||
|
#include "ChartString.h"
|
||||||
|
|
||||||
|
class CChartLegend;
|
||||||
|
class CChartCtrl;
|
||||||
|
|
||||||
|
#define INVALID_POINT UINT_MAX
|
||||||
|
|
||||||
|
//! Abstract class that provides a common "interface" for all series in the control
|
||||||
|
/**
|
||||||
|
The class doesn't manipulate points (the type of point is unknown at this
|
||||||
|
level in the class hierarchy) but it provides all other functionalities
|
||||||
|
which are independant of the point type.
|
||||||
|
|
||||||
|
The drawing of the series is made through pure virtual functions which
|
||||||
|
should be implemented by derived classes.
|
||||||
|
|
||||||
|
Each series is identified by an Id.
|
||||||
|
**/
|
||||||
|
class CChartSerie
|
||||||
|
{
|
||||||
|
friend CChartCtrl;
|
||||||
|
friend CChartLegend;
|
||||||
|
|
||||||
|
public:
|
||||||
|
//! Returns the number of points in the series.
|
||||||
|
virtual unsigned GetPointsCount() const = 0;
|
||||||
|
|
||||||
|
//! Returns the screen coordinate of a specific point
|
||||||
|
virtual CPoint GetPointScreenCoord(unsigned uPointIndex) = 0;
|
||||||
|
|
||||||
|
//! Retrieves the minimum and maxium Y values of the series.
|
||||||
|
/**
|
||||||
|
@param Min
|
||||||
|
Minimum value will be stored in this parameter
|
||||||
|
@param Max
|
||||||
|
Maximum value will be stored in this parameter
|
||||||
|
@return
|
||||||
|
false if the series doesn't contain data or is invisible
|
||||||
|
**/
|
||||||
|
virtual bool GetSerieYMinMax(double& Min, double& Max) const = 0;
|
||||||
|
//! Retrieves the minimum and maxium X values of the series.
|
||||||
|
/**
|
||||||
|
@param Min
|
||||||
|
Minimum value will be stored in this parameter
|
||||||
|
@param Max
|
||||||
|
Maximum value will be stored in this parameter
|
||||||
|
@return
|
||||||
|
false if the series doesn't contain data or is invisible
|
||||||
|
**/
|
||||||
|
virtual bool GetSerieXMinMax(double& Min, double& Max) const = 0;
|
||||||
|
//! Retrieves the minimum and maxium screen X values of the series.
|
||||||
|
/**
|
||||||
|
@param Min
|
||||||
|
Minimum value will be stored in this parameter
|
||||||
|
@param Max
|
||||||
|
Maximum value will be stored in this parameter
|
||||||
|
@return
|
||||||
|
false if the series doesn't contain data or is invisible
|
||||||
|
**/
|
||||||
|
virtual bool GetSerieXScreenMinMax(double& Min, double& Max) const = 0;
|
||||||
|
//! Retrieves the minimum and maxium screen Y values of the series.
|
||||||
|
/**
|
||||||
|
@param Min
|
||||||
|
Minimum value will be stored in this parameter
|
||||||
|
@param Max
|
||||||
|
Maximum value will be stored in this parameter
|
||||||
|
@return
|
||||||
|
false if the series doesn't contain data or is invisible
|
||||||
|
**/
|
||||||
|
virtual bool GetSerieYScreenMinMax(double& Min, double& Max) const = 0;
|
||||||
|
|
||||||
|
//! Sets the name of the series, which is displayed in the legend.
|
||||||
|
void SetName(const TChartString& NewName);
|
||||||
|
//! Returns the name of the series.
|
||||||
|
TChartString GetName() const { return m_strSerieName; }
|
||||||
|
|
||||||
|
//! Converts any data point into its relative screen point.
|
||||||
|
/**
|
||||||
|
@param XValue
|
||||||
|
The X value of the data point
|
||||||
|
@param YValue
|
||||||
|
The Y value of the data point
|
||||||
|
@param ScreenPoint
|
||||||
|
The screen point will be stored in the parameter
|
||||||
|
**/
|
||||||
|
void ValueToScreen(double XValue, double YValue, CPoint& ScreenPoint) const;
|
||||||
|
//! Converts an Y screen value into its relative Y data value.
|
||||||
|
double YScreenToValue(long YScreenCoord) const;
|
||||||
|
//! Converts an Xscreen value into its relative X data value.
|
||||||
|
double XScreenToValue(long XScreenCoord) const;
|
||||||
|
|
||||||
|
//! Constructor
|
||||||
|
CChartSerie(CChartCtrl* pParent);
|
||||||
|
//! Destructor
|
||||||
|
virtual ~CChartSerie();
|
||||||
|
|
||||||
|
//! Specifies if the series is visible or not.
|
||||||
|
/**
|
||||||
|
An invisible series won't affect automatic axis: it is considered
|
||||||
|
as if it was not in the control.
|
||||||
|
**/
|
||||||
|
void SetVisible(bool bVisible);
|
||||||
|
//! Returns true if the series is visible.
|
||||||
|
bool IsVisible() const { return m_bIsVisible; }
|
||||||
|
|
||||||
|
//! Returns the color of the series.
|
||||||
|
COLORREF GetColor() const { return m_SerieColor; }
|
||||||
|
//! Sets the color of the series.
|
||||||
|
void SetColor(COLORREF NewColor);
|
||||||
|
//! Returns the color of the shadow.
|
||||||
|
COLORREF GetShadowColor() const { return m_ShadowColor; }
|
||||||
|
//! Sets the color of the shadow.
|
||||||
|
void SetShadowColor(COLORREF NewColor);
|
||||||
|
//! Enables or disables the shadow for the series.
|
||||||
|
void EnableShadow(bool bEnable);
|
||||||
|
//! Sepcifies the depth (in pixels) of the shadow.
|
||||||
|
void SetShadowDepth(int Depth);
|
||||||
|
|
||||||
|
//! Tests if a certain screen point is on the series.
|
||||||
|
/**
|
||||||
|
This function should be overidden by all child classes.
|
||||||
|
@param screenPoint
|
||||||
|
The screen point to test
|
||||||
|
@param uIndex
|
||||||
|
If the point is close to a specific point of the series, its index is stored here.
|
||||||
|
@return true if the point is on the series
|
||||||
|
**/
|
||||||
|
virtual bool IsPointOnSerie(const CPoint& screenPoint, unsigned& uIndex) const = 0;
|
||||||
|
|
||||||
|
//! Returns the series Id.
|
||||||
|
unsigned GetSerieId() const { return m_uSerieId; }
|
||||||
|
//! Enables or disables certain mouse notifications on the series.
|
||||||
|
/**
|
||||||
|
Checking if a point is on the series could degrade performances if
|
||||||
|
it has to be done for each mouse event. This function allows to disable
|
||||||
|
certain notifications, in which case the test won't be done. By default
|
||||||
|
the series reacts on mouse clicks but not on mouse moves.
|
||||||
|
@param bClickEnabled
|
||||||
|
Specifies if the series reacts on mouse clicks.
|
||||||
|
@param bMoveEnabled
|
||||||
|
Specifies if the series reacts on mouse moves.
|
||||||
|
**/
|
||||||
|
void EnableMouseNotifications(bool bClickEnabled, bool bMoveEnabled);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
//! Refreshes the automatic axes associated with this series
|
||||||
|
void RefreshAutoAxes(bool bForceRefresh);
|
||||||
|
//! Returns the first and last visible points of the series.
|
||||||
|
/**
|
||||||
|
This function only works if ordering is enabled.
|
||||||
|
@param uFirst
|
||||||
|
The index of the first visible point is stored in this argument
|
||||||
|
@param uLast
|
||||||
|
The index of the last visible point is stored in this argument
|
||||||
|
@return false if the series has no ordering or no data points.
|
||||||
|
**/
|
||||||
|
virtual bool GetVisiblePoints(unsigned& uFirst, unsigned& uLast) const = 0;
|
||||||
|
|
||||||
|
//! Draws the legend icon for the series.
|
||||||
|
/**
|
||||||
|
This pure virtual function should be overriden by child classes.
|
||||||
|
@param pDC
|
||||||
|
The device context used to draw
|
||||||
|
@param rectBitmap
|
||||||
|
The rectangle in which to draw the legend icon
|
||||||
|
**/
|
||||||
|
virtual void DrawLegend(CDC* pDC, const CRect& rectBitmap) const =0;
|
||||||
|
|
||||||
|
//! Draws the most recent points of the series.
|
||||||
|
/**
|
||||||
|
This pure virtual function should be overriden by child classes.
|
||||||
|
This function should only draw the points that were not previously
|
||||||
|
drawn.
|
||||||
|
@param pDC
|
||||||
|
The device context used to draw
|
||||||
|
**/
|
||||||
|
virtual void Draw(CDC* pDC) =0;
|
||||||
|
//! Redraws the full series.
|
||||||
|
/**
|
||||||
|
This pure virtual function should be overriden by child classes.
|
||||||
|
@param pDC
|
||||||
|
The device context used to draw
|
||||||
|
**/
|
||||||
|
virtual void DrawAll(CDC *pDC) =0;
|
||||||
|
//! Draws the labels of the series.
|
||||||
|
/**
|
||||||
|
This pure virtual function should be overriden by child classes.
|
||||||
|
@param pDC
|
||||||
|
The device context used to draw
|
||||||
|
**/
|
||||||
|
virtual void DrawLabels(CDC* pDC) =0;
|
||||||
|
|
||||||
|
//! Called when a mouse event is detected on the chart
|
||||||
|
/**
|
||||||
|
This pure virtual function should be overriden by child classes.
|
||||||
|
@param mouseEvent
|
||||||
|
The event that occured on the control
|
||||||
|
@param screenPoint
|
||||||
|
The screen point on which the event occured
|
||||||
|
@return true if the event occured on the series.
|
||||||
|
**/
|
||||||
|
virtual bool OnMouseEvent(CChartMouseListener::MouseEvent mouseEvent,
|
||||||
|
const CPoint& screenPoint) = 0;
|
||||||
|
|
||||||
|
//! Returns true if the series reacts on mouse moves.
|
||||||
|
bool NotifyMouseMoveEnabled() { return m_bMouseMoveNotifications; }
|
||||||
|
//! Returns true if the series reacts on mouse clicks.
|
||||||
|
bool NotifyMouseClickEnabled() { return m_bMouseClickNotifications; }
|
||||||
|
|
||||||
|
//! The parent charting control.
|
||||||
|
CChartCtrl* m_pParentCtrl;
|
||||||
|
//! The related vertical axis.
|
||||||
|
CChartAxis* m_pVerticalAxis;
|
||||||
|
//! The related horizontal axis.
|
||||||
|
CChartAxis* m_pHorizontalAxis;
|
||||||
|
|
||||||
|
//! The series name displayed in the legend.
|
||||||
|
TChartString m_strSerieName;
|
||||||
|
|
||||||
|
//! Specifies if the series is visible.
|
||||||
|
bool m_bIsVisible;
|
||||||
|
//! Specifies if the series has shadow enabled.
|
||||||
|
bool m_bShadow;
|
||||||
|
//! Color of the series
|
||||||
|
COLORREF m_SerieColor;
|
||||||
|
//! Color of the shadow
|
||||||
|
COLORREF m_ShadowColor;
|
||||||
|
//! Depth (in pixels) of the shadow
|
||||||
|
int m_iShadowDepth;
|
||||||
|
//! The rectangle in which the series should be drawn.
|
||||||
|
CRect m_PlottingRect;
|
||||||
|
|
||||||
|
private:
|
||||||
|
//! Sets the plotting rectangle.
|
||||||
|
void SetPlottingRect(const CRect& plottingRect) { m_PlottingRect = plottingRect; }
|
||||||
|
|
||||||
|
//! The next available series Id
|
||||||
|
static unsigned m_uNextFreeId;
|
||||||
|
//! The series Id
|
||||||
|
unsigned m_uSerieId;
|
||||||
|
|
||||||
|
//! Specifies if the series reacts on mouse clicks.
|
||||||
|
bool m_bMouseClickNotifications;
|
||||||
|
//! Specifies if the series reacts on mouse moves.
|
||||||
|
bool m_bMouseMoveNotifications;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // !defined(AFX_CHARTSERIE_H__FFCF0E32_10E7_4A4D_9FF3_3C6177EDE4B1__INCLUDED_)
|
|
@ -0,0 +1,231 @@
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
* ChartSerieBase.h
|
||||||
|
*
|
||||||
|
* Written by Cédric Moonen (cedric_moonen@hotmail.com)
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* This code may be used for any non-commercial and commercial purposes in a compiled form.
|
||||||
|
* The code may be redistributed as long as it remains unmodified and providing that the
|
||||||
|
* author name and this disclaimer remain intact. The sources can be modified WITH the author
|
||||||
|
* consent only.
|
||||||
|
*
|
||||||
|
* This code is provided without any garanties. I cannot be held responsible for the damage or
|
||||||
|
* the loss of time it causes. Use it at your own risks
|
||||||
|
*
|
||||||
|
* An e-mail to notify me that you are using this code is appreciated also.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#if _MSC_VER > 1000
|
||||||
|
#pragma once
|
||||||
|
#endif // _MSC_VER > 1000
|
||||||
|
|
||||||
|
#include "ChartSerie.h"
|
||||||
|
#include "ChartAxis.h"
|
||||||
|
#include "ChartPointsArray.h"
|
||||||
|
#include "ChartLabel.h"
|
||||||
|
#include "ChartBalloonLabel.h"
|
||||||
|
#include "ChartSeriesMouseListener.h"
|
||||||
|
|
||||||
|
#include <map>
|
||||||
|
#include "ChartString.h"
|
||||||
|
#include "PointsOrdering.h"
|
||||||
|
|
||||||
|
class CChartLegend;
|
||||||
|
|
||||||
|
|
||||||
|
//! Base class for all series of the control
|
||||||
|
/**
|
||||||
|
This class inherits from CChartSeries and introduces the concept of
|
||||||
|
points through the template parameter.
|
||||||
|
|
||||||
|
This class is much more than a simple base class. It already store
|
||||||
|
all the data points and provide utility functions to manipulate them.
|
||||||
|
**/
|
||||||
|
template <class T>
|
||||||
|
class CChartSerieBase : public CChartSerie
|
||||||
|
{
|
||||||
|
friend CChartCtrl;
|
||||||
|
friend CChartLegend;
|
||||||
|
|
||||||
|
public:
|
||||||
|
//! Adds a single data point to the series.
|
||||||
|
void AddPoint(const T& newPoint);
|
||||||
|
//! Adds an array of points to the series.
|
||||||
|
/**
|
||||||
|
Points which were already present in the series are kept.
|
||||||
|
@param pPoints
|
||||||
|
Array of the new points
|
||||||
|
@param Count
|
||||||
|
Size of the array
|
||||||
|
**/
|
||||||
|
void AddPoints(T* pPoints, unsigned Count);
|
||||||
|
//! Retrieves the point at the specified index.
|
||||||
|
/**
|
||||||
|
@param index
|
||||||
|
The index of the point to retrieve
|
||||||
|
**/
|
||||||
|
const T& GetPoint(unsigned index) const;
|
||||||
|
//! Sets an array of points to the series.
|
||||||
|
/**
|
||||||
|
Points which were already present in the series are discarded.
|
||||||
|
@param pPoints
|
||||||
|
Array of the new points
|
||||||
|
@param Count
|
||||||
|
Size of the array
|
||||||
|
**/
|
||||||
|
void SetPoints(T* pPoints, unsigned Count);
|
||||||
|
//! Removes a certain amount of points from the begining of the series.
|
||||||
|
void RemovePointsFromBegin(unsigned Count);
|
||||||
|
//! Removes a certain amount of points from the end of the series.
|
||||||
|
void RemovePointsFromEnd(unsigned Count);
|
||||||
|
//! Removes all points from the series.
|
||||||
|
void ClearSerie();
|
||||||
|
|
||||||
|
//! Returns the number of points in the series.
|
||||||
|
unsigned GetPointsCount() const { return m_vPoints.GetPointsCount(); }
|
||||||
|
|
||||||
|
//! Retrieves the minimum and maxium Y values of the series.
|
||||||
|
/**
|
||||||
|
@param Min
|
||||||
|
Minimum value will be stored in this parameter
|
||||||
|
@param Max
|
||||||
|
Maximum value will be stored in this parameter
|
||||||
|
@return
|
||||||
|
false if the series doesn't contain data or is invisible
|
||||||
|
**/
|
||||||
|
bool GetSerieYMinMax(double& Min, double& Max) const;
|
||||||
|
//! Retrieves the minimum and maxium X values of the series.
|
||||||
|
/**
|
||||||
|
@param Min
|
||||||
|
Minimum value will be stored in this parameter
|
||||||
|
@param Max
|
||||||
|
Maximum value will be stored in this parameter
|
||||||
|
@return
|
||||||
|
false if the series doesn't contain data or is invisible
|
||||||
|
**/
|
||||||
|
bool GetSerieXMinMax(double& Min, double& Max) const;
|
||||||
|
//! Retrieves the minimum and maxium screen X values of the series.
|
||||||
|
/**
|
||||||
|
@param Min
|
||||||
|
Minimum value will be stored in this parameter
|
||||||
|
@param Max
|
||||||
|
Maximum value will be stored in this parameter
|
||||||
|
@return
|
||||||
|
false if the series doesn't contain data or is invisible
|
||||||
|
**/
|
||||||
|
bool GetSerieXScreenMinMax(double& Min, double& Max) const;
|
||||||
|
//! Retrieves the minimum and maxium screen Y values of the series.
|
||||||
|
/**
|
||||||
|
@param Min
|
||||||
|
Minimum value will be stored in this parameter
|
||||||
|
@param Max
|
||||||
|
Maximum value will be stored in this parameter
|
||||||
|
@return
|
||||||
|
false if the series doesn't contain data or is invisible
|
||||||
|
**/
|
||||||
|
bool GetSerieYScreenMinMax(double& Min, double& Max) const;
|
||||||
|
|
||||||
|
//! Creates and attaches a balloon label on a point of the series.
|
||||||
|
/**
|
||||||
|
This functions specifies a static text to display in the label.
|
||||||
|
@param uPointIndex
|
||||||
|
The index of the point on which the label should be attached
|
||||||
|
@param strLabelText
|
||||||
|
The text of the label
|
||||||
|
@return the created CChartBalloonLabel
|
||||||
|
**/
|
||||||
|
CChartBalloonLabel<T>* CreateBalloonLabel(unsigned uPointIndex, const TChartString& strLabelText);
|
||||||
|
//! Creates and attaches a balloon label on a point of the series.
|
||||||
|
/**
|
||||||
|
This functions specifies a CChartLabelProvider object which is used to
|
||||||
|
supply the text of the label. This is useful if you want more flexibility
|
||||||
|
for the text of the label (display information about the point value for
|
||||||
|
instance).
|
||||||
|
@param uPointIndex
|
||||||
|
The index of the point on which the label should be attached
|
||||||
|
@param pLabelProvider
|
||||||
|
Object providing the text displayed on the label
|
||||||
|
@return the created CChartBalloonLabel
|
||||||
|
**/
|
||||||
|
CChartBalloonLabel<T>* CreateBalloonLabel(unsigned uPointIndex, CChartLabelProvider<T>* pLabelProvider);
|
||||||
|
//! Attaches a custom label on a point of the series.
|
||||||
|
/**
|
||||||
|
@param uPointIndex
|
||||||
|
The index of the point on which the label should be attached
|
||||||
|
@param pLabel
|
||||||
|
The label to attach to the point
|
||||||
|
**/
|
||||||
|
void AttachCustomLabel(unsigned uPointIndex, CChartLabel<T>* pLabel);
|
||||||
|
|
||||||
|
//! Constructor
|
||||||
|
CChartSerieBase(CChartCtrl* pParent);
|
||||||
|
//! Destructor
|
||||||
|
virtual ~CChartSerieBase();
|
||||||
|
|
||||||
|
//! Specifies how the points should be ordered in the series.
|
||||||
|
/**
|
||||||
|
This specifies if the points should be ordered on their X values,
|
||||||
|
on their Y values or not ordered (kept in order they are added to
|
||||||
|
the control). Ordering can improve performances a lot but makes it
|
||||||
|
impossible to draw some specific curves (for instance, drawing an
|
||||||
|
ellipse is only possible if no ordering is set).
|
||||||
|
**/
|
||||||
|
virtual void SetSeriesOrdering(PointsOrdering newOrdering);
|
||||||
|
|
||||||
|
//! Retrieves the screen point of a specific data point
|
||||||
|
/**
|
||||||
|
@param uPointIndex
|
||||||
|
The index of the point for which to retrieve the screen point
|
||||||
|
@return the screen point
|
||||||
|
**/
|
||||||
|
CPoint GetPointScreenCoord(unsigned uPointIndex);
|
||||||
|
|
||||||
|
//! Register a series mouse listener on this series
|
||||||
|
/**
|
||||||
|
@param pListener
|
||||||
|
The listener to register
|
||||||
|
**/
|
||||||
|
void RegisterMouseListener(CChartSeriesMouseListener<T>* pListener);
|
||||||
|
//! Unregister the series mouse listener for this series
|
||||||
|
void UnregisterMouseListener();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
//! Returns the first and last visible points of the series.
|
||||||
|
/**
|
||||||
|
This function only works if ordering is enabled.
|
||||||
|
@param uFirst
|
||||||
|
The index of the first visible point is stored in this argument
|
||||||
|
@param uLast
|
||||||
|
The index of the last visible point is stored in this argument
|
||||||
|
@return false if the series has no ordering or no data points.
|
||||||
|
**/
|
||||||
|
bool GetVisiblePoints(unsigned& uFirst, unsigned& uLast) const;
|
||||||
|
|
||||||
|
//! Called by the control to check if an event occured on the series.
|
||||||
|
bool OnMouseEvent(CChartMouseListener::MouseEvent mouseEvent,
|
||||||
|
const CPoint& screenPoint);
|
||||||
|
|
||||||
|
//! The helper class containing all the data points.
|
||||||
|
CChartPointsArray<T> m_vPoints;
|
||||||
|
//! Index of the last point drawn
|
||||||
|
unsigned m_uLastDrawnPoint;
|
||||||
|
|
||||||
|
private:
|
||||||
|
//! Draws the labels of the series.
|
||||||
|
void DrawLabels(CDC* pDC);
|
||||||
|
|
||||||
|
typedef std::map<unsigned, CChartLabel<T>*> TLabelMap;
|
||||||
|
//! Map containing the labels of the series.
|
||||||
|
TLabelMap m_mapLabels;
|
||||||
|
|
||||||
|
CChartSeriesMouseListener<T>* m_pMouseListener;
|
||||||
|
};
|
||||||
|
|
||||||
|
#include "ChartSerieBase.inl"
|
||||||
|
|
|
@ -0,0 +1,340 @@
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
* ChartSerieBase.cpp
|
||||||
|
*
|
||||||
|
* Written by Cédric Moonen (cedric_moonen@hotmail.com)
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* This code may be used for any non-commercial and commercial purposes in a compiled form.
|
||||||
|
* The code may be redistributed as long as it remains unmodified and providing that the
|
||||||
|
* author name and this disclaimer remain intact. The sources can be modified WITH the author
|
||||||
|
* consent only.
|
||||||
|
*
|
||||||
|
* This code is provided without any garanties. I cannot be held responsible for the damage or
|
||||||
|
* the loss of time it causes. Use it at your own risks
|
||||||
|
*
|
||||||
|
* An e-mail to notify me that you are using this code is appreciated also.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "ChartSerieBase.h"
|
||||||
|
#include "ChartAxis.h"
|
||||||
|
#include "ChartCtrl.h"
|
||||||
|
#include "ChartLabel.h"
|
||||||
|
|
||||||
|
#include "Math.h"
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
// Construction/Destruction
|
||||||
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
CChartSerieBase<T>::CChartSerieBase(CChartCtrl* pParent) : CChartSerie(pParent)
|
||||||
|
{
|
||||||
|
m_uLastDrawnPoint = 0;
|
||||||
|
m_pMouseListener = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
CChartSerieBase<T>::~CChartSerieBase()
|
||||||
|
{
|
||||||
|
TLabelMap::iterator iter = m_mapLabels.begin();
|
||||||
|
for (iter; iter!=m_mapLabels.end(); iter++)
|
||||||
|
{
|
||||||
|
delete iter->second;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
void CChartSerieBase<T>::SetSeriesOrdering(PointsOrdering newOrdering)
|
||||||
|
{
|
||||||
|
m_vPoints.SetOrdering(newOrdering);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
void CChartSerieBase<T>::AddPoint(const T& newPoint)
|
||||||
|
{
|
||||||
|
m_vPoints.AddPoint(newPoint);
|
||||||
|
RefreshAutoAxes(false);
|
||||||
|
|
||||||
|
CDC* pDC = m_pParentCtrl->GetDC();
|
||||||
|
Draw(pDC);
|
||||||
|
m_pParentCtrl->Invalidate();
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
void CChartSerieBase<T>::AddPoints(T* pPoints, unsigned Count)
|
||||||
|
{
|
||||||
|
m_vPoints.AddPoints(pPoints, Count);
|
||||||
|
RefreshAutoAxes(false);
|
||||||
|
|
||||||
|
CDC* pDC = m_pParentCtrl->GetDC();
|
||||||
|
Draw(pDC);
|
||||||
|
m_pParentCtrl->Invalidate();
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
const T& CChartSerieBase<T>::GetPoint(unsigned Index) const
|
||||||
|
{
|
||||||
|
return m_vPoints[Index];
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
void CChartSerieBase<T>::SetPoints(T* pPoints, unsigned Count)
|
||||||
|
{
|
||||||
|
m_vPoints.SetPoints(pPoints, Count);
|
||||||
|
RefreshAutoAxes(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
void CChartSerieBase<T>::RemovePointsFromBegin(unsigned Count)
|
||||||
|
{
|
||||||
|
m_vPoints.RemovePointsFromBegin(Count);
|
||||||
|
// Remove all the labels associated with those points
|
||||||
|
for (unsigned i=0; i<=Count; i++)
|
||||||
|
{
|
||||||
|
TLabelMap::iterator iter = m_mapLabels.find(i);
|
||||||
|
if (iter != m_mapLabels.end())
|
||||||
|
{
|
||||||
|
delete iter->second;
|
||||||
|
m_mapLabels.erase(iter);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
RefreshAutoAxes(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
void CChartSerieBase<T>::RemovePointsFromEnd(unsigned Count)
|
||||||
|
{
|
||||||
|
unsigned uPtsCount = m_vPoints.GetPointsCount();
|
||||||
|
|
||||||
|
m_vPoints.RemovePointsFromEnd(Count);
|
||||||
|
// Remove all the labels associated with those points
|
||||||
|
unsigned uStart = uPtsCount - Count;
|
||||||
|
for (unsigned i=0; i<=Count; i++)
|
||||||
|
{
|
||||||
|
TLabelMap::iterator iter = m_mapLabels.find(uStart + i);
|
||||||
|
if (iter != m_mapLabels.end())
|
||||||
|
{
|
||||||
|
delete iter->second;
|
||||||
|
m_mapLabels.erase(iter);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
RefreshAutoAxes(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
void CChartSerieBase<T>::ClearSerie()
|
||||||
|
{
|
||||||
|
m_vPoints.Clear();
|
||||||
|
TLabelMap::iterator iter = m_mapLabels.begin();
|
||||||
|
for (iter; iter!=m_mapLabels.end(); iter++)
|
||||||
|
{
|
||||||
|
delete iter->second;
|
||||||
|
}
|
||||||
|
m_mapLabels.clear();
|
||||||
|
m_uLastDrawnPoint = 0;
|
||||||
|
|
||||||
|
RefreshAutoAxes(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
bool CChartSerieBase<T>::GetSerieXMinMax(double &Min, double &Max) const
|
||||||
|
{
|
||||||
|
if (!IsVisible())
|
||||||
|
return false;
|
||||||
|
return m_vPoints.GetSerieXMinMax(Min, Max);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
bool CChartSerieBase<T>::GetSerieYMinMax(double &Min, double &Max) const
|
||||||
|
{
|
||||||
|
if (!IsVisible())
|
||||||
|
return false;
|
||||||
|
return m_vPoints.GetSerieYMinMax(Min, Max);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
bool CChartSerieBase<T>::GetSerieXScreenMinMax(double& Min, double& Max) const
|
||||||
|
{
|
||||||
|
if (!IsVisible())
|
||||||
|
return false;
|
||||||
|
if (m_vPoints.GetOrdering() != poYOrdering)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
unsigned first=0, last=0;
|
||||||
|
bool bRes = GetVisiblePoints(first, last);
|
||||||
|
if (!bRes)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
Min = m_vPoints[first].GetXMin();
|
||||||
|
Max = m_vPoints[first].GetXMax();
|
||||||
|
for (unsigned i=first; i<last; i++)
|
||||||
|
{
|
||||||
|
if (m_vPoints[i].GetXMin() < Min)
|
||||||
|
Min = m_vPoints[i].GetXMin();
|
||||||
|
if (m_vPoints[i].GetXMax() > Max)
|
||||||
|
Max = m_vPoints[i].GetXMax();
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
bool CChartSerieBase<T>::GetSerieYScreenMinMax(double& Min, double& Max) const
|
||||||
|
{
|
||||||
|
if (!IsVisible())
|
||||||
|
return false;
|
||||||
|
if (m_vPoints.GetOrdering() != poXOrdering)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
unsigned first=0, last=0;
|
||||||
|
bool bRes = GetVisiblePoints(first, last);
|
||||||
|
if (!bRes)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
Min = m_vPoints[first].GetYMin();
|
||||||
|
Max = m_vPoints[first].GetYMax();
|
||||||
|
for (unsigned i=first; i<last; i++)
|
||||||
|
{
|
||||||
|
if (m_vPoints[i].GetYMin() < Min)
|
||||||
|
Min = m_vPoints[i].GetYMin();
|
||||||
|
if (m_vPoints[i].GetYMax() > Max)
|
||||||
|
Max = m_vPoints[i].GetYMax();
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
bool CChartSerieBase<T>::GetVisiblePoints(unsigned& uFirst, unsigned& uLast) const
|
||||||
|
{
|
||||||
|
if (m_vPoints.GetPointsCount() == 0)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
double Min=0, Max=0;
|
||||||
|
bool bResult = false;
|
||||||
|
switch (m_vPoints.GetOrdering())
|
||||||
|
{
|
||||||
|
case poNoOrdering:
|
||||||
|
uFirst = 0;
|
||||||
|
uLast = GetPointsCount() - 1;
|
||||||
|
bResult = true;
|
||||||
|
break;
|
||||||
|
case poXOrdering:
|
||||||
|
m_pHorizontalAxis->GetMinMax(Min, Max);
|
||||||
|
bResult = m_vPoints.GetVisiblePoints(Min, Max, uFirst, uLast);
|
||||||
|
break;
|
||||||
|
case poYOrdering:
|
||||||
|
m_pVerticalAxis->GetMinMax(Min, Max);
|
||||||
|
bResult = m_vPoints.GetVisiblePoints(Min, Max, uFirst, uLast);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return bResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
CPoint CChartSerieBase<T>::GetPointScreenCoord(unsigned uPointIndex)
|
||||||
|
{
|
||||||
|
unsigned uCount = m_vPoints.GetPointsCount();
|
||||||
|
ASSERT(uPointIndex<uCount);
|
||||||
|
|
||||||
|
T Point = m_vPoints[uPointIndex];
|
||||||
|
CPoint ScreenPoint;
|
||||||
|
ValueToScreen(Point.GetX(), Point.GetY(), ScreenPoint);
|
||||||
|
return ScreenPoint;
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
CChartBalloonLabel<T>* CChartSerieBase<T>::CreateBalloonLabel(unsigned uPointIndex,
|
||||||
|
const TChartString& strLabelText)
|
||||||
|
{
|
||||||
|
ASSERT(uPointIndex<GetPointsCount());
|
||||||
|
|
||||||
|
CChartBalloonLabel<T>* pToReturn = new CChartBalloonLabel<T>(m_pParentCtrl, this);
|
||||||
|
pToReturn->SetLabelText(strLabelText);
|
||||||
|
AttachCustomLabel(uPointIndex, pToReturn);
|
||||||
|
return pToReturn;
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
void CChartSerieBase<T>::RegisterMouseListener(CChartSeriesMouseListener<T>* pListener)
|
||||||
|
{
|
||||||
|
m_pMouseListener = pListener;
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
void CChartSerieBase<T>::UnregisterMouseListener()
|
||||||
|
{
|
||||||
|
m_pMouseListener = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
CChartBalloonLabel<T>* CChartSerieBase<T>::CreateBalloonLabel(unsigned uPointIndex,
|
||||||
|
CChartLabelProvider<T>* pLabelProvider)
|
||||||
|
{
|
||||||
|
ASSERT(uPointIndex<GetPointsCount());
|
||||||
|
|
||||||
|
CChartBalloonLabel<T>* pToReturn = new CChartBalloonLabel<T>(m_pParentCtrl, this);
|
||||||
|
pToReturn->SetLabelProvider(pLabelProvider);
|
||||||
|
AttachCustomLabel(uPointIndex, pToReturn);
|
||||||
|
return pToReturn;
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
void CChartSerieBase<T>::AttachCustomLabel(unsigned uPointIndex, CChartLabel<T>* pLabel)
|
||||||
|
{
|
||||||
|
ASSERT(uPointIndex<GetPointsCount());
|
||||||
|
|
||||||
|
TLabelMap::iterator iter = m_mapLabels.find(uPointIndex);
|
||||||
|
if (iter != m_mapLabels.end())
|
||||||
|
{
|
||||||
|
delete iter->second;
|
||||||
|
}
|
||||||
|
m_mapLabels[uPointIndex] = pLabel;
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
void CChartSerieBase<T>::DrawLabels(CDC* pDC)
|
||||||
|
{
|
||||||
|
TLabelMap::iterator iter = m_mapLabels.begin();
|
||||||
|
for (iter; iter!=m_mapLabels.end(); iter++)
|
||||||
|
{
|
||||||
|
iter->second->Draw(pDC,iter->first);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
bool CChartSerieBase<T>::OnMouseEvent(CChartMouseListener::MouseEvent mouseEvent,
|
||||||
|
const CPoint& screenPoint)
|
||||||
|
{
|
||||||
|
bool bHandled = false;
|
||||||
|
if (m_pMouseListener == NULL)
|
||||||
|
return bHandled;
|
||||||
|
|
||||||
|
if ( (mouseEvent==CChartMouseListener::MouseMove) &&
|
||||||
|
!NotifyMouseMoveEnabled())
|
||||||
|
{
|
||||||
|
return bHandled;
|
||||||
|
}
|
||||||
|
if ( (mouseEvent!=CChartMouseListener::MouseMove) &&
|
||||||
|
!NotifyMouseClickEnabled())
|
||||||
|
{
|
||||||
|
return bHandled;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned uPtIndex = 0;
|
||||||
|
if (IsPointOnSerie(screenPoint,uPtIndex))
|
||||||
|
{
|
||||||
|
m_pMouseListener->OnMouseEventSeries(mouseEvent,screenPoint,this,uPtIndex);
|
||||||
|
bHandled = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return bHandled;
|
||||||
|
}
|
|
@ -0,0 +1,65 @@
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
* ChartSeriesMouseListener.h
|
||||||
|
*
|
||||||
|
* Written by Cédric Moonen (cedric_moonen@hotmail.com)
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* This code may be used for any non-commercial and commercial purposes in a compiled form.
|
||||||
|
* The code may be redistributed as long as it remains unmodified and providing that the
|
||||||
|
* author name and this disclaimer remain intact. The sources can be modified WITH the author
|
||||||
|
* consent only.
|
||||||
|
*
|
||||||
|
* This code is provided without any garanties. I cannot be held responsible for the damage or
|
||||||
|
* the loss of time it causes. Use it at your own risks
|
||||||
|
*
|
||||||
|
* An e-mail to notify me that you are using this code is appreciated also.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _CHARTSERIESMOUSELISTENER_H_
|
||||||
|
#define _CHARTSERIESMOUSELISTENER_H_
|
||||||
|
|
||||||
|
#include "ChartMouseListener.h"
|
||||||
|
|
||||||
|
//#pragma warning( disable : 4100 )
|
||||||
|
|
||||||
|
template <class PointType>
|
||||||
|
class CChartSerieBase;
|
||||||
|
|
||||||
|
//! Listener for mouse events occuring on a series.
|
||||||
|
/**
|
||||||
|
This is an interface which must be implemented in order to receive
|
||||||
|
mouse notifications. You can then register your class with the chart
|
||||||
|
control by calling RegisterMouseListener.
|
||||||
|
**/
|
||||||
|
template <class PointType>
|
||||||
|
class CChartSeriesMouseListener
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
//! Constructor
|
||||||
|
CChartSeriesMouseListener() { }
|
||||||
|
//! Destructor
|
||||||
|
virtual ~CChartSeriesMouseListener() { }
|
||||||
|
|
||||||
|
//! Virtual function to implement in order to be notified when a mouse event occurs on a series.
|
||||||
|
/**
|
||||||
|
@param mouseEvent
|
||||||
|
The mouse event which occured
|
||||||
|
@param point
|
||||||
|
The screen point on which the event occured
|
||||||
|
@param pSerie
|
||||||
|
The series on which the event occured
|
||||||
|
@param uPointIndex
|
||||||
|
The index of the point on which the event occured. In case the event
|
||||||
|
did not occur on a specific point but on the series itself (e.g. clicking
|
||||||
|
between two points on a line series), INVALID_POINT is passed for this
|
||||||
|
parameter.
|
||||||
|
**/
|
||||||
|
virtual void OnMouseEventSeries(CChartMouseListener::MouseEvent mouseEvent, CPoint point,
|
||||||
|
CChartSerieBase<PointType>* pSerie, unsigned uPointIndex) { }
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // _CHARTSERIESMOUSELISTENER_H_
|
|
@ -0,0 +1,197 @@
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
* ChartAxis.cpp
|
||||||
|
*
|
||||||
|
* Written by Cédric Moonen (cedric_moonen@hotmail.com)
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* This code may be used for any non-commercial and commercial purposes in a compiled form.
|
||||||
|
* The code may be redistributed as long as it remains unmodified and providing that the
|
||||||
|
* author name and this disclaimer remain intact. The sources can be modified WITH the author
|
||||||
|
* consent only.
|
||||||
|
*
|
||||||
|
* This code is provided without any garanties. I cannot be held responsible for the damage or
|
||||||
|
* the loss of time it causes. Use it at your own risks
|
||||||
|
*
|
||||||
|
* An e-mail to notify me that you are using this code is appreciated also.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "stdafx.h"
|
||||||
|
#include "ChartStandardAxis.h"
|
||||||
|
#include "ChartCtrl.h"
|
||||||
|
#include <sstream>
|
||||||
|
#include <iostream>
|
||||||
|
#include <iomanip>
|
||||||
|
#include <math.h>
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
CChartStandardAxis::CChartStandardAxis()
|
||||||
|
: CChartAxis(), m_dFirstTickValue(0),
|
||||||
|
m_dTickIncrement(1.0), m_uDecCount(0)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
CChartStandardAxis::~CChartStandardAxis()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CChartStandardAxis::SetTickIncrement(bool bAuto, double newIncrement)
|
||||||
|
{
|
||||||
|
m_bAutoTicks = bAuto;
|
||||||
|
if (!m_bAutoTicks)
|
||||||
|
{
|
||||||
|
m_dTickIncrement = newIncrement;
|
||||||
|
|
||||||
|
int Zeros = (int)floor(log10(m_dTickIncrement));
|
||||||
|
|
||||||
|
int Digits = 0;
|
||||||
|
if (Zeros<0)
|
||||||
|
{
|
||||||
|
//We must set decimal places. In the other cases, Digits will be 0.
|
||||||
|
Digits = (int)fabs(Zeros*1.0);
|
||||||
|
}
|
||||||
|
SetDecimals(Digits);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
double CChartStandardAxis::GetFirstTickValue() const
|
||||||
|
{
|
||||||
|
double dRetVal = m_dFirstTickValue;
|
||||||
|
if (m_bDiscrete)
|
||||||
|
{
|
||||||
|
dRetVal = m_dFirstTickValue - m_dTickIncrement;
|
||||||
|
}
|
||||||
|
return dRetVal;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CChartStandardAxis::GetNextTickValue(double dCurrentTick, double& dNextTick) const
|
||||||
|
{
|
||||||
|
if (m_dTickIncrement==0)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
dNextTick = dCurrentTick + m_dTickIncrement;
|
||||||
|
if (dNextTick <= m_MaxValue)
|
||||||
|
return true;
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
long CChartStandardAxis::ValueToScreenDiscrete(double dValue) const
|
||||||
|
{
|
||||||
|
// In discrete mode, all values between two ticks are "directed"
|
||||||
|
// to the middle of the interval.
|
||||||
|
double precision = 0.0000000001;
|
||||||
|
if (dValue < 0)
|
||||||
|
precision = -0.0000000001;
|
||||||
|
int tickNr = (int)((dValue+precision)/m_dTickIncrement);
|
||||||
|
dValue = tickNr * m_dTickIncrement;
|
||||||
|
|
||||||
|
dValue += m_dTickIncrement/2.0;
|
||||||
|
return ValueToScreenStandard(dValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
long CChartStandardAxis::GetTickPos(double TickVal) const
|
||||||
|
{
|
||||||
|
// The tick is always at the same position,
|
||||||
|
// even if the axis is discrete.
|
||||||
|
return ValueToScreenStandard(TickVal);
|
||||||
|
}
|
||||||
|
|
||||||
|
TChartString CChartStandardAxis::GetTickLabel(double TickValue) const
|
||||||
|
{
|
||||||
|
TChartStringStream ssLabel;
|
||||||
|
ssLabel << fixed << setprecision(m_uDecCount) << TickValue;
|
||||||
|
return ssLabel.str();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartStandardAxis::RefreshTickIncrement()
|
||||||
|
{
|
||||||
|
if (!m_bAutoTicks)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (m_MaxValue == m_MinValue)
|
||||||
|
{
|
||||||
|
m_dTickIncrement = 0;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
int PixelSpace;
|
||||||
|
if (m_bIsHorizontal)
|
||||||
|
PixelSpace = 30;
|
||||||
|
else
|
||||||
|
PixelSpace = 20;
|
||||||
|
|
||||||
|
int MaxTickNumber = (int)fabs((m_EndPos-m_StartPos)/PixelSpace * 1.0);
|
||||||
|
|
||||||
|
//Calculate the appropriate TickSpace (1 tick every 30 pixel +/-)
|
||||||
|
//Temporary tick increment
|
||||||
|
double TempTickIncrement = (m_MaxValue-m_MinValue)/MaxTickNumber;
|
||||||
|
|
||||||
|
// Calculate appropriate tickSpace (not rounded on 'strange values' but
|
||||||
|
// on something like 1, 2 or 5*10^X where X is optimalized for showing the most
|
||||||
|
// significant digits)
|
||||||
|
int Zeros = (int)floor(log10(TempTickIncrement));
|
||||||
|
double MinTickIncrement = pow(10.0,Zeros);
|
||||||
|
|
||||||
|
int Digits = 0;
|
||||||
|
if (Zeros<0)
|
||||||
|
{
|
||||||
|
//We must set decimal places. In the other cases, Digits will be 0.
|
||||||
|
Digits = (int)fabs(Zeros*1.0);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (MinTickIncrement>=TempTickIncrement)
|
||||||
|
{
|
||||||
|
m_dTickIncrement = MinTickIncrement;
|
||||||
|
SetDecimals(Digits);
|
||||||
|
}
|
||||||
|
else if (MinTickIncrement*2>=TempTickIncrement)
|
||||||
|
{
|
||||||
|
m_dTickIncrement = MinTickIncrement*2;
|
||||||
|
SetDecimals(Digits);
|
||||||
|
}
|
||||||
|
else if (MinTickIncrement*5>=TempTickIncrement)
|
||||||
|
{
|
||||||
|
m_dTickIncrement = MinTickIncrement*5;
|
||||||
|
SetDecimals(Digits);
|
||||||
|
}
|
||||||
|
else if (MinTickIncrement*10>=TempTickIncrement)
|
||||||
|
{
|
||||||
|
m_dTickIncrement = MinTickIncrement*10;
|
||||||
|
if (Digits)
|
||||||
|
SetDecimals(Digits-1);
|
||||||
|
else
|
||||||
|
SetDecimals(Digits);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartStandardAxis::RefreshFirstTick()
|
||||||
|
{
|
||||||
|
if (m_dTickIncrement!=0)
|
||||||
|
{
|
||||||
|
if (m_MinValue == 0)
|
||||||
|
m_dFirstTickValue = 0;
|
||||||
|
else if (m_MinValue>0)
|
||||||
|
{
|
||||||
|
m_dFirstTickValue = (int)(m_MinValue/m_dTickIncrement) * m_dTickIncrement;
|
||||||
|
while (m_dFirstTickValue<m_MinValue)
|
||||||
|
m_dFirstTickValue += m_dTickIncrement;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_dFirstTickValue = (int)(m_MinValue/m_dTickIncrement) * m_dTickIncrement;
|
||||||
|
while (m_dFirstTickValue>m_MinValue)
|
||||||
|
m_dFirstTickValue -= m_dTickIncrement;
|
||||||
|
if (!(m_dFirstTickValue == m_MinValue))
|
||||||
|
m_dFirstTickValue += m_dTickIncrement;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else // m_TickIncrement!=0
|
||||||
|
{
|
||||||
|
m_dFirstTickValue = m_MinValue;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,76 @@
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
* ChartStandardAxis.h
|
||||||
|
*
|
||||||
|
* Written by Cédric Moonen (cedric_moonen@hotmail.com)
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* This code may be used for any non-commercial and commercial purposes in a compiled form.
|
||||||
|
* The code may be redistributed as long as it remains unmodified and providing that the
|
||||||
|
* author name and this disclaimer remain intact. The sources can be modified WITH the author
|
||||||
|
* consent only.
|
||||||
|
*
|
||||||
|
* This code is provided without any garanties. I cannot be held responsible for the damage or
|
||||||
|
* the loss of time it causes. Use it at your own risks
|
||||||
|
*
|
||||||
|
* An e-mail to notify me that you are using this code is appreciated also.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _CHARTSTANDARDAXIS_H_
|
||||||
|
#define _CHARTSTANDARDAXIS_H_
|
||||||
|
|
||||||
|
#include "ChartAxis.h"
|
||||||
|
|
||||||
|
//! Specialization of a CChartAxis class to display standard values.
|
||||||
|
class CChartStandardAxis : public CChartAxis
|
||||||
|
{
|
||||||
|
friend CChartCtrl;
|
||||||
|
|
||||||
|
public:
|
||||||
|
//! Sets the tick increment.
|
||||||
|
/**
|
||||||
|
The tick increment is the value between two adjacents
|
||||||
|
ticks on the axis.
|
||||||
|
@param bAuto
|
||||||
|
Specifies if the tick increment is automatically calculated.
|
||||||
|
@param newIncrement
|
||||||
|
The tick increment to use in manual mode.
|
||||||
|
**/
|
||||||
|
void SetTickIncrement(bool bAuto, double newIncrement);
|
||||||
|
//! Gets the tick increment.
|
||||||
|
/**
|
||||||
|
The tick increment is the value between two adjacents
|
||||||
|
ticks on the axis.
|
||||||
|
**/
|
||||||
|
double GetTickIncrement() const { return m_dTickIncrement; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
//! Default constructor
|
||||||
|
CChartStandardAxis();
|
||||||
|
//! Default destructor
|
||||||
|
~CChartStandardAxis();
|
||||||
|
|
||||||
|
double GetFirstTickValue() const;
|
||||||
|
bool GetNextTickValue(double dCurrentTick, double& dNextTick) const;
|
||||||
|
TChartString GetTickLabel(double TickValue) const;
|
||||||
|
long ValueToScreenDiscrete(double Value) const;
|
||||||
|
long GetTickPos(double TickVal) const;
|
||||||
|
|
||||||
|
void RefreshTickIncrement();
|
||||||
|
void RefreshFirstTick();
|
||||||
|
|
||||||
|
//! Sets the number of decimals points.
|
||||||
|
void SetDecimals(unsigned uDecimals) { m_uDecCount = uDecimals; }
|
||||||
|
|
||||||
|
//! Caches the value of the first tick.
|
||||||
|
double m_dFirstTickValue;
|
||||||
|
//! Indicates the space between ticks (in axis value).
|
||||||
|
double m_dTickIncrement;
|
||||||
|
//! Number of decimals to display for tick labels.
|
||||||
|
unsigned int m_uDecCount;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // _CHARTSTANDARDAXIS_H_
|
|
@ -0,0 +1,33 @@
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
* ChartString.h
|
||||||
|
*
|
||||||
|
* Written by Cédric Moonen (cedric_moonen@hotmail.com)
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* This code may be used for any non-commercial and commercial purposes in a compiled form.
|
||||||
|
* The code may be redistributed as long as it remains unmodified and providing that the
|
||||||
|
* author name and this disclaimer remain intact. The sources can be modified WITH the author
|
||||||
|
* consent only.
|
||||||
|
*
|
||||||
|
* This code is provided without any garanties. I cannot be held responsible for the damage or
|
||||||
|
* the loss of time it causes. Use it at your own risks
|
||||||
|
*
|
||||||
|
* An e-mail to notify me that you are using this code is appreciated also.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <sstream>
|
||||||
|
|
||||||
|
#if defined _UNICODE || defined UNICODE
|
||||||
|
typedef std::wstring TChartString;
|
||||||
|
typedef std::wstringstream TChartStringStream;
|
||||||
|
#else
|
||||||
|
typedef std::string TChartString;
|
||||||
|
typedef std::stringstream TChartStringStream;
|
||||||
|
#endif
|
|
@ -0,0 +1,289 @@
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
* ChartSurfaceSerie.cpp
|
||||||
|
*
|
||||||
|
* Written by Cédric Moonen (cedric_moonen@hotmail.com)
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* This code may be used for any non-commercial and commercial purposes in a compiled form.
|
||||||
|
* The code may be redistributed as long as it remains unmodified and providing that the
|
||||||
|
* author name and this disclaimer remain intact. The sources can be modified WITH the author
|
||||||
|
* consent only.
|
||||||
|
*
|
||||||
|
* This code is provided without any garanties. I cannot be held responsible for the damage or
|
||||||
|
* the loss of time it causes. Use it at your own risks
|
||||||
|
*
|
||||||
|
* An e-mail to notify me that you are using this code is appreciated also.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "stdafx.h"
|
||||||
|
#include "ChartSurfaceSerie.h"
|
||||||
|
#include "ChartCtrl.h"
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef _DEBUG
|
||||||
|
#undef THIS_FILE
|
||||||
|
static char THIS_FILE[]=__FILE__;
|
||||||
|
#define new DEBUG_NEW
|
||||||
|
#endif
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
// Construction/Destruction
|
||||||
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
CChartSurfaceSerie::CChartSurfaceSerie(CChartCtrl* pParent)
|
||||||
|
: CChartXYSerie(pParent), m_FillStyle(fsHatchDownDiag), m_bHorizontal(true)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
CChartSurfaceSerie::~CChartSurfaceSerie()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartSurfaceSerie::Draw(CDC* pDC)
|
||||||
|
{
|
||||||
|
DrawAll(pDC);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartSurfaceSerie::DrawAll(CDC* pDC)
|
||||||
|
{
|
||||||
|
unsigned uFirst=0, uLast=0;
|
||||||
|
if (!GetVisiblePoints(uFirst,uLast))
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (uFirst>0)
|
||||||
|
uFirst--;
|
||||||
|
if (uLast<GetPointsCount()-1)
|
||||||
|
uLast++;
|
||||||
|
unsigned uCount = uLast - uFirst + 1;
|
||||||
|
CPoint* pPoints = new CPoint[uCount+2];
|
||||||
|
|
||||||
|
CBrush NewBrush;
|
||||||
|
if (m_FillStyle == fsSolid)
|
||||||
|
NewBrush.CreateSolidBrush(m_SerieColor);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
int nIndex = 0;
|
||||||
|
switch (m_FillStyle)
|
||||||
|
{
|
||||||
|
case fsHatchDownDiag:
|
||||||
|
nIndex = HS_FDIAGONAL;
|
||||||
|
break;
|
||||||
|
case fsHatchUpDiag:
|
||||||
|
nIndex = HS_BDIAGONAL;
|
||||||
|
break;
|
||||||
|
case fsHatchCross:
|
||||||
|
nIndex = HS_CROSS;
|
||||||
|
break;
|
||||||
|
case fsHatchDiagCross:
|
||||||
|
nIndex = HS_DIAGCROSS;
|
||||||
|
break;
|
||||||
|
case fsHatchHorizontal:
|
||||||
|
nIndex = HS_HORIZONTAL;
|
||||||
|
break;
|
||||||
|
case fsHatchVertical:
|
||||||
|
nIndex = HS_VERTICAL;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
NewBrush.CreateHatchBrush(nIndex,m_SerieColor);
|
||||||
|
}
|
||||||
|
|
||||||
|
CBrush* pOldBrush = pDC->SelectObject(&NewBrush);
|
||||||
|
|
||||||
|
for (unsigned index=uFirst; index<=uLast; index++)
|
||||||
|
{
|
||||||
|
SChartXYPoint Point = GetPoint(index);
|
||||||
|
ValueToScreen(Point.X, Point.Y, pPoints[index-uFirst+1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_bHorizontal)
|
||||||
|
{
|
||||||
|
pPoints[0].x = pPoints[1].x;
|
||||||
|
pPoints[uCount+1].x = pPoints[uCount].x;
|
||||||
|
|
||||||
|
double Position = m_pHorizontalAxis->GetPosition()/100.00;
|
||||||
|
int AxisPos = m_PlottingRect.top + (int)(Position * (m_PlottingRect.bottom-m_PlottingRect.top));
|
||||||
|
|
||||||
|
pPoints[0].y = AxisPos;
|
||||||
|
pPoints[uCount+1].y = AxisPos;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pPoints[0].y = pPoints[1].y;
|
||||||
|
pPoints[uCount+1].y = pPoints[uCount].y;
|
||||||
|
|
||||||
|
double Position = m_pVerticalAxis->GetPosition()/100.00;
|
||||||
|
int AxisPos = m_PlottingRect.left + (int)(Position * (m_PlottingRect.right-m_PlottingRect.left));
|
||||||
|
|
||||||
|
pPoints[0].x = AxisPos;
|
||||||
|
pPoints[uCount+1].x = AxisPos;
|
||||||
|
}
|
||||||
|
|
||||||
|
pDC->SetBkMode(TRANSPARENT);
|
||||||
|
//To have lines limited in the drawing rectangle :
|
||||||
|
CRect TempClipRect(m_PlottingRect);
|
||||||
|
TempClipRect.DeflateRect(1,1);
|
||||||
|
pDC->SetBkMode(TRANSPARENT);
|
||||||
|
pDC->IntersectClipRect(TempClipRect);
|
||||||
|
|
||||||
|
pDC->Polygon(pPoints,uCount+2);
|
||||||
|
pDC->SelectClipRgn(NULL);
|
||||||
|
pDC->SelectObject(pOldBrush);
|
||||||
|
DeleteObject(NewBrush);
|
||||||
|
|
||||||
|
delete[] pPoints;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartSurfaceSerie::DrawLegend(CDC* pDC, const CRect& rectBitmap) const
|
||||||
|
{
|
||||||
|
if (m_strSerieName== _T(""))
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Draw the bitmap
|
||||||
|
CBrush NewBrush;
|
||||||
|
if (m_FillStyle == fsSolid)
|
||||||
|
NewBrush.CreateSolidBrush(m_SerieColor);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
int nIndex = 0;
|
||||||
|
switch (m_FillStyle)
|
||||||
|
{
|
||||||
|
case fsHatchDownDiag:
|
||||||
|
nIndex = HS_FDIAGONAL;
|
||||||
|
break;
|
||||||
|
case fsHatchUpDiag:
|
||||||
|
nIndex = HS_BDIAGONAL;
|
||||||
|
break;
|
||||||
|
case fsHatchCross:
|
||||||
|
nIndex = HS_CROSS;
|
||||||
|
break;
|
||||||
|
case fsHatchDiagCross:
|
||||||
|
nIndex = HS_DIAGCROSS;
|
||||||
|
break;
|
||||||
|
case fsHatchHorizontal:
|
||||||
|
nIndex = HS_HORIZONTAL;
|
||||||
|
break;
|
||||||
|
case fsHatchVertical:
|
||||||
|
nIndex = HS_VERTICAL;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
NewBrush.CreateHatchBrush(nIndex,m_SerieColor);
|
||||||
|
}
|
||||||
|
|
||||||
|
CBrush* pOldBrush = pDC->SelectObject(&NewBrush);
|
||||||
|
|
||||||
|
pDC->Rectangle(rectBitmap);
|
||||||
|
|
||||||
|
pDC->SelectObject(pOldBrush);
|
||||||
|
DeleteObject(NewBrush);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartSurfaceSerie::SetFillStyle(FillStyle NewStyle)
|
||||||
|
{
|
||||||
|
m_FillStyle = NewStyle;
|
||||||
|
m_pParentCtrl->RefreshCtrl();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartSurfaceSerie::SetHorizontal(bool bHoriz)
|
||||||
|
{
|
||||||
|
m_bHorizontal = bHoriz;
|
||||||
|
if (m_bHorizontal)
|
||||||
|
m_vPoints.SetOrdering(poXOrdering);
|
||||||
|
else
|
||||||
|
m_vPoints.SetOrdering(poYOrdering);
|
||||||
|
m_pParentCtrl->RefreshCtrl();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartSurfaceSerie::SetSeriesOrdering(PointsOrdering )
|
||||||
|
{
|
||||||
|
TRACE("Can't change the series ordering of a surface series.");
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CChartSurfaceSerie::IsPointOnSerie(const CPoint& screenPoint,
|
||||||
|
unsigned& uIndex) const
|
||||||
|
{
|
||||||
|
uIndex = INVALID_POINT;
|
||||||
|
if (!m_bIsVisible)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
unsigned uFirst=0, uLast=0;
|
||||||
|
if (!GetVisiblePoints(uFirst,uLast))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (uFirst>0)
|
||||||
|
uFirst--;
|
||||||
|
if (uLast<GetPointsCount())
|
||||||
|
uLast++;
|
||||||
|
|
||||||
|
bool bResult = false;
|
||||||
|
for (unsigned ptIndex=uFirst; ptIndex<uLast-1; ptIndex++)
|
||||||
|
{
|
||||||
|
SChartXYPoint SeriePoint1 = GetPoint(ptIndex);
|
||||||
|
SChartXYPoint SeriePoint2 = GetPoint(ptIndex+1);
|
||||||
|
CPoint point1;
|
||||||
|
CPoint point2;
|
||||||
|
ValueToScreen(SeriePoint1.X, SeriePoint1.Y, point1);
|
||||||
|
ValueToScreen(SeriePoint2.X, SeriePoint2.Y, point2);
|
||||||
|
|
||||||
|
double lineSlope = (1.0*(point2.y-point1.y))/(point2.x-point1.x);
|
||||||
|
double lineOffset = (1.0*(point2.x*point1.y-point1.x*point2.y))/(point2.x-point1.x);
|
||||||
|
|
||||||
|
if (m_bHorizontal)
|
||||||
|
{
|
||||||
|
if ( (screenPoint.x < point1.x) || (screenPoint.x > point2.x))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
int Position = m_pHorizontalAxis->GetPosition();
|
||||||
|
if ( (Position==100) && (screenPoint.y > (screenPoint.x *lineSlope + lineOffset)) )
|
||||||
|
bResult = true;
|
||||||
|
if ( (Position==0) && (screenPoint.y < (screenPoint.x *lineSlope + lineOffset)) )
|
||||||
|
bResult = true;
|
||||||
|
|
||||||
|
if (bResult)
|
||||||
|
{
|
||||||
|
// Check if the click is close to one of the two points.
|
||||||
|
int xDist = abs(screenPoint.x - point1.x);
|
||||||
|
int yDist = abs(screenPoint.y - point1.y);
|
||||||
|
if (xDist<=5 && yDist<=5)
|
||||||
|
uIndex = ptIndex;
|
||||||
|
xDist = abs(screenPoint.x - point2.x);
|
||||||
|
yDist = abs(screenPoint.y - point2.y);
|
||||||
|
if (xDist<=5 && yDist<=5)
|
||||||
|
uIndex = ptIndex+1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ( (screenPoint.y > point1.y) || (screenPoint.y < point2.y))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
int Position = m_pVerticalAxis->GetPosition();
|
||||||
|
if ( (Position==0) && (screenPoint.x < (screenPoint.y-lineOffset)/lineSlope) )
|
||||||
|
bResult = true;
|
||||||
|
if ( (Position==100) && (screenPoint.x > (screenPoint.y-lineOffset)/lineSlope) )
|
||||||
|
bResult = true;
|
||||||
|
|
||||||
|
if (bResult)
|
||||||
|
{
|
||||||
|
// Check if the click is close to one of the two points.
|
||||||
|
int xDist = abs(screenPoint.x - point1.x);
|
||||||
|
int yDist = abs(screenPoint.y - point1.y);
|
||||||
|
if (xDist<=5 && yDist<=5)
|
||||||
|
uIndex = ptIndex;
|
||||||
|
xDist = abs(screenPoint.x - point2.x);
|
||||||
|
yDist = abs(screenPoint.y - point2.y);
|
||||||
|
if (xDist<=5 && yDist<=5)
|
||||||
|
uIndex = ptIndex+1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return bResult;
|
||||||
|
}
|
|
@ -0,0 +1,128 @@
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
* ChartSurfaceSerie.h
|
||||||
|
*
|
||||||
|
* Written by Cédric Moonen (cedric_moonen@hotmail.com)
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* This code may be used for any non-commercial and commercial purposes in a compiled form.
|
||||||
|
* The code may be redistributed as long as it remains unmodified and providing that the
|
||||||
|
* author name and this disclaimer remain intact. The sources can be modified WITH the author
|
||||||
|
* consent only.
|
||||||
|
*
|
||||||
|
* This code is provided without any garanties. I cannot be held responsible for the damage or
|
||||||
|
* the loss of time it causes. Use it at your own risks
|
||||||
|
*
|
||||||
|
* An e-mail to notify me that you are using this code is appreciated also.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if !defined(AFX_CHARTSURFACESERIE_H__28A77823_43BD_4502_9AA7_A2B227454035__INCLUDED_)
|
||||||
|
#define AFX_CHARTSURFACESERIE_H__28A77823_43BD_4502_9AA7_A2B227454035__INCLUDED_
|
||||||
|
|
||||||
|
#if _MSC_VER > 1000
|
||||||
|
#pragma once
|
||||||
|
#endif // _MSC_VER > 1000
|
||||||
|
|
||||||
|
#include "ChartXYSerie.h"
|
||||||
|
|
||||||
|
//! Specialization of a CChartSerie to display a surface series.
|
||||||
|
/**
|
||||||
|
A surface can be horizontal (default) or vertical: this defines how
|
||||||
|
the filling of the surface is done. For a horizontal surface, the
|
||||||
|
filling is done between the points and the associated horizontal axis
|
||||||
|
and for a vertical surface, the filling is done between the points
|
||||||
|
and the associated vertical axis.
|
||||||
|
The series can be associated with a secondary axis. For example, if
|
||||||
|
the surface series is horizontal and is associated with the top axis
|
||||||
|
(secondary axis), the filling is done between the top axis and the points.
|
||||||
|
**/
|
||||||
|
class CChartSurfaceSerie : public CChartXYSerie
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
//! Constructor
|
||||||
|
CChartSurfaceSerie(CChartCtrl* pParent);
|
||||||
|
//! Destructor
|
||||||
|
virtual ~CChartSurfaceSerie();
|
||||||
|
|
||||||
|
//! The different fill styles
|
||||||
|
enum FillStyle
|
||||||
|
{
|
||||||
|
fsSolid = 0,
|
||||||
|
fsHatchDownDiag,
|
||||||
|
fsHatchUpDiag,
|
||||||
|
fsHatchCross,
|
||||||
|
fsHatchDiagCross,
|
||||||
|
fsHatchHorizontal,
|
||||||
|
fsHatchVertical
|
||||||
|
};
|
||||||
|
|
||||||
|
//! Sets the fill style
|
||||||
|
void SetFillStyle(FillStyle NewStyle);
|
||||||
|
//! Returns the fill style
|
||||||
|
FillStyle GetFillStyle() const { return m_FillStyle; }
|
||||||
|
|
||||||
|
//! Sets the series in horizontal or vertical mode
|
||||||
|
/**
|
||||||
|
If the series is in horizontal mode, the filling will be done between
|
||||||
|
the data points and the horizontal axis.
|
||||||
|
**/
|
||||||
|
void SetHorizontal(bool bHoriz);
|
||||||
|
//! Returns true if the series is in horizontal mode
|
||||||
|
bool GetHorizontal() const { return m_bHorizontal; }
|
||||||
|
|
||||||
|
//! Check whether a screen point is on the series.
|
||||||
|
/**
|
||||||
|
This function returns true if the screen point is on the surface.
|
||||||
|
If the screen point is also close to a specific point of the series, the
|
||||||
|
index of the point is stored in the uIndex parameter. Otherwise, this
|
||||||
|
parameter contains INVALID_POINT.
|
||||||
|
@param screenPoint
|
||||||
|
The screen point to test
|
||||||
|
@param uIndex
|
||||||
|
If the point is close to a specific point of the series, its index is stored here.
|
||||||
|
@return true if the point is on the series
|
||||||
|
**/
|
||||||
|
bool IsPointOnSerie(const CPoint& screenPoint, unsigned& uIndex) const;
|
||||||
|
|
||||||
|
void CChartSurfaceSerie::SetSeriesOrdering(PointsOrdering );
|
||||||
|
private:
|
||||||
|
//! Override in order to avoid changing series ordering.
|
||||||
|
// void SetSeriesOrdering(CChartPointsArray::PointsOrdering);
|
||||||
|
|
||||||
|
//! Draws the legend icon for the series.
|
||||||
|
/**
|
||||||
|
This pure virtual function should be overriden by child classes.
|
||||||
|
@param pDC
|
||||||
|
The device context used to draw
|
||||||
|
@param rectBitmap
|
||||||
|
The rectangle in which to draw the legend icon
|
||||||
|
**/
|
||||||
|
void DrawLegend(CDC* pDC, const CRect& rectBitmap) const;
|
||||||
|
|
||||||
|
//! Draws the most recent points of the series.
|
||||||
|
/**
|
||||||
|
This pure virtual function should be overriden by child classes.
|
||||||
|
This function should only draw the points that were not previously
|
||||||
|
drawn.
|
||||||
|
@param pDC
|
||||||
|
The device context used to draw
|
||||||
|
**/
|
||||||
|
void Draw(CDC* pDC);
|
||||||
|
//! Redraws the full series.
|
||||||
|
/**
|
||||||
|
This pure virtual function should be overriden by child classes.
|
||||||
|
@param pDC
|
||||||
|
The device context used to draw
|
||||||
|
**/
|
||||||
|
void DrawAll(CDC *pDC);
|
||||||
|
|
||||||
|
//! The brush style used to fill the surface
|
||||||
|
FillStyle m_FillStyle;
|
||||||
|
//! The horizontal/vertical mode
|
||||||
|
bool m_bHorizontal;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // !defined(AFX_CHARTSURFACESERIE_H__28A77823_43BD_4502_9AA7_A2B227454035__INCLUDED_)
|
|
@ -0,0 +1,201 @@
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
* ChartTitle.cpp
|
||||||
|
*
|
||||||
|
* Written by Cédric Moonen (cedric_moonen@hotmail.com)
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* This code may be used for any non-commercial and commercial purposes in a compiled form.
|
||||||
|
* The code may be redistributed as long as it remains unmodified and providing that the
|
||||||
|
* author name and this disclaimer remain intact. The sources can be modified WITH the author
|
||||||
|
* consent only.
|
||||||
|
*
|
||||||
|
* This code is provided without any garanties. I cannot be held responsible for the damage or
|
||||||
|
* the loss of time it causes. Use it at your own risks
|
||||||
|
*
|
||||||
|
* An e-mail to notify me that you are using this code is appreciated also.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "stdafx.h"
|
||||||
|
#include "ChartTitle.h"
|
||||||
|
#include "ChartCtrl.h"
|
||||||
|
#include "Math.h"
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
#ifdef _DEBUG
|
||||||
|
#undef THIS_FILE
|
||||||
|
static char THIS_FILE[]=__FILE__;
|
||||||
|
#define new DEBUG_NEW
|
||||||
|
#endif
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
// Construction/Destruction
|
||||||
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
CChartTitle::CChartTitle(CChartCtrl* pParent)
|
||||||
|
{
|
||||||
|
m_pParentCtrl = pParent;
|
||||||
|
m_bIsVisible = true;
|
||||||
|
m_TextColor = RGB(0,0,0);
|
||||||
|
}
|
||||||
|
|
||||||
|
CChartTitle::~CChartTitle()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartTitle::SetFont(int iPointSize, const TChartString& strFaceName)
|
||||||
|
{
|
||||||
|
m_DefaultFont.SetFont(strFaceName, iPointSize);
|
||||||
|
m_pParentCtrl->RefreshCtrl();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartTitle::SetFont(const CChartFont& newFont)
|
||||||
|
{
|
||||||
|
m_DefaultFont = newFont;
|
||||||
|
m_pParentCtrl->RefreshCtrl();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartTitle::SetColor(COLORREF NewColor)
|
||||||
|
{
|
||||||
|
m_TextColor = NewColor;
|
||||||
|
m_pParentCtrl->RefreshCtrl();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartTitle::SetLineFont(int iLineIndex,
|
||||||
|
int iPointSize,
|
||||||
|
const TChartString& strFaceName)
|
||||||
|
{
|
||||||
|
CChartFont newFont(strFaceName,iPointSize);
|
||||||
|
m_mapLineFonts[iLineIndex] = newFont;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartTitle::SetLineFont(int iLineIndex, const CChartFont& newFont)
|
||||||
|
{
|
||||||
|
m_mapLineFonts[iLineIndex] = newFont;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartTitle::AddString(const TChartString& NewString)
|
||||||
|
{
|
||||||
|
m_StringArray.push_back(NewString);
|
||||||
|
m_pParentCtrl->RefreshCtrl();
|
||||||
|
}
|
||||||
|
|
||||||
|
size_t CChartTitle::GetStringCount() const
|
||||||
|
{
|
||||||
|
return m_StringArray.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
TChartString CChartTitle::GetString(size_t Index) const
|
||||||
|
{
|
||||||
|
if ( (Index<0) || (Index>=m_StringArray.size()) )
|
||||||
|
return _T("");
|
||||||
|
return m_StringArray[Index];
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartTitle::RemoveAll()
|
||||||
|
{
|
||||||
|
m_StringArray.clear();
|
||||||
|
m_pParentCtrl->RefreshCtrl();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartTitle::Draw(CDC *pDC)
|
||||||
|
{
|
||||||
|
if (!pDC->GetSafeHdc())
|
||||||
|
return;
|
||||||
|
if (!m_bIsVisible)
|
||||||
|
return;
|
||||||
|
|
||||||
|
m_DefaultFont.SelectFont(pDC);
|
||||||
|
COLORREF OldColor = pDC->SetTextColor(m_TextColor);
|
||||||
|
int iPrevMode = pDC->SetBkMode(TRANSPARENT);
|
||||||
|
|
||||||
|
//Draw all entries
|
||||||
|
int YPos = 4;
|
||||||
|
size_t TitleCount = m_StringArray.size();
|
||||||
|
for (size_t i=0;i<TitleCount;i++)
|
||||||
|
{
|
||||||
|
map<int, CChartFont>::iterator iter = m_mapLineFonts.find(i);
|
||||||
|
if (iter != m_mapLineFonts.end())
|
||||||
|
iter->second.SelectFont(pDC);
|
||||||
|
|
||||||
|
//Draw Text
|
||||||
|
int TextWidth = pDC->GetTextExtent(m_StringArray[i].c_str()).cx;
|
||||||
|
int TextHeigh = pDC->GetTextExtent(m_StringArray[i].c_str()).cy;
|
||||||
|
|
||||||
|
int XPos = m_TitleRect.left + (int)fabs((m_TitleRect.left-m_TitleRect.right)/2.0) - TextWidth/2;
|
||||||
|
|
||||||
|
/* if (m_bShadow)
|
||||||
|
{
|
||||||
|
pDC->SetTextColor(m_ShadowColor);
|
||||||
|
pDC->ExtTextOut(XPos+m_iShadowDepth,m_TitleRect.top+YPos+m_iShadowDepth,
|
||||||
|
ETO_CLIPPED,NULL,m_StringArray[i].c_str(),NULL);
|
||||||
|
pDC->SetTextColor(m_TextColor);
|
||||||
|
}*/
|
||||||
|
pDC->ExtTextOut(XPos,m_TitleRect.top+YPos,ETO_CLIPPED,NULL,m_StringArray[i].c_str(),NULL);
|
||||||
|
|
||||||
|
if (iter != m_mapLineFonts.end())
|
||||||
|
iter->second.UnselectFont(pDC);
|
||||||
|
|
||||||
|
YPos += TextHeigh + 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_DefaultFont.UnselectFont(pDC);
|
||||||
|
pDC->SetTextColor(OldColor);
|
||||||
|
pDC->SetBkMode(iPrevMode);
|
||||||
|
}
|
||||||
|
|
||||||
|
CSize CChartTitle::GetSize(CDC *pDC)
|
||||||
|
{
|
||||||
|
CSize TitleSize;
|
||||||
|
|
||||||
|
if (!m_bIsVisible)
|
||||||
|
{
|
||||||
|
TitleSize.cx = TitleSize.cy = 0;
|
||||||
|
return TitleSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
int Height = 4; //Upper space
|
||||||
|
CSize TextSize = 0;
|
||||||
|
int MaxTextWidth = 0;
|
||||||
|
|
||||||
|
size_t TitleCount = m_StringArray.size();
|
||||||
|
if (TitleCount==0)
|
||||||
|
{
|
||||||
|
TitleSize.cx = TitleSize.cy = 0;
|
||||||
|
return TitleSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_DefaultFont.SelectFont(pDC);
|
||||||
|
for (size_t i=0;i<TitleCount;i++)
|
||||||
|
{
|
||||||
|
map<int, CChartFont>::iterator iter = m_mapLineFonts.find(i);
|
||||||
|
if (iter != m_mapLineFonts.end())
|
||||||
|
iter->second.SelectFont(pDC);
|
||||||
|
|
||||||
|
TextSize = pDC->GetTextExtent(m_StringArray[i].c_str());
|
||||||
|
Height += TextSize.cy + 2;
|
||||||
|
if (TextSize.cx > MaxTextWidth)
|
||||||
|
MaxTextWidth = TextSize.cx;
|
||||||
|
|
||||||
|
if (iter != m_mapLineFonts.end())
|
||||||
|
iter->second.UnselectFont(pDC);
|
||||||
|
}
|
||||||
|
|
||||||
|
TitleSize.cx = MaxTextWidth + 2;
|
||||||
|
TitleSize.cy = Height;
|
||||||
|
|
||||||
|
m_TitleRect.bottom = m_TitleRect.top + Height;
|
||||||
|
|
||||||
|
m_DefaultFont.UnselectFont(pDC);
|
||||||
|
return TitleSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL CChartTitle::IsPointInside(const CPoint& screenPoint) const
|
||||||
|
{
|
||||||
|
return m_TitleRect.PtInRect(screenPoint);
|
||||||
|
}
|
|
@ -0,0 +1,136 @@
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
* ChartTitle.h
|
||||||
|
*
|
||||||
|
* Written by Cédric Moonen (cedric_moonen@hotmail.com)
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* This code may be used for any non-commercial and commercial purposes in a compiled form.
|
||||||
|
* The code may be redistributed as long as it remains unmodified and providing that the
|
||||||
|
* author name and this disclaimer remain intact. The sources can be modified WITH the author
|
||||||
|
* consent only.
|
||||||
|
*
|
||||||
|
* This code is provided without any garanties. I cannot be held responsible for the damage or
|
||||||
|
* the loss of time it causes. Use it at your own risks
|
||||||
|
*
|
||||||
|
* An e-mail to notify me that you are using this code is appreciated also.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if !defined(AFX_CHARTTITLE_H__49972787_6D28_4F81_A12F_420947456913__INCLUDED_)
|
||||||
|
#define AFX_CHARTTITLE_H__49972787_6D28_4F81_A12F_420947456913__INCLUDED_
|
||||||
|
|
||||||
|
#if _MSC_VER > 1000
|
||||||
|
#pragma once
|
||||||
|
#endif // _MSC_VER > 1000
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
#include <map>
|
||||||
|
#include "ChartString.h"
|
||||||
|
#include "ChartFont.h"
|
||||||
|
|
||||||
|
class CChartCtrl;
|
||||||
|
|
||||||
|
//! This class is responsible for the titles displayed on the control.
|
||||||
|
/**
|
||||||
|
Several lines can be displayed in the title, each one possibly with
|
||||||
|
its own font. It is retrieved by calling the GetTitle() function
|
||||||
|
from the CChartCtrl class.
|
||||||
|
**/
|
||||||
|
class CChartTitle
|
||||||
|
{
|
||||||
|
friend CChartCtrl;
|
||||||
|
|
||||||
|
public:
|
||||||
|
//! Returns the number of lines in the title.
|
||||||
|
size_t GetStringCount() const;
|
||||||
|
//! Returns a specific line, specified by its index.
|
||||||
|
TChartString GetString(size_t Index) const;
|
||||||
|
//! Adds a new line to the title.
|
||||||
|
void AddString(const TChartString& NewString);
|
||||||
|
//! Removes all the lines displayed in the title.
|
||||||
|
void RemoveAll();
|
||||||
|
|
||||||
|
//! Sets the default font.
|
||||||
|
/**
|
||||||
|
@param iPointSize
|
||||||
|
The font point size.
|
||||||
|
@param strFaceName
|
||||||
|
The font face name ("Times New Roman", "Arial", ...)
|
||||||
|
**/
|
||||||
|
void SetFont(int iPointSize, const TChartString& strFaceName);
|
||||||
|
//! Sets the default font.
|
||||||
|
/**
|
||||||
|
This function allows to set extended font style by passing
|
||||||
|
a CChartFont object.
|
||||||
|
@param newFont
|
||||||
|
The new font.
|
||||||
|
**/
|
||||||
|
void SetFont(const CChartFont& newFont);
|
||||||
|
//! Sets the font for a specific line.
|
||||||
|
/**
|
||||||
|
@param iLineIndex
|
||||||
|
The index of the line to set the font.
|
||||||
|
@param iPointSize
|
||||||
|
The font point size.
|
||||||
|
@param strFaceName
|
||||||
|
The font face name ("Times New Roman", "Arial", ...)
|
||||||
|
**/
|
||||||
|
void SetLineFont(int iLineIndex, int iPointSize, const TChartString& strFaceName);
|
||||||
|
//! Sets the font for a specific line.
|
||||||
|
/**
|
||||||
|
This function allows to set extended font style by passing
|
||||||
|
a CChartFont object.
|
||||||
|
@param iLineIndex
|
||||||
|
The index of the line to set the font.
|
||||||
|
@param newFont
|
||||||
|
The new font.
|
||||||
|
**/
|
||||||
|
void SetLineFont(int iLineIndex, const CChartFont& newFont);
|
||||||
|
|
||||||
|
//! Shows/hides the title.
|
||||||
|
void SetVisible(bool bVisible) { m_bIsVisible = bVisible; }
|
||||||
|
//! Returns true if the title is visible.
|
||||||
|
bool IsVisible() const { return m_bIsVisible; }
|
||||||
|
|
||||||
|
//! Returns the text color.
|
||||||
|
COLORREF GetColor() const { return m_TextColor; }
|
||||||
|
//! Sets the text color.
|
||||||
|
void SetColor(COLORREF NewColor);
|
||||||
|
|
||||||
|
//! Returns true if a screen point is in the region of the title.
|
||||||
|
BOOL IsPointInside(const CPoint& screenPoint) const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
//! Constructor
|
||||||
|
CChartTitle(CChartCtrl* pParent);
|
||||||
|
//! Destructor
|
||||||
|
virtual ~CChartTitle();
|
||||||
|
|
||||||
|
//! Sets the rectangle in which to display the title.
|
||||||
|
void SetTitleRect(const CRect& newRect) { m_TitleRect = newRect; }
|
||||||
|
//! Returns the size of the title lines.
|
||||||
|
CSize GetSize(CDC* pDC);
|
||||||
|
//! Draw the title.
|
||||||
|
void Draw(CDC *pDC);
|
||||||
|
|
||||||
|
//! The parent charting control.
|
||||||
|
CChartCtrl* m_pParentCtrl;
|
||||||
|
//! Vector containing all strings to display.
|
||||||
|
std::vector<TChartString> m_StringArray;
|
||||||
|
//! Map containing all the fonts used for the title lines.
|
||||||
|
std::map<int, CChartFont> m_mapLineFonts;
|
||||||
|
|
||||||
|
//! Specifies if the title is visible.
|
||||||
|
bool m_bIsVisible;
|
||||||
|
//! The default font used to draw the titles.
|
||||||
|
CChartFont m_DefaultFont;
|
||||||
|
//! The text color.
|
||||||
|
COLORREF m_TextColor;
|
||||||
|
//! The rectangle in which to draw the titles.
|
||||||
|
CRect m_TitleRect;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // !defined(AFX_CHARTTITLE_H__49972787_6D28_4F81_A12F_420947456913__INCLUDED_)
|
|
@ -0,0 +1,186 @@
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
* ChartXYSerie.cpp
|
||||||
|
*
|
||||||
|
* Written by Cédric Moonen (cedric_moonen@hotmail.com)
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* This code may be used for any non-commercial and commercial purposes in a compiled form.
|
||||||
|
* The code may be redistributed as long as it remains unmodified and providing that the
|
||||||
|
* author name and this disclaimer remain intact. The sources can be modified WITH the author
|
||||||
|
* consent only.
|
||||||
|
*
|
||||||
|
* This code is provided without any garanties. I cannot be held responsible for the damage or
|
||||||
|
* the loss of time it causes. Use it at your own risks
|
||||||
|
*
|
||||||
|
* An e-mail to notify me that you are using this code is appreciated also.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "stdafx.h"
|
||||||
|
#include "ChartXYSerie.h"
|
||||||
|
|
||||||
|
CChartXYSerie::CChartXYSerie(CChartCtrl* pParent)
|
||||||
|
: CChartSerieBase<SChartXYPoint>(pParent)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
CChartXYSerie::~CChartXYSerie()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartXYSerie::AddPoint(double X, double Y)
|
||||||
|
{
|
||||||
|
SChartXYPoint newPoint(X, Y);
|
||||||
|
CChartSerieBase<SChartXYPoint>::AddPoint(newPoint);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartXYSerie::AddPoints(double* pX, double* pY, unsigned Count)
|
||||||
|
{
|
||||||
|
SChartXYPoint* pPoints = new SChartXYPoint[Count];
|
||||||
|
for (unsigned i=0; i<Count; i++)
|
||||||
|
{
|
||||||
|
pPoints[i].X = pX[i];
|
||||||
|
pPoints[i].Y = pY[i];
|
||||||
|
}
|
||||||
|
CChartSerieBase<SChartXYPoint>::AddPoints(pPoints, Count);
|
||||||
|
delete pPoints;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartXYSerie::SetPoints(double* pX, double* pY, unsigned Count)
|
||||||
|
{
|
||||||
|
SChartXYPoint* pPoints = new SChartXYPoint[Count];
|
||||||
|
for (unsigned i=0; i<Count; i++)
|
||||||
|
{
|
||||||
|
pPoints[i].X = pX[i];
|
||||||
|
pPoints[i].Y = pY[i];
|
||||||
|
}
|
||||||
|
CChartSerieBase<SChartXYPoint>::SetPoints(pPoints, Count);
|
||||||
|
delete pPoints;
|
||||||
|
}
|
||||||
|
|
||||||
|
double CChartXYSerie::GetXPointValue(unsigned PointIndex) const
|
||||||
|
{
|
||||||
|
return m_vPoints[PointIndex].GetX();
|
||||||
|
}
|
||||||
|
|
||||||
|
double CChartXYSerie::GetYPointValue(unsigned PointIndex) const
|
||||||
|
{
|
||||||
|
return m_vPoints[PointIndex].GetY();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartXYSerie::SetXPointValue(unsigned PointIndex, double NewVal)
|
||||||
|
{
|
||||||
|
m_vPoints[PointIndex].X = NewVal;
|
||||||
|
m_vPoints.ReorderPoints();
|
||||||
|
|
||||||
|
RefreshAutoAxes(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartXYSerie::SetYPointValue(unsigned PointIndex, double NewVal)
|
||||||
|
{
|
||||||
|
m_vPoints[PointIndex].Y = NewVal;
|
||||||
|
m_vPoints.ReorderPoints();
|
||||||
|
|
||||||
|
RefreshAutoAxes(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifndef NO_USER_DATA
|
||||||
|
void CChartXYSerie::SetUserData(unsigned uPointIndex, void* pData)
|
||||||
|
{
|
||||||
|
m_vPoints[uPointIndex].pUserData = pData;
|
||||||
|
}
|
||||||
|
|
||||||
|
void* CChartXYSerie::GetUserData(unsigned uPointIndex)
|
||||||
|
{
|
||||||
|
return m_vPoints[uPointIndex].pUserData;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void CChartXYSerie::GetBezierControlPoints(unsigned uFirst,
|
||||||
|
unsigned uLast,
|
||||||
|
SChartXYPoint* &pKnots,
|
||||||
|
SChartXYPoint* &pFirstControlPoints,
|
||||||
|
SChartXYPoint* &pSecondControlPoints) const
|
||||||
|
{
|
||||||
|
int Count = uLast - uFirst - 1;
|
||||||
|
if (Count < 1)
|
||||||
|
{
|
||||||
|
pFirstControlPoints = new SChartXYPoint[0];
|
||||||
|
pSecondControlPoints = new SChartXYPoint[0];
|
||||||
|
pKnots = new SChartXYPoint[0];
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
pKnots = new SChartXYPoint[uLast-uFirst];
|
||||||
|
SChartXYPoint* pPoints = m_vPoints.GetInternalBuffer();
|
||||||
|
memcpy(pKnots, pPoints+uFirst, (uLast-uFirst)*sizeof(SChartXYPoint));
|
||||||
|
|
||||||
|
// Calculate first Bezier control points
|
||||||
|
// Right hand side vector
|
||||||
|
double* rhs = new double[Count];
|
||||||
|
|
||||||
|
// Set right hand side X values
|
||||||
|
int i=0;
|
||||||
|
for (i = 1; i < Count - 1; ++i)
|
||||||
|
rhs[i] = 4 * pKnots[i].X + 2 * pKnots[i + 1].X;
|
||||||
|
rhs[0] = pKnots[0].X + 2 * pKnots[1].X;
|
||||||
|
rhs[Count - 1] = 3 * pKnots[Count - 1].X;
|
||||||
|
// Get first control points X-values
|
||||||
|
double* pFirstX = GetFirstControlPoints(rhs, Count);
|
||||||
|
|
||||||
|
// Set right hand side Y values
|
||||||
|
for (i = 1; i < Count - 1; ++i)
|
||||||
|
rhs[i] = 4 * pKnots[i].Y + 2 * pKnots[i + 1].Y;
|
||||||
|
rhs[0] = pKnots[0].Y + 2 * pKnots[1].Y;
|
||||||
|
rhs[Count - 1] = 3 * pKnots[Count - 1].Y;
|
||||||
|
// Get first control points Y-values
|
||||||
|
double* pFirstY = GetFirstControlPoints(rhs, Count);
|
||||||
|
|
||||||
|
// Fill output arrays.
|
||||||
|
pFirstControlPoints = new SChartXYPoint[Count];
|
||||||
|
pSecondControlPoints = new SChartXYPoint[Count];
|
||||||
|
for (i = 0; i < Count; ++i)
|
||||||
|
{
|
||||||
|
// First control point
|
||||||
|
pFirstControlPoints[i].X = pFirstX[i];
|
||||||
|
pFirstControlPoints[i].Y = pFirstY[i];
|
||||||
|
// Second control point
|
||||||
|
if (i < Count - 1)
|
||||||
|
{
|
||||||
|
pSecondControlPoints[i].X = 2 * pKnots[i + 1].X - pFirstX[i + 1];
|
||||||
|
pSecondControlPoints[i].Y = 2 * pKnots[i + 1].Y - pFirstY[i + 1];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pSecondControlPoints[i].X = (pKnots[Count].X + pFirstX[Count - 1]) / 2;
|
||||||
|
pSecondControlPoints[i].Y = (pKnots[Count].Y + pFirstY[Count - 1]) / 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
delete[] rhs;
|
||||||
|
delete[] pFirstX;
|
||||||
|
delete[] pFirstY;
|
||||||
|
}
|
||||||
|
|
||||||
|
double* CChartXYSerie::GetFirstControlPoints(double* rhs, int Count) const
|
||||||
|
{
|
||||||
|
double* pPoints = new double[Count]; // Solution vector.
|
||||||
|
double* pTemp = new double[Count]; // Temp workspace.
|
||||||
|
|
||||||
|
double b = 2.0;
|
||||||
|
pPoints[0] = rhs[0] / b;
|
||||||
|
int i =0;
|
||||||
|
for (i = 1; i < Count; i++) // Decomposition and forward substitution.
|
||||||
|
{
|
||||||
|
pTemp[i] = 1 / b;
|
||||||
|
b = (i < Count - 1 ? 4.0 : 2.0) - pTemp[i];
|
||||||
|
pPoints[i] = (rhs[i] - pPoints[i - 1]) / b;
|
||||||
|
}
|
||||||
|
for (i = 1; i < Count; i++)
|
||||||
|
pPoints[Count - i - 1] -= pTemp[Count - i] * pPoints[Count - i]; // Backsubstitution.
|
||||||
|
delete[] pTemp;
|
||||||
|
return pPoints;
|
||||||
|
}
|
|
@ -0,0 +1,157 @@
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
* ChartXYSerie.h
|
||||||
|
*
|
||||||
|
* Written by Cédric Moonen (cedric_moonen@hotmail.com)
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* This code may be used for any non-commercial and commercial purposes in a compiled form.
|
||||||
|
* The code may be redistributed as long as it remains unmodified and providing that the
|
||||||
|
* author name and this disclaimer remain intact. The sources can be modified WITH the author
|
||||||
|
* consent only.
|
||||||
|
*
|
||||||
|
* This code is provided without any garanties. I cannot be held responsible for the damage or
|
||||||
|
* the loss of time it causes. Use it at your own risks
|
||||||
|
*
|
||||||
|
* An e-mail to notify me that you are using this code is appreciated also.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
#include "ChartSerieBase.h"
|
||||||
|
|
||||||
|
//! Structure containing a point data with X and Y values
|
||||||
|
struct SChartXYPoint
|
||||||
|
{
|
||||||
|
SChartXYPoint() : X(0.0), Y(0.0)
|
||||||
|
{
|
||||||
|
#ifndef NO_USER_DATA
|
||||||
|
pUserData = NULL;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
SChartXYPoint(double XVal, double YVal) : X(XVal), Y(YVal)
|
||||||
|
{
|
||||||
|
#ifndef NO_USER_DATA
|
||||||
|
pUserData = NULL;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
double GetX() const { return X; }
|
||||||
|
double GetY() const { return Y; }
|
||||||
|
double GetXMin() const { return X; }
|
||||||
|
double GetXMax() const { return X; }
|
||||||
|
double GetYMin() const { return Y; }
|
||||||
|
double GetYMax() const { return Y; }
|
||||||
|
|
||||||
|
//! The point X value.
|
||||||
|
double X;
|
||||||
|
//! The point Y value.
|
||||||
|
double Y;
|
||||||
|
#ifndef NO_USER_DATA
|
||||||
|
//! Optional user data.
|
||||||
|
void *pUserData;
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
|
||||||
|
//! Specialization of a CChartSerieBase for series having data with an X and an Y value.
|
||||||
|
/**
|
||||||
|
This class is abstract and has to be implemented for specific series. It
|
||||||
|
already provides features which are common to all series with points having
|
||||||
|
an X and an Y value. Examples of such series are: point series, line series,
|
||||||
|
surface series and bar series.
|
||||||
|
**/
|
||||||
|
class CChartXYSerie : public CChartSerieBase<SChartXYPoint>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
//! Constructor
|
||||||
|
CChartXYSerie(CChartCtrl* pParent);
|
||||||
|
//! Destructor
|
||||||
|
virtual ~CChartXYSerie();
|
||||||
|
|
||||||
|
//! Adds a single data point to the series.
|
||||||
|
void AddPoint(double X, double Y);
|
||||||
|
//! Adds an array of points to the series.
|
||||||
|
/**
|
||||||
|
Points which were already present in the series are kept.
|
||||||
|
@param pX
|
||||||
|
Array of X values for the points
|
||||||
|
@param pY
|
||||||
|
Array of Y values for the points
|
||||||
|
@param Count
|
||||||
|
Size of each of both arrays (number of points to add)
|
||||||
|
**/
|
||||||
|
void AddPoints(double* pX, double* pY, unsigned Count);
|
||||||
|
//! Sets an array of points to the series.
|
||||||
|
/**
|
||||||
|
Points which were already present in the series are discarded.
|
||||||
|
@param pX
|
||||||
|
Array of X values for the points
|
||||||
|
@param pY
|
||||||
|
Array of Y values for the points
|
||||||
|
@param Count
|
||||||
|
Size of each of both arrays (number of points to add)
|
||||||
|
**/
|
||||||
|
void SetPoints(double* pX, double* pY, unsigned Count);
|
||||||
|
|
||||||
|
//! Returns the Y value of a specific point in the series.
|
||||||
|
double GetYPointValue(unsigned PointIndex) const;
|
||||||
|
//! Returns the X value of a specific point in the series.
|
||||||
|
double GetXPointValue(unsigned PointIndex) const;
|
||||||
|
//! Sets the Y value of a specific point in the series.
|
||||||
|
/**
|
||||||
|
The control is refreshed to display the change.
|
||||||
|
@param PointIndex
|
||||||
|
The index of the points to change the Y value
|
||||||
|
@param NewVal
|
||||||
|
The new Y value of the point
|
||||||
|
**/
|
||||||
|
void SetYPointValue(unsigned PointIndex, double NewVal);
|
||||||
|
//! Sets the X value of a specific point in the series.
|
||||||
|
/**
|
||||||
|
The control is refreshed to display the change.
|
||||||
|
@param PointIndex
|
||||||
|
The index of the points to change the Y value
|
||||||
|
@param NewVal
|
||||||
|
The new X value of the point
|
||||||
|
**/
|
||||||
|
void SetXPointValue(unsigned PointIndex, double NewVal);
|
||||||
|
|
||||||
|
#ifndef NO_USER_DATA
|
||||||
|
//! Sets user data for a specific point.
|
||||||
|
/**
|
||||||
|
User data can be disabled by adding the flag NO_USER_DATA in the preprocessor
|
||||||
|
definitions. This is usefull when you don't want to have an additional pointer
|
||||||
|
stored for each points in your series.
|
||||||
|
**/
|
||||||
|
void SetUserData(unsigned uPointIndex, void* pData);
|
||||||
|
//! Retrieves user data for a specific point.
|
||||||
|
/**
|
||||||
|
User data can be disabled by adding the flag NO_USER_DATA in the preprocessor
|
||||||
|
definitions. This is usefull when you don't want to have an additional pointer
|
||||||
|
stored for each points in your series.
|
||||||
|
**/
|
||||||
|
void* GetUserData(unsigned uPointIndex);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
protected:
|
||||||
|
//! Retrieves the control points of a bezier curve fitting the points stored in the array.
|
||||||
|
/**
|
||||||
|
@param uFirst
|
||||||
|
The index of the first point of the bezier curve
|
||||||
|
@param uLast
|
||||||
|
The index of the last point of the bezier curve
|
||||||
|
@param pKnots
|
||||||
|
This parameter will store the points data
|
||||||
|
@param pFirstControlPoints
|
||||||
|
This parameter will store the primary control points of the bezier curve
|
||||||
|
@param pSecondControlPoints
|
||||||
|
This parameter will store the secondary control points of the bezier curve
|
||||||
|
**/
|
||||||
|
void GetBezierControlPoints(unsigned uFirst, unsigned uLast, SChartXYPoint* &pKnots,
|
||||||
|
SChartXYPoint* &pFirstControlPoints, SChartXYPoint* &pSecondControlPoints) const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
double* GetFirstControlPoints(double* rhs, int Count) const;
|
||||||
|
};
|
|
@ -0,0 +1,33 @@
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
* PointOrdering.h
|
||||||
|
*
|
||||||
|
* Written by Cédric Moonen (cedric_moonen@hotmail.com)
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* This code may be used for any non-commercial and commercial purposes in a compiled form.
|
||||||
|
* The code may be redistributed as long as it remains unmodified and providing that the
|
||||||
|
* author name and this disclaimer remain intact. The sources can be modified WITH the author
|
||||||
|
* consent only.
|
||||||
|
*
|
||||||
|
* This code is provided without any garanties. I cannot be held responsible for the damage or
|
||||||
|
* the loss of time it causes. Use it at your own risks
|
||||||
|
*
|
||||||
|
* An e-mail to notify me that you are using this code is appreciated also.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
//! Enumeration listing the types of ordering.
|
||||||
|
enum PointsOrdering
|
||||||
|
{
|
||||||
|
//! The points are not ordered
|
||||||
|
poNoOrdering,
|
||||||
|
//! The points are ordered by their X values
|
||||||
|
poXOrdering,
|
||||||
|
//! The points are ordered by their Y values
|
||||||
|
poYOrdering
|
||||||
|
};
|
|
@ -0,0 +1,76 @@
|
||||||
|
// ChartDemo.cpp : Defines the class behaviors for the application.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "stdafx.h"
|
||||||
|
#include "ChartDemo.h"
|
||||||
|
#include "ChartDemoDlg.h"
|
||||||
|
|
||||||
|
#ifdef _DEBUG
|
||||||
|
#define new DEBUG_NEW
|
||||||
|
#undef THIS_FILE
|
||||||
|
static char THIS_FILE[] = __FILE__;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CChartDemoApp
|
||||||
|
|
||||||
|
BEGIN_MESSAGE_MAP(CChartDemoApp, CWinApp)
|
||||||
|
//{{AFX_MSG_MAP(CChartDemoApp)
|
||||||
|
// NOTE - the ClassWizard will add and remove mapping macros here.
|
||||||
|
// DO NOT EDIT what you see in these blocks of generated code!
|
||||||
|
//}}AFX_MSG
|
||||||
|
ON_COMMAND(ID_HELP, CWinApp::OnHelp)
|
||||||
|
END_MESSAGE_MAP()
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CChartDemoApp construction
|
||||||
|
|
||||||
|
CChartDemoApp::CChartDemoApp()
|
||||||
|
{
|
||||||
|
// Place all significant initialization in InitInstance
|
||||||
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// The one and only CChartDemoApp object
|
||||||
|
|
||||||
|
CChartDemoApp theApp;
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CChartDemoApp initialization
|
||||||
|
|
||||||
|
BOOL CChartDemoApp::InitInstance()
|
||||||
|
{
|
||||||
|
AfxEnableControlContainer();
|
||||||
|
|
||||||
|
// Standard initialization
|
||||||
|
// If you are not using these features and wish to reduce the size
|
||||||
|
// of your final executable, you should remove from the following
|
||||||
|
// the specific initialization routines you do not need.
|
||||||
|
|
||||||
|
#if _MFC_VER < 0x0700
|
||||||
|
#ifdef _AFXDLL
|
||||||
|
Enable3dControls(); // Call this when using MFC in a shared DLL
|
||||||
|
#else
|
||||||
|
Enable3dControlsStatic(); // Call this when linking to MFC statically
|
||||||
|
#endif
|
||||||
|
#else
|
||||||
|
InitCommonControls();
|
||||||
|
CWinApp::InitInstance();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
CChartDemoDlg dlg;
|
||||||
|
m_pMainWnd = &dlg;
|
||||||
|
INT_PTR nResponse = dlg.DoModal();
|
||||||
|
if (nResponse == IDOK)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
else if (nResponse == IDCANCEL)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Since the dialog has been closed, return FALSE so that we exit the
|
||||||
|
// application, rather than start the application's message pump.
|
||||||
|
return FALSE;
|
||||||
|
}
|
|
@ -0,0 +1,440 @@
|
||||||
|
# Microsoft Developer Studio Project File - Name="ChartDemo" - Package Owner=<4>
|
||||||
|
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||||
|
# ** DO NOT EDIT **
|
||||||
|
|
||||||
|
# TARGTYPE "Win32 (x86) Application" 0x0101
|
||||||
|
|
||||||
|
CFG=ChartDemo - Win32 Debug
|
||||||
|
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||||
|
!MESSAGE use the Export Makefile command and run
|
||||||
|
!MESSAGE
|
||||||
|
!MESSAGE NMAKE /f "ChartDemo.mak".
|
||||||
|
!MESSAGE
|
||||||
|
!MESSAGE You can specify a configuration when running NMAKE
|
||||||
|
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||||
|
!MESSAGE
|
||||||
|
!MESSAGE NMAKE /f "ChartDemo.mak" CFG="ChartDemo - Win32 Debug"
|
||||||
|
!MESSAGE
|
||||||
|
!MESSAGE Possible choices for configuration are:
|
||||||
|
!MESSAGE
|
||||||
|
!MESSAGE "ChartDemo - Win32 Release" (based on "Win32 (x86) Application")
|
||||||
|
!MESSAGE "ChartDemo - Win32 Debug" (based on "Win32 (x86) Application")
|
||||||
|
!MESSAGE
|
||||||
|
|
||||||
|
# Begin Project
|
||||||
|
# PROP AllowPerConfigDependencies 0
|
||||||
|
# PROP Scc_ProjName ""
|
||||||
|
# PROP Scc_LocalPath ""
|
||||||
|
CPP=cl.exe
|
||||||
|
MTL=midl.exe
|
||||||
|
RSC=rc.exe
|
||||||
|
|
||||||
|
!IF "$(CFG)" == "ChartDemo - Win32 Release"
|
||||||
|
|
||||||
|
# PROP BASE Use_MFC 6
|
||||||
|
# PROP BASE Use_Debug_Libraries 0
|
||||||
|
# PROP BASE Output_Dir "Release"
|
||||||
|
# PROP BASE Intermediate_Dir "Release"
|
||||||
|
# PROP BASE Target_Dir ""
|
||||||
|
# PROP Use_MFC 6
|
||||||
|
# PROP Use_Debug_Libraries 0
|
||||||
|
# PROP Output_Dir "Release"
|
||||||
|
# PROP Intermediate_Dir "Release"
|
||||||
|
# PROP Target_Dir ""
|
||||||
|
# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /Yu"stdafx.h" /FD /c
|
||||||
|
# ADD CPP /nologo /MD /W3 /GR /GX /O2 /I "ChartCtrl" /I "ColourPicker" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /Yu"stdafx.h" /FD /c
|
||||||
|
# SUBTRACT CPP /Fr
|
||||||
|
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||||
|
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||||
|
# ADD BASE RSC /l 0x40c /d "NDEBUG" /d "_AFXDLL"
|
||||||
|
# ADD RSC /l 0x40c /d "NDEBUG" /d "_AFXDLL"
|
||||||
|
BSC32=bscmake.exe
|
||||||
|
# ADD BASE BSC32 /nologo
|
||||||
|
# ADD BSC32 /nologo
|
||||||
|
LINK32=link.exe
|
||||||
|
# ADD BASE LINK32 /nologo /subsystem:windows /machine:I386
|
||||||
|
# ADD LINK32 /nologo /subsystem:windows /machine:I386
|
||||||
|
|
||||||
|
!ELSEIF "$(CFG)" == "ChartDemo - Win32 Debug"
|
||||||
|
|
||||||
|
# PROP BASE Use_MFC 6
|
||||||
|
# PROP BASE Use_Debug_Libraries 1
|
||||||
|
# PROP BASE Output_Dir "Debug"
|
||||||
|
# PROP BASE Intermediate_Dir "Debug"
|
||||||
|
# PROP BASE Target_Dir ""
|
||||||
|
# PROP Use_MFC 6
|
||||||
|
# PROP Use_Debug_Libraries 1
|
||||||
|
# PROP Output_Dir "Debug"
|
||||||
|
# PROP Intermediate_Dir "Debug"
|
||||||
|
# PROP Ignore_Export_Lib 0
|
||||||
|
# PROP Target_Dir ""
|
||||||
|
# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /Yu"stdafx.h" /FD /GZ /c
|
||||||
|
# ADD CPP /nologo /MDd /W3 /Gm /GR /GX /ZI /Od /I "ChartCtrl" /I "ColourPicker" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /FR /Yu"stdafx.h" /FD /GZ /c
|
||||||
|
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||||
|
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||||
|
# ADD BASE RSC /l 0x40c /d "_DEBUG" /d "_AFXDLL"
|
||||||
|
# ADD RSC /l 0x40c /d "_DEBUG" /d "_AFXDLL"
|
||||||
|
BSC32=bscmake.exe
|
||||||
|
# ADD BASE BSC32 /nologo
|
||||||
|
# ADD BSC32 /nologo
|
||||||
|
LINK32=link.exe
|
||||||
|
# ADD BASE LINK32 /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
|
||||||
|
# ADD LINK32 /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
|
||||||
|
|
||||||
|
!ENDIF
|
||||||
|
|
||||||
|
# Begin Target
|
||||||
|
|
||||||
|
# Name "ChartDemo - Win32 Release"
|
||||||
|
# Name "ChartDemo - Win32 Debug"
|
||||||
|
# Begin Group "Source Files"
|
||||||
|
|
||||||
|
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat;h;hpp;hxx;hm;inl"
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\ChartDemo.cpp
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\ChartDemoDlg.cpp
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\ChartSurfaceSerie.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\LinePropDialog.cpp
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\LinePropDialog.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\PointsPropDialog.cpp
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\PointsPropDialog.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\SeriesPropDlg.cpp
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\StdAfx.cpp
|
||||||
|
# ADD CPP /Yc"stdafx.h"
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\SurfacePropDialog.cpp
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\SurfacePropDialog.h
|
||||||
|
# End Source File
|
||||||
|
# End Group
|
||||||
|
# Begin Group "Resource Files"
|
||||||
|
|
||||||
|
# PROP Default_Filter "rc2;rct;bin"
|
||||||
|
# Begin Group "Files"
|
||||||
|
|
||||||
|
# PROP Default_Filter "ico;cur;bmp;dlg;rgs;gif;jpg;jpeg;jpe"
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\res\ChartDemo.ico
|
||||||
|
# End Source File
|
||||||
|
# End Group
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\ChartDemo.rc
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\res\ChartDemo.rc2
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\Resource.h
|
||||||
|
# End Source File
|
||||||
|
# End Group
|
||||||
|
# Begin Group "Header Files"
|
||||||
|
|
||||||
|
# PROP Default_Filter ""
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\ChartDemo.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\ChartDemoDlg.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\SeriesPropDlg.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\StdAfx.h
|
||||||
|
# End Source File
|
||||||
|
# End Group
|
||||||
|
# Begin Group "ChartCtrl"
|
||||||
|
|
||||||
|
# PROP Default_Filter ""
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\ChartCtrl\ChartAxis.cpp
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\ChartCtrl\ChartAxis.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\ChartCtrl\ChartAxisLabel.cpp
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\ChartCtrl\ChartAxisLabel.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\ChartCtrl\ChartBalloonLabel.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\ChartCtrl\ChartBalloonLabel.inl
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\ChartCtrl\ChartBarSerie.cpp
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\ChartCtrl\ChartBarSerie.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\ChartCtrl\ChartCandlestickSerie.cpp
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\ChartCtrl\ChartCandlestickSerie.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\ChartCtrl\ChartCrossHairCursor.cpp
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\ChartCtrl\ChartCrossHairCursor.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\ChartCtrl\ChartCtrl.cpp
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\ChartCtrl\ChartCtrl.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\ChartCtrl\ChartCursor.cpp
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\ChartCtrl\ChartCursor.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\ChartCtrl\ChartDateTimeAxis.cpp
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\ChartCtrl\ChartDateTimeAxis.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\ChartCtrl\ChartDragLineCursor.cpp
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\ChartCtrl\ChartDragLineCursor.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\ChartCtrl\ChartFont.cpp
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\ChartCtrl\ChartFont.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\ChartCtrl\ChartGanttSerie.cpp
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\ChartCtrl\ChartGanttSerie.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\ChartCtrl\ChartGradient.cpp
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\ChartCtrl\ChartGradient.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\ChartCtrl\ChartGrid.cpp
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\ChartCtrl\ChartGrid.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\ChartCtrl\ChartLabel.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\ChartCtrl\ChartLabel.inl
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\ChartCtrl\ChartLegend.cpp
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\ChartCtrl\ChartLegend.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\ChartCtrl\ChartLineSerie.cpp
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\ChartCtrl\ChartLineSerie.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\ChartCtrl\ChartLogarithmicAxis.cpp
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\ChartCtrl\ChartLogarithmicAxis.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\ChartCtrl\ChartMouseListener.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\ChartCtrl\ChartPointsArray.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\ChartCtrl\ChartPointsArray.inl
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\ChartCtrl\ChartPointsSerie.cpp
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\ChartCtrl\ChartPointsSerie.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\ChartCtrl\ChartScrollBar.cpp
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\ChartCtrl\ChartScrollBar.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\ChartCtrl\ChartSerie.cpp
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\ChartCtrl\ChartSerie.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\ChartCtrl\ChartSerieBase.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\ChartCtrl\ChartSerieBase.inl
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\ChartCtrl\ChartSeriesMouseListener.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\ChartCtrl\ChartStandardAxis.cpp
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\ChartCtrl\ChartStandardAxis.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\ChartCtrl\ChartString.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\ChartCtrl\ChartSurfaceSerie.cpp
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\ChartCtrl\ChartSurfaceSerie.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\ChartCtrl\ChartTitle.cpp
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\ChartCtrl\ChartTitle.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\ChartCtrl\ChartXYSerie.cpp
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\ChartCtrl\ChartXYSerie.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\ChartCtrl\PointsOrdering.h
|
||||||
|
# End Source File
|
||||||
|
# End Group
|
||||||
|
# Begin Group "ColourCtrl"
|
||||||
|
|
||||||
|
# PROP Default_Filter ""
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\ColourPicker\ColourPicker.cpp
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\ColourPicker\ColourPicker.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\ColourPicker\ColourPopup.cpp
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\ColourPicker\ColourPopup.h
|
||||||
|
# End Source File
|
||||||
|
# End Group
|
||||||
|
# End Target
|
||||||
|
# End Project
|
|
@ -0,0 +1,29 @@
|
||||||
|
Microsoft Developer Studio Workspace File, Format Version 6.00
|
||||||
|
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
Project: "ChartDemo"=".\ChartDemo.dsp" - Package Owner=<4>
|
||||||
|
|
||||||
|
Package=<5>
|
||||||
|
{{{
|
||||||
|
}}}
|
||||||
|
|
||||||
|
Package=<4>
|
||||||
|
{{{
|
||||||
|
}}}
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
Global:
|
||||||
|
|
||||||
|
Package=<5>
|
||||||
|
{{{
|
||||||
|
}}}
|
||||||
|
|
||||||
|
Package=<3>
|
||||||
|
{{{
|
||||||
|
}}}
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
|
|
@ -0,0 +1,49 @@
|
||||||
|
// ChartDemo.h : main header file for the CHARTDEMO application
|
||||||
|
//
|
||||||
|
|
||||||
|
#if !defined(AFX_CHARTDEMO_H__B7735086_C0AE_4EB2_91AF_2AA128DA4EBD__INCLUDED_)
|
||||||
|
#define AFX_CHARTDEMO_H__B7735086_C0AE_4EB2_91AF_2AA128DA4EBD__INCLUDED_
|
||||||
|
|
||||||
|
#if _MSC_VER > 1000
|
||||||
|
#pragma once
|
||||||
|
#endif // _MSC_VER > 1000
|
||||||
|
|
||||||
|
#ifndef __AFXWIN_H__
|
||||||
|
#error include 'stdafx.h' before including this file for PCH
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "resource.h" // main symbols
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CChartDemoApp:
|
||||||
|
// See ChartDemo.cpp for the implementation of this class
|
||||||
|
//
|
||||||
|
|
||||||
|
class CChartDemoApp : public CWinApp
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CChartDemoApp();
|
||||||
|
|
||||||
|
// Overrides
|
||||||
|
// ClassWizard generated virtual function overrides
|
||||||
|
//{{AFX_VIRTUAL(CChartDemoApp)
|
||||||
|
public:
|
||||||
|
virtual BOOL InitInstance();
|
||||||
|
//}}AFX_VIRTUAL
|
||||||
|
|
||||||
|
// Implementation
|
||||||
|
|
||||||
|
//{{AFX_MSG(CChartDemoApp)
|
||||||
|
// NOTE - the ClassWizard will add and remove member functions here.
|
||||||
|
// DO NOT EDIT what you see in these blocks of generated code !
|
||||||
|
//}}AFX_MSG
|
||||||
|
DECLARE_MESSAGE_MAP()
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
//{{AFX_INSERT_LOCATION}}
|
||||||
|
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
|
||||||
|
|
||||||
|
#endif // !defined(AFX_CHARTDEMO_H__B7735086_C0AE_4EB2_91AF_2AA128DA4EBD__INCLUDED_)
|
|
@ -0,0 +1,454 @@
|
||||||
|
//Microsoft Developer Studio generated resource script.
|
||||||
|
//
|
||||||
|
#include "resource.h"
|
||||||
|
|
||||||
|
#define APSTUDIO_READONLY_SYMBOLS
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Generated from the TEXTINCLUDE 2 resource.
|
||||||
|
//
|
||||||
|
#include "afxres.h"
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
#undef APSTUDIO_READONLY_SYMBOLS
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Chinese (P.R.C.) resources
|
||||||
|
|
||||||
|
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_CHS)
|
||||||
|
#ifdef _WIN32
|
||||||
|
LANGUAGE LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED
|
||||||
|
#pragma code_page(936)
|
||||||
|
#endif //_WIN32
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Dialog
|
||||||
|
//
|
||||||
|
|
||||||
|
IDD_ABOUTBOX DIALOG DISCARDABLE 0, 0, 235, 55
|
||||||
|
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||||
|
CAPTION "A propos de ChartDemo"
|
||||||
|
FONT 8, "MS Sans Serif"
|
||||||
|
BEGIN
|
||||||
|
ICON IDR_MAINFRAME,IDC_STATIC,11,17,20,20
|
||||||
|
LTEXT "ChartDemo version 1.0",IDC_STATIC,40,10,119,8,
|
||||||
|
SS_NOPREFIX
|
||||||
|
LTEXT "Copyright (C) 2006",IDC_STATIC,40,25,119,8
|
||||||
|
DEFPUSHBUTTON "OK",IDOK,178,7,50,14,WS_GROUP
|
||||||
|
END
|
||||||
|
|
||||||
|
IDD_CHARTDEMO_DIALOG DIALOGEX 0, 0, 449, 543
|
||||||
|
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
|
||||||
|
EXSTYLE WS_EX_APPWINDOW
|
||||||
|
CAPTION "ChartDemo"
|
||||||
|
FONT 8, "MS Sans Serif"
|
||||||
|
BEGIN
|
||||||
|
CONTROL "",IDC_CHARTCTRL,"ChartCtrl",WS_CLIPCHILDREN |
|
||||||
|
WS_TABSTOP,7,7,432,369
|
||||||
|
GROUPBOX "Series",IDC_SERIES_GROUP,7,380,101,148
|
||||||
|
LISTBOX IDC_SERIES_LIST,17,394,74,98,LBS_NOINTEGRALHEIGHT |
|
||||||
|
WS_VSCROLL | WS_TABSTOP
|
||||||
|
PUSHBUTTON "Add",IDC_ADDSERIES,17,500,37,14
|
||||||
|
PUSHBUTTON "Delete",IDC_DELETESERIES,55,500,37,14
|
||||||
|
GROUPBOX "General",IDC_GENERAL_GROUP,115,380,132,148
|
||||||
|
LTEXT "Bkgnd color:",IDC_STATIC,123,397,41,8
|
||||||
|
PUSHBUTTON "",IDC_BKGND_COLBTN,173,395,30,12
|
||||||
|
CONTROL "Legend visible",IDC_LEGENDVIS_CHECK,"Button",
|
||||||
|
BS_AUTOCHECKBOX | WS_TABSTOP,123,420,74,10
|
||||||
|
LTEXT "Title:",IDC_STATIC,155,463,27,8
|
||||||
|
EDITTEXT IDC_TITLE_EDIT,124,475,83,39,ES_CENTER | ES_MULTILINE |
|
||||||
|
ES_AUTOHSCROLL | ES_WANTRETURN
|
||||||
|
GROUPBOX "Axis",IDC_AXIS_GROUP,262,380,180,148
|
||||||
|
CONTROL "Left",IDC_LEFTAXIS_RADIO,"Button",BS_AUTORADIOBUTTON,
|
||||||
|
269,390,28,10
|
||||||
|
CONTROL "Bottom",IDC_BOTTOMAXIS_RADIO,"Button",
|
||||||
|
BS_AUTORADIOBUTTON,308,390,38,10
|
||||||
|
CONTROL "Right",IDC_RIGHTAXIS_RADIO,"Button",BS_AUTORADIOBUTTON,
|
||||||
|
357,390,33,10
|
||||||
|
CONTROL "Top",IDC_TOPAXIS_RADIO,"Button",BS_AUTORADIOBUTTON,401,
|
||||||
|
390,29,10
|
||||||
|
CONTROL "Visible",IDC_AXISVISIBLE_CHECK,"Button",BS_AUTOCHECKBOX |
|
||||||
|
WS_TABSTOP,269,421,36,10
|
||||||
|
CONTROL "Inverted",IDC_AXISINVERTED_CHECK,"Button",
|
||||||
|
BS_AUTOCHECKBOX | WS_TABSTOP,320,421,50,10
|
||||||
|
CONTROL "Automatic",IDC_AXISAUTOMATIC_CHECK,"Button",
|
||||||
|
BS_AUTOCHECKBOX | WS_TABSTOP,377,421,53,10
|
||||||
|
CONTROL "Grid",IDC_AXISGRIDVIS_CHECK,"Button",BS_AUTOCHECKBOX |
|
||||||
|
WS_TABSTOP,269,441,29,10
|
||||||
|
LTEXT "Axis min value:",IDC_AXISMINVAL_STATIC,280,462,63,8
|
||||||
|
EDITTEXT IDC_AXISMINVAL_EDIT,355,460,40,14,ES_AUTOHSCROLL
|
||||||
|
LTEXT "Axis max value:",IDC_AXISMAXVAL_STATIC,278,481,63,8
|
||||||
|
EDITTEXT IDC_AXISMAXVAL_EDIT,355,478,40,14,ES_AUTOHSCROLL
|
||||||
|
LTEXT "Label:",IDC_STATIC,286,502,25,8
|
||||||
|
EDITTEXT IDC_AXISLABEL_EDIT,319,499,76,14,ES_AUTOHSCROLL
|
||||||
|
CONTROL "Pan",IDC_PAN_CHECK,"Button",BS_AUTOCHECKBOX |
|
||||||
|
WS_TABSTOP,123,441,29,10
|
||||||
|
CONTROL "Zoom",IDC_ZOOM_CHECK,"Button",BS_AUTOCHECKBOX |
|
||||||
|
WS_TABSTOP,166,441,34,10
|
||||||
|
CONTROL "ScrollBar",IDC_AXISSCROLLBAR_CHECK,"Button",
|
||||||
|
BS_AUTOCHECKBOX | WS_TABSTOP,320,441,44,10
|
||||||
|
END
|
||||||
|
|
||||||
|
IDD_SERIESPROP_DLG DIALOG DISCARDABLE 0, 0, 449, 279
|
||||||
|
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||||
|
CAPTION "Series properties"
|
||||||
|
FONT 8, "MS Sans Serif"
|
||||||
|
BEGIN
|
||||||
|
GROUPBOX "Series properties",IDC_STATIC,7,7,435,82
|
||||||
|
LTEXT "Series type:",IDC_STATIC,45,25,66,8
|
||||||
|
COMBOBOX IDC_SERIESTYPE_COMBO,123,23,62,54,CBS_DROPDOWNLIST |
|
||||||
|
WS_VSCROLL | WS_TABSTOP
|
||||||
|
LTEXT "Series name:",IDC_STATIC,237,25,92,8
|
||||||
|
EDITTEXT IDC_SERIESNAME_EDIT,341,22,63,14,ES_AUTOHSCROLL
|
||||||
|
LTEXT "Series colour:",IDC_STATIC,45,58,66,8
|
||||||
|
PUSHBUTTON "",IDC_SERIESCOLOUR_BTN,123,55,38,14
|
||||||
|
LTEXT "Associated vert axis:",IDC_STATIC,237,50,92,8
|
||||||
|
COMBOBOX IDC_VERTICALAXIS_COMBO,341,48,48,49,CBS_DROPDOWNLIST |
|
||||||
|
WS_VSCROLL | WS_TABSTOP
|
||||||
|
LTEXT "Associated horiz axis:",IDC_STATIC,237,67,92,8
|
||||||
|
COMBOBOX IDC_HORIZONTALAXIS_COMBO,341,65,48,51,CBS_DROPDOWNLIST |
|
||||||
|
WS_VSCROLL | WS_TABSTOP
|
||||||
|
GROUPBOX "Series Data",IDC_STATIC,7,102,435,139
|
||||||
|
CONTROL "Line 一元一次方程",IDC_LINEDATA_RADIO,"Button",
|
||||||
|
BS_AUTORADIOBUTTON,50,119,88,10
|
||||||
|
CONTROL "Sine wave 正弦曲线",IDC_SINEDATA_RADIO,"Button",
|
||||||
|
BS_AUTORADIOBUTTON,191,117,92,10
|
||||||
|
CONTROL "Random data",IDC_RANDOMDATA_RADIO,"Button",
|
||||||
|
BS_AUTORADIOBUTTON,340,119,59,10
|
||||||
|
RTEXT "Line Slope 斜率:",IDC_DATAPARAM1_TEXT,41,168,97,8
|
||||||
|
EDITTEXT IDC_DATAPARAM1_EDIT,157,163,40,14,ES_AUTOHSCROLL
|
||||||
|
RTEXT "Line Offset 偏移量:",IDC_DATAPARAM2_TEXT,232,168,107,8
|
||||||
|
EDITTEXT IDC_DATAPARAM2_EDIT,351,165,40,14,ES_AUTOHSCROLL
|
||||||
|
LTEXT "Number of points 点数量:",IDC_STATIC,41,205,97,8
|
||||||
|
EDITTEXT IDC_POINTSNUMBER_EDIT,157,201,40,14,ES_AUTOHSCROLL |
|
||||||
|
ES_NUMBER
|
||||||
|
LTEXT "Minimum X value X的最小值:",IDC_STATIC,232,194,107,8
|
||||||
|
EDITTEXT IDC_MINXVALUE_EDIT,351,191,29,14,ES_AUTOHSCROLL
|
||||||
|
LTEXT "Maximum X value X的最大值:",IDC_STATIC,232,215,107,8
|
||||||
|
EDITTEXT IDC_MAXXVALUE_EDIT,351,212,29,14,ES_AUTOHSCROLL
|
||||||
|
DEFPUSHBUTTON "OK",IDOK,7,258,50,14
|
||||||
|
PUSHBUTTON "Cancel",IDCANCEL,392,258,50,14
|
||||||
|
END
|
||||||
|
|
||||||
|
IDD_LINEPROP_DLG DIALOG DISCARDABLE 0, 0, 216, 96
|
||||||
|
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||||
|
CAPTION "Line series properties"
|
||||||
|
FONT 8, "MS Sans Serif"
|
||||||
|
BEGIN
|
||||||
|
DEFPUSHBUTTON "OK",IDOK,82,75,50,14
|
||||||
|
COMBOBOX IDC_PENSTYLE_COMBO,105,17,79,61,CBS_DROPDOWNLIST |
|
||||||
|
WS_VSCROLL | WS_TABSTOP
|
||||||
|
LTEXT "Pen style:",IDC_STATIC,35,19,53,8
|
||||||
|
LTEXT "Line width:",IDC_STATIC,35,41,53,8
|
||||||
|
EDITTEXT IDC_LINEWIDTH_EDIT,105,38,40,14,ES_AUTOHSCROLL
|
||||||
|
END
|
||||||
|
|
||||||
|
IDD_SURFACEPROP_DLG DIALOG DISCARDABLE 0, 0, 267, 98
|
||||||
|
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||||
|
CAPTION "Surface series properties"
|
||||||
|
FONT 8, "MS Sans Serif"
|
||||||
|
BEGIN
|
||||||
|
DEFPUSHBUTTON "OK",IDOK,108,77,50,14
|
||||||
|
LTEXT "Fill style:",IDC_STATIC,39,20,69,8
|
||||||
|
CONTROL "Horizontal surface",IDC_HORIZONTAL_RADIO,"Button",
|
||||||
|
BS_AUTORADIOBUTTON | WS_GROUP,30,46,92,10
|
||||||
|
CONTROL "Vertical surface",IDC_RADIO2,"Button",
|
||||||
|
BS_AUTORADIOBUTTON,144,46,92,10
|
||||||
|
COMBOBOX IDC_FILLSTYLE_COMBO,134,17,93,78,CBS_DROPDOWNLIST |
|
||||||
|
WS_VSCROLL | WS_TABSTOP
|
||||||
|
END
|
||||||
|
|
||||||
|
IDD_POINTPROP_DLG DIALOG DISCARDABLE 0, 0, 235, 101
|
||||||
|
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||||
|
CAPTION "Points series properties"
|
||||||
|
FONT 8, "MS Sans Serif"
|
||||||
|
BEGIN
|
||||||
|
DEFPUSHBUTTON "OK",IDOK,92,80,50,14
|
||||||
|
LTEXT "Point type:",IDC_STATIC,34,16,53,8
|
||||||
|
LTEXT "Point width:",IDC_STATIC,34,36,53,8
|
||||||
|
LTEXT "Point height:",IDC_STATIC,34,56,53,8
|
||||||
|
COMBOBOX IDC_POINTTYPE_COMBO,113,14,88,66,CBS_DROPDOWNLIST |
|
||||||
|
WS_VSCROLL | WS_TABSTOP
|
||||||
|
EDITTEXT IDC_POINTWIDTH_EDIT,113,33,40,14,ES_AUTOHSCROLL |
|
||||||
|
ES_NUMBER
|
||||||
|
EDITTEXT IDC_POINTHEIGHT_EDIT,113,53,40,14,ES_AUTOHSCROLL |
|
||||||
|
ES_NUMBER
|
||||||
|
END
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef _MAC
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Version
|
||||||
|
//
|
||||||
|
|
||||||
|
VS_VERSION_INFO VERSIONINFO
|
||||||
|
FILEVERSION 1,0,0,1
|
||||||
|
PRODUCTVERSION 1,0,0,1
|
||||||
|
FILEFLAGSMASK 0x3fL
|
||||||
|
#ifdef _DEBUG
|
||||||
|
FILEFLAGS 0x1L
|
||||||
|
#else
|
||||||
|
FILEFLAGS 0x0L
|
||||||
|
#endif
|
||||||
|
FILEOS 0x4L
|
||||||
|
FILETYPE 0x1L
|
||||||
|
FILESUBTYPE 0x0L
|
||||||
|
BEGIN
|
||||||
|
BLOCK "StringFileInfo"
|
||||||
|
BEGIN
|
||||||
|
BLOCK "040c04b0"
|
||||||
|
BEGIN
|
||||||
|
VALUE "Comments", "\0"
|
||||||
|
VALUE "CompanyName", "\0"
|
||||||
|
VALUE "FileDescription", "Application MFC ChartDemo\0"
|
||||||
|
VALUE "FileVersion", "1, 0, 0, 1\0"
|
||||||
|
VALUE "InternalName", "ChartDemo\0"
|
||||||
|
VALUE "LegalCopyright", "Copyright (C) 2006\0"
|
||||||
|
VALUE "LegalTrademarks", "\0"
|
||||||
|
VALUE "OriginalFilename", "ChartDemo.EXE\0"
|
||||||
|
VALUE "PrivateBuild", "\0"
|
||||||
|
VALUE "ProductName", "Application ChartDemo\0"
|
||||||
|
VALUE "ProductVersion", "1, 0, 0, 1\0"
|
||||||
|
VALUE "SpecialBuild", "\0"
|
||||||
|
END
|
||||||
|
END
|
||||||
|
BLOCK "VarFileInfo"
|
||||||
|
BEGIN
|
||||||
|
VALUE "Translation", 0x40c, 1200
|
||||||
|
END
|
||||||
|
END
|
||||||
|
|
||||||
|
#endif // !_MAC
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// DESIGNINFO
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifdef APSTUDIO_INVOKED
|
||||||
|
GUIDELINES DESIGNINFO DISCARDABLE
|
||||||
|
BEGIN
|
||||||
|
IDD_ABOUTBOX, DIALOG
|
||||||
|
BEGIN
|
||||||
|
LEFTMARGIN, 7
|
||||||
|
RIGHTMARGIN, 228
|
||||||
|
TOPMARGIN, 7
|
||||||
|
BOTTOMMARGIN, 48
|
||||||
|
END
|
||||||
|
|
||||||
|
IDD_CHARTDEMO_DIALOG, DIALOG
|
||||||
|
BEGIN
|
||||||
|
LEFTMARGIN, 7
|
||||||
|
RIGHTMARGIN, 442
|
||||||
|
TOPMARGIN, 7
|
||||||
|
BOTTOMMARGIN, 536
|
||||||
|
END
|
||||||
|
|
||||||
|
IDD_SERIESPROP_DLG, DIALOG
|
||||||
|
BEGIN
|
||||||
|
LEFTMARGIN, 7
|
||||||
|
RIGHTMARGIN, 442
|
||||||
|
TOPMARGIN, 7
|
||||||
|
BOTTOMMARGIN, 272
|
||||||
|
END
|
||||||
|
|
||||||
|
IDD_LINEPROP_DLG, DIALOG
|
||||||
|
BEGIN
|
||||||
|
LEFTMARGIN, 7
|
||||||
|
RIGHTMARGIN, 209
|
||||||
|
TOPMARGIN, 7
|
||||||
|
BOTTOMMARGIN, 89
|
||||||
|
END
|
||||||
|
|
||||||
|
IDD_SURFACEPROP_DLG, DIALOG
|
||||||
|
BEGIN
|
||||||
|
LEFTMARGIN, 7
|
||||||
|
RIGHTMARGIN, 260
|
||||||
|
TOPMARGIN, 7
|
||||||
|
BOTTOMMARGIN, 91
|
||||||
|
END
|
||||||
|
|
||||||
|
IDD_POINTPROP_DLG, DIALOG
|
||||||
|
BEGIN
|
||||||
|
LEFTMARGIN, 7
|
||||||
|
RIGHTMARGIN, 228
|
||||||
|
TOPMARGIN, 7
|
||||||
|
BOTTOMMARGIN, 94
|
||||||
|
END
|
||||||
|
END
|
||||||
|
#endif // APSTUDIO_INVOKED
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Dialog Info
|
||||||
|
//
|
||||||
|
|
||||||
|
IDD_SERIESPROP_DLG DLGINIT
|
||||||
|
BEGIN
|
||||||
|
IDC_SERIESTYPE_COMBO, 0x403, 5, 0
|
||||||
|
0x694c, 0x656e, "\000"
|
||||||
|
IDC_SERIESTYPE_COMBO, 0x403, 7, 0
|
||||||
|
0x6f50, 0x6e69, 0x7374, "\000"
|
||||||
|
IDC_SERIESTYPE_COMBO, 0x403, 8, 0
|
||||||
|
0x7553, 0x6672, 0x6361, 0x0065,
|
||||||
|
IDC_VERTICALAXIS_COMBO, 0x403, 5, 0
|
||||||
|
0x654c, 0x7466, "\000"
|
||||||
|
IDC_VERTICALAXIS_COMBO, 0x403, 6, 0
|
||||||
|
0x6952, 0x6867, 0x0074,
|
||||||
|
IDC_HORIZONTALAXIS_COMBO, 0x403, 7, 0
|
||||||
|
0x6f42, 0x7474, 0x6d6f, "\000"
|
||||||
|
IDC_HORIZONTALAXIS_COMBO, 0x403, 4, 0
|
||||||
|
0x6f54, 0x0070,
|
||||||
|
0
|
||||||
|
END
|
||||||
|
|
||||||
|
IDD_LINEPROP_DLG DLGINIT
|
||||||
|
BEGIN
|
||||||
|
IDC_PENSTYLE_COMBO, 0x403, 11, 0
|
||||||
|
0x6f53, 0x696c, 0x2064, 0xb5ca, 0xdfcf, "\000"
|
||||||
|
IDC_PENSTYLE_COMBO, 0x403, 10, 0
|
||||||
|
0x6144, 0x6873, 0xd020, 0xcfe9, 0x00df,
|
||||||
|
IDC_PENSTYLE_COMBO, 0x403, 9, 0
|
||||||
|
0x6f44, 0x2074, 0xe3b5, 0xdfcf, "\000"
|
||||||
|
IDC_PENSTYLE_COMBO, 0x403, 16, 0
|
||||||
|
0x6144, 0x6873, 0x442d, 0x746f, 0xb520, 0xbbe3, 0xcfae, 0x00df,
|
||||||
|
IDC_PENSTYLE_COMBO, 0x403, 20, 0
|
||||||
|
0x6144, 0x6873, 0x442d, 0x746f, 0x442d, 0x746f, 0xb520, 0xbbe3, 0xcfae,
|
||||||
|
0x00df,
|
||||||
|
0
|
||||||
|
END
|
||||||
|
|
||||||
|
IDD_SURFACEPROP_DLG DLGINIT
|
||||||
|
BEGIN
|
||||||
|
IDC_FILLSTYLE_COMBO, 0x403, 6, 0
|
||||||
|
0x6f53, 0x696c, 0x0064,
|
||||||
|
IDC_FILLSTYLE_COMBO, 0x403, 20, 0
|
||||||
|
0x6148, 0x6374, 0x2068, 0x6f64, 0x6e77, 0x6420, 0x6169, 0x6f67, 0x616e,
|
||||||
|
0x006c,
|
||||||
|
IDC_FILLSTYLE_COMBO, 0x403, 18, 0
|
||||||
|
0x6148, 0x6374, 0x2068, 0x7075, 0x6420, 0x6169, 0x6f67, 0x616e, 0x006c,
|
||||||
|
|
||||||
|
IDC_FILLSTYLE_COMBO, 0x403, 12, 0
|
||||||
|
0x6148, 0x6374, 0x2068, 0x7263, 0x736f, 0x0073,
|
||||||
|
IDC_FILLSTYLE_COMBO, 0x403, 22, 0
|
||||||
|
0x6148, 0x6374, 0x2068, 0x7263, 0x736f, 0x2073, 0x6964, 0x6761, 0x6e6f,
|
||||||
|
0x6c61, 0x0020,
|
||||||
|
IDC_FILLSTYLE_COMBO, 0x403, 17, 0
|
||||||
|
0x6148, 0x6374, 0x2068, 0x6f68, 0x6972, 0x6f7a, 0x746e, 0x6c61, "\000"
|
||||||
|
IDC_FILLSTYLE_COMBO, 0x403, 15, 0
|
||||||
|
0x6148, 0x6374, 0x2068, 0x6576, 0x7472, 0x6369, 0x6c61, "\000"
|
||||||
|
0
|
||||||
|
END
|
||||||
|
|
||||||
|
IDD_POINTPROP_DLG DLGINIT
|
||||||
|
BEGIN
|
||||||
|
IDC_POINTTYPE_COMBO, 0x403, 8, 0
|
||||||
|
0x6c45, 0x696c, 0x7370, 0x0065,
|
||||||
|
IDC_POINTTYPE_COMBO, 0x403, 10, 0
|
||||||
|
0x6552, 0x7463, 0x6e61, 0x6c67, 0x0065,
|
||||||
|
IDC_POINTTYPE_COMBO, 0x403, 9, 0
|
||||||
|
0x7254, 0x6169, 0x676e, 0x656c, "\000"
|
||||||
|
0
|
||||||
|
END
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// String Table
|
||||||
|
//
|
||||||
|
|
||||||
|
STRINGTABLE DISCARDABLE
|
||||||
|
BEGIN
|
||||||
|
IDS_ABOUTBOX "&A propos de ChartDemo..."
|
||||||
|
END
|
||||||
|
|
||||||
|
#endif // Chinese (P.R.C.) resources
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// French (France) resources
|
||||||
|
|
||||||
|
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_FRA)
|
||||||
|
#ifdef _WIN32
|
||||||
|
LANGUAGE LANG_FRENCH, SUBLANG_FRENCH
|
||||||
|
#pragma code_page(1252)
|
||||||
|
#endif //_WIN32
|
||||||
|
|
||||||
|
#ifdef APSTUDIO_INVOKED
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// TEXTINCLUDE
|
||||||
|
//
|
||||||
|
|
||||||
|
1 TEXTINCLUDE MOVEABLE PURE
|
||||||
|
BEGIN
|
||||||
|
"resource.h\0"
|
||||||
|
END
|
||||||
|
|
||||||
|
2 TEXTINCLUDE MOVEABLE PURE
|
||||||
|
BEGIN
|
||||||
|
"#include ""afxres.h""\r\n"
|
||||||
|
"\0"
|
||||||
|
END
|
||||||
|
|
||||||
|
3 TEXTINCLUDE MOVEABLE PURE
|
||||||
|
BEGIN
|
||||||
|
"#define _AFX_NO_SPLITTER_RESOURCES\r\n"
|
||||||
|
"#define _AFX_NO_OLE_RESOURCES\r\n"
|
||||||
|
"#define _AFX_NO_TRACKER_RESOURCES\r\n"
|
||||||
|
"#define _AFX_NO_PROPERTY_RESOURCES\r\n"
|
||||||
|
"\r\n"
|
||||||
|
"#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_FRA)\r\n"
|
||||||
|
"#ifdef _WIN32\r\n"
|
||||||
|
"LANGUAGE 12, 1\r\n"
|
||||||
|
"#pragma code_page(1252)\r\n"
|
||||||
|
"#endif //_WIN32\r\n"
|
||||||
|
"#include ""res\\ChartDemo.rc2"" // non-Microsoft Visual C++ edited resources\r\n"
|
||||||
|
"#include ""l.fra\\afxres.rc"" // Standard components\r\n"
|
||||||
|
"#endif\r\n"
|
||||||
|
"\0"
|
||||||
|
END
|
||||||
|
|
||||||
|
#endif // APSTUDIO_INVOKED
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Icon
|
||||||
|
//
|
||||||
|
|
||||||
|
// Icon with lowest ID value placed first to ensure application icon
|
||||||
|
// remains consistent on all systems.
|
||||||
|
IDR_MAINFRAME ICON DISCARDABLE "res\\ChartDemo.ico"
|
||||||
|
#endif // French (France) resources
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef APSTUDIO_INVOKED
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Generated from the TEXTINCLUDE 3 resource.
|
||||||
|
//
|
||||||
|
#define _AFX_NO_SPLITTER_RESOURCES
|
||||||
|
#define _AFX_NO_OLE_RESOURCES
|
||||||
|
#define _AFX_NO_TRACKER_RESOURCES
|
||||||
|
#define _AFX_NO_PROPERTY_RESOURCES
|
||||||
|
|
||||||
|
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_FRA)
|
||||||
|
#ifdef _WIN32
|
||||||
|
LANGUAGE 12, 1
|
||||||
|
#pragma code_page(1252)
|
||||||
|
#endif //_WIN32
|
||||||
|
#include "res\ChartDemo.rc2" // non-Microsoft Visual C++ edited resources
|
||||||
|
#include "l.fra\afxres.rc" // Standard components
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
#endif // not APSTUDIO_INVOKED
|
||||||
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 9.00
|
||||||
|
# Visual C++ Express 2005
|
||||||
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ChartDemo", "ChartDemo.vcproj", "{EFDCE8CF-7F5A-4BC4-A320-93563E1D0AF7}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug|Win32 = Debug|Win32
|
||||||
|
Release|Win32 = Release|Win32
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{EFDCE8CF-7F5A-4BC4-A320-93563E1D0AF7}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||||
|
{EFDCE8CF-7F5A-4BC4-A320-93563E1D0AF7}.Debug|Win32.Build.0 = Debug|Win32
|
||||||
|
{EFDCE8CF-7F5A-4BC4-A320-93563E1D0AF7}.Release|Win32.ActiveCfg = Release|Win32
|
||||||
|
{EFDCE8CF-7F5A-4BC4-A320-93563E1D0AF7}.Release|Win32.Build.0 = Release|Win32
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
|
HideSolutionNode = FALSE
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
|
@ -0,0 +1,656 @@
|
||||||
|
<?xml version="1.0" encoding="Windows-1252"?>
|
||||||
|
<VisualStudioProject
|
||||||
|
ProjectType="Visual C++"
|
||||||
|
Version="8,00"
|
||||||
|
Name="ChartDemo"
|
||||||
|
ProjectGUID="{EFDCE8CF-7F5A-4BC4-A320-93563E1D0AF7}"
|
||||||
|
RootNamespace="ChartDemo"
|
||||||
|
Keyword="MFCProj"
|
||||||
|
>
|
||||||
|
<Platforms>
|
||||||
|
<Platform
|
||||||
|
Name="Win32"
|
||||||
|
/>
|
||||||
|
</Platforms>
|
||||||
|
<ToolFiles>
|
||||||
|
</ToolFiles>
|
||||||
|
<Configurations>
|
||||||
|
<Configuration
|
||||||
|
Name="Release|Win32"
|
||||||
|
OutputDirectory=".\Release"
|
||||||
|
IntermediateDirectory=".\Release"
|
||||||
|
ConfigurationType="1"
|
||||||
|
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
|
||||||
|
UseOfMFC="2"
|
||||||
|
ATLMinimizesCRunTimeLibraryUsage="false"
|
||||||
|
CharacterSet="2"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreBuildEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCustomBuildTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXMLDataGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCWebServiceProxyGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCMIDLTool"
|
||||||
|
PreprocessorDefinitions="NDEBUG"
|
||||||
|
MkTypLibCompatible="true"
|
||||||
|
SuppressStartupBanner="true"
|
||||||
|
TargetEnvironment="1"
|
||||||
|
TypeLibraryName=".\Release/ChartDemo.tlb"
|
||||||
|
HeaderFileName=""
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
Optimization="2"
|
||||||
|
InlineFunctionExpansion="1"
|
||||||
|
AdditionalIncludeDirectories="ChartCtrl;ColourPicker"
|
||||||
|
PreprocessorDefinitions="WIN32;_WINDOWS;NDEBUG"
|
||||||
|
StringPooling="true"
|
||||||
|
RuntimeLibrary="2"
|
||||||
|
EnableFunctionLevelLinking="true"
|
||||||
|
UsePrecompiledHeader="2"
|
||||||
|
PrecompiledHeaderThrough="stdafx.h"
|
||||||
|
PrecompiledHeaderFile=".\Release/ChartDemo.pch"
|
||||||
|
AssemblerListingLocation=".\Release/"
|
||||||
|
ObjectFile=".\Release/"
|
||||||
|
ProgramDataBaseFileName=".\Release/"
|
||||||
|
WarningLevel="3"
|
||||||
|
SuppressStartupBanner="true"
|
||||||
|
DebugInformationFormat="0"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManagedResourceCompilerTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCResourceCompilerTool"
|
||||||
|
PreprocessorDefinitions="NDEBUG"
|
||||||
|
Culture="1036"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreLinkEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCLinkerTool"
|
||||||
|
OutputFile=".\Release/ChartDemo.exe"
|
||||||
|
LinkIncremental="1"
|
||||||
|
SuppressStartupBanner="true"
|
||||||
|
GenerateDebugInformation="false"
|
||||||
|
ProgramDatabaseFile=".\Release/ChartDemo.pdb"
|
||||||
|
SubSystem="2"
|
||||||
|
OptimizeReferences="2"
|
||||||
|
EnableCOMDATFolding="2"
|
||||||
|
TargetMachine="1"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCALinkTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManifestTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXDCMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCBscMakeTool"
|
||||||
|
SuppressStartupBanner="true"
|
||||||
|
OutputFile=".\Release/ChartDemo.bsc"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCFxCopTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCAppVerifierTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCWebDeploymentTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPostBuildEventTool"
|
||||||
|
/>
|
||||||
|
</Configuration>
|
||||||
|
<Configuration
|
||||||
|
Name="Debug|Win32"
|
||||||
|
OutputDirectory=".\Debug"
|
||||||
|
IntermediateDirectory=".\Debug"
|
||||||
|
ConfigurationType="1"
|
||||||
|
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
|
||||||
|
UseOfMFC="2"
|
||||||
|
ATLMinimizesCRunTimeLibraryUsage="false"
|
||||||
|
CharacterSet="1"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreBuildEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCustomBuildTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXMLDataGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCWebServiceProxyGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCMIDLTool"
|
||||||
|
PreprocessorDefinitions="_DEBUG"
|
||||||
|
MkTypLibCompatible="true"
|
||||||
|
SuppressStartupBanner="true"
|
||||||
|
TargetEnvironment="1"
|
||||||
|
TypeLibraryName=".\Debug/ChartDemo.tlb"
|
||||||
|
HeaderFileName=""
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
Optimization="0"
|
||||||
|
AdditionalIncludeDirectories="ChartCtrl;ColourPicker"
|
||||||
|
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS"
|
||||||
|
MinimalRebuild="true"
|
||||||
|
BasicRuntimeChecks="3"
|
||||||
|
RuntimeLibrary="3"
|
||||||
|
UsePrecompiledHeader="2"
|
||||||
|
PrecompiledHeaderThrough="stdafx.h"
|
||||||
|
PrecompiledHeaderFile=".\Debug/ChartDemo.pch"
|
||||||
|
AssemblerListingLocation=".\Debug/"
|
||||||
|
ObjectFile=".\Debug/"
|
||||||
|
ProgramDataBaseFileName=".\Debug/"
|
||||||
|
BrowseInformation="1"
|
||||||
|
WarningLevel="4"
|
||||||
|
SuppressStartupBanner="true"
|
||||||
|
DebugInformationFormat="4"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManagedResourceCompilerTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCResourceCompilerTool"
|
||||||
|
PreprocessorDefinitions="_DEBUG"
|
||||||
|
Culture="1036"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreLinkEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCLinkerTool"
|
||||||
|
OutputFile=".\Debug/ChartDemo.exe"
|
||||||
|
LinkIncremental="2"
|
||||||
|
SuppressStartupBanner="true"
|
||||||
|
GenerateDebugInformation="true"
|
||||||
|
ProgramDatabaseFile=".\Debug/ChartDemo.pdb"
|
||||||
|
SubSystem="2"
|
||||||
|
TargetMachine="1"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCALinkTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManifestTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXDCMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCBscMakeTool"
|
||||||
|
SuppressStartupBanner="true"
|
||||||
|
OutputFile=".\Debug/ChartDemo.bsc"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCFxCopTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCAppVerifierTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCWebDeploymentTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPostBuildEventTool"
|
||||||
|
/>
|
||||||
|
</Configuration>
|
||||||
|
</Configurations>
|
||||||
|
<References>
|
||||||
|
</References>
|
||||||
|
<Files>
|
||||||
|
<Filter
|
||||||
|
Name="Source Files"
|
||||||
|
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat;h;hpp;hxx;hm;inl"
|
||||||
|
>
|
||||||
|
<File
|
||||||
|
RelativePath="ChartDemo.cpp"
|
||||||
|
>
|
||||||
|
<FileConfiguration
|
||||||
|
Name="Release|Win32"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
PreprocessorDefinitions=""
|
||||||
|
/>
|
||||||
|
</FileConfiguration>
|
||||||
|
<FileConfiguration
|
||||||
|
Name="Debug|Win32"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
PreprocessorDefinitions=""
|
||||||
|
/>
|
||||||
|
</FileConfiguration>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="ChartDemoDlg.cpp"
|
||||||
|
>
|
||||||
|
<FileConfiguration
|
||||||
|
Name="Release|Win32"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
PreprocessorDefinitions=""
|
||||||
|
/>
|
||||||
|
</FileConfiguration>
|
||||||
|
<FileConfiguration
|
||||||
|
Name="Debug|Win32"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
PreprocessorDefinitions=""
|
||||||
|
/>
|
||||||
|
</FileConfiguration>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\LinePropDialog.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\PointsPropDialog.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="SeriesPropDlg.cpp"
|
||||||
|
>
|
||||||
|
<FileConfiguration
|
||||||
|
Name="Release|Win32"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
PreprocessorDefinitions=""
|
||||||
|
/>
|
||||||
|
</FileConfiguration>
|
||||||
|
<FileConfiguration
|
||||||
|
Name="Debug|Win32"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
PreprocessorDefinitions=""
|
||||||
|
/>
|
||||||
|
</FileConfiguration>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="StdAfx.cpp"
|
||||||
|
>
|
||||||
|
<FileConfiguration
|
||||||
|
Name="Release|Win32"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
PreprocessorDefinitions=""
|
||||||
|
UsePrecompiledHeader="1"
|
||||||
|
/>
|
||||||
|
</FileConfiguration>
|
||||||
|
<FileConfiguration
|
||||||
|
Name="Debug|Win32"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
PreprocessorDefinitions=""
|
||||||
|
UsePrecompiledHeader="1"
|
||||||
|
/>
|
||||||
|
</FileConfiguration>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\SurfacePropDialog.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
</Filter>
|
||||||
|
<Filter
|
||||||
|
Name="Resource Files"
|
||||||
|
Filter="rc2;rct;bin"
|
||||||
|
>
|
||||||
|
<File
|
||||||
|
RelativePath="ChartDemo.rc"
|
||||||
|
>
|
||||||
|
<FileConfiguration
|
||||||
|
Name="Release|Win32"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCResourceCompilerTool"
|
||||||
|
PreprocessorDefinitions=""
|
||||||
|
/>
|
||||||
|
</FileConfiguration>
|
||||||
|
<FileConfiguration
|
||||||
|
Name="Debug|Win32"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCResourceCompilerTool"
|
||||||
|
PreprocessorDefinitions=""
|
||||||
|
/>
|
||||||
|
</FileConfiguration>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="res\ChartDemo.rc2"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="Resource.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<Filter
|
||||||
|
Name="Files"
|
||||||
|
Filter="ico;cur;bmp;dlg;rgs;gif;jpg;jpeg;jpe"
|
||||||
|
>
|
||||||
|
<File
|
||||||
|
RelativePath="res\ChartDemo.ico"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
</Filter>
|
||||||
|
</Filter>
|
||||||
|
<Filter
|
||||||
|
Name="Header Files"
|
||||||
|
>
|
||||||
|
<File
|
||||||
|
RelativePath="ChartDemo.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="ChartDemoDlg.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\LinePropDialog.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\PointsPropDialog.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="SeriesPropDlg.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="StdAfx.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\SurfacePropDialog.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
</Filter>
|
||||||
|
<Filter
|
||||||
|
Name="ChartCtrl"
|
||||||
|
>
|
||||||
|
<File
|
||||||
|
RelativePath=".\ChartCtrl\ChartAxis.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\ChartCtrl\ChartAxis.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\ChartCtrl\ChartAxisLabel.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\ChartCtrl\ChartAxisLabel.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\ChartCtrl\ChartBalloonLabel.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\ChartCtrl\ChartBalloonLabel.inl"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\ChartCtrl\ChartBarSerie.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\ChartCtrl\ChartBarSerie.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\ChartCtrl\ChartCandlestickSerie.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\ChartCtrl\ChartCandlestickSerie.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\ChartCtrl\ChartCrossHairCursor.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\ChartCtrl\ChartCrossHairCursor.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\ChartCtrl\ChartCtrl.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\ChartCtrl\ChartCtrl.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\ChartCtrl\ChartCursor.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\ChartCtrl\ChartCursor.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\ChartCtrl\ChartDateTimeAxis.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\ChartCtrl\ChartDateTimeAxis.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\ChartCtrl\ChartDragLineCursor.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\ChartCtrl\ChartDragLineCursor.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\ChartCtrl\ChartFont.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\ChartCtrl\ChartFont.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\ChartCtrl\ChartGanttSerie.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\ChartCtrl\ChartGanttSerie.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\ChartCtrl\ChartGradient.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\ChartCtrl\ChartGradient.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\ChartCtrl\ChartGrid.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\ChartCtrl\ChartGrid.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\ChartCtrl\ChartLabel.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\ChartCtrl\ChartLabel.inl"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\ChartCtrl\ChartLegend.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\ChartCtrl\ChartLegend.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\ChartCtrl\ChartLineSerie.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\ChartCtrl\ChartLineSerie.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\ChartCtrl\ChartLogarithmicAxis.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\ChartCtrl\ChartLogarithmicAxis.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\ChartCtrl\ChartMouseListener.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\ChartCtrl\ChartPointsArray.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\ChartCtrl\ChartPointsArray.inl"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\ChartCtrl\ChartPointsSerie.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\ChartCtrl\ChartPointsSerie.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\ChartCtrl\ChartScrollBar.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\ChartCtrl\ChartScrollBar.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\ChartCtrl\ChartSerie.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\ChartCtrl\ChartSerie.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\ChartCtrl\ChartSerieBase.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\ChartCtrl\ChartSerieBase.inl"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\ChartCtrl\ChartSeriesMouseListener.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\ChartCtrl\ChartStandardAxis.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\ChartCtrl\ChartStandardAxis.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\ChartCtrl\ChartString.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\ChartCtrl\ChartSurfaceSerie.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\ChartCtrl\ChartSurfaceSerie.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\ChartCtrl\ChartTitle.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\ChartCtrl\ChartTitle.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\ChartCtrl\ChartXYSerie.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\ChartCtrl\ChartXYSerie.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\ChartCtrl\PointsOrdering.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
</Filter>
|
||||||
|
<Filter
|
||||||
|
Name="ColourCtrl"
|
||||||
|
>
|
||||||
|
<File
|
||||||
|
RelativePath=".\ColourPicker\ColourPicker.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\ColourPicker\ColourPicker.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\ColourPicker\ColourPopup.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\ColourPicker\ColourPopup.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
</Filter>
|
||||||
|
</Files>
|
||||||
|
<Globals>
|
||||||
|
<Global
|
||||||
|
Name="RESOURCE_FILE"
|
||||||
|
Value="ChartDemo.rc"
|
||||||
|
/>
|
||||||
|
</Globals>
|
||||||
|
</VisualStudioProject>
|
|
@ -0,0 +1,751 @@
|
||||||
|
// ChartDemoDlg.cpp : implementation file
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "stdafx.h"
|
||||||
|
#include "ChartDemo.h"
|
||||||
|
#include "ChartDemoDlg.h"
|
||||||
|
|
||||||
|
#include "ChartLineSerie.h"
|
||||||
|
#include "ChartPointsSerie.h"
|
||||||
|
#include "ChartSurfaceSerie.h"
|
||||||
|
#include "ChartGrid.h"
|
||||||
|
|
||||||
|
#include "SeriesPropDlg.h"
|
||||||
|
#include "LinePropDialog.h"
|
||||||
|
#include "SurfacePropDialog.h"
|
||||||
|
#include "PointsPropDialog.h"
|
||||||
|
|
||||||
|
#include "ChartBarSerie.h"
|
||||||
|
#include "ChartLabel.h"
|
||||||
|
|
||||||
|
#include "ChartAxisLabel.h"
|
||||||
|
#include "ChartStandardAxis.h"
|
||||||
|
#include "ChartDateTimeAxis.h"
|
||||||
|
|
||||||
|
#include "ChartCrossHairCursor.h"
|
||||||
|
#include "ChartDragLineCursor.h"
|
||||||
|
|
||||||
|
#include <math.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <sstream>
|
||||||
|
#include <iomanip>
|
||||||
|
|
||||||
|
#ifdef _DEBUG
|
||||||
|
#define new DEBUG_NEW
|
||||||
|
#undef THIS_FILE
|
||||||
|
static char THIS_FILE[] = __FILE__;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CAboutDlg dialog used for App About
|
||||||
|
|
||||||
|
class CAboutDlg : public CDialog
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CAboutDlg();
|
||||||
|
|
||||||
|
// Dialog Data
|
||||||
|
//{{AFX_DATA(CAboutDlg)
|
||||||
|
enum { IDD = IDD_ABOUTBOX };
|
||||||
|
//}}AFX_DATA
|
||||||
|
|
||||||
|
// ClassWizard generated virtual function overrides
|
||||||
|
//{{AFX_VIRTUAL(CAboutDlg)
|
||||||
|
protected:
|
||||||
|
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
||||||
|
//}}AFX_VIRTUAL
|
||||||
|
|
||||||
|
// Implementation
|
||||||
|
protected:
|
||||||
|
//{{AFX_MSG(CAboutDlg)
|
||||||
|
//}}AFX_MSG
|
||||||
|
DECLARE_MESSAGE_MAP()
|
||||||
|
};
|
||||||
|
|
||||||
|
CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
|
||||||
|
{
|
||||||
|
//{{AFX_DATA_INIT(CAboutDlg)
|
||||||
|
//}}AFX_DATA_INIT
|
||||||
|
}
|
||||||
|
|
||||||
|
void CAboutDlg::DoDataExchange(CDataExchange* pDX)
|
||||||
|
{
|
||||||
|
CDialog::DoDataExchange(pDX);
|
||||||
|
//{{AFX_DATA_MAP(CAboutDlg)
|
||||||
|
//}}AFX_DATA_MAP
|
||||||
|
}
|
||||||
|
|
||||||
|
BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
|
||||||
|
//{{AFX_MSG_MAP(CAboutDlg)
|
||||||
|
// No message handlers
|
||||||
|
//}}AFX_MSG_MAP
|
||||||
|
END_MESSAGE_MAP()
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CChartDemoDlg dialog
|
||||||
|
|
||||||
|
CChartDemoDlg::CChartDemoDlg(CWnd* pParent /*=NULL*/)
|
||||||
|
: CDialog(CChartDemoDlg::IDD, pParent)
|
||||||
|
{
|
||||||
|
//{{AFX_DATA_INIT(CChartDemoDlg)
|
||||||
|
//}}AFX_DATA_INIT
|
||||||
|
// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
|
||||||
|
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartDemoDlg::DoDataExchange(CDataExchange* pDX)
|
||||||
|
{
|
||||||
|
CDialog::DoDataExchange(pDX);
|
||||||
|
//{{AFX_DATA_MAP(CChartDemoDlg)
|
||||||
|
DDX_Control(pDX, IDC_TITLE_EDIT, m_TitlesEdit);
|
||||||
|
DDX_Control(pDX, IDC_SERIES_LIST, m_SeriesList);
|
||||||
|
DDX_Control(pDX, IDC_AXISMINVAL_EDIT, m_AxisMinValEdit);
|
||||||
|
DDX_Control(pDX, IDC_AXISMAXVAL_EDIT, m_AxisMaxValEdit);
|
||||||
|
DDX_Control(pDX, IDC_LEGENDVIS_CHECK, m_LegendVisBtn);
|
||||||
|
DDX_Control(pDX, IDC_BKGND_COLBTN, m_BackgndColSel);
|
||||||
|
DDX_Control(pDX, IDC_CHARTCTRL, m_ChartCtrl);
|
||||||
|
//}}AFX_DATA_MAP
|
||||||
|
}
|
||||||
|
|
||||||
|
BEGIN_MESSAGE_MAP(CChartDemoDlg, CDialog)
|
||||||
|
//{{AFX_MSG_MAP(CChartDemoDlg)
|
||||||
|
ON_WM_SYSCOMMAND()
|
||||||
|
ON_WM_PAINT()
|
||||||
|
ON_WM_QUERYDRAGICON()
|
||||||
|
ON_BN_CLICKED(IDC_ADDSERIES, OnAddseries)
|
||||||
|
ON_BN_CLICKED(IDC_LEGENDVIS_CHECK, OnLegendVisible)
|
||||||
|
ON_BN_CLICKED(IDC_BOTTOMAXIS_RADIO, OnBottomAxisRadio)
|
||||||
|
ON_BN_CLICKED(IDC_LEFTAXIS_RADIO, OnLeftAxisRadio)
|
||||||
|
ON_BN_CLICKED(IDC_RIGHTAXIS_RADIO, OnRightAxisRadio)
|
||||||
|
ON_BN_CLICKED(IDC_TOPAXIS_RADIO, OnTopAxisRadio)
|
||||||
|
ON_BN_CLICKED(IDC_AXISAUTOMATIC_CHECK, OnAxisAutomaticCheck)
|
||||||
|
ON_BN_CLICKED(IDC_AXISGRIDVIS_CHECK, OnAxisGridVisCheck)
|
||||||
|
ON_BN_CLICKED(IDC_AXISVISIBLE_CHECK, OnAxisVisibleCheck)
|
||||||
|
ON_BN_CLICKED(IDC_AXISSCROLLBAR_CHECK, OnAxisScrollBarCheck)
|
||||||
|
ON_MESSAGE(CPN_SELENDOK, OnChangeBckCol)
|
||||||
|
ON_EN_KILLFOCUS(IDC_AXISMAXVAL_EDIT, OnChangeAxisMax)
|
||||||
|
ON_EN_KILLFOCUS(IDC_AXISMINVAL_EDIT, OnChangeAxisMin)
|
||||||
|
ON_BN_CLICKED(IDC_AXISINVERTED_CHECK, OnAxisInvertedCheck)
|
||||||
|
ON_EN_KILLFOCUS(IDC_AXISLABEL_EDIT, OnChangeAxisLabel)
|
||||||
|
ON_BN_CLICKED(IDC_DELETESERIES, OnDeleteSeries)
|
||||||
|
ON_EN_KILLFOCUS(IDC_TITLE_EDIT, OnChangeTitle)
|
||||||
|
ON_BN_CLICKED(IDC_PAN_CHECK, OnPanCheck)
|
||||||
|
ON_BN_CLICKED(IDC_ZOOM_CHECK, OnZoomCheck)
|
||||||
|
//}}AFX_MSG_MAP
|
||||||
|
END_MESSAGE_MAP()
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CChartDemoDlg message handlers
|
||||||
|
|
||||||
|
BOOL CChartDemoDlg::OnInitDialog()
|
||||||
|
{
|
||||||
|
CDialog::OnInitDialog();
|
||||||
|
|
||||||
|
// Add "About..." menu item to system menu.
|
||||||
|
|
||||||
|
// IDM_ABOUTBOX must be in the system command range.
|
||||||
|
ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
|
||||||
|
ASSERT(IDM_ABOUTBOX < 0xF000);
|
||||||
|
|
||||||
|
CMenu* pSysMenu = GetSystemMenu(FALSE);
|
||||||
|
if (pSysMenu != NULL)
|
||||||
|
{
|
||||||
|
CString strAboutMenu;
|
||||||
|
strAboutMenu.LoadString(IDS_ABOUTBOX);
|
||||||
|
if (!strAboutMenu.IsEmpty())
|
||||||
|
{
|
||||||
|
pSysMenu->AppendMenu(MF_SEPARATOR);
|
||||||
|
pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set the icon for this dialog. The framework does this automatically
|
||||||
|
// when the application's main window is not a dialog
|
||||||
|
SetIcon(m_hIcon, TRUE); // Set big icon
|
||||||
|
SetIcon(m_hIcon, FALSE); // Set small icon
|
||||||
|
|
||||||
|
COLORREF BackColor = 0x00eeeeaf;
|
||||||
|
m_BackgndColSel.SetColour(BackColor);
|
||||||
|
m_ChartCtrl.SetBackColor(BackColor);
|
||||||
|
|
||||||
|
((CButton*)GetDlgItem(IDC_LEFTAXIS_RADIO))->SetCheck(1);
|
||||||
|
((CButton*)GetDlgItem(IDC_PAN_CHECK))->SetCheck(1);
|
||||||
|
((CButton*)GetDlgItem(IDC_ZOOM_CHECK))->SetCheck(1);
|
||||||
|
|
||||||
|
CChartStandardAxis* pBottomAxis =
|
||||||
|
m_ChartCtrl.CreateStandardAxis(CChartCtrl::BottomAxis);
|
||||||
|
pBottomAxis->SetMinMax(0, 10);
|
||||||
|
CChartStandardAxis* pLeftAxis =
|
||||||
|
m_ChartCtrl.CreateStandardAxis(CChartCtrl::LeftAxis);
|
||||||
|
pLeftAxis->SetMinMax(0, 10);
|
||||||
|
CChartStandardAxis* pTopAxis =
|
||||||
|
m_ChartCtrl.CreateStandardAxis(CChartCtrl::TopAxis);
|
||||||
|
pTopAxis->SetMinMax(0, 10);
|
||||||
|
CChartStandardAxis* pRightAxis =
|
||||||
|
m_ChartCtrl.CreateStandardAxis(CChartCtrl::RightAxis);
|
||||||
|
pRightAxis->SetMinMax(0, 10);
|
||||||
|
|
||||||
|
OnLeftAxisRadio();
|
||||||
|
return TRUE; // return TRUE unless you set the focus to a control
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartDemoDlg::OnSysCommand(UINT nID, LPARAM lParam)
|
||||||
|
{
|
||||||
|
if ((nID & 0xFFF0) == IDM_ABOUTBOX)
|
||||||
|
{
|
||||||
|
CAboutDlg dlgAbout;
|
||||||
|
dlgAbout.DoModal();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CDialog::OnSysCommand(nID, lParam);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// If you add a minimize button to your dialog, you will need the code below
|
||||||
|
// to draw the icon. For MFC applications using the document/view model,
|
||||||
|
// this is automatically done for you by the framework.
|
||||||
|
|
||||||
|
void CChartDemoDlg::OnPaint()
|
||||||
|
{
|
||||||
|
if (IsIconic())
|
||||||
|
{
|
||||||
|
CPaintDC dc(this); // device context for painting
|
||||||
|
|
||||||
|
SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);
|
||||||
|
|
||||||
|
// Center icon in client rectangle
|
||||||
|
int cxIcon = GetSystemMetrics(SM_CXICON);
|
||||||
|
int cyIcon = GetSystemMetrics(SM_CYICON);
|
||||||
|
CRect rect;
|
||||||
|
GetClientRect(&rect);
|
||||||
|
int x = (rect.Width() - cxIcon + 1) / 2;
|
||||||
|
int y = (rect.Height() - cyIcon + 1) / 2;
|
||||||
|
|
||||||
|
// Draw the icon
|
||||||
|
dc.DrawIcon(x, y, m_hIcon);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CDialog::OnPaint();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// The system calls this to obtain the cursor to display while the user drags
|
||||||
|
// the minimized window.
|
||||||
|
HCURSOR CChartDemoDlg::OnQueryDragIcon()
|
||||||
|
{
|
||||||
|
return (HCURSOR) m_hIcon;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CChartDemoDlg::OnAddseries()
|
||||||
|
{
|
||||||
|
CSeriesPropDlg PropertiesDlg;
|
||||||
|
if (PropertiesDlg.DoModal() == IDCANCEL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
int Type = PropertiesDlg.m_iSeriesType;
|
||||||
|
TChartString Name = PropertiesDlg.m_strSeriesName;
|
||||||
|
COLORREF Color = PropertiesDlg.m_SeriesColour;
|
||||||
|
|
||||||
|
CChartXYSerie* pSeries = NULL;
|
||||||
|
INT_PTR nPropDlgRet = -1;
|
||||||
|
switch (Type)
|
||||||
|
{
|
||||||
|
// Line series
|
||||||
|
case 0:
|
||||||
|
{
|
||||||
|
bool bSecondHorizAxis = (PropertiesDlg.m_iHorizAxis == 1);
|
||||||
|
bool bSecondVertAxis = (PropertiesDlg.m_iVertAxis == 1);
|
||||||
|
CChartLineSerie* pLineSeries = m_ChartCtrl.CreateLineSerie(bSecondHorizAxis, bSecondVertAxis);
|
||||||
|
pSeries = pLineSeries;
|
||||||
|
|
||||||
|
CLinePropDialog LinePropDlg;
|
||||||
|
nPropDlgRet = LinePropDlg.DoModal();
|
||||||
|
|
||||||
|
pLineSeries->SetWidth(LinePropDlg.m_iLineWidth);
|
||||||
|
pLineSeries->SetPenStyle(LinePropDlg.m_iPenStyle);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
// Points series
|
||||||
|
case 1:
|
||||||
|
{
|
||||||
|
bool bSecondHorizAxis = (PropertiesDlg.m_iHorizAxis == 1);
|
||||||
|
bool bSecondVertAxis = (PropertiesDlg.m_iVertAxis == 1);
|
||||||
|
CChartPointsSerie* pPointsSeries = m_ChartCtrl.CreatePointsSerie(bSecondHorizAxis, bSecondVertAxis);
|
||||||
|
pSeries = pPointsSeries;
|
||||||
|
|
||||||
|
CPointsPropDialog PointsPropDlg;
|
||||||
|
nPropDlgRet = PointsPropDlg.DoModal();
|
||||||
|
|
||||||
|
switch (PointsPropDlg.m_iPointsType)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
pPointsSeries->SetPointType(CChartPointsSerie::ptEllipse);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 1:
|
||||||
|
pPointsSeries->SetPointType(CChartPointsSerie::ptRectangle);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 2:
|
||||||
|
pPointsSeries->SetPointType(CChartPointsSerie::ptTriangle);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
pPointsSeries->SetPointSize(PointsPropDlg.m_iPointsWidth,PointsPropDlg.m_iPointsHeight);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
// Surface series
|
||||||
|
case 2:
|
||||||
|
{
|
||||||
|
bool bSecondHorizAxis = (PropertiesDlg.m_iHorizAxis == 1);
|
||||||
|
bool bSecondVertAxis = (PropertiesDlg.m_iVertAxis == 1);
|
||||||
|
CChartSurfaceSerie* pSurfSeries = m_ChartCtrl.CreateSurfaceSerie(bSecondHorizAxis, bSecondVertAxis);
|
||||||
|
pSeries = pSurfSeries;
|
||||||
|
|
||||||
|
CSurfacePropDialog SurfPropDlg;
|
||||||
|
nPropDlgRet = SurfPropDlg.DoModal();
|
||||||
|
|
||||||
|
switch (SurfPropDlg.m_FillStyle)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
pSurfSeries->SetFillStyle(CChartSurfaceSerie::fsSolid);
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
pSurfSeries->SetFillStyle(CChartSurfaceSerie::fsHatchDownDiag);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
pSurfSeries->SetFillStyle(CChartSurfaceSerie::fsHatchUpDiag);
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
pSurfSeries->SetFillStyle(CChartSurfaceSerie::fsHatchCross);
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
pSurfSeries->SetFillStyle(CChartSurfaceSerie::fsHatchDiagCross);
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
pSurfSeries->SetFillStyle(CChartSurfaceSerie::fsHatchHorizontal);
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
|
pSurfSeries->SetFillStyle(CChartSurfaceSerie::fsHatchVertical);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (SurfPropDlg.m_iHorizSurf == 0)
|
||||||
|
pSurfSeries->SetHorizontal(true);
|
||||||
|
else
|
||||||
|
pSurfSeries->SetHorizontal(false);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(nPropDlgRet ==IDCANCEL){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
pSeries->SetName(Name);
|
||||||
|
pSeries->SetColor(Color);
|
||||||
|
|
||||||
|
int NumberPoints = PropertiesDlg.m_iPointsNumber;
|
||||||
|
double* XValues = new double[NumberPoints];
|
||||||
|
double* YValues = new double[NumberPoints];
|
||||||
|
float Step = (PropertiesDlg.m_fMaxXValue - PropertiesDlg.m_fMinXValue)/(NumberPoints - 1);
|
||||||
|
float XStart = PropertiesDlg.m_fMinXValue;
|
||||||
|
switch (PropertiesDlg.m_iDataType)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
{
|
||||||
|
float Slope = PropertiesDlg.m_fLineSlope;
|
||||||
|
float Offset = PropertiesDlg.m_fLineOffset;
|
||||||
|
|
||||||
|
for (int i=0;i<NumberPoints;i++)
|
||||||
|
{
|
||||||
|
XValues[i] = XStart + i * Step;
|
||||||
|
YValues[i] = XValues[i] * Slope + Offset;
|
||||||
|
}
|
||||||
|
pSeries->SetPoints(XValues,YValues,NumberPoints);
|
||||||
|
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 1:
|
||||||
|
{
|
||||||
|
float Amplitude = PropertiesDlg.m_fSineAmplitude;
|
||||||
|
float Period = PropertiesDlg.m_fSinePeriod;
|
||||||
|
|
||||||
|
for (int i=0;i<NumberPoints;i++)
|
||||||
|
{
|
||||||
|
XValues[i] = XStart + i * Step;
|
||||||
|
YValues[i] = Amplitude * (float)sin( 2 * 3.141592 * XValues[i]/Period );
|
||||||
|
}
|
||||||
|
pSeries->SetPoints(XValues,YValues,NumberPoints);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 2:
|
||||||
|
{
|
||||||
|
int Min = PropertiesDlg.m_iRandMinVal;
|
||||||
|
int Max = PropertiesDlg.m_iRandMaxVal;
|
||||||
|
srand((unsigned int)time(NULL));
|
||||||
|
for (int i=0;i<NumberPoints;i++)
|
||||||
|
{
|
||||||
|
XValues[i] = XStart + i * Step;
|
||||||
|
YValues[i] = Min + (rand()%(Max-Min));
|
||||||
|
}
|
||||||
|
pSeries->SetPoints(XValues,YValues,NumberPoints);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
delete[] XValues;
|
||||||
|
delete[] YValues;
|
||||||
|
m_ChartCtrl.RefreshCtrl();
|
||||||
|
int index = m_SeriesList.AddString(Name.c_str());
|
||||||
|
m_SeriesList.SetItemData(index, pSeries->GetSerieId());
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartDemoDlg::OnLegendVisible()
|
||||||
|
{
|
||||||
|
if (m_LegendVisBtn.GetCheck() == 1)
|
||||||
|
m_ChartCtrl.GetLegend()->SetVisible(true);
|
||||||
|
else
|
||||||
|
m_ChartCtrl.GetLegend()->SetVisible(false);
|
||||||
|
m_ChartCtrl.RefreshCtrl();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartDemoDlg::OnBottomAxisRadio()
|
||||||
|
{
|
||||||
|
CChartAxis* pAxis = m_ChartCtrl.GetBottomAxis();
|
||||||
|
if (pAxis->IsVisible())
|
||||||
|
((CButton*)GetDlgItem(IDC_AXISVISIBLE_CHECK))->SetCheck(1);
|
||||||
|
else
|
||||||
|
((CButton*)GetDlgItem(IDC_AXISVISIBLE_CHECK))->SetCheck(0);
|
||||||
|
if (pAxis->GetGrid()->IsVisible())
|
||||||
|
((CButton*)GetDlgItem(IDC_AXISGRIDVIS_CHECK))->SetCheck(1);
|
||||||
|
else
|
||||||
|
((CButton*)GetDlgItem(IDC_AXISGRIDVIS_CHECK))->SetCheck(0);
|
||||||
|
if (pAxis->IsAutomatic())
|
||||||
|
((CButton*)GetDlgItem(IDC_AXISAUTOMATIC_CHECK))->SetCheck(1);
|
||||||
|
else
|
||||||
|
((CButton*)GetDlgItem(IDC_AXISAUTOMATIC_CHECK))->SetCheck(0);
|
||||||
|
if (pAxis->IsInverted())
|
||||||
|
((CButton*)GetDlgItem(IDC_AXISINVERTED_CHECK))->SetCheck(1);
|
||||||
|
else
|
||||||
|
((CButton*)GetDlgItem(IDC_AXISINVERTED_CHECK))->SetCheck(0);
|
||||||
|
if (pAxis->ScrollBarEnabled())
|
||||||
|
((CButton*)GetDlgItem(IDC_AXISSCROLLBAR_CHECK))->SetCheck(1);
|
||||||
|
else
|
||||||
|
((CButton*)GetDlgItem(IDC_AXISSCROLLBAR_CHECK))->SetCheck(0);
|
||||||
|
|
||||||
|
TChartString AxisLabel = pAxis->GetLabel()->GetText();
|
||||||
|
GetDlgItem(IDC_AXISLABEL_EDIT)->SetWindowText(AxisLabel.c_str());
|
||||||
|
|
||||||
|
double Min=0, Max=0;
|
||||||
|
CString strBuff;
|
||||||
|
pAxis->GetMinMax(Min,Max);
|
||||||
|
strBuff.Format(_T("%.2f"),Min);
|
||||||
|
GetDlgItem(IDC_AXISMINVAL_EDIT)->SetWindowText(strBuff);
|
||||||
|
strBuff.Format(_T("%.2f"),Max);
|
||||||
|
GetDlgItem(IDC_AXISMAXVAL_EDIT)->SetWindowText(strBuff);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartDemoDlg::OnLeftAxisRadio()
|
||||||
|
{
|
||||||
|
CChartAxis* pAxis = m_ChartCtrl.GetLeftAxis();
|
||||||
|
if (pAxis->IsVisible())
|
||||||
|
((CButton*)GetDlgItem(IDC_AXISVISIBLE_CHECK))->SetCheck(1);
|
||||||
|
else
|
||||||
|
((CButton*)GetDlgItem(IDC_AXISVISIBLE_CHECK))->SetCheck(0);
|
||||||
|
if (pAxis->GetGrid()->IsVisible())
|
||||||
|
((CButton*)GetDlgItem(IDC_AXISGRIDVIS_CHECK))->SetCheck(1);
|
||||||
|
else
|
||||||
|
((CButton*)GetDlgItem(IDC_AXISGRIDVIS_CHECK))->SetCheck(0);
|
||||||
|
if (pAxis->IsAutomatic())
|
||||||
|
((CButton*)GetDlgItem(IDC_AXISAUTOMATIC_CHECK))->SetCheck(1);
|
||||||
|
else
|
||||||
|
((CButton*)GetDlgItem(IDC_AXISAUTOMATIC_CHECK))->SetCheck(0);
|
||||||
|
if (pAxis->IsInverted())
|
||||||
|
((CButton*)GetDlgItem(IDC_AXISINVERTED_CHECK))->SetCheck(1);
|
||||||
|
else
|
||||||
|
((CButton*)GetDlgItem(IDC_AXISINVERTED_CHECK))->SetCheck(0);
|
||||||
|
if (pAxis->ScrollBarEnabled())
|
||||||
|
((CButton*)GetDlgItem(IDC_AXISSCROLLBAR_CHECK))->SetCheck(1);
|
||||||
|
else
|
||||||
|
((CButton*)GetDlgItem(IDC_AXISSCROLLBAR_CHECK))->SetCheck(0);
|
||||||
|
|
||||||
|
TChartString AxisLabel = pAxis->GetLabel()->GetText();
|
||||||
|
GetDlgItem(IDC_AXISLABEL_EDIT)->SetWindowText(AxisLabel.c_str());
|
||||||
|
|
||||||
|
double Min=0, Max=0;
|
||||||
|
CString strBuff;
|
||||||
|
pAxis->GetMinMax(Min,Max);
|
||||||
|
strBuff.Format(_T("%.2f"),Min);
|
||||||
|
GetDlgItem(IDC_AXISMINVAL_EDIT)->SetWindowText(strBuff);
|
||||||
|
strBuff.Format(_T("%.2f"),Max);
|
||||||
|
GetDlgItem(IDC_AXISMAXVAL_EDIT)->SetWindowText(strBuff);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartDemoDlg::OnRightAxisRadio()
|
||||||
|
{
|
||||||
|
CChartAxis* pAxis = m_ChartCtrl.GetRightAxis();
|
||||||
|
if (pAxis->IsVisible())
|
||||||
|
((CButton*)GetDlgItem(IDC_AXISVISIBLE_CHECK))->SetCheck(1);
|
||||||
|
else
|
||||||
|
((CButton*)GetDlgItem(IDC_AXISVISIBLE_CHECK))->SetCheck(0);
|
||||||
|
if (pAxis->GetGrid()->IsVisible())
|
||||||
|
((CButton*)GetDlgItem(IDC_AXISGRIDVIS_CHECK))->SetCheck(1);
|
||||||
|
else
|
||||||
|
((CButton*)GetDlgItem(IDC_AXISGRIDVIS_CHECK))->SetCheck(0);
|
||||||
|
if (pAxis->IsAutomatic())
|
||||||
|
((CButton*)GetDlgItem(IDC_AXISAUTOMATIC_CHECK))->SetCheck(1);
|
||||||
|
else
|
||||||
|
((CButton*)GetDlgItem(IDC_AXISAUTOMATIC_CHECK))->SetCheck(0);
|
||||||
|
if (pAxis->IsInverted())
|
||||||
|
((CButton*)GetDlgItem(IDC_AXISINVERTED_CHECK))->SetCheck(1);
|
||||||
|
else
|
||||||
|
((CButton*)GetDlgItem(IDC_AXISINVERTED_CHECK))->SetCheck(0);
|
||||||
|
if (pAxis->ScrollBarEnabled())
|
||||||
|
((CButton*)GetDlgItem(IDC_AXISSCROLLBAR_CHECK))->SetCheck(1);
|
||||||
|
else
|
||||||
|
((CButton*)GetDlgItem(IDC_AXISSCROLLBAR_CHECK))->SetCheck(0);
|
||||||
|
|
||||||
|
TChartString AxisLabel = pAxis->GetLabel()->GetText();
|
||||||
|
GetDlgItem(IDC_AXISLABEL_EDIT)->SetWindowText(AxisLabel.c_str());
|
||||||
|
|
||||||
|
double Min=0, Max=0;
|
||||||
|
CString strBuff;
|
||||||
|
pAxis->GetMinMax(Min,Max);
|
||||||
|
strBuff.Format(_T("%.2f"),Min);
|
||||||
|
GetDlgItem(IDC_AXISMINVAL_EDIT)->SetWindowText(strBuff);
|
||||||
|
strBuff.Format(_T("%.2f"),Max);
|
||||||
|
GetDlgItem(IDC_AXISMAXVAL_EDIT)->SetWindowText(strBuff);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartDemoDlg::OnTopAxisRadio()
|
||||||
|
{
|
||||||
|
CChartAxis* pAxis = m_ChartCtrl.GetTopAxis();
|
||||||
|
if (pAxis->IsVisible())
|
||||||
|
((CButton*)GetDlgItem(IDC_AXISVISIBLE_CHECK))->SetCheck(1);
|
||||||
|
else
|
||||||
|
((CButton*)GetDlgItem(IDC_AXISVISIBLE_CHECK))->SetCheck(0);
|
||||||
|
if (pAxis->GetGrid()->IsVisible())
|
||||||
|
((CButton*)GetDlgItem(IDC_AXISGRIDVIS_CHECK))->SetCheck(1);
|
||||||
|
else
|
||||||
|
((CButton*)GetDlgItem(IDC_AXISGRIDVIS_CHECK))->SetCheck(0);
|
||||||
|
if (pAxis->IsAutomatic())
|
||||||
|
((CButton*)GetDlgItem(IDC_AXISAUTOMATIC_CHECK))->SetCheck(1);
|
||||||
|
else
|
||||||
|
((CButton*)GetDlgItem(IDC_AXISAUTOMATIC_CHECK))->SetCheck(0);
|
||||||
|
if (pAxis->IsInverted())
|
||||||
|
((CButton*)GetDlgItem(IDC_AXISINVERTED_CHECK))->SetCheck(1);
|
||||||
|
else
|
||||||
|
((CButton*)GetDlgItem(IDC_AXISINVERTED_CHECK))->SetCheck(0);
|
||||||
|
if (pAxis->ScrollBarEnabled())
|
||||||
|
((CButton*)GetDlgItem(IDC_AXISSCROLLBAR_CHECK))->SetCheck(1);
|
||||||
|
else
|
||||||
|
((CButton*)GetDlgItem(IDC_AXISSCROLLBAR_CHECK))->SetCheck(0);
|
||||||
|
|
||||||
|
TChartString AxisLabel = pAxis->GetLabel()->GetText();
|
||||||
|
GetDlgItem(IDC_AXISLABEL_EDIT)->SetWindowText(AxisLabel.c_str());
|
||||||
|
|
||||||
|
double Min=0, Max=0;
|
||||||
|
CString strBuff;
|
||||||
|
pAxis->GetMinMax(Min,Max);
|
||||||
|
strBuff.Format(_T("%.2f"),Min);
|
||||||
|
GetDlgItem(IDC_AXISMINVAL_EDIT)->SetWindowText(strBuff);
|
||||||
|
strBuff.Format(_T("%.2f"),Max);
|
||||||
|
GetDlgItem(IDC_AXISMAXVAL_EDIT)->SetWindowText(strBuff);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartDemoDlg::OnAxisAutomaticCheck()
|
||||||
|
{
|
||||||
|
CChartAxis* pAxis = GetSelectedAxis();
|
||||||
|
if ( ((CButton*)GetDlgItem(IDC_AXISAUTOMATIC_CHECK))->GetCheck() == 1)
|
||||||
|
pAxis->SetAutomatic(true);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
TCHAR szBuffer[255];
|
||||||
|
double MinVal=0, MaxVal=0;
|
||||||
|
m_AxisMinValEdit.GetWindowText(szBuffer,254);
|
||||||
|
// MinVal = _tstof(szBuffer);
|
||||||
|
MinVal = _tcstod(szBuffer, NULL);
|
||||||
|
m_AxisMaxValEdit.GetWindowText(szBuffer,254);
|
||||||
|
// MaxVal = _tstof(szBuffer);
|
||||||
|
MaxVal = _tcstod(szBuffer, NULL);
|
||||||
|
|
||||||
|
if (MinVal > MaxVal)
|
||||||
|
{
|
||||||
|
MessageBox(_T("MinVal > MaxVal"),_T("Error"),MB_OK);
|
||||||
|
((CButton*)GetDlgItem(IDC_AXISAUTOMATIC_CHECK))->SetCheck(1);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
pAxis->SetAutomatic(false);
|
||||||
|
pAxis->SetMinMax(MinVal,MaxVal);
|
||||||
|
}
|
||||||
|
m_ChartCtrl.RefreshCtrl();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartDemoDlg::OnAxisGridVisCheck()
|
||||||
|
{
|
||||||
|
CChartAxis* pAxis = GetSelectedAxis();
|
||||||
|
if ( ((CButton*)GetDlgItem(IDC_AXISGRIDVIS_CHECK))->GetCheck() == 1)
|
||||||
|
pAxis->GetGrid()->SetVisible(true);
|
||||||
|
else
|
||||||
|
pAxis->GetGrid()->SetVisible(false);
|
||||||
|
m_ChartCtrl.RefreshCtrl();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartDemoDlg::OnAxisVisibleCheck()
|
||||||
|
{
|
||||||
|
CChartAxis* pAxis = GetSelectedAxis();
|
||||||
|
if ( ((CButton*)GetDlgItem(IDC_AXISVISIBLE_CHECK))->GetCheck() == 1)
|
||||||
|
pAxis->SetVisible(true);
|
||||||
|
else
|
||||||
|
pAxis->SetVisible(false);
|
||||||
|
m_ChartCtrl.RefreshCtrl();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartDemoDlg::OnAxisInvertedCheck()
|
||||||
|
{
|
||||||
|
CChartAxis* pAxis = GetSelectedAxis();
|
||||||
|
if ( ((CButton*)GetDlgItem(IDC_AXISINVERTED_CHECK))->GetCheck() == 1)
|
||||||
|
pAxis->SetInverted(true);
|
||||||
|
else
|
||||||
|
pAxis->SetInverted(false);
|
||||||
|
m_ChartCtrl.RefreshCtrl();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartDemoDlg::OnAxisScrollBarCheck()
|
||||||
|
{
|
||||||
|
CChartAxis* pAxis = GetSelectedAxis();
|
||||||
|
bool bShow = ((CButton*)GetDlgItem(IDC_AXISSCROLLBAR_CHECK))->GetCheck() == 1;
|
||||||
|
pAxis->EnableScrollBar(bShow);
|
||||||
|
}
|
||||||
|
|
||||||
|
CChartAxis* CChartDemoDlg::GetSelectedAxis()
|
||||||
|
{
|
||||||
|
if ( ((CButton*)GetDlgItem(IDC_LEFTAXIS_RADIO))->GetCheck() == 1)
|
||||||
|
return m_ChartCtrl.GetLeftAxis();
|
||||||
|
if ( ((CButton*)GetDlgItem(IDC_BOTTOMAXIS_RADIO))->GetCheck() == 1)
|
||||||
|
return m_ChartCtrl.GetBottomAxis();
|
||||||
|
if ( ((CButton*)GetDlgItem(IDC_RIGHTAXIS_RADIO))->GetCheck() == 1)
|
||||||
|
return m_ChartCtrl.GetRightAxis();
|
||||||
|
if ( ((CButton*)GetDlgItem(IDC_TOPAXIS_RADIO))->GetCheck() == 1)
|
||||||
|
return m_ChartCtrl.GetTopAxis();
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
LONG CChartDemoDlg::OnChangeBckCol(UINT , LONG )
|
||||||
|
{
|
||||||
|
COLORREF BackColor = m_BackgndColSel.GetColour();
|
||||||
|
m_ChartCtrl.SetBackColor(BackColor);
|
||||||
|
m_ChartCtrl.RefreshCtrl();
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartDemoDlg::OnChangeAxisMax()
|
||||||
|
{
|
||||||
|
CChartAxis* pAxis = GetSelectedAxis();
|
||||||
|
TCHAR szBuffer[255];
|
||||||
|
double MinVal=0, MaxVal=0;
|
||||||
|
m_AxisMinValEdit.GetWindowText(szBuffer,254);
|
||||||
|
// MinVal = _tstof(szBuffer);
|
||||||
|
MinVal = _tcstod(szBuffer, NULL);
|
||||||
|
m_AxisMaxValEdit.GetWindowText(szBuffer,254);
|
||||||
|
// MaxVal = _tstof(szBuffer);
|
||||||
|
MaxVal = _tcstod(szBuffer, NULL);
|
||||||
|
|
||||||
|
if (MinVal > MaxVal)
|
||||||
|
{
|
||||||
|
MessageBox(_T("MinVal > MaxVal"),_T("Error"),MB_OK);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
pAxis->SetMinMax(MinVal,MaxVal);
|
||||||
|
|
||||||
|
m_ChartCtrl.RefreshCtrl();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartDemoDlg::OnChangeAxisMin()
|
||||||
|
{
|
||||||
|
CChartAxis* pAxis = GetSelectedAxis();
|
||||||
|
TCHAR szBuffer[255];
|
||||||
|
double MinVal=0, MaxVal=0;
|
||||||
|
m_AxisMinValEdit.GetWindowText(szBuffer,254);
|
||||||
|
// MinVal = _tstof(szBuffer);
|
||||||
|
MinVal = _tcstod(szBuffer, NULL);
|
||||||
|
m_AxisMaxValEdit.GetWindowText(szBuffer,254);
|
||||||
|
// MaxVal = _tstof(szBuffer);
|
||||||
|
MaxVal = _tcstod(szBuffer, NULL);
|
||||||
|
|
||||||
|
if (MinVal > MaxVal)
|
||||||
|
{
|
||||||
|
MessageBox(_T("MinVal > MaxVal"),_T("Error"),MB_OK);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
pAxis->SetMinMax(MinVal,MaxVal);
|
||||||
|
|
||||||
|
m_ChartCtrl.RefreshCtrl();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartDemoDlg::OnChangeAxisLabel()
|
||||||
|
{
|
||||||
|
CChartAxis* pAxis = GetSelectedAxis();
|
||||||
|
TCHAR szBuffer[255];
|
||||||
|
GetDlgItem(IDC_AXISLABEL_EDIT)->GetWindowText(szBuffer,254);
|
||||||
|
pAxis->GetLabel()->SetText(szBuffer);
|
||||||
|
m_ChartCtrl.RefreshCtrl();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartDemoDlg::OnDeleteSeries()
|
||||||
|
{
|
||||||
|
int Index = m_SeriesList.GetCurSel();
|
||||||
|
if (Index == -1)
|
||||||
|
return;
|
||||||
|
unsigned seriesId = m_SeriesList.GetItemData(Index);
|
||||||
|
|
||||||
|
m_ChartCtrl.RemoveSerie(seriesId);
|
||||||
|
m_SeriesList.DeleteString(Index);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartDemoDlg::OnChangeTitle()
|
||||||
|
{
|
||||||
|
int Count = m_TitlesEdit.GetLineCount();
|
||||||
|
CChartTitle* pTitle = m_ChartCtrl.GetTitle();
|
||||||
|
pTitle->RemoveAll();
|
||||||
|
|
||||||
|
TCHAR szBuff[255];
|
||||||
|
for (int i=0;i<Count;i++)
|
||||||
|
{
|
||||||
|
int Size = m_TitlesEdit.GetLine(i,szBuff);
|
||||||
|
szBuff[Size] = '\0';
|
||||||
|
pTitle->AddString(szBuff);
|
||||||
|
}
|
||||||
|
|
||||||
|
m_ChartCtrl.RefreshCtrl();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartDemoDlg::OnPanCheck()
|
||||||
|
{
|
||||||
|
if ( ((CButton*)GetDlgItem(IDC_PAN_CHECK))->GetCheck() == 1)
|
||||||
|
m_ChartCtrl.SetPanEnabled(true);
|
||||||
|
else
|
||||||
|
m_ChartCtrl.SetPanEnabled(false);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChartDemoDlg::OnZoomCheck()
|
||||||
|
{
|
||||||
|
if ( ((CButton*)GetDlgItem(IDC_ZOOM_CHECK))->GetCheck() == 1)
|
||||||
|
m_ChartCtrl.SetZoomEnabled(true);
|
||||||
|
else
|
||||||
|
m_ChartCtrl.SetZoomEnabled(false);
|
||||||
|
}
|
|
@ -0,0 +1,82 @@
|
||||||
|
// ChartDemoDlg.h : header file
|
||||||
|
//
|
||||||
|
|
||||||
|
#if !defined(AFX_CHARTDEMODLG_H__1C3B17D7_0821_47FC_B873_9D9337728F79__INCLUDED_)
|
||||||
|
#define AFX_CHARTDEMODLG_H__1C3B17D7_0821_47FC_B873_9D9337728F79__INCLUDED_
|
||||||
|
|
||||||
|
#if _MSC_VER > 1000
|
||||||
|
#pragma once
|
||||||
|
#endif // _MSC_VER > 1000
|
||||||
|
|
||||||
|
#include "ChartCtrl.h"
|
||||||
|
#include "ColourPicker.h"
|
||||||
|
#include "ChartLineSerie.h"
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CChartDemoDlg dialog
|
||||||
|
|
||||||
|
class CChartDemoDlg : public CDialog
|
||||||
|
{
|
||||||
|
// Construction
|
||||||
|
public:
|
||||||
|
CChartDemoDlg(CWnd* pParent = NULL); // standard constructor
|
||||||
|
|
||||||
|
// Dialog Data
|
||||||
|
//{{AFX_DATA(CChartDemoDlg)
|
||||||
|
enum { IDD = IDD_CHARTDEMO_DIALOG };
|
||||||
|
CEdit m_TitlesEdit;
|
||||||
|
CListBox m_SeriesList;
|
||||||
|
CEdit m_AxisMinValEdit;
|
||||||
|
CEdit m_AxisMaxValEdit;
|
||||||
|
CButton m_LegendVisBtn;
|
||||||
|
CColourPicker m_BackgndColSel;
|
||||||
|
//}}AFX_DATA
|
||||||
|
|
||||||
|
// ClassWizard generated virtual function overrides
|
||||||
|
//{{AFX_VIRTUAL(CChartDemoDlg)
|
||||||
|
protected:
|
||||||
|
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
||||||
|
//}}AFX_VIRTUAL
|
||||||
|
|
||||||
|
// Implementation
|
||||||
|
protected:
|
||||||
|
HICON m_hIcon;
|
||||||
|
|
||||||
|
// Generated message map functions
|
||||||
|
//{{AFX_MSG(CChartDemoDlg)
|
||||||
|
virtual BOOL OnInitDialog();
|
||||||
|
afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
|
||||||
|
afx_msg void OnPaint();
|
||||||
|
afx_msg HCURSOR OnQueryDragIcon();
|
||||||
|
afx_msg void OnAddseries();
|
||||||
|
afx_msg void OnLegendVisible();
|
||||||
|
afx_msg void OnBottomAxisRadio();
|
||||||
|
afx_msg void OnLeftAxisRadio();
|
||||||
|
afx_msg void OnRightAxisRadio();
|
||||||
|
afx_msg void OnTopAxisRadio();
|
||||||
|
afx_msg void OnAxisAutomaticCheck();
|
||||||
|
afx_msg void OnAxisGridVisCheck();
|
||||||
|
afx_msg void OnAxisVisibleCheck();
|
||||||
|
afx_msg void OnAxisScrollBarCheck();
|
||||||
|
afx_msg LONG OnChangeBckCol(UINT lParam, LONG wParam);
|
||||||
|
afx_msg void OnChangeAxisMax();
|
||||||
|
afx_msg void OnChangeAxisMin();
|
||||||
|
afx_msg void OnAxisInvertedCheck();
|
||||||
|
afx_msg void OnChangeAxisLabel();
|
||||||
|
afx_msg void OnDeleteSeries();
|
||||||
|
afx_msg void OnChangeTitle();
|
||||||
|
afx_msg void OnPanCheck();
|
||||||
|
afx_msg void OnZoomCheck();
|
||||||
|
afx_msg void OnSaveImage();
|
||||||
|
//}}AFX_MSG
|
||||||
|
DECLARE_MESSAGE_MAP()
|
||||||
|
|
||||||
|
CChartAxis* GetSelectedAxis();
|
||||||
|
|
||||||
|
CChartCtrl m_ChartCtrl;
|
||||||
|
};
|
||||||
|
|
||||||
|
//{{AFX_INSERT_LOCATION}}
|
||||||
|
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
|
||||||
|
|
||||||
|
#endif // !defined(AFX_CHARTDEMODLG_H__1C3B17D7_0821_47FC_B873_9D9337728F79__INCLUDED_)
|
|
@ -0,0 +1,309 @@
|
||||||
|
// ColourPicker.cpp : implementation file
|
||||||
|
//
|
||||||
|
// ColourPicker is a drop-in colour picker control. Check out the
|
||||||
|
// header file or the accompanying HTML doc file for details.
|
||||||
|
//
|
||||||
|
// Written by Chris Maunder (chrismaunder@codeguru.com)
|
||||||
|
// Extended by Alexander Bischofberger (bischofb@informatik.tu-muenchen.de)
|
||||||
|
// Copyright (c) 1998.
|
||||||
|
//
|
||||||
|
// This code may be used in compiled form in any way you desire. This
|
||||||
|
// file may be redistributed unmodified by any means PROVIDING it is
|
||||||
|
// not sold for profit without the authors written consent, and
|
||||||
|
// providing that this notice and the authors name is included. If
|
||||||
|
// the source code in this file is used in any commercial application
|
||||||
|
// then a simple email would be nice.
|
||||||
|
//
|
||||||
|
// This file is provided "as is" with no expressed or implied warranty.
|
||||||
|
// The author accepts no liability if it causes any damage to your
|
||||||
|
// computer, causes your pet cat to fall ill, increases baldness or
|
||||||
|
// makes you car start emitting strange noises when you start it up.
|
||||||
|
//
|
||||||
|
// Expect bugs.
|
||||||
|
//
|
||||||
|
// Please use and enjoy. Please let me know of any bugs/mods/improvements
|
||||||
|
// that you have found/implemented and I will fix/incorporate them into this
|
||||||
|
// file.
|
||||||
|
//
|
||||||
|
// Updated 16 May 1998
|
||||||
|
// 31 May 1998 - added Default text (CJM)
|
||||||
|
// 9 Jan 1999 - minor vis update
|
||||||
|
|
||||||
|
#include "stdafx.h"
|
||||||
|
#include "ColourPopup.h"
|
||||||
|
#include "ColourPicker.h"
|
||||||
|
|
||||||
|
#ifdef _DEBUG
|
||||||
|
#define new DEBUG_NEW
|
||||||
|
#undef THIS_FILE
|
||||||
|
static char THIS_FILE[] = __FILE__;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void AFXAPI DDX_ColourPicker(CDataExchange *pDX, int nIDC, COLORREF& crColour)
|
||||||
|
{
|
||||||
|
HWND hWndCtrl = pDX->PrepareCtrl(nIDC);
|
||||||
|
ASSERT (hWndCtrl != NULL);
|
||||||
|
|
||||||
|
CColourPicker* pColourPicker = (CColourPicker*) CWnd::FromHandle(hWndCtrl);
|
||||||
|
if (pDX->m_bSaveAndValidate)
|
||||||
|
{
|
||||||
|
crColour = pColourPicker->GetColour();
|
||||||
|
}
|
||||||
|
else // initializing
|
||||||
|
{
|
||||||
|
pColourPicker->SetColour(crColour);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CColourPicker
|
||||||
|
|
||||||
|
CColourPicker::CColourPicker()
|
||||||
|
{
|
||||||
|
SetBkColour(GetSysColor(COLOR_3DFACE));
|
||||||
|
SetTextColour(GetSysColor(COLOR_BTNTEXT));
|
||||||
|
|
||||||
|
m_bTrackSelection = FALSE;
|
||||||
|
m_nSelectionMode = CP_MODE_BK;
|
||||||
|
m_bActive = FALSE;
|
||||||
|
|
||||||
|
m_strDefaultText = _T("Automatic");
|
||||||
|
m_strCustomText = _T("More Colours...");
|
||||||
|
}
|
||||||
|
|
||||||
|
CColourPicker::~CColourPicker()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
IMPLEMENT_DYNCREATE(CColourPicker, CButton)
|
||||||
|
|
||||||
|
BEGIN_MESSAGE_MAP(CColourPicker, CButton)
|
||||||
|
//{{AFX_MSG_MAP(CColourPicker)
|
||||||
|
ON_CONTROL_REFLECT_EX(BN_CLICKED, OnClicked)
|
||||||
|
ON_WM_CREATE()
|
||||||
|
//}}AFX_MSG_MAP
|
||||||
|
ON_MESSAGE(CPN_SELENDOK, OnSelEndOK)
|
||||||
|
ON_MESSAGE(CPN_SELENDCANCEL, OnSelEndCancel)
|
||||||
|
ON_MESSAGE(CPN_SELCHANGE, OnSelChange)
|
||||||
|
END_MESSAGE_MAP()
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CColourPicker message handlers
|
||||||
|
|
||||||
|
LONG CColourPicker::OnSelEndOK(UINT lParam, LONG /*wParam*/)
|
||||||
|
{
|
||||||
|
COLORREF crNewColour = (COLORREF) lParam;
|
||||||
|
m_bActive = FALSE;
|
||||||
|
SetColour(crNewColour);
|
||||||
|
|
||||||
|
CWnd *pParent = GetParent();
|
||||||
|
if (pParent) {
|
||||||
|
pParent->SendMessage(CPN_CLOSEUP, lParam, (WPARAM) GetDlgCtrlID());
|
||||||
|
pParent->SendMessage(CPN_SELENDOK, lParam, (WPARAM) GetDlgCtrlID());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (crNewColour != GetColour())
|
||||||
|
if (pParent) pParent->SendMessage(CPN_SELCHANGE, lParam, (WPARAM) GetDlgCtrlID());
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
LONG CColourPicker::OnSelEndCancel(UINT lParam, LONG /*wParam*/)
|
||||||
|
{
|
||||||
|
m_bActive = FALSE;
|
||||||
|
SetColour((COLORREF) lParam);
|
||||||
|
|
||||||
|
CWnd *pParent = GetParent();
|
||||||
|
if (pParent) {
|
||||||
|
pParent->SendMessage(CPN_CLOSEUP, lParam, (WPARAM) GetDlgCtrlID());
|
||||||
|
pParent->SendMessage(CPN_SELENDCANCEL, lParam, (WPARAM) GetDlgCtrlID());
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
LONG CColourPicker::OnSelChange(UINT lParam, LONG /*wParam*/)
|
||||||
|
{
|
||||||
|
if (m_bTrackSelection) SetColour((COLORREF) lParam);
|
||||||
|
|
||||||
|
CWnd *pParent = GetParent();
|
||||||
|
if (pParent) pParent->SendMessage(CPN_SELCHANGE, lParam, (WPARAM) GetDlgCtrlID());
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
int CColourPicker::OnCreate(LPCREATESTRUCT lpCreateStruct)
|
||||||
|
{
|
||||||
|
if (CButton::OnCreate(lpCreateStruct) == -1)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
SetWindowSize(); // resize appropriately
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// On mouse click, create and show a CColourPopup window for colour selection
|
||||||
|
BOOL CColourPicker::OnClicked()
|
||||||
|
{
|
||||||
|
m_bActive = TRUE;
|
||||||
|
CRect rect;
|
||||||
|
GetWindowRect(rect);
|
||||||
|
new CColourPopup(CPoint(rect.left, rect.bottom), // Point to display popup
|
||||||
|
GetColour(), // Selected colour
|
||||||
|
this, // parent
|
||||||
|
m_strDefaultText, // "Default" text area
|
||||||
|
m_strCustomText); // Custom Text
|
||||||
|
|
||||||
|
CWnd *pParent = GetParent();
|
||||||
|
if (pParent)
|
||||||
|
pParent->SendMessage(CPN_DROPDOWN, (LPARAM)GetColour(), (WPARAM) GetDlgCtrlID());
|
||||||
|
|
||||||
|
// Docs say I should return FALSE to stop the parent also getting the message.
|
||||||
|
// HA! What a joke.
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CColourPicker::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct)
|
||||||
|
{
|
||||||
|
ASSERT(lpDrawItemStruct);
|
||||||
|
|
||||||
|
CDC* pDC = CDC::FromHandle(lpDrawItemStruct->hDC);
|
||||||
|
CRect rect = lpDrawItemStruct->rcItem;
|
||||||
|
UINT state = lpDrawItemStruct->itemState;
|
||||||
|
CString m_strText;
|
||||||
|
|
||||||
|
CSize Margins(::GetSystemMetrics(SM_CXEDGE), ::GetSystemMetrics(SM_CYEDGE));
|
||||||
|
|
||||||
|
// Draw arrow
|
||||||
|
if (m_bActive) state |= ODS_SELECTED;
|
||||||
|
pDC->DrawFrameControl(&m_ArrowRect, DFC_SCROLL, DFCS_SCROLLDOWN |
|
||||||
|
((state & ODS_SELECTED) ? DFCS_PUSHED : 0) |
|
||||||
|
((state & ODS_DISABLED) ? DFCS_INACTIVE : 0));
|
||||||
|
|
||||||
|
pDC->DrawEdge(rect, EDGE_SUNKEN, BF_RECT);
|
||||||
|
|
||||||
|
// Must reduce the size of the "client" area of the button due to edge thickness.
|
||||||
|
rect.DeflateRect(Margins.cx, Margins.cy);
|
||||||
|
|
||||||
|
// Fill remaining area with colour
|
||||||
|
rect.right -= m_ArrowRect.Width();
|
||||||
|
|
||||||
|
CBrush brush( ((state & ODS_DISABLED) || m_crColourBk == CLR_DEFAULT)?
|
||||||
|
::GetSysColor(COLOR_3DFACE) : m_crColourBk);
|
||||||
|
CBrush* pOldBrush = (CBrush*) pDC->SelectObject(&brush);
|
||||||
|
pDC->SelectStockObject(NULL_PEN);
|
||||||
|
pDC->Rectangle(rect);
|
||||||
|
pDC->SelectObject(pOldBrush);
|
||||||
|
|
||||||
|
// Draw the window text (if any)
|
||||||
|
GetWindowText(m_strText);
|
||||||
|
if (m_strText.GetLength())
|
||||||
|
{
|
||||||
|
pDC->SetBkMode(TRANSPARENT);
|
||||||
|
if (state & ODS_DISABLED)
|
||||||
|
{
|
||||||
|
rect.OffsetRect(1,1);
|
||||||
|
pDC->SetTextColor(::GetSysColor(COLOR_3DHILIGHT));
|
||||||
|
pDC->DrawText(m_strText, rect, DT_CENTER|DT_SINGLELINE|DT_VCENTER);
|
||||||
|
rect.OffsetRect(-1,-1);
|
||||||
|
pDC->SetTextColor(::GetSysColor(COLOR_3DSHADOW));
|
||||||
|
pDC->DrawText(m_strText, rect, DT_CENTER|DT_SINGLELINE|DT_VCENTER);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pDC->SetTextColor((m_crColourText == CLR_DEFAULT)? 0 : m_crColourText);
|
||||||
|
pDC->DrawText(m_strText, rect, DT_CENTER|DT_SINGLELINE|DT_VCENTER);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Draw focus rect
|
||||||
|
if (state & ODS_FOCUS)
|
||||||
|
{
|
||||||
|
rect.DeflateRect(1,1);
|
||||||
|
pDC->DrawFocusRect(rect);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CColourPicker overrides
|
||||||
|
|
||||||
|
void CColourPicker::PreSubclassWindow()
|
||||||
|
{
|
||||||
|
ModifyStyle(0, BS_OWNERDRAW); // Make it owner drawn
|
||||||
|
CButton::PreSubclassWindow();
|
||||||
|
SetWindowSize(); // resize appropriately
|
||||||
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CColourPicker attributes
|
||||||
|
|
||||||
|
COLORREF CColourPicker::GetColour()
|
||||||
|
{
|
||||||
|
return (m_nSelectionMode == CP_MODE_TEXT)?
|
||||||
|
GetTextColour(): GetBkColour();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CColourPicker::SetColour(COLORREF crColour)
|
||||||
|
{
|
||||||
|
(m_nSelectionMode == CP_MODE_TEXT)?
|
||||||
|
SetTextColour(crColour): SetBkColour(crColour);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CColourPicker::SetBkColour(COLORREF crColourBk)
|
||||||
|
{
|
||||||
|
m_crColourBk = crColourBk;
|
||||||
|
if (IsWindow(m_hWnd))
|
||||||
|
RedrawWindow();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CColourPicker::SetTextColour(COLORREF crColourText)
|
||||||
|
{
|
||||||
|
m_crColourText = crColourText;
|
||||||
|
if (IsWindow(m_hWnd))
|
||||||
|
RedrawWindow();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CColourPicker::SetDefaultText(LPCTSTR szDefaultText)
|
||||||
|
{
|
||||||
|
m_strDefaultText = (szDefaultText)? szDefaultText : _T("");
|
||||||
|
}
|
||||||
|
|
||||||
|
void CColourPicker::SetCustomText(LPCTSTR szCustomText)
|
||||||
|
{
|
||||||
|
m_strCustomText = (szCustomText)? szCustomText : _T("");
|
||||||
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CColourPicker implementation
|
||||||
|
|
||||||
|
void CColourPicker::SetWindowSize()
|
||||||
|
{
|
||||||
|
// Get size dimensions of edges
|
||||||
|
CSize MarginSize(::GetSystemMetrics(SM_CXEDGE), ::GetSystemMetrics(SM_CYEDGE));
|
||||||
|
|
||||||
|
// Get size of dropdown arrow
|
||||||
|
int nArrowWidth = max(::GetSystemMetrics(SM_CXHTHUMB), 5*MarginSize.cx);
|
||||||
|
int nArrowHeight = max(::GetSystemMetrics(SM_CYVTHUMB), 5*MarginSize.cy);
|
||||||
|
CSize ArrowSize(max(nArrowWidth, nArrowHeight), max(nArrowWidth, nArrowHeight));
|
||||||
|
|
||||||
|
// Get window size
|
||||||
|
CRect rect;
|
||||||
|
GetWindowRect(rect);
|
||||||
|
|
||||||
|
CWnd* pParent = GetParent();
|
||||||
|
if (pParent)
|
||||||
|
pParent->ScreenToClient(rect);
|
||||||
|
|
||||||
|
// Set window size at least as wide as 2 arrows, and as high as arrow + margins
|
||||||
|
int nWidth = max(rect.Width(), 2*ArrowSize.cx + 2*MarginSize.cx);
|
||||||
|
MoveWindow(rect.left, rect.top, nWidth, ArrowSize.cy+2*MarginSize.cy, TRUE);
|
||||||
|
|
||||||
|
// Get the new coords of this window
|
||||||
|
GetWindowRect(rect);
|
||||||
|
ScreenToClient(rect);
|
||||||
|
|
||||||
|
// Get the rect where the arrow goes, and convert to client coords.
|
||||||
|
m_ArrowRect.SetRect(rect.right - ArrowSize.cx - MarginSize.cx,
|
||||||
|
rect.top + MarginSize.cy, rect.right - MarginSize.cx,
|
||||||
|
rect.bottom - MarginSize.cy);
|
||||||
|
}
|
|
@ -0,0 +1,113 @@
|
||||||
|
#if !defined(AFX_COLOURPICKER_H__D0B75901_9830_11D1_9C0F_00A0243D1382__INCLUDED_)
|
||||||
|
#define AFX_COLOURPICKER_H__D0B75901_9830_11D1_9C0F_00A0243D1382__INCLUDED_
|
||||||
|
|
||||||
|
#if _MSC_VER >= 1000
|
||||||
|
#pragma once
|
||||||
|
#endif // _MSC_VER >= 1000
|
||||||
|
|
||||||
|
// ColourPicker.h : header file
|
||||||
|
//
|
||||||
|
// Written by Chris Maunder (chrismaunder@codeguru.com)
|
||||||
|
// Extended by Alexander Bischofberger (bischofb@informatik.tu-muenchen.de)
|
||||||
|
// Copyright (c) 1998.
|
||||||
|
//
|
||||||
|
// This code may be used in compiled form in any way you desire. This
|
||||||
|
// file may be redistributed unmodified by any means PROVIDING it is
|
||||||
|
// not sold for profit without the authors written consent, and
|
||||||
|
// providing that this notice and the authors name is included. If
|
||||||
|
// the source code in this file is used in any commercial application
|
||||||
|
// then a simple email would be nice.
|
||||||
|
//
|
||||||
|
// This file is provided "as is" with no expressed or implied warranty.
|
||||||
|
// The author accepts no liability if it causes any damage whatsoever.
|
||||||
|
// It's free - so you get what you pay for.
|
||||||
|
|
||||||
|
#include "ColourPopup.h"
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CColourPicker window
|
||||||
|
|
||||||
|
void AFXAPI DDX_ColourPicker(CDataExchange *pDX, int nIDC, COLORREF& crColour);
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CColourPicker window
|
||||||
|
|
||||||
|
#define CP_MODE_TEXT 1 // edit text colour
|
||||||
|
#define CP_MODE_BK 2 // edit background colour (default)
|
||||||
|
|
||||||
|
class CColourPicker : public CButton
|
||||||
|
{
|
||||||
|
// Construction
|
||||||
|
public:
|
||||||
|
CColourPicker();
|
||||||
|
DECLARE_DYNCREATE(CColourPicker);
|
||||||
|
|
||||||
|
// Attributes
|
||||||
|
public:
|
||||||
|
COLORREF GetColour();
|
||||||
|
void SetColour(COLORREF crColour);
|
||||||
|
|
||||||
|
void SetDefaultText(LPCTSTR szDefaultText);
|
||||||
|
void SetCustomText(LPCTSTR szCustomText);
|
||||||
|
|
||||||
|
void SetTrackSelection(BOOL bTracking = TRUE) { m_bTrackSelection = bTracking; }
|
||||||
|
BOOL GetTrackSelection() { return m_bTrackSelection; }
|
||||||
|
|
||||||
|
void SetSelectionMode(UINT nMode) { m_nSelectionMode = nMode; }
|
||||||
|
UINT GetSelectionMode() { return m_nSelectionMode; };
|
||||||
|
|
||||||
|
void SetBkColour(COLORREF crColourBk);
|
||||||
|
COLORREF GetBkColour() { return m_crColourBk; }
|
||||||
|
|
||||||
|
void SetTextColour(COLORREF crColourText);
|
||||||
|
COLORREF GetTextColour() { return m_crColourText;}
|
||||||
|
|
||||||
|
// Operations
|
||||||
|
public:
|
||||||
|
|
||||||
|
// Overrides
|
||||||
|
// ClassWizard generated virtual function overrides
|
||||||
|
//{{AFX_VIRTUAL(CColourPicker)
|
||||||
|
public:
|
||||||
|
virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct);
|
||||||
|
protected:
|
||||||
|
virtual void PreSubclassWindow();
|
||||||
|
//}}AFX_VIRTUAL
|
||||||
|
|
||||||
|
// Implementation
|
||||||
|
public:
|
||||||
|
virtual ~CColourPicker();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void SetWindowSize();
|
||||||
|
|
||||||
|
// protected attributes
|
||||||
|
protected:
|
||||||
|
BOOL m_bActive, // Is the dropdown active?
|
||||||
|
m_bTrackSelection; // track colour changes?
|
||||||
|
COLORREF m_crColourBk;
|
||||||
|
COLORREF m_crColourText;
|
||||||
|
UINT m_nSelectionMode;
|
||||||
|
CRect m_ArrowRect;
|
||||||
|
CString m_strDefaultText;
|
||||||
|
CString m_strCustomText;
|
||||||
|
|
||||||
|
// Generated message map functions
|
||||||
|
protected:
|
||||||
|
//{{AFX_MSG(CColourPicker)
|
||||||
|
afx_msg BOOL OnClicked();
|
||||||
|
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
|
||||||
|
//}}AFX_MSG
|
||||||
|
afx_msg LONG OnSelEndOK(UINT lParam, LONG wParam);
|
||||||
|
afx_msg LONG OnSelEndCancel(UINT lParam, LONG wParam);
|
||||||
|
afx_msg LONG OnSelChange(UINT lParam, LONG wParam);
|
||||||
|
|
||||||
|
DECLARE_MESSAGE_MAP()
|
||||||
|
};
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
//{{AFX_INSERT_LOCATION}}
|
||||||
|
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
|
||||||
|
|
||||||
|
#endif // !defined(AFX_COLOURPICKER_H__D0B75901_9830_11D1_9C0F_00A0243D1382__INCLUDED_)
|
|
@ -0,0 +1,917 @@
|
||||||
|
// ColourPopup.cpp : implementation file
|
||||||
|
//
|
||||||
|
// Written by Chris Maunder (chrismaunder@codeguru.com)
|
||||||
|
// Extended by Alexander Bischofberger (bischofb@informatik.tu-muenchen.de)
|
||||||
|
// Copyright (c) 1998.
|
||||||
|
//
|
||||||
|
// Updated 30 May 1998 to allow any number of colours, and to
|
||||||
|
// make the appearance closer to Office 97.
|
||||||
|
// Also added "Default" text area. (CJM)
|
||||||
|
//
|
||||||
|
// 13 June 1998 Fixed change of focus bug (CJM)
|
||||||
|
// 30 June 1998 Fixed bug caused by focus bug fix (D'oh!!)
|
||||||
|
// Solution suggested by Paul Wilkerson.
|
||||||
|
//
|
||||||
|
// ColourPopup is a helper class for the colour picker control
|
||||||
|
// CColourPicker. Check out the header file or the accompanying
|
||||||
|
// HTML doc file for details.
|
||||||
|
//
|
||||||
|
// This code may be used in compiled form in any way you desire. This
|
||||||
|
// file may be redistributed unmodified by any means PROVIDING it is
|
||||||
|
// not sold for profit without the authors written consent, and
|
||||||
|
// providing that this notice and the authors name is included.
|
||||||
|
//
|
||||||
|
// This file is provided "as is" with no expressed or implied warranty.
|
||||||
|
// The author accepts no liability if it causes any damage to you or your
|
||||||
|
// computer whatsoever. It's free, so don't hassle me about it.
|
||||||
|
//
|
||||||
|
// Expect bugs.
|
||||||
|
//
|
||||||
|
// Please use and enjoy. Please let me know of any bugs/mods/improvements
|
||||||
|
// that you have found/implemented and I will fix/incorporate them into this
|
||||||
|
// file.
|
||||||
|
|
||||||
|
#include "stdafx.h"
|
||||||
|
#include <math.h>
|
||||||
|
#include "ColourPicker.h"
|
||||||
|
#include "ColourPopup.h"
|
||||||
|
|
||||||
|
#ifdef _DEBUG
|
||||||
|
#define new DEBUG_NEW
|
||||||
|
#undef THIS_FILE
|
||||||
|
static char THIS_FILE[] = __FILE__;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define DEFAULT_BOX_VALUE -3
|
||||||
|
#define CUSTOM_BOX_VALUE -2
|
||||||
|
#define INVALID_COLOUR -1
|
||||||
|
|
||||||
|
#define MAX_COLOURS 100
|
||||||
|
|
||||||
|
|
||||||
|
ColourTableEntry CColourPopup::m_crColours[] =
|
||||||
|
{
|
||||||
|
{ RGB(0x00, 0x00, 0x00), _T("Black") },
|
||||||
|
{ RGB(0xA5, 0x2A, 0x00), _T("Brown") },
|
||||||
|
{ RGB(0x00, 0x40, 0x40), _T("Dark Olive Green") },
|
||||||
|
{ RGB(0x00, 0x55, 0x00), _T("Dark Green") },
|
||||||
|
{ RGB(0x00, 0x00, 0x5E), _T("Dark Teal") },
|
||||||
|
{ RGB(0x00, 0x00, 0x8B), _T("Dark blue") },
|
||||||
|
{ RGB(0x4B, 0x00, 0x82), _T("Indigo") },
|
||||||
|
{ RGB(0x28, 0x28, 0x28), _T("Dark grey") },
|
||||||
|
|
||||||
|
{ RGB(0x8B, 0x00, 0x00), _T("Dark red") },
|
||||||
|
{ RGB(0xFF, 0x68, 0x20), _T("Orange") },
|
||||||
|
{ RGB(0x8B, 0x8B, 0x00), _T("Dark yellow") },
|
||||||
|
{ RGB(0x00, 0x93, 0x00), _T("Green") },
|
||||||
|
{ RGB(0x38, 0x8E, 0x8E), _T("Teal") },
|
||||||
|
{ RGB(0x00, 0x00, 0xFF), _T("Blue") },
|
||||||
|
{ RGB(0x7B, 0x7B, 0xC0), _T("Blue-grey") },
|
||||||
|
{ RGB(0x66, 0x66, 0x66), _T("Grey - 40") },
|
||||||
|
|
||||||
|
{ RGB(0xFF, 0x00, 0x00), _T("Red") },
|
||||||
|
{ RGB(0xFF, 0xAD, 0x5B), _T("Light orange") },
|
||||||
|
{ RGB(0x32, 0xCD, 0x32), _T("Lime") },
|
||||||
|
{ RGB(0x3C, 0xB3, 0x71), _T("Sea green") },
|
||||||
|
{ RGB(0x7F, 0xFF, 0xD4), _T("Aqua") },
|
||||||
|
{ RGB(0x7D, 0x9E, 0xC0), _T("Light blue") },
|
||||||
|
{ RGB(0x80, 0x00, 0x80), _T("Violet") },
|
||||||
|
{ RGB(0x7F, 0x7F, 0x7F), _T("Grey - 50") },
|
||||||
|
|
||||||
|
{ RGB(0xFF, 0xC0, 0xCB), _T("Pink") },
|
||||||
|
{ RGB(0xFF, 0xD7, 0x00), _T("Gold") },
|
||||||
|
{ RGB(0xFF, 0xFF, 0x00), _T("Yellow") },
|
||||||
|
{ RGB(0x00, 0xFF, 0x00), _T("Bright green") },
|
||||||
|
{ RGB(0x40, 0xE0, 0xD0), _T("Turquoise") },
|
||||||
|
{ RGB(0xC0, 0xFF, 0xFF), _T("Skyblue") },
|
||||||
|
{ RGB(0x48, 0x00, 0x48), _T("Plum") },
|
||||||
|
{ RGB(0xC0, 0xC0, 0xC0), _T("Light grey") },
|
||||||
|
|
||||||
|
{ RGB(0xFF, 0xE4, 0xE1), _T("Rose") },
|
||||||
|
{ RGB(0xD2, 0xB4, 0x8C), _T("Tan") },
|
||||||
|
{ RGB(0xFF, 0xFF, 0xE0), _T("Light yellow") },
|
||||||
|
{ RGB(0x98, 0xFB, 0x98), _T("Pale green ") },
|
||||||
|
{ RGB(0xAF, 0xEE, 0xEE), _T("Pale turquoise") },
|
||||||
|
{ RGB(0x68, 0x83, 0x8B), _T("Pale blue") },
|
||||||
|
{ RGB(0xE6, 0xE6, 0xFA), _T("Lavender") },
|
||||||
|
{ RGB(0xFF, 0xFF, 0xFF), _T("White") }
|
||||||
|
};
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CColourPopup
|
||||||
|
|
||||||
|
CColourPopup::CColourPopup()
|
||||||
|
{
|
||||||
|
Initialise();
|
||||||
|
}
|
||||||
|
|
||||||
|
CColourPopup::CColourPopup(CPoint p, COLORREF crColour, CWnd* pParentWnd,
|
||||||
|
LPCTSTR szDefaultText /* = NULL */,
|
||||||
|
LPCTSTR szCustomText /* = NULL */)
|
||||||
|
{
|
||||||
|
Initialise();
|
||||||
|
|
||||||
|
m_crColour = m_crInitialColour = crColour;
|
||||||
|
m_pParent = pParentWnd;
|
||||||
|
m_strDefaultText = (szDefaultText)? szDefaultText : _T("");
|
||||||
|
m_strCustomText = (szCustomText)? szCustomText : _T("");
|
||||||
|
|
||||||
|
CColourPopup::Create(p, crColour, pParentWnd, szDefaultText, szCustomText);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CColourPopup::Initialise()
|
||||||
|
{
|
||||||
|
m_nNumColours = sizeof(m_crColours)/sizeof(ColourTableEntry);
|
||||||
|
ASSERT(m_nNumColours <= MAX_COLOURS);
|
||||||
|
if (m_nNumColours > MAX_COLOURS)
|
||||||
|
m_nNumColours = MAX_COLOURS;
|
||||||
|
|
||||||
|
m_nNumColumns = 0;
|
||||||
|
m_nNumRows = 0;
|
||||||
|
m_nBoxSize = 18;
|
||||||
|
m_nMargin = ::GetSystemMetrics(SM_CXEDGE);
|
||||||
|
m_nCurrentSel = INVALID_COLOUR;
|
||||||
|
m_nChosenColourSel = INVALID_COLOUR;
|
||||||
|
m_pParent = NULL;
|
||||||
|
m_crColour = m_crInitialColour = RGB(0,0,0);
|
||||||
|
|
||||||
|
m_bChildWindowVisible = FALSE;
|
||||||
|
|
||||||
|
// Idiot check: Make sure the colour square is at least 5 x 5;
|
||||||
|
if (m_nBoxSize - 2*m_nMargin - 2 < 5) m_nBoxSize = 5 + 2*m_nMargin + 2;
|
||||||
|
|
||||||
|
// Create the font
|
||||||
|
NONCLIENTMETRICS ncm;
|
||||||
|
ncm.cbSize = sizeof(NONCLIENTMETRICS);
|
||||||
|
VERIFY(SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(NONCLIENTMETRICS), &ncm, 0));
|
||||||
|
m_Font.CreateFontIndirect(&(ncm.lfMessageFont));
|
||||||
|
|
||||||
|
// Create the palette
|
||||||
|
struct {
|
||||||
|
LOGPALETTE LogPalette;
|
||||||
|
PALETTEENTRY PalEntry[MAX_COLOURS];
|
||||||
|
} pal;
|
||||||
|
|
||||||
|
LOGPALETTE* pLogPalette = (LOGPALETTE*) &pal;
|
||||||
|
pLogPalette->palVersion = 0x300;
|
||||||
|
pLogPalette->palNumEntries = (WORD) m_nNumColours;
|
||||||
|
|
||||||
|
for (int i = 0; i < m_nNumColours; i++)
|
||||||
|
{
|
||||||
|
pLogPalette->palPalEntry[i].peRed = GetRValue(m_crColours[i].crColour);
|
||||||
|
pLogPalette->palPalEntry[i].peGreen = GetGValue(m_crColours[i].crColour);
|
||||||
|
pLogPalette->palPalEntry[i].peBlue = GetBValue(m_crColours[i].crColour);
|
||||||
|
pLogPalette->palPalEntry[i].peFlags = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_Palette.CreatePalette(pLogPalette);
|
||||||
|
}
|
||||||
|
|
||||||
|
CColourPopup::~CColourPopup()
|
||||||
|
{
|
||||||
|
m_Font.DeleteObject();
|
||||||
|
m_Palette.DeleteObject();
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL CColourPopup::Create(CPoint p, COLORREF crColour, CWnd* pParentWnd,
|
||||||
|
LPCTSTR szDefaultText /* = NULL */,
|
||||||
|
LPCTSTR szCustomText /* = NULL */)
|
||||||
|
{
|
||||||
|
ASSERT(pParentWnd && ::IsWindow(pParentWnd->GetSafeHwnd()));
|
||||||
|
ASSERT(pParentWnd->IsKindOf(RUNTIME_CLASS(CColourPicker)));
|
||||||
|
|
||||||
|
m_pParent = pParentWnd;
|
||||||
|
m_crColour = m_crInitialColour = crColour;
|
||||||
|
|
||||||
|
// Get the class name and create the window
|
||||||
|
CString szClassName = AfxRegisterWndClass(CS_CLASSDC|CS_SAVEBITS|CS_HREDRAW|CS_VREDRAW,
|
||||||
|
0,
|
||||||
|
(HBRUSH) (COLOR_BTNFACE+1),
|
||||||
|
0);
|
||||||
|
|
||||||
|
if (!CWnd::CreateEx(0, szClassName, _T(""), WS_VISIBLE|WS_POPUP,
|
||||||
|
p.x, p.y, 100, 100, // size updated soon
|
||||||
|
pParentWnd->GetSafeHwnd(), 0, NULL))
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
// Store the Custom text
|
||||||
|
if (szCustomText != NULL)
|
||||||
|
m_strCustomText = szCustomText;
|
||||||
|
|
||||||
|
// Store the Default Area text
|
||||||
|
if (szDefaultText != NULL)
|
||||||
|
m_strDefaultText = szDefaultText;
|
||||||
|
|
||||||
|
// Set the window size
|
||||||
|
SetWindowSize();
|
||||||
|
|
||||||
|
// Create the tooltips
|
||||||
|
CreateToolTips();
|
||||||
|
|
||||||
|
// Find which cell (if any) corresponds to the initial colour
|
||||||
|
FindCellFromColour(crColour);
|
||||||
|
|
||||||
|
// Capture all mouse events for the life of this window
|
||||||
|
SetCapture();
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
BEGIN_MESSAGE_MAP(CColourPopup, CWnd)
|
||||||
|
//{{AFX_MSG_MAP(CColourPopup)
|
||||||
|
ON_WM_NCDESTROY()
|
||||||
|
ON_WM_LBUTTONUP()
|
||||||
|
ON_WM_PAINT()
|
||||||
|
ON_WM_MOUSEMOVE()
|
||||||
|
ON_WM_KEYDOWN()
|
||||||
|
ON_WM_QUERYNEWPALETTE()
|
||||||
|
ON_WM_PALETTECHANGED()
|
||||||
|
ON_WM_KILLFOCUS()
|
||||||
|
ON_WM_ACTIVATEAPP()
|
||||||
|
//}}AFX_MSG_MAP
|
||||||
|
END_MESSAGE_MAP()
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CColourPopup message handlers
|
||||||
|
|
||||||
|
// For tooltips
|
||||||
|
BOOL CColourPopup::PreTranslateMessage(MSG* pMsg)
|
||||||
|
{
|
||||||
|
m_ToolTip.RelayEvent(pMsg);
|
||||||
|
|
||||||
|
// Fix (Adrian Roman): Sometimes if the picker loses focus it is never destroyed
|
||||||
|
if (GetCapture()->GetSafeHwnd() != m_hWnd)
|
||||||
|
SetCapture();
|
||||||
|
|
||||||
|
return CWnd::PreTranslateMessage(pMsg);
|
||||||
|
}
|
||||||
|
|
||||||
|
// If an arrow key is pressed, then move the selection
|
||||||
|
void CColourPopup::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
|
||||||
|
{
|
||||||
|
int row = GetRow(m_nCurrentSel),
|
||||||
|
col = GetColumn(m_nCurrentSel);
|
||||||
|
|
||||||
|
if (nChar == VK_DOWN)
|
||||||
|
{
|
||||||
|
if (row == DEFAULT_BOX_VALUE)
|
||||||
|
row = col = 0;
|
||||||
|
else if (row == CUSTOM_BOX_VALUE)
|
||||||
|
{
|
||||||
|
if (m_strDefaultText.GetLength())
|
||||||
|
row = col = DEFAULT_BOX_VALUE;
|
||||||
|
else
|
||||||
|
row = col = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
row++;
|
||||||
|
if (GetIndex(row,col) < 0)
|
||||||
|
{
|
||||||
|
if (m_strCustomText.GetLength())
|
||||||
|
row = col = CUSTOM_BOX_VALUE;
|
||||||
|
else if (m_strDefaultText.GetLength())
|
||||||
|
row = col = DEFAULT_BOX_VALUE;
|
||||||
|
else
|
||||||
|
row = col = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ChangeSelection(GetIndex(row, col));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (nChar == VK_UP)
|
||||||
|
{
|
||||||
|
if (row == DEFAULT_BOX_VALUE)
|
||||||
|
{
|
||||||
|
if (m_strCustomText.GetLength())
|
||||||
|
row = col = CUSTOM_BOX_VALUE;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
row = GetRow(m_nNumColours-1);
|
||||||
|
col = GetColumn(m_nNumColours-1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (row == CUSTOM_BOX_VALUE)
|
||||||
|
{
|
||||||
|
row = GetRow(m_nNumColours-1);
|
||||||
|
col = GetColumn(m_nNumColours-1);
|
||||||
|
}
|
||||||
|
else if (row > 0) row--;
|
||||||
|
else /* row == 0 */
|
||||||
|
{
|
||||||
|
if (m_strDefaultText.GetLength())
|
||||||
|
row = col = DEFAULT_BOX_VALUE;
|
||||||
|
else if (m_strCustomText.GetLength())
|
||||||
|
row = col = CUSTOM_BOX_VALUE;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
row = GetRow(m_nNumColours-1);
|
||||||
|
col = GetColumn(m_nNumColours-1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ChangeSelection(GetIndex(row, col));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (nChar == VK_RIGHT)
|
||||||
|
{
|
||||||
|
if (row == DEFAULT_BOX_VALUE)
|
||||||
|
row = col = 0;
|
||||||
|
else if (row == CUSTOM_BOX_VALUE)
|
||||||
|
{
|
||||||
|
if (m_strDefaultText.GetLength())
|
||||||
|
row = col = DEFAULT_BOX_VALUE;
|
||||||
|
else
|
||||||
|
row = col = 0;
|
||||||
|
}
|
||||||
|
else if (col < m_nNumColumns-1)
|
||||||
|
col++;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
col = 0; row++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (GetIndex(row,col) == INVALID_COLOUR)
|
||||||
|
{
|
||||||
|
if (m_strCustomText.GetLength())
|
||||||
|
row = col = CUSTOM_BOX_VALUE;
|
||||||
|
else if (m_strDefaultText.GetLength())
|
||||||
|
row = col = DEFAULT_BOX_VALUE;
|
||||||
|
else
|
||||||
|
row = col = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
ChangeSelection(GetIndex(row, col));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (nChar == VK_LEFT)
|
||||||
|
{
|
||||||
|
if (row == DEFAULT_BOX_VALUE)
|
||||||
|
{
|
||||||
|
if (m_strCustomText.GetLength())
|
||||||
|
row = col = CUSTOM_BOX_VALUE;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
row = GetRow(m_nNumColours-1);
|
||||||
|
col = GetColumn(m_nNumColours-1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (row == CUSTOM_BOX_VALUE)
|
||||||
|
{
|
||||||
|
row = GetRow(m_nNumColours-1);
|
||||||
|
col = GetColumn(m_nNumColours-1);
|
||||||
|
}
|
||||||
|
else if (col > 0) col--;
|
||||||
|
else /* col == 0 */
|
||||||
|
{
|
||||||
|
if (row > 0) { row--; col = m_nNumColumns-1; }
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (m_strDefaultText.GetLength())
|
||||||
|
row = col = DEFAULT_BOX_VALUE;
|
||||||
|
else if (m_strCustomText.GetLength())
|
||||||
|
row = col = CUSTOM_BOX_VALUE;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
row = GetRow(m_nNumColours-1);
|
||||||
|
col = GetColumn(m_nNumColours-1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ChangeSelection(GetIndex(row, col));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (nChar == VK_ESCAPE)
|
||||||
|
{
|
||||||
|
m_crColour = m_crInitialColour;
|
||||||
|
EndSelection(CPN_SELENDCANCEL);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (nChar == VK_RETURN || nChar == VK_SPACE)
|
||||||
|
{
|
||||||
|
EndSelection(CPN_SELENDOK);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
CWnd::OnKeyDown(nChar, nRepCnt, nFlags);
|
||||||
|
}
|
||||||
|
|
||||||
|
// auto-deletion
|
||||||
|
void CColourPopup::OnNcDestroy()
|
||||||
|
{
|
||||||
|
CWnd::OnNcDestroy();
|
||||||
|
delete this;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CColourPopup::OnPaint()
|
||||||
|
{
|
||||||
|
CPaintDC dc(this); // device context for painting
|
||||||
|
|
||||||
|
// Draw the Default Area text
|
||||||
|
if (m_strDefaultText.GetLength())
|
||||||
|
DrawCell(&dc, DEFAULT_BOX_VALUE);
|
||||||
|
|
||||||
|
// Draw colour cells
|
||||||
|
for (int i = 0; i < m_nNumColours; i++)
|
||||||
|
DrawCell(&dc, i);
|
||||||
|
|
||||||
|
// Draw custom text
|
||||||
|
if (m_strCustomText.GetLength())
|
||||||
|
DrawCell(&dc, CUSTOM_BOX_VALUE);
|
||||||
|
|
||||||
|
// Draw raised window edge (ex-window style WS_EX_WINDOWEDGE is sposed to do this,
|
||||||
|
// but for some reason isn't
|
||||||
|
CRect rect;
|
||||||
|
GetClientRect(rect);
|
||||||
|
dc.DrawEdge(rect, EDGE_RAISED, BF_RECT);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CColourPopup::OnMouseMove(UINT nFlags, CPoint point)
|
||||||
|
{
|
||||||
|
int nNewSelection = INVALID_COLOUR;
|
||||||
|
|
||||||
|
// Translate points to be relative raised window edge
|
||||||
|
point.x -= m_nMargin;
|
||||||
|
point.y -= m_nMargin;
|
||||||
|
|
||||||
|
// First check we aren't in text box
|
||||||
|
if (m_strCustomText.GetLength() && m_CustomTextRect.PtInRect(point))
|
||||||
|
nNewSelection = CUSTOM_BOX_VALUE;
|
||||||
|
else if (m_strDefaultText.GetLength() && m_DefaultTextRect.PtInRect(point))
|
||||||
|
nNewSelection = DEFAULT_BOX_VALUE;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Take into account text box
|
||||||
|
if (m_strDefaultText.GetLength())
|
||||||
|
point.y -= m_DefaultTextRect.Height();
|
||||||
|
|
||||||
|
// Get the row and column
|
||||||
|
nNewSelection = GetIndex(point.y / m_nBoxSize, point.x / m_nBoxSize);
|
||||||
|
|
||||||
|
// In range? If not, default and exit
|
||||||
|
if (nNewSelection < 0 || nNewSelection >= m_nNumColours)
|
||||||
|
{
|
||||||
|
CWnd::OnMouseMove(nFlags, point);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// OK - we have the row and column of the current selection (may be CUSTOM_BOX_VALUE)
|
||||||
|
// Has the row/col selection changed? If yes, then redraw old and new cells.
|
||||||
|
if (nNewSelection != m_nCurrentSel)
|
||||||
|
ChangeSelection(nNewSelection);
|
||||||
|
|
||||||
|
CWnd::OnMouseMove(nFlags, point);
|
||||||
|
}
|
||||||
|
|
||||||
|
// End selection on LButtonUp
|
||||||
|
void CColourPopup::OnLButtonUp(UINT nFlags, CPoint point)
|
||||||
|
{
|
||||||
|
CWnd::OnLButtonUp(nFlags, point);
|
||||||
|
|
||||||
|
DWORD pos = GetMessagePos();
|
||||||
|
point = CPoint(LOWORD(pos), HIWORD(pos));
|
||||||
|
|
||||||
|
if (m_WindowRect.PtInRect(point))
|
||||||
|
EndSelection(CPN_SELENDOK);
|
||||||
|
else
|
||||||
|
EndSelection(CPN_SELENDCANCEL);
|
||||||
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CColourPopup implementation
|
||||||
|
|
||||||
|
int CColourPopup::GetIndex(int row, int col) const
|
||||||
|
{
|
||||||
|
if ((row == CUSTOM_BOX_VALUE || col == CUSTOM_BOX_VALUE) && m_strCustomText.GetLength())
|
||||||
|
return CUSTOM_BOX_VALUE;
|
||||||
|
else if ((row == DEFAULT_BOX_VALUE || col == DEFAULT_BOX_VALUE) && m_strDefaultText.GetLength())
|
||||||
|
return DEFAULT_BOX_VALUE;
|
||||||
|
else if (row < 0 || col < 0 || row >= m_nNumRows || col >= m_nNumColumns)
|
||||||
|
return INVALID_COLOUR;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (row*m_nNumColumns + col >= m_nNumColours)
|
||||||
|
return INVALID_COLOUR;
|
||||||
|
else
|
||||||
|
return row*m_nNumColumns + col;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int CColourPopup::GetRow(int nIndex) const
|
||||||
|
{
|
||||||
|
if (nIndex == CUSTOM_BOX_VALUE && m_strCustomText.GetLength())
|
||||||
|
return CUSTOM_BOX_VALUE;
|
||||||
|
else if (nIndex == DEFAULT_BOX_VALUE && m_strDefaultText.GetLength())
|
||||||
|
return DEFAULT_BOX_VALUE;
|
||||||
|
else if (nIndex < 0 || nIndex >= m_nNumColours)
|
||||||
|
return INVALID_COLOUR;
|
||||||
|
else
|
||||||
|
return nIndex / m_nNumColumns;
|
||||||
|
}
|
||||||
|
|
||||||
|
int CColourPopup::GetColumn(int nIndex) const
|
||||||
|
{
|
||||||
|
if (nIndex == CUSTOM_BOX_VALUE && m_strCustomText.GetLength())
|
||||||
|
return CUSTOM_BOX_VALUE;
|
||||||
|
else if (nIndex == DEFAULT_BOX_VALUE && m_strDefaultText.GetLength())
|
||||||
|
return DEFAULT_BOX_VALUE;
|
||||||
|
else if (nIndex < 0 || nIndex >= m_nNumColours)
|
||||||
|
return INVALID_COLOUR;
|
||||||
|
else
|
||||||
|
return nIndex % m_nNumColumns;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CColourPopup::FindCellFromColour(COLORREF crColour)
|
||||||
|
{
|
||||||
|
if (crColour == CLR_DEFAULT && m_strDefaultText.GetLength())
|
||||||
|
{
|
||||||
|
m_nChosenColourSel = DEFAULT_BOX_VALUE;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < m_nNumColours; i++)
|
||||||
|
{
|
||||||
|
if (GetColour(i) == crColour)
|
||||||
|
{
|
||||||
|
m_nChosenColourSel = i;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_strCustomText.GetLength())
|
||||||
|
m_nChosenColourSel = CUSTOM_BOX_VALUE;
|
||||||
|
else
|
||||||
|
m_nChosenColourSel = INVALID_COLOUR;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Gets the dimensions of the colour cell given by (row,col)
|
||||||
|
BOOL CColourPopup::GetCellRect(int nIndex, const LPRECT& rect)
|
||||||
|
{
|
||||||
|
if (nIndex == CUSTOM_BOX_VALUE)
|
||||||
|
{
|
||||||
|
::SetRect(rect,
|
||||||
|
m_CustomTextRect.left, m_CustomTextRect.top,
|
||||||
|
m_CustomTextRect.right, m_CustomTextRect.bottom);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
else if (nIndex == DEFAULT_BOX_VALUE)
|
||||||
|
{
|
||||||
|
::SetRect(rect,
|
||||||
|
m_DefaultTextRect.left, m_DefaultTextRect.top,
|
||||||
|
m_DefaultTextRect.right, m_DefaultTextRect.bottom);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (nIndex < 0 || nIndex >= m_nNumColours)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
rect->left = GetColumn(nIndex) * m_nBoxSize + m_nMargin;
|
||||||
|
rect->top = GetRow(nIndex) * m_nBoxSize + m_nMargin;
|
||||||
|
|
||||||
|
// Move everything down if we are displaying a default text area
|
||||||
|
if (m_strDefaultText.GetLength())
|
||||||
|
rect->top += (m_nMargin + m_DefaultTextRect.Height());
|
||||||
|
|
||||||
|
rect->right = rect->left + m_nBoxSize;
|
||||||
|
rect->bottom = rect->top + m_nBoxSize;
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Works out an appropriate size and position of this window
|
||||||
|
void CColourPopup::SetWindowSize()
|
||||||
|
{
|
||||||
|
CSize TextSize;
|
||||||
|
|
||||||
|
// If we are showing a custom or default text area, get the font and text size.
|
||||||
|
if (m_strCustomText.GetLength() || m_strDefaultText.GetLength())
|
||||||
|
{
|
||||||
|
CClientDC dc(this);
|
||||||
|
CFont* pOldFont = (CFont*) dc.SelectObject(&m_Font);
|
||||||
|
|
||||||
|
// Get the size of the custom text (if there IS custom text)
|
||||||
|
TextSize = CSize(0,0);
|
||||||
|
if (m_strCustomText.GetLength())
|
||||||
|
TextSize = dc.GetTextExtent(m_strCustomText);
|
||||||
|
|
||||||
|
// Get the size of the default text (if there IS default text)
|
||||||
|
if (m_strDefaultText.GetLength())
|
||||||
|
{
|
||||||
|
CSize DefaultSize = dc.GetTextExtent(m_strDefaultText);
|
||||||
|
if (DefaultSize.cx > TextSize.cx) TextSize.cx = DefaultSize.cx;
|
||||||
|
if (DefaultSize.cy > TextSize.cy) TextSize.cy = DefaultSize.cy;
|
||||||
|
}
|
||||||
|
|
||||||
|
dc.SelectObject(pOldFont);
|
||||||
|
TextSize += CSize(2*m_nMargin,2*m_nMargin);
|
||||||
|
|
||||||
|
// Add even more space to draw the horizontal line
|
||||||
|
TextSize.cy += 2*m_nMargin + 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get the number of columns and rows
|
||||||
|
//m_nNumColumns = (int) sqrt((double)m_nNumColours); // for a square window (yuk)
|
||||||
|
m_nNumColumns = 8;
|
||||||
|
m_nNumRows = m_nNumColours / m_nNumColumns;
|
||||||
|
if (m_nNumColours % m_nNumColumns) m_nNumRows++;
|
||||||
|
|
||||||
|
// Get the current window position, and set the new size
|
||||||
|
CRect rect;
|
||||||
|
GetWindowRect(rect);
|
||||||
|
|
||||||
|
m_WindowRect.SetRect(rect.left, rect.top,
|
||||||
|
rect.left + m_nNumColumns*m_nBoxSize + 2*m_nMargin,
|
||||||
|
rect.top + m_nNumRows*m_nBoxSize + 2*m_nMargin);
|
||||||
|
|
||||||
|
// if custom text, then expand window if necessary, and set text width as
|
||||||
|
// window width
|
||||||
|
if (m_strDefaultText.GetLength())
|
||||||
|
{
|
||||||
|
if (TextSize.cx > m_WindowRect.Width())
|
||||||
|
m_WindowRect.right = m_WindowRect.left + TextSize.cx;
|
||||||
|
TextSize.cx = m_WindowRect.Width()-2*m_nMargin;
|
||||||
|
|
||||||
|
// Work out the text area
|
||||||
|
m_DefaultTextRect.SetRect(m_nMargin, m_nMargin,
|
||||||
|
m_nMargin+TextSize.cx, 2*m_nMargin+TextSize.cy);
|
||||||
|
m_WindowRect.bottom += m_DefaultTextRect.Height() + 2*m_nMargin;
|
||||||
|
}
|
||||||
|
|
||||||
|
// if custom text, then expand window if necessary, and set text width as
|
||||||
|
// window width
|
||||||
|
if (m_strCustomText.GetLength())
|
||||||
|
{
|
||||||
|
if (TextSize.cx > m_WindowRect.Width())
|
||||||
|
m_WindowRect.right = m_WindowRect.left + TextSize.cx;
|
||||||
|
TextSize.cx = m_WindowRect.Width()-2*m_nMargin;
|
||||||
|
|
||||||
|
// Work out the text area
|
||||||
|
m_CustomTextRect.SetRect(m_nMargin, m_WindowRect.Height(),
|
||||||
|
m_nMargin+TextSize.cx,
|
||||||
|
m_WindowRect.Height()+m_nMargin+TextSize.cy);
|
||||||
|
m_WindowRect.bottom += m_CustomTextRect.Height() + 2*m_nMargin;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Need to check it'll fit on screen: Too far right?
|
||||||
|
CSize ScreenSize(::GetSystemMetrics(SM_CXSCREEN), ::GetSystemMetrics(SM_CYSCREEN));
|
||||||
|
if (m_WindowRect.right > ScreenSize.cx)
|
||||||
|
m_WindowRect.OffsetRect(-(m_WindowRect.right - ScreenSize.cx), 0);
|
||||||
|
|
||||||
|
// Too far left?
|
||||||
|
if (m_WindowRect.left < 0)
|
||||||
|
m_WindowRect.OffsetRect( -m_WindowRect.left, 0);
|
||||||
|
|
||||||
|
// Bottom falling out of screen?
|
||||||
|
if (m_WindowRect.bottom > ScreenSize.cy)
|
||||||
|
{
|
||||||
|
CRect ParentRect;
|
||||||
|
m_pParent->GetWindowRect(ParentRect);
|
||||||
|
m_WindowRect.OffsetRect(0, -(ParentRect.Height() + m_WindowRect.Height()));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set the window size and position
|
||||||
|
MoveWindow(m_WindowRect, TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CColourPopup::CreateToolTips()
|
||||||
|
{
|
||||||
|
// Create the tool tip
|
||||||
|
if (!m_ToolTip.Create(this)) return;
|
||||||
|
|
||||||
|
// Add a tool for each cell
|
||||||
|
for (int i = 0; i < m_nNumColours; i++)
|
||||||
|
{
|
||||||
|
CRect rect;
|
||||||
|
if (!GetCellRect(i, rect)) continue;
|
||||||
|
m_ToolTip.AddTool(this, GetColourName(i), rect, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CColourPopup::ChangeSelection(int nIndex)
|
||||||
|
{
|
||||||
|
CClientDC dc(this); // device context for drawing
|
||||||
|
|
||||||
|
if (nIndex > m_nNumColours)
|
||||||
|
nIndex = CUSTOM_BOX_VALUE;
|
||||||
|
|
||||||
|
if ((m_nCurrentSel >= 0 && m_nCurrentSel < m_nNumColours) ||
|
||||||
|
m_nCurrentSel == CUSTOM_BOX_VALUE || m_nCurrentSel == DEFAULT_BOX_VALUE)
|
||||||
|
{
|
||||||
|
// Set Current selection as invalid and redraw old selection (this way
|
||||||
|
// the old selection will be drawn unselected)
|
||||||
|
int OldSel = m_nCurrentSel;
|
||||||
|
m_nCurrentSel = INVALID_COLOUR;
|
||||||
|
DrawCell(&dc, OldSel);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set the current selection as row/col and draw (it will be drawn selected)
|
||||||
|
m_nCurrentSel = nIndex;
|
||||||
|
DrawCell(&dc, m_nCurrentSel);
|
||||||
|
|
||||||
|
// Store the current colour
|
||||||
|
if (m_nCurrentSel == CUSTOM_BOX_VALUE)
|
||||||
|
m_pParent->SendMessage(CPN_SELCHANGE, (WPARAM) m_crInitialColour, 0);
|
||||||
|
else if (m_nCurrentSel == DEFAULT_BOX_VALUE)
|
||||||
|
{
|
||||||
|
m_crColour = CLR_DEFAULT;
|
||||||
|
m_pParent->SendMessage(CPN_SELCHANGE, (WPARAM) CLR_DEFAULT, 0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_crColour = GetColour(m_nCurrentSel);
|
||||||
|
m_pParent->SendMessage(CPN_SELCHANGE, (WPARAM) m_crColour, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CColourPopup::EndSelection(int nMessage)
|
||||||
|
{
|
||||||
|
ReleaseCapture();
|
||||||
|
|
||||||
|
// If custom text selected, perform a custom colour selection
|
||||||
|
if (nMessage != CPN_SELENDCANCEL && m_nCurrentSel == CUSTOM_BOX_VALUE)
|
||||||
|
{
|
||||||
|
m_bChildWindowVisible = TRUE;
|
||||||
|
|
||||||
|
CColorDialog dlg(m_crInitialColour, CC_FULLOPEN | CC_ANYCOLOR, this);
|
||||||
|
|
||||||
|
if (dlg.DoModal() == IDOK)
|
||||||
|
m_crColour = dlg.GetColor();
|
||||||
|
else
|
||||||
|
nMessage = CPN_SELENDCANCEL;
|
||||||
|
|
||||||
|
m_bChildWindowVisible = FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (nMessage == CPN_SELENDCANCEL)
|
||||||
|
m_crColour = m_crInitialColour;
|
||||||
|
|
||||||
|
m_pParent->SendMessage(nMessage, (WPARAM) m_crColour, 0);
|
||||||
|
|
||||||
|
// Kill focus bug fixed by Martin Wawrusch
|
||||||
|
if (!m_bChildWindowVisible)
|
||||||
|
DestroyWindow();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CColourPopup::DrawCell(CDC* pDC, int nIndex)
|
||||||
|
{
|
||||||
|
// For the Custom Text area
|
||||||
|
if (m_strCustomText.GetLength() && nIndex == CUSTOM_BOX_VALUE)
|
||||||
|
{
|
||||||
|
// The extent of the actual text button
|
||||||
|
CRect TextButtonRect = m_CustomTextRect;
|
||||||
|
TextButtonRect.top += 2*m_nMargin;
|
||||||
|
|
||||||
|
// Fill background
|
||||||
|
pDC->FillSolidRect(TextButtonRect, ::GetSysColor(COLOR_3DFACE));
|
||||||
|
|
||||||
|
// Draw horizontal line
|
||||||
|
pDC->FillSolidRect(m_CustomTextRect.left+2*m_nMargin, m_CustomTextRect.top,
|
||||||
|
m_CustomTextRect.Width()-4*m_nMargin, 1, ::GetSysColor(COLOR_3DSHADOW));
|
||||||
|
pDC->FillSolidRect(m_CustomTextRect.left+2*m_nMargin, m_CustomTextRect.top+1,
|
||||||
|
m_CustomTextRect.Width()-4*m_nMargin, 1, ::GetSysColor(COLOR_3DHILIGHT));
|
||||||
|
|
||||||
|
TextButtonRect.DeflateRect(1,1);
|
||||||
|
|
||||||
|
// fill background
|
||||||
|
if (m_nChosenColourSel == nIndex && m_nCurrentSel != nIndex)
|
||||||
|
pDC->FillSolidRect(TextButtonRect, ::GetSysColor(COLOR_3DLIGHT));
|
||||||
|
else
|
||||||
|
pDC->FillSolidRect(TextButtonRect, ::GetSysColor(COLOR_3DFACE));
|
||||||
|
|
||||||
|
// Draw button
|
||||||
|
if (m_nCurrentSel == nIndex)
|
||||||
|
pDC->DrawEdge(TextButtonRect, BDR_RAISEDINNER, BF_RECT);
|
||||||
|
else if (m_nChosenColourSel == nIndex)
|
||||||
|
pDC->DrawEdge(TextButtonRect, BDR_SUNKENOUTER, BF_RECT);
|
||||||
|
|
||||||
|
// Draw custom text
|
||||||
|
CFont *pOldFont = (CFont*) pDC->SelectObject(&m_Font);
|
||||||
|
pDC->SetBkMode(TRANSPARENT);
|
||||||
|
pDC->DrawText(m_strCustomText, TextButtonRect, DT_CENTER | DT_VCENTER | DT_SINGLELINE);
|
||||||
|
pDC->SelectObject(pOldFont);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// For the Default Text area
|
||||||
|
if (m_strDefaultText.GetLength() && nIndex == DEFAULT_BOX_VALUE)
|
||||||
|
{
|
||||||
|
// Fill background
|
||||||
|
pDC->FillSolidRect(m_DefaultTextRect, ::GetSysColor(COLOR_3DFACE));
|
||||||
|
|
||||||
|
// The extent of the actual text button
|
||||||
|
CRect TextButtonRect = m_DefaultTextRect;
|
||||||
|
TextButtonRect.DeflateRect(1,1);
|
||||||
|
|
||||||
|
// fill background
|
||||||
|
if (m_nChosenColourSel == nIndex && m_nCurrentSel != nIndex)
|
||||||
|
pDC->FillSolidRect(TextButtonRect, ::GetSysColor(COLOR_3DLIGHT));
|
||||||
|
else
|
||||||
|
pDC->FillSolidRect(TextButtonRect, ::GetSysColor(COLOR_3DFACE));
|
||||||
|
|
||||||
|
// Draw thin line around text
|
||||||
|
CRect LineRect = TextButtonRect;
|
||||||
|
LineRect.DeflateRect(2*m_nMargin,2*m_nMargin);
|
||||||
|
CPen pen(PS_SOLID, 1, ::GetSysColor(COLOR_3DSHADOW));
|
||||||
|
CPen* pOldPen = pDC->SelectObject(&pen);
|
||||||
|
pDC->SelectStockObject(NULL_BRUSH);
|
||||||
|
pDC->Rectangle(LineRect);
|
||||||
|
pDC->SelectObject(pOldPen);
|
||||||
|
|
||||||
|
// Draw button
|
||||||
|
if (m_nCurrentSel == nIndex)
|
||||||
|
pDC->DrawEdge(TextButtonRect, BDR_RAISEDINNER, BF_RECT);
|
||||||
|
else if (m_nChosenColourSel == nIndex)
|
||||||
|
pDC->DrawEdge(TextButtonRect, BDR_SUNKENOUTER, BF_RECT);
|
||||||
|
|
||||||
|
// Draw custom text
|
||||||
|
CFont *pOldFont = (CFont*) pDC->SelectObject(&m_Font);
|
||||||
|
pDC->SetBkMode(TRANSPARENT);
|
||||||
|
pDC->DrawText(m_strDefaultText, TextButtonRect, DT_CENTER | DT_VCENTER | DT_SINGLELINE);
|
||||||
|
pDC->SelectObject(pOldFont);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
CRect rect;
|
||||||
|
if (!GetCellRect(nIndex, rect)) return;
|
||||||
|
|
||||||
|
// Select and realize the palette
|
||||||
|
CPalette* pOldPalette = NULL;
|
||||||
|
if (pDC->GetDeviceCaps(RASTERCAPS) & RC_PALETTE)
|
||||||
|
{
|
||||||
|
pOldPalette = pDC->SelectPalette(&m_Palette, FALSE);
|
||||||
|
pDC->RealizePalette();
|
||||||
|
}
|
||||||
|
|
||||||
|
// fill background
|
||||||
|
if (m_nChosenColourSel == nIndex && m_nCurrentSel != nIndex)
|
||||||
|
pDC->FillSolidRect(rect, ::GetSysColor(COLOR_3DHILIGHT));
|
||||||
|
else
|
||||||
|
pDC->FillSolidRect(rect, ::GetSysColor(COLOR_3DFACE));
|
||||||
|
|
||||||
|
// Draw button
|
||||||
|
if (m_nCurrentSel == nIndex)
|
||||||
|
pDC->DrawEdge(rect, BDR_RAISEDINNER, BF_RECT);
|
||||||
|
else if (m_nChosenColourSel == nIndex)
|
||||||
|
pDC->DrawEdge(rect, BDR_SUNKENOUTER, BF_RECT);
|
||||||
|
|
||||||
|
CBrush brush(PALETTERGB(GetRValue(GetColour(nIndex)),
|
||||||
|
GetGValue(GetColour(nIndex)),
|
||||||
|
GetBValue(GetColour(nIndex)) ));
|
||||||
|
CPen pen;
|
||||||
|
pen.CreatePen(PS_SOLID, 1, ::GetSysColor(COLOR_3DSHADOW));
|
||||||
|
|
||||||
|
CBrush* pOldBrush = (CBrush*) pDC->SelectObject(&brush);
|
||||||
|
CPen* pOldPen = (CPen*) pDC->SelectObject(&pen);
|
||||||
|
|
||||||
|
// Draw the cell colour
|
||||||
|
rect.DeflateRect(m_nMargin+1, m_nMargin+1);
|
||||||
|
pDC->Rectangle(rect);
|
||||||
|
|
||||||
|
// restore DC and cleanup
|
||||||
|
pDC->SelectObject(pOldBrush);
|
||||||
|
pDC->SelectObject(pOldPen);
|
||||||
|
brush.DeleteObject();
|
||||||
|
pen.DeleteObject();
|
||||||
|
|
||||||
|
if (pOldPalette && pDC->GetDeviceCaps(RASTERCAPS) & RC_PALETTE)
|
||||||
|
pDC->SelectPalette(pOldPalette, FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL CColourPopup::OnQueryNewPalette()
|
||||||
|
{
|
||||||
|
Invalidate();
|
||||||
|
return CWnd::OnQueryNewPalette();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CColourPopup::OnPaletteChanged(CWnd* pFocusWnd)
|
||||||
|
{
|
||||||
|
CWnd::OnPaletteChanged(pFocusWnd);
|
||||||
|
|
||||||
|
if (pFocusWnd->GetSafeHwnd() != GetSafeHwnd())
|
||||||
|
Invalidate();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CColourPopup::OnKillFocus(CWnd* pNewWnd)
|
||||||
|
{
|
||||||
|
CWnd::OnKillFocus(pNewWnd);
|
||||||
|
|
||||||
|
ReleaseCapture();
|
||||||
|
//DestroyWindow(); - causes crash when Custom colour dialog appears.
|
||||||
|
}
|
||||||
|
|
||||||
|
// KillFocus problem fix suggested by Paul Wilkerson.
|
||||||
|
#if _MFC_VER < 0x0700
|
||||||
|
void CColourPopup::OnActivateApp(BOOL bActive, HTASK hTask)
|
||||||
|
#else
|
||||||
|
void CColourPopup::OnActivateApp(BOOL bActive, DWORD hTask)
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
CWnd::OnActivateApp(bActive, hTask);
|
||||||
|
|
||||||
|
// If Deactivating App, cancel this selection
|
||||||
|
if (!bActive)
|
||||||
|
EndSelection(CPN_SELENDCANCEL);
|
||||||
|
}
|
|
@ -0,0 +1,132 @@
|
||||||
|
#if !defined(AFX_COLOURPOPUP_H__D0B75902_9830_11D1_9C0F_00A0243D1382__INCLUDED_)
|
||||||
|
#define AFX_COLOURPOPUP_H__D0B75902_9830_11D1_9C0F_00A0243D1382__INCLUDED_
|
||||||
|
|
||||||
|
#if _MSC_VER >= 1000
|
||||||
|
#pragma once
|
||||||
|
#endif // _MSC_VER >= 1000
|
||||||
|
|
||||||
|
// ColourPopup.h : header file
|
||||||
|
//
|
||||||
|
// Written by Chris Maunder (chrismaunder@codeguru.com)
|
||||||
|
// Extended by Alexander Bischofberger (bischofb@informatik.tu-muenchen.de)
|
||||||
|
// Copyright (c) 1998.
|
||||||
|
//
|
||||||
|
// This code may be used in compiled form in any way you desire. This
|
||||||
|
// file may be redistributed unmodified by any means PROVIDING it is
|
||||||
|
// not sold for profit without the authors written consent, and
|
||||||
|
// providing that this notice and the authors name is included. If
|
||||||
|
// the source code in this file is used in any commercial application
|
||||||
|
// then a simple email would be nice.
|
||||||
|
//
|
||||||
|
// This file is provided "as is" with no expressed or implied warranty.
|
||||||
|
// The author accepts no liability if it causes any damage whatsoever.
|
||||||
|
// It's free - so you get what you pay for.
|
||||||
|
|
||||||
|
|
||||||
|
// CColourPopup messages
|
||||||
|
#define CPN_SELCHANGE WM_USER + 1001 // Colour Picker Selection change
|
||||||
|
#define CPN_DROPDOWN WM_USER + 1002 // Colour Picker drop down
|
||||||
|
#define CPN_CLOSEUP WM_USER + 1003 // Colour Picker close up
|
||||||
|
#define CPN_SELENDOK WM_USER + 1004 // Colour Picker end OK
|
||||||
|
#define CPN_SELENDCANCEL WM_USER + 1005 // Colour Picker end (cancelled)
|
||||||
|
|
||||||
|
// forward declaration
|
||||||
|
class CColourPicker;
|
||||||
|
|
||||||
|
// To hold the colours and their names
|
||||||
|
typedef struct {
|
||||||
|
COLORREF crColour;
|
||||||
|
TCHAR *szName;
|
||||||
|
} ColourTableEntry;
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CColourPopup window
|
||||||
|
|
||||||
|
class CColourPopup : public CWnd
|
||||||
|
{
|
||||||
|
// Construction
|
||||||
|
public:
|
||||||
|
CColourPopup();
|
||||||
|
CColourPopup(CPoint p, COLORREF crColour, CWnd* pParentWnd,
|
||||||
|
LPCTSTR szDefaultText = NULL, LPCTSTR szCustomText = NULL);
|
||||||
|
void Initialise();
|
||||||
|
|
||||||
|
// Attributes
|
||||||
|
public:
|
||||||
|
|
||||||
|
// Operations
|
||||||
|
public:
|
||||||
|
BOOL Create(CPoint p, COLORREF crColour, CWnd* pParentWnd,
|
||||||
|
LPCTSTR szDefaultText = NULL, LPCTSTR szCustomText = NULL);
|
||||||
|
|
||||||
|
// Overrides
|
||||||
|
// ClassWizard generated virtual function overrides
|
||||||
|
//{{AFX_VIRTUAL(CColourPopup)
|
||||||
|
public:
|
||||||
|
virtual BOOL PreTranslateMessage(MSG* pMsg);
|
||||||
|
//}}AFX_VIRTUAL
|
||||||
|
|
||||||
|
// Implementation
|
||||||
|
public:
|
||||||
|
virtual ~CColourPopup();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
BOOL GetCellRect(int nIndex, const LPRECT& rect);
|
||||||
|
void FindCellFromColour(COLORREF crColour);
|
||||||
|
void SetWindowSize();
|
||||||
|
void CreateToolTips();
|
||||||
|
void ChangeSelection(int nIndex);
|
||||||
|
void EndSelection(int nMessage);
|
||||||
|
void DrawCell(CDC* pDC, int nIndex);
|
||||||
|
|
||||||
|
COLORREF GetColour(int nIndex) { return m_crColours[nIndex].crColour; }
|
||||||
|
LPCTSTR GetColourName(int nIndex) { return m_crColours[nIndex].szName; }
|
||||||
|
int GetIndex(int row, int col) const;
|
||||||
|
int GetRow(int nIndex) const;
|
||||||
|
int GetColumn(int nIndex) const;
|
||||||
|
|
||||||
|
// protected attributes
|
||||||
|
protected:
|
||||||
|
static ColourTableEntry m_crColours[];
|
||||||
|
int m_nNumColours;
|
||||||
|
int m_nNumColumns, m_nNumRows;
|
||||||
|
int m_nBoxSize, m_nMargin;
|
||||||
|
int m_nCurrentSel;
|
||||||
|
int m_nChosenColourSel;
|
||||||
|
CString m_strDefaultText;
|
||||||
|
CString m_strCustomText;
|
||||||
|
CRect m_CustomTextRect, m_DefaultTextRect, m_WindowRect;
|
||||||
|
CFont m_Font;
|
||||||
|
CPalette m_Palette;
|
||||||
|
COLORREF m_crInitialColour, m_crColour;
|
||||||
|
CToolTipCtrl m_ToolTip;
|
||||||
|
CWnd* m_pParent;
|
||||||
|
|
||||||
|
BOOL m_bChildWindowVisible;
|
||||||
|
|
||||||
|
// Generated message map functions
|
||||||
|
protected:
|
||||||
|
//{{AFX_MSG(CColourPopup)
|
||||||
|
afx_msg void OnNcDestroy();
|
||||||
|
afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
|
||||||
|
afx_msg void OnPaint();
|
||||||
|
afx_msg void OnMouseMove(UINT nFlags, CPoint point);
|
||||||
|
afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
|
||||||
|
afx_msg BOOL OnQueryNewPalette();
|
||||||
|
afx_msg void OnPaletteChanged(CWnd* pFocusWnd);
|
||||||
|
afx_msg void OnKillFocus(CWnd* pNewWnd);
|
||||||
|
#if _MFC_VER < 0x0700
|
||||||
|
afx_msg void OnActivateApp(BOOL bActive, HTASK hTask);
|
||||||
|
#else
|
||||||
|
afx_msg void OnActivateApp(BOOL bActive, DWORD hTask);
|
||||||
|
#endif
|
||||||
|
//}}AFX_MSG
|
||||||
|
DECLARE_MESSAGE_MAP()
|
||||||
|
};
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
//{{AFX_INSERT_LOCATION}}
|
||||||
|
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
|
||||||
|
|
||||||
|
#endif // !defined(AFX_COLOURPOPUP_H__D0B75902_9830_11D1_9C0F_00A0243D1382__INCLUDED_)
|
|
@ -0,0 +1,265 @@
|
||||||
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||||
|
<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
|
||||||
|
<title>ChartDemo: E:/Sources Misc/ChartDemo/ChartCtrl/ChartAxis.h Source File</title>
|
||||||
|
<link href="tabs.css" rel="stylesheet" type="text/css">
|
||||||
|
<link href="doxygen.css" rel="stylesheet" type="text/css">
|
||||||
|
</head><body>
|
||||||
|
<!-- Generated by Doxygen 1.5.8 -->
|
||||||
|
<div class="navigation" id="top">
|
||||||
|
<div class="tabs">
|
||||||
|
<ul>
|
||||||
|
<li><a href="index.html"><span>Main Page</span></a></li>
|
||||||
|
<li><a href="pages.html"><span>Related Pages</span></a></li>
|
||||||
|
<li><a href="annotated.html"><span>Classes</span></a></li>
|
||||||
|
<li class="current"><a href="files.html"><span>Files</span></a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="tabs">
|
||||||
|
<ul>
|
||||||
|
<li><a href="files.html"><span>File List</span></a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<h1>E:/Sources Misc/ChartDemo/ChartCtrl/ChartAxis.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span>
|
||||||
|
<a name="l00002"></a>00002 <span class="comment"> *</span>
|
||||||
|
<a name="l00003"></a>00003 <span class="comment"> * ChartAxis.h</span>
|
||||||
|
<a name="l00004"></a>00004 <span class="comment"> *</span>
|
||||||
|
<a name="l00005"></a>00005 <span class="comment"> * Written by Cédric Moonen (cedric_moonen@hotmail.com)</span>
|
||||||
|
<a name="l00006"></a>00006 <span class="comment"> *</span>
|
||||||
|
<a name="l00007"></a>00007 <span class="comment"> *</span>
|
||||||
|
<a name="l00008"></a>00008 <span class="comment"> *</span>
|
||||||
|
<a name="l00009"></a>00009 <span class="comment"> * This code may be used for any non-commercial and commercial purposes in a compiled form.</span>
|
||||||
|
<a name="l00010"></a>00010 <span class="comment"> * The code may be redistributed as long as it remains unmodified and providing that the </span>
|
||||||
|
<a name="l00011"></a>00011 <span class="comment"> * author name and this disclaimer remain intact. The sources can be modified WITH the author </span>
|
||||||
|
<a name="l00012"></a>00012 <span class="comment"> * consent only.</span>
|
||||||
|
<a name="l00013"></a>00013 <span class="comment"> * </span>
|
||||||
|
<a name="l00014"></a>00014 <span class="comment"> * This code is provided without any garanties. I cannot be held responsible for the damage or</span>
|
||||||
|
<a name="l00015"></a>00015 <span class="comment"> * the loss of time it causes. Use it at your own risks</span>
|
||||||
|
<a name="l00016"></a>00016 <span class="comment"> *</span>
|
||||||
|
<a name="l00017"></a>00017 <span class="comment"> * An e-mail to notify me that you are using this code is appreciated also.</span>
|
||||||
|
<a name="l00018"></a>00018 <span class="comment"> *</span>
|
||||||
|
<a name="l00019"></a>00019 <span class="comment"> *</span>
|
||||||
|
<a name="l00020"></a>00020 <span class="comment"> */</span>
|
||||||
|
<a name="l00021"></a>00021
|
||||||
|
<a name="l00022"></a>00022 <span class="preprocessor">#ifndef _CHARTAXIS_H_</span>
|
||||||
|
<a name="l00023"></a>00023 <span class="preprocessor"></span><span class="preprocessor">#define _CHARTAXIS_H_</span>
|
||||||
|
<a name="l00024"></a>00024 <span class="preprocessor"></span>
|
||||||
|
<a name="l00025"></a>00025 <span class="preprocessor">#include "ChartScrollBar.h"</span>
|
||||||
|
<a name="l00026"></a>00026 <span class="preprocessor">#include "ChartString.h"</span>
|
||||||
|
<a name="l00027"></a>00027 <span class="preprocessor">#include <afx.h></span>
|
||||||
|
<a name="l00028"></a>00028
|
||||||
|
<a name="l00029"></a>00029 <span class="preprocessor">#include <list></span>
|
||||||
|
<a name="l00030"></a>00030
|
||||||
|
<a name="l00031"></a>00031 <span class="keyword">class </span><a class="code" href="class_c_chart_ctrl.html" title="The main chart control class.">CChartCtrl</a>;
|
||||||
|
<a name="l00032"></a>00032 <span class="keyword">class </span><a class="code" href="class_c_chart_grid.html" title="Class which draws the grid associated with a specific axis.">CChartGrid</a>;
|
||||||
|
<a name="l00033"></a>00033 <span class="keyword">class </span><a class="code" href="class_c_chart_serie.html" title="Abstract class that provides a common &quot;interface&quot; for all series in the...">CChartSerie</a>;
|
||||||
|
<a name="l00034"></a>00034 <span class="keyword">class </span><a class="code" href="class_c_chart_axis_label.html" title="Draws the label of an axis.">CChartAxisLabel</a>;
|
||||||
|
<a name="l00035"></a>00035
|
||||||
|
<a name="l00037"></a>00037
|
||||||
|
<a name="l00049"></a><a class="code" href="class_c_chart_axis.html">00049</a> <span class="keyword">class </span><a class="code" href="class_c_chart_axis.html" title="Base class that takes care of the management of a chart axis.">CChartAxis</a>
|
||||||
|
<a name="l00050"></a>00050 {
|
||||||
|
<a name="l00051"></a>00051 <span class="keyword">friend</span> <a class="code" href="class_c_chart_ctrl.html" title="The main chart control class.">CChartCtrl</a>;
|
||||||
|
<a name="l00052"></a>00052 <span class="keyword">friend</span> <a class="code" href="class_c_chart_grid.html" title="Class which draws the grid associated with a specific axis.">CChartGrid</a>;
|
||||||
|
<a name="l00053"></a>00053 <span class="keyword">friend</span> <a class="code" href="class_c_chart_serie.html" title="Abstract class that provides a common &quot;interface&quot; for all series in the...">CChartSerie</a>;
|
||||||
|
<a name="l00054"></a>00054 <span class="keyword">friend</span> <a class="code" href="class_c_chart_scroll_bar.html" title="Class which manages the interaction with the axis scroll bar.">CChartScrollBar</a>;
|
||||||
|
<a name="l00055"></a>00055
|
||||||
|
<a name="l00056"></a>00056 <span class="keyword">public</span>:
|
||||||
|
<a name="l00058"></a>00058 <a class="code" href="class_c_chart_axis.html#c917fa1081c59c2a896877e96db8a654" title="Default constructor.">CChartAxis</a>();
|
||||||
|
<a name="l00060"></a>00060 <span class="keyword">virtual</span> <a class="code" href="class_c_chart_axis.html#2fd6614c7bece2b705d21ed384c78928" title="Default destructor.">~CChartAxis</a>();
|
||||||
|
<a name="l00061"></a>00061
|
||||||
|
<a name="l00063"></a>00063 <span class="keywordtype">int</span> <a class="code" href="class_c_chart_axis.html#64a6ddeff5c34376d461c5bd5c6177dc" title="Retrieves the position (in %) of the axis.">GetPosition</a>();
|
||||||
|
<a name="l00064"></a>00064
|
||||||
|
<a name="l00066"></a>00066
|
||||||
|
<a name="l00072"></a>00072 <span class="keywordtype">void</span> <a class="code" href="class_c_chart_axis.html#e28da3bb1baa1938e70d0f25c02c3798" title="Sets the axis in reverse.">SetInverted</a>(<span class="keywordtype">bool</span> bInverted);
|
||||||
|
<a name="l00074"></a><a class="code" href="class_c_chart_axis.html#0fd782ffe225b9a639a3880691b6e2ff">00074</a> <span class="keywordtype">bool</span> <a class="code" href="class_c_chart_axis.html#0fd782ffe225b9a639a3880691b6e2ff" title="Retrieves if the axis is inverted or not.">IsInverted</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="class_c_chart_axis.html#bf01a1fb475970963e8c71bff67720b2" title="Indicates if the axis is inverted.">m_bIsInverted</a>; }
|
||||||
|
<a name="l00075"></a>00075
|
||||||
|
<a name="l00077"></a>00077
|
||||||
|
<a name="l00084"></a>00084 <span class="keywordtype">void</span> <a class="code" href="class_c_chart_axis.html#053e50c1db5a5f96c5543b81d90ec048" title="Sets the axis in automatic or manual mode.">SetAutomatic</a>(<span class="keywordtype">bool</span> bAutomatic);
|
||||||
|
<a name="l00086"></a>00086
|
||||||
|
<a name="l00089"></a><a class="code" href="class_c_chart_axis.html#70c25c84b78ac9d349e1b30162bf88ce">00089</a> <span class="keywordtype">bool</span> <a class="code" href="class_c_chart_axis.html#70c25c84b78ac9d349e1b30162bf88ce" title="Returns true if an automatic mode has been set on this axis.">IsAutomatic</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="class_c_chart_axis.html#ab7d8484805306c90d550313535981bb" title="Indicates if the axis is automatic.">m_AutoMode</a> != <a class="code" href="class_c_chart_axis.html#74b3b27fe9d32d4a108c9ac497283162c238e209352b6df80689cd7febd452a2" title="The axis min and max values are set manually.">NotAutomatic</a>; }
|
||||||
|
<a name="l00090"></a>00090
|
||||||
|
<a name="l00092"></a><a class="code" href="class_c_chart_axis.html#74b3b27fe9d32d4a108c9ac497283162">00092</a> <span class="keyword">enum</span> <a class="code" href="class_c_chart_axis.html#74b3b27fe9d32d4a108c9ac497283162" title="The different modes of automatic modes for an axis.">EAxisAutoModes</a>
|
||||||
|
<a name="l00093"></a>00093 {
|
||||||
|
<a name="l00095"></a><a class="code" href="class_c_chart_axis.html#74b3b27fe9d32d4a108c9ac497283162c238e209352b6df80689cd7febd452a2">00095</a> <a class="code" href="class_c_chart_axis.html#74b3b27fe9d32d4a108c9ac497283162c238e209352b6df80689cd7febd452a2" title="The axis min and max values are set manually.">NotAutomatic</a>,
|
||||||
|
<a name="l00097"></a><a class="code" href="class_c_chart_axis.html#74b3b27fe9d32d4a108c9ac497283162d8bbaa0f333ec3bed105282c270d95d7">00097</a> <a class="code" href="class_c_chart_axis.html#74b3b27fe9d32d4a108c9ac497283162d8bbaa0f333ec3bed105282c270d95d7" title="The axis min and max values of the axis are the min and max values of all series...">FullAutomatic</a>,
|
||||||
|
<a name="l00099"></a><a class="code" href="class_c_chart_axis.html#74b3b27fe9d32d4a108c9ac4972831626e6e92f41d3fc547aaaa6e35e6ad5290">00099</a> <a class="code" href="class_c_chart_axis.html#74b3b27fe9d32d4a108c9ac4972831626e6e92f41d3fc547aaaa6e35e6ad5290" title="The axis min and max values of the axis are the visible min and max values of all...">ScreenAutomatic</a>
|
||||||
|
<a name="l00100"></a>00100 };
|
||||||
|
<a name="l00101"></a>00101
|
||||||
|
<a name="l00103"></a>00103 <span class="keywordtype">void</span> <a class="code" href="class_c_chart_axis.html#c8c07c4ad50ff449f557ab57232f8a81" title="Sets the automatic mode of the axis.">SetAutomaticMode</a>(<a class="code" href="class_c_chart_axis.html#74b3b27fe9d32d4a108c9ac497283162" title="The different modes of automatic modes for an axis.">EAxisAutoModes</a> AutoMode);
|
||||||
|
<a name="l00105"></a><a class="code" href="class_c_chart_axis.html#a2f448f32ecbf2406adbc987c2e354ef">00105</a> <a class="code" href="class_c_chart_axis.html#74b3b27fe9d32d4a108c9ac497283162" title="The different modes of automatic modes for an axis.">EAxisAutoModes</a> <a class="code" href="class_c_chart_axis.html#a2f448f32ecbf2406adbc987c2e354ef" title="Gets the automatic type of the axis.">GetAutomaticMode</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="class_c_chart_axis.html#ab7d8484805306c90d550313535981bb" title="Indicates if the axis is automatic.">m_AutoMode</a>; }
|
||||||
|
<a name="l00106"></a>00106
|
||||||
|
<a name="l00108"></a>00108 <span class="keywordtype">void</span> <a class="code" href="class_c_chart_axis.html#8108cb56f8a1e6b2688a429158ce38e3" title="Sets the axis visible/invisible.">SetVisible</a>(<span class="keywordtype">bool</span> bVisible);
|
||||||
|
<a name="l00110"></a><a class="code" href="class_c_chart_axis.html#9e7bf4eec0e4a881f9ef869e3e12cd2e">00110</a> <span class="keywordtype">bool</span> <a class="code" href="class_c_chart_axis.html#9e7bf4eec0e4a881f9ef869e3e12cd2e" title="Retrieves the axis automatic mode.">IsVisible</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="class_c_chart_axis.html#4fa87c936a3fc43345159691be8de282" title="Indicates if the axis is visible or not.">m_bIsVisible</a>; }
|
||||||
|
<a name="l00111"></a>00111
|
||||||
|
<a name="l00113"></a>00113
|
||||||
|
<a name="l00121"></a>00121 <span class="keywordtype">void</span> <a class="code" href="class_c_chart_axis.html#308cfb9fa31478e1689807693ee79f87" title="Sets the axis min and max values.">SetMinMax</a>(<span class="keywordtype">double</span> Minimum, <span class="keywordtype">double</span> Maximum);
|
||||||
|
<a name="l00123"></a><a class="code" href="class_c_chart_axis.html#72dcb666db261ed42c3bf81a928f3a89">00123</a> <span class="keywordtype">void</span> <a class="code" href="class_c_chart_axis.html#72dcb666db261ed42c3bf81a928f3a89" title="Gets the min anx max values of the axis.">GetMinMax</a>(<span class="keywordtype">double</span>& Minimum, <span class="keywordtype">double</span>& Maximum)<span class="keyword"> const</span>
|
||||||
|
<a name="l00124"></a>00124 <span class="keyword"> </span>{
|
||||||
|
<a name="l00125"></a>00125 Minimum = <a class="code" href="class_c_chart_axis.html#21beddc72ca06eb4057ff8b22176bc56" title="The axis min value.">m_MinValue</a>;
|
||||||
|
<a name="l00126"></a>00126 Maximum = <a class="code" href="class_c_chart_axis.html#d983f570d89221b662818a4d32b1d79f" title="The axis max value.">m_MaxValue</a>;
|
||||||
|
<a name="l00127"></a>00127 }
|
||||||
|
<a name="l00128"></a>00128
|
||||||
|
<a name="l00130"></a>00130 <span class="keywordtype">void</span> <a class="code" href="class_c_chart_axis.html#f4930424d5142658710116b971ece619" title="Sets the axis color.">SetAxisColor</a>(COLORREF NewColor);
|
||||||
|
<a name="l00132"></a>00132 <span class="keywordtype">void</span> <a class="code" href="class_c_chart_axis.html#6cb9a7c906010039c8d2b23d4cb2a9ef" title="Sets the tick labels color.">SetTextColor</a>(COLORREF NewColor);
|
||||||
|
<a name="l00134"></a><a class="code" href="class_c_chart_axis.html#f682fbf0598b0e268fbbb2d5106f3516">00134</a> COLORREF <a class="code" href="class_c_chart_axis.html#f682fbf0598b0e268fbbb2d5106f3516" title="Gets the tick labels color.">GetTextColor</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_TextColor; }
|
||||||
|
<a name="l00136"></a>00136
|
||||||
|
<a name="l00142"></a>00142 <span class="keywordtype">void</span> <a class="code" href="class_c_chart_axis.html#3fa54ecfefdfe6ebdfe3f2adce0a6bfb" title="Sets the tick labels font.">SetFont</a>(<span class="keywordtype">int</span> nPointSize, <span class="keyword">const</span> TChartString& strFaceName);
|
||||||
|
<a name="l00143"></a>00143
|
||||||
|
<a name="l00145"></a><a class="code" href="class_c_chart_axis.html#4417f35b4d3f19e282d80f6bb09daa5f">00145</a> <a class="code" href="class_c_chart_axis_label.html" title="Draws the label of an axis.">CChartAxisLabel</a>* <a class="code" href="class_c_chart_axis.html#4417f35b4d3f19e282d80f6bb09daa5f" title="Retrieves the chart axis label object.">GetLabel</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_pAxisLabel; }
|
||||||
|
<a name="l00147"></a><a class="code" href="class_c_chart_axis.html#74b26b2b6d797991ee74120594e04f3d">00147</a> <a class="code" href="class_c_chart_grid.html" title="Class which draws the grid associated with a specific axis.">CChartGrid</a>* <a class="code" href="class_c_chart_axis.html#74b26b2b6d797991ee74120594e04f3d" title="Retrieves the chart axis grid object.">GetGrid</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_pAxisGrid; }
|
||||||
|
<a name="l00148"></a>00148
|
||||||
|
<a name="l00150"></a>00150
|
||||||
|
<a name="l00158"></a>00158 <span class="keywordtype">void</span> <a class="code" href="class_c_chart_axis.html#e16cf020349a4b6d7ef484edde4347ba" title="Sets the margin size.">SetMarginSize</a>(<span class="keywordtype">bool</span> bAuto, <span class="keywordtype">int</span> iNewSize);
|
||||||
|
<a name="l00159"></a>00159
|
||||||
|
<a name="l00161"></a><a class="code" href="class_c_chart_axis.html#0100cbb22d10c56eb7bc07cc62db0b36">00161</a> <span class="keywordtype">void</span> <a class="code" href="class_c_chart_axis.html#0100cbb22d10c56eb7bc07cc62db0b36" title="Enable the pan and zoom for this axis.">SetPanZoomEnabled</a>(<span class="keywordtype">bool</span> bEnabled) { m_bZoomEnabled = bEnabled; }
|
||||||
|
<a name="l00163"></a>00163
|
||||||
|
<a name="l00166"></a><a class="code" href="class_c_chart_axis.html#cb3b5a6071ebd6fe2cbd19cd9094fa7f">00166</a> <span class="keywordtype">void</span> <a class="code" href="class_c_chart_axis.html#cb3b5a6071ebd6fe2cbd19cd9094fa7f" title="Sets the zoom limit.">SetZoomLimit</a>(<span class="keywordtype">double</span> dLimit) { m_dZoomLimit = dLimit; }
|
||||||
|
<a name="l00167"></a>00167
|
||||||
|
<a name="l00169"></a>00169 <span class="keywordtype">void</span> <a class="code" href="class_c_chart_axis.html#f2f3caee0c87708cf40518ed07ae7808" title="Enables/disables the scroll bar.">EnableScrollBar</a>(<span class="keywordtype">bool</span> bEnabled);
|
||||||
|
<a name="l00171"></a><a class="code" href="class_c_chart_axis.html#e60ca9c4f27472b7d60a87d49ce5040b">00171</a> <span class="keywordtype">bool</span> <a class="code" href="class_c_chart_axis.html#e60ca9c4f27472b7d60a87d49ce5040b" title="Retrieves if the scroll bar is enabled or not.">ScrollBarEnabled</a>()<span class="keyword"> const </span>
|
||||||
|
<a name="l00172"></a>00172 <span class="keyword"> </span>{
|
||||||
|
<a name="l00173"></a>00173 <span class="keywordflow">if</span> (m_pScrollBar)
|
||||||
|
<a name="l00174"></a>00174 <span class="keywordflow">return</span> (m_pScrollBar-><a class="code" href="class_c_chart_scroll_bar.html#f71fa8b4d24a4b5d8ae6577b0a4691f5" title="Returns true if the scroll bar is enabled.">GetEnabled</a>());
|
||||||
|
<a name="l00175"></a>00175 <span class="keywordflow">else</span>
|
||||||
|
<a name="l00176"></a>00176 <span class="keywordflow">return</span> <span class="keyword">false</span>;
|
||||||
|
<a name="l00177"></a>00177 }
|
||||||
|
<a name="l00179"></a>00179
|
||||||
|
<a name="l00183"></a>00183 <span class="keywordtype">void</span> <a class="code" href="class_c_chart_axis.html#64e03f4cbe792f05772159ef7ed9e2e8" title="Specifies if the scroll bar is in auto-hide mode.">SetAutoHideScrollBar</a>(<span class="keywordtype">bool</span> bAutoHide);
|
||||||
|
<a name="l00185"></a>00185 <span class="keywordtype">bool</span> <a class="code" href="class_c_chart_axis.html#b30b762fd016500a992a6095c63b648f" title="Retrieves if the scroll bar is in auto-hide mode.">GetAutoHideScrollBar</a>() <span class="keyword">const</span>;
|
||||||
|
<a name="l00186"></a>00186
|
||||||
|
<a name="l00188"></a>00188
|
||||||
|
<a name="l00201"></a>00201 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="class_c_chart_axis.html#1f7c1f1d63f629cc91694735e085ff72" title="Sets the axis in discrete mode.">SetDiscrete</a>(<span class="keywordtype">bool</span> bDiscrete);
|
||||||
|
<a name="l00202"></a>00202
|
||||||
|
<a name="l00204"></a>00204
|
||||||
|
<a name="l00212"></a>00212 <span class="keywordtype">long</span> <a class="code" href="class_c_chart_axis.html#e9bff492d909eb9d86f1b95d0cff9c45" title="Converts a value on the axis to a screen position.">ValueToScreen</a>(<span class="keywordtype">double</span> Value) <span class="keyword">const</span>;
|
||||||
|
<a name="l00214"></a>00214
|
||||||
|
<a name="l00225"></a>00225 <span class="keyword">virtual</span> <span class="keywordtype">double</span> <a class="code" href="class_c_chart_axis.html#474712f8b4f24920304443cbe6d3821d" title="Converts a screen position to a value on the axis.">ScreenToValue</a>(<span class="keywordtype">long</span> ScreenVal) <span class="keyword">const</span>;
|
||||||
|
<a name="l00226"></a>00226
|
||||||
|
<a name="l00228"></a><a class="code" href="class_c_chart_axis.html#635f5e389dadc7f59b81ce6b0a4529f9">00228</a> <span class="keywordtype">bool</span> <a class="code" href="class_c_chart_axis.html#635f5e389dadc7f59b81ce6b0a4529f9" title="Returns true if the axis is horizontal.">IsHorizontal</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="class_c_chart_axis.html#ed506671697ff705f470d1a2c7b036e2" title="Indicates if this is an horizontal or vertical axis.">m_bIsHorizontal</a>; }
|
||||||
|
<a name="l00229"></a>00229
|
||||||
|
<a name="l00231"></a>00231 BOOL <a class="code" href="class_c_chart_axis.html#2ebc8ea10c41e4b635e097469f56f313" title="Returns true if a screen point is in the region of the axis.">IsPointInside</a>(<span class="keyword">const</span> CPoint& screenPoint) <span class="keyword">const</span>;
|
||||||
|
<a name="l00232"></a>00232
|
||||||
|
<a name="l00233"></a>00233 <span class="keyword">protected</span>:
|
||||||
|
<a name="l00235"></a>00235
|
||||||
|
<a name="l00239"></a>00239 <span class="keyword">virtual</span> <span class="keywordtype">double</span> <a class="code" href="class_c_chart_axis.html#3c38b9980d4a3c999b03443193df6006" title="Returns the first tick value.">GetFirstTickValue</a>() <span class="keyword">const</span> = 0;
|
||||||
|
<a name="l00241"></a>00241
|
||||||
|
<a name="l00250"></a>00250 <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code" href="class_c_chart_axis.html#88f7d87dffd2c1ef7ed5a3f4edd4a004" title="Retrieves the next tick value after a given tick.">GetNextTickValue</a>(<span class="keywordtype">double</span> dCurrentTick, <span class="keywordtype">double</span>& dNextTick) <span class="keyword">const</span> = 0;
|
||||||
|
<a name="l00252"></a>00252
|
||||||
|
<a name="l00260"></a>00260 <span class="keyword">virtual</span> <span class="keywordtype">long</span> <a class="code" href="class_c_chart_axis.html#bc9379bae77cf45f3f5010a247a5b8b2" title="Retrieves the screen position of a certain tick.">GetTickPos</a>(<span class="keywordtype">double</span> Value) <span class="keyword">const</span> = 0;
|
||||||
|
<a name="l00262"></a>00262
|
||||||
|
<a name="l00270"></a>00270 <span class="keyword">virtual</span> <span class="keywordtype">long</span> <a class="code" href="class_c_chart_axis.html#9cf74d600feed2f9a214644b97632829" title="Converts a value on the axis to a screen position.">ValueToScreenDiscrete</a>(<span class="keywordtype">double</span> Value) <span class="keyword">const</span> = 0;
|
||||||
|
<a name="l00272"></a>00272
|
||||||
|
<a name="l00280"></a>00280 <span class="keyword">virtual</span> <span class="keywordtype">long</span> <a class="code" href="class_c_chart_axis.html#4262b15c1564b6dd8220afbe62ae966b" title="Converts a value on the axis to a screen position.">ValueToScreenStandard</a>(<span class="keywordtype">double</span> Value) <span class="keyword">const</span>;
|
||||||
|
<a name="l00281"></a>00281
|
||||||
|
<a name="l00283"></a>00283
|
||||||
|
<a name="l00290"></a>00290 <span class="keyword">virtual</span> TChartString <a class="code" href="class_c_chart_axis.html#d7a3eac8b9db57f066f52074a56d8ec7" title="Retrieves the label for a specific tick.">GetTickLabel</a>(<span class="keywordtype">double</span> TickValue) <span class="keyword">const</span> = 0;
|
||||||
|
<a name="l00291"></a>00291
|
||||||
|
<a name="l00293"></a>00293 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="class_c_chart_axis.html#720800eaa24e5d2fd14a44d2e823f8c2" title="Forces a recalculation of the tick increment.">RefreshTickIncrement</a>() = 0;
|
||||||
|
<a name="l00295"></a>00295 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="class_c_chart_axis.html#d90be3be952a70b66471b59cd008c21f" title="Forces a recalculation of the first tick value.">RefreshFirstTick</a>() = 0;
|
||||||
|
<a name="l00296"></a>00296
|
||||||
|
<a name="l00298"></a>00298
|
||||||
|
<a name="l00307"></a>00307 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="class_c_chart_axis.html#cadb566b32dd7cb52fd29d50eda6974f" title="Retrieves the step information related to the scrollbar.">GetScrollbarSteps</a>(<span class="keywordtype">int</span>& iTotalSteps, <span class="keywordtype">int</span>& iCurrentStep);
|
||||||
|
<a name="l00309"></a>00309
|
||||||
|
<a name="l00320"></a>00320 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="class_c_chart_axis.html#be54a513053538716155409cdaf2ac68" title="Sets the axis to the specified scrollbar step.">SetAxisToScrollStep</a>(<span class="keywordtype">int</span> iPreviousStep, <span class="keywordtype">int</span> iCurrentStep, <span class="keywordtype">bool</span> bScrollInverted);
|
||||||
|
<a name="l00321"></a>00321
|
||||||
|
<a name="l00323"></a>00323
|
||||||
|
<a name="l00331"></a>00331 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="class_c_chart_axis.html#b890a71d7893431f7651d0fbb9352705" title="Pan the axis.">PanAxis</a>(<span class="keywordtype">long</span> PanStart, <span class="keywordtype">long</span> PanEnd);
|
||||||
|
<a name="l00333"></a>00333 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="class_c_chart_axis.html#7202c1f22e3e0c678def008f19c53e19" title="Sets the min and max values of the axis due to a zoom operation.">SetZoomMinMax</a>(<span class="keywordtype">double</span> Minimum, <span class="keywordtype">double</span> Maximum);
|
||||||
|
<a name="l00335"></a>00335 <span class="keywordtype">void</span> <a class="code" href="class_c_chart_axis.html#933b0071a04af914af06ec03e7a0b250" title="Reverts the zoom and pan settings.">UndoZoom</a>();
|
||||||
|
<a name="l00336"></a>00336
|
||||||
|
<a name="l00338"></a>00338 <span class="keywordtype">long</span> <a class="code" href="class_c_chart_axis.html#da7fa85a04f2430e5e293c248d87998f" title="Retrieves the lenght (in pixels) of the axis.">GetAxisLenght</a>() <span class="keyword">const</span>;
|
||||||
|
<a name="l00340"></a>00340 <span class="keywordtype">void</span> <a class="code" href="class_c_chart_axis.html#3e6094a0885da791201677702e2a9989" title="Retrieves the min and max values for all the series related to this axis.">GetSeriesMinMax</a>(<span class="keywordtype">double</span>& Minimum, <span class="keywordtype">double</span>& Maximum);
|
||||||
|
<a name="l00342"></a>00342 <span class="keywordtype">void</span> <a class="code" href="class_c_chart_axis.html#c2336f30ca4bcbf3ece50d1c741990dd" title="Retrieves the screen min and max values for all the series related to this axis.">GetSeriesScreenMinMax</a>(<span class="keywordtype">double</span>& Minimum, <span class="keywordtype">double</span>& Maximum);
|
||||||
|
<a name="l00343"></a>00343
|
||||||
|
<a name="l00344"></a>00344 <span class="keyword">private</span>:
|
||||||
|
<a name="l00346"></a>00346
|
||||||
|
<a name="l00349"></a>00349 <span class="keywordtype">bool</span> RefreshAutoAxis();
|
||||||
|
<a name="l00351"></a>00351
|
||||||
|
<a name="l00354"></a>00354 <span class="keywordtype">bool</span> RefreshScreenAutoAxis();
|
||||||
|
<a name="l00355"></a>00355
|
||||||
|
<a name="l00357"></a>00357
|
||||||
|
<a name="l00362"></a>00362 CSize GetLargestTick(CDC* pDC);
|
||||||
|
<a name="l00363"></a>00363
|
||||||
|
<a name="l00365"></a>00365
|
||||||
|
<a name="l00369"></a>00369 <span class="keywordtype">void</span> SetSecondary(<span class="keywordtype">bool</span> bSecondary) { <a class="code" href="class_c_chart_axis.html#c42a13ee6fb3823fa963f084d30c85a6" title="Specifies if the axis is secondary.">m_bIsSecondary</a> = bSecondary; }
|
||||||
|
<a name="l00371"></a>00371 <span class="keywordtype">bool</span> IsSecondary()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="class_c_chart_axis.html#c42a13ee6fb3823fa963f084d30c85a6" title="Specifies if the axis is secondary.">m_bIsSecondary</a>; }
|
||||||
|
<a name="l00373"></a>00373 <span class="keywordtype">void</span> SetHorizontal(<span class="keywordtype">bool</span> bHorizontal);
|
||||||
|
<a name="l00374"></a>00374
|
||||||
|
<a name="l00376"></a>00376
|
||||||
|
<a name="l00380"></a>00380 <span class="keywordtype">void</span> Draw(CDC* pDC);
|
||||||
|
<a name="l00382"></a>00382
|
||||||
|
<a name="l00386"></a>00386 <span class="keywordtype">void</span> DrawLabel(CDC* pDC);
|
||||||
|
<a name="l00388"></a>00388
|
||||||
|
<a name="l00396"></a>00396 <span class="keywordtype">void</span> DrawTick(CDC* pDC, <span class="keywordtype">double</span> dTickVal);
|
||||||
|
<a name="l00398"></a>00398
|
||||||
|
<a name="l00404"></a>00404 <span class="keywordtype">bool</span> IsLabelOnAxis(<span class="keywordtype">double</span> TickVal);
|
||||||
|
<a name="l00405"></a>00405
|
||||||
|
<a name="l00407"></a>00407
|
||||||
|
<a name="l00410"></a>00410 <span class="keywordtype">void</span> RegisterSeries(<a class="code" href="class_c_chart_serie.html" title="Abstract class that provides a common &quot;interface&quot; for all series in the...">CChartSerie</a>* pSeries);
|
||||||
|
<a name="l00412"></a>00412 <span class="keywordtype">void</span> UnregisterSeries(<a class="code" href="class_c_chart_serie.html" title="Abstract class that provides a common &quot;interface&quot; for all series in the...">CChartSerie</a>* pSeries);
|
||||||
|
<a name="l00413"></a>00413
|
||||||
|
<a name="l00415"></a>00415 <span class="keywordtype">void</span> CreateScrollBar();
|
||||||
|
<a name="l00417"></a>00417 <span class="keywordtype">void</span> UpdateScrollBarPos();
|
||||||
|
<a name="l00419"></a>00419 <span class="keywordtype">void</span> RefreshScrollBar();
|
||||||
|
<a name="l00420"></a>00420
|
||||||
|
<a name="l00422"></a>00422 <span class="keywordtype">void</span> SetParent(<a class="code" href="class_c_chart_ctrl.html" title="The main chart control class.">CChartCtrl</a>* pParent);
|
||||||
|
<a name="l00423"></a>00423
|
||||||
|
<a name="l00425"></a>00425
|
||||||
|
<a name="l00431"></a>00431 <span class="keywordtype">void</span> SetAxisSize(<span class="keyword">const</span> CRect& ControlRect, <span class="keyword">const</span> CRect& MarginRect);
|
||||||
|
<a name="l00433"></a>00433
|
||||||
|
<a name="l00441"></a>00441 <span class="keywordtype">int</span> ClipMargin(CRect ControlRect,CRect& MarginRect,CDC* pDC);
|
||||||
|
<a name="l00443"></a>00443
|
||||||
|
<a name="l00447"></a>00447 <span class="keywordtype">void</span> Recalculate();
|
||||||
|
<a name="l00448"></a>00448
|
||||||
|
<a name="l00449"></a>00449 <span class="keyword">protected</span>:
|
||||||
|
<a name="l00451"></a><a class="code" href="class_c_chart_axis.html#e2c8a1607523b37f4fd11ec35e113856">00451</a> <a class="code" href="class_c_chart_ctrl.html" title="The main chart control class.">CChartCtrl</a>* <a class="code" href="class_c_chart_axis.html#e2c8a1607523b37f4fd11ec35e113856" title="The parent chart control.">m_pParentCtrl</a>;
|
||||||
|
<a name="l00452"></a>00452
|
||||||
|
<a name="l00454"></a><a class="code" href="class_c_chart_axis.html#ed506671697ff705f470d1a2c7b036e2">00454</a> <span class="keywordtype">bool</span> <a class="code" href="class_c_chart_axis.html#ed506671697ff705f470d1a2c7b036e2" title="Indicates if this is an horizontal or vertical axis.">m_bIsHorizontal</a>;
|
||||||
|
<a name="l00456"></a><a class="code" href="class_c_chart_axis.html#bf01a1fb475970963e8c71bff67720b2">00456</a> <span class="keywordtype">bool</span> <a class="code" href="class_c_chart_axis.html#bf01a1fb475970963e8c71bff67720b2" title="Indicates if the axis is inverted.">m_bIsInverted</a>;
|
||||||
|
<a name="l00458"></a>00458 <span class="comment">// bool m_bIsAutomatic; </span>
|
||||||
|
<a name="l00460"></a><a class="code" href="class_c_chart_axis.html#ab7d8484805306c90d550313535981bb">00460</a> <span class="comment"></span> <a class="code" href="class_c_chart_axis.html#74b3b27fe9d32d4a108c9ac497283162" title="The different modes of automatic modes for an axis.">EAxisAutoModes</a> <a class="code" href="class_c_chart_axis.html#ab7d8484805306c90d550313535981bb" title="Indicates if the axis is automatic.">m_AutoMode</a>;
|
||||||
|
<a name="l00461"></a>00461
|
||||||
|
<a name="l00463"></a><a class="code" href="class_c_chart_axis.html#4fa87c936a3fc43345159691be8de282">00463</a> <span class="keywordtype">bool</span> <a class="code" href="class_c_chart_axis.html#4fa87c936a3fc43345159691be8de282" title="Indicates if the axis is visible or not.">m_bIsVisible</a>;
|
||||||
|
<a name="l00464"></a>00464
|
||||||
|
<a name="l00466"></a>00466
|
||||||
|
<a name="l00470"></a><a class="code" href="class_c_chart_axis.html#c42a13ee6fb3823fa963f084d30c85a6">00470</a> <span class="keywordtype">bool</span> <a class="code" href="class_c_chart_axis.html#c42a13ee6fb3823fa963f084d30c85a6" title="Specifies if the axis is secondary.">m_bIsSecondary</a>;
|
||||||
|
<a name="l00471"></a>00471
|
||||||
|
<a name="l00473"></a><a class="code" href="class_c_chart_axis.html#d983f570d89221b662818a4d32b1d79f">00473</a> <span class="keywordtype">double</span> <a class="code" href="class_c_chart_axis.html#d983f570d89221b662818a4d32b1d79f" title="The axis max value.">m_MaxValue</a>;
|
||||||
|
<a name="l00475"></a><a class="code" href="class_c_chart_axis.html#21beddc72ca06eb4057ff8b22176bc56">00475</a> <span class="keywordtype">double</span> <a class="code" href="class_c_chart_axis.html#21beddc72ca06eb4057ff8b22176bc56" title="The axis min value.">m_MinValue</a>;
|
||||||
|
<a name="l00477"></a><a class="code" href="class_c_chart_axis.html#0ef1ca7f15e14d313fa3bfb89e6d8634">00477</a> <span class="keywordtype">double</span> <a class="code" href="class_c_chart_axis.html#0ef1ca7f15e14d313fa3bfb89e6d8634" title="Min value of the axis before it has been zoomed.">m_UnzoomMin</a>;
|
||||||
|
<a name="l00479"></a><a class="code" href="class_c_chart_axis.html#b59aae9335438f4013b7cfa6663631f5">00479</a> <span class="keywordtype">double</span> <a class="code" href="class_c_chart_axis.html#b59aae9335438f4013b7cfa6663631f5" title="Max value of the axis before it has been zoomed.">m_UnzoomMax</a>;
|
||||||
|
<a name="l00480"></a>00480
|
||||||
|
<a name="l00482"></a><a class="code" href="class_c_chart_axis.html#709a22de2a236d99371e6a4b5a9abebb">00482</a> <span class="keywordtype">bool</span> <a class="code" href="class_c_chart_axis.html#709a22de2a236d99371e6a4b5a9abebb" title="Specify if the tick increment is manual or automatic.">m_bAutoTicks</a>;
|
||||||
|
<a name="l00484"></a><a class="code" href="class_c_chart_axis.html#47312e5e307faab0c07d4524d971803c">00484</a> <span class="keywordtype">bool</span> <a class="code" href="class_c_chart_axis.html#47312e5e307faab0c07d4524d971803c" title="Specify if the axis has to be in discrete mode or not.">m_bDiscrete</a>;
|
||||||
|
<a name="l00485"></a>00485
|
||||||
|
<a name="l00487"></a><a class="code" href="class_c_chart_axis.html#3e31b004cf574ede66a8b069086b4236">00487</a> <span class="keywordtype">int</span> <a class="code" href="class_c_chart_axis.html#3e31b004cf574ede66a8b069086b4236" title="Start position of the axis (in pixels).">m_StartPos</a>;
|
||||||
|
<a name="l00489"></a><a class="code" href="class_c_chart_axis.html#a7d85a34e4dc88016775771bf9acc926">00489</a> <span class="keywordtype">int</span> <a class="code" href="class_c_chart_axis.html#a7d85a34e4dc88016775771bf9acc926" title="End position of the axis (in pixels).">m_EndPos</a>;
|
||||||
|
<a name="l00491"></a><a class="code" href="class_c_chart_axis.html#a33ee78a82bfa536959c1daaadd6dca6">00491</a> CRect <a class="code" href="class_c_chart_axis.html#a33ee78a82bfa536959c1daaadd6dca6" title="The rectangle in which the axis is contained.">m_AxisRect</a>;
|
||||||
|
<a name="l00492"></a>00492
|
||||||
|
<a name="l00493"></a>00493 <span class="keyword">private</span>:
|
||||||
|
<a name="l00495"></a>00495 <span class="keywordtype">int</span> m_nFontSize;
|
||||||
|
<a name="l00497"></a>00497 TChartString m_strFontName;
|
||||||
|
<a name="l00499"></a>00499 COLORREF m_TextColor;
|
||||||
|
<a name="l00501"></a>00501 COLORREF m_AxisColor;
|
||||||
|
<a name="l00502"></a>00502
|
||||||
|
<a name="l00504"></a>00504 <a class="code" href="class_c_chart_grid.html" title="Class which draws the grid associated with a specific axis.">CChartGrid</a>* m_pAxisGrid;
|
||||||
|
<a name="l00506"></a>00506 <a class="code" href="class_c_chart_axis_label.html" title="Draws the label of an axis.">CChartAxisLabel</a>* m_pAxisLabel;
|
||||||
|
<a name="l00507"></a>00507
|
||||||
|
<a name="l00508"></a>00508 <span class="keyword">typedef</span> std::list<CChartSerie*> SeriesList;
|
||||||
|
<a name="l00510"></a>00510 SeriesList m_pRelatedSeries;
|
||||||
|
<a name="l00511"></a>00511
|
||||||
|
<a name="l00513"></a>00513 <span class="keywordtype">bool</span> m_bAutoMargin;
|
||||||
|
<a name="l00515"></a>00515 <span class="keywordtype">int</span> m_iMarginSize;
|
||||||
|
<a name="l00516"></a>00516
|
||||||
|
<a name="l00518"></a>00518 <span class="keywordtype">bool</span> m_bZoomEnabled;
|
||||||
|
<a name="l00520"></a>00520 <span class="keywordtype">double</span> m_dZoomLimit;
|
||||||
|
<a name="l00521"></a>00521
|
||||||
|
<a name="l00523"></a>00523 <a class="code" href="class_c_chart_scroll_bar.html" title="Class which manages the interaction with the axis scroll bar.">CChartScrollBar</a>* m_pScrollBar;
|
||||||
|
<a name="l00524"></a>00524 };
|
||||||
|
<a name="l00525"></a>00525
|
||||||
|
<a name="l00526"></a>00526 <span class="preprocessor">#endif // _CHARTAXIS_H_</span>
|
||||||
|
</pre></div></div>
|
||||||
|
<hr size="1"><address style="text-align: right;"><small>Generated on Sun Jan 17 13:33:09 2010 for ChartDemo by
|
||||||
|
<a href="http://www.doxygen.org/index.html">
|
||||||
|
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.8 </small></address>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -0,0 +1,104 @@
|
||||||
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||||
|
<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
|
||||||
|
<title>ChartDemo: E:/Sources Misc/ChartDemo/ChartCtrl/ChartAxisLabel.h Source File</title>
|
||||||
|
<link href="tabs.css" rel="stylesheet" type="text/css">
|
||||||
|
<link href="doxygen.css" rel="stylesheet" type="text/css">
|
||||||
|
</head><body>
|
||||||
|
<!-- Generated by Doxygen 1.5.8 -->
|
||||||
|
<div class="navigation" id="top">
|
||||||
|
<div class="tabs">
|
||||||
|
<ul>
|
||||||
|
<li><a href="index.html"><span>Main Page</span></a></li>
|
||||||
|
<li><a href="pages.html"><span>Related Pages</span></a></li>
|
||||||
|
<li><a href="annotated.html"><span>Classes</span></a></li>
|
||||||
|
<li class="current"><a href="files.html"><span>Files</span></a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="tabs">
|
||||||
|
<ul>
|
||||||
|
<li><a href="files.html"><span>File List</span></a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<h1>E:/Sources Misc/ChartDemo/ChartCtrl/ChartAxisLabel.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span>
|
||||||
|
<a name="l00002"></a>00002 <span class="comment"> *</span>
|
||||||
|
<a name="l00003"></a>00003 <span class="comment"> * ChartAxisLabel.h</span>
|
||||||
|
<a name="l00004"></a>00004 <span class="comment"> *</span>
|
||||||
|
<a name="l00005"></a>00005 <span class="comment"> * Written by Cédric Moonen (cedric_moonen@hotmail.com)</span>
|
||||||
|
<a name="l00006"></a>00006 <span class="comment"> *</span>
|
||||||
|
<a name="l00007"></a>00007 <span class="comment"> *</span>
|
||||||
|
<a name="l00008"></a>00008 <span class="comment"> *</span>
|
||||||
|
<a name="l00009"></a>00009 <span class="comment"> * This code may be used for any non-commercial and commercial purposes in a compiled form.</span>
|
||||||
|
<a name="l00010"></a>00010 <span class="comment"> * The code may be redistributed as long as it remains unmodified and providing that the </span>
|
||||||
|
<a name="l00011"></a>00011 <span class="comment"> * author name and this disclaimer remain intact. The sources can be modified WITH the author </span>
|
||||||
|
<a name="l00012"></a>00012 <span class="comment"> * consent only.</span>
|
||||||
|
<a name="l00013"></a>00013 <span class="comment"> * </span>
|
||||||
|
<a name="l00014"></a>00014 <span class="comment"> * This code is provided without any garanties. I cannot be held responsible for the damage or</span>
|
||||||
|
<a name="l00015"></a>00015 <span class="comment"> * the loss of time it causes. Use it at your own risks</span>
|
||||||
|
<a name="l00016"></a>00016 <span class="comment"> *</span>
|
||||||
|
<a name="l00017"></a>00017 <span class="comment"> * An e-mail to notify me that you are using this code is appreciated also.</span>
|
||||||
|
<a name="l00018"></a>00018 <span class="comment"> *</span>
|
||||||
|
<a name="l00019"></a>00019 <span class="comment"> *</span>
|
||||||
|
<a name="l00020"></a>00020 <span class="comment"> */</span>
|
||||||
|
<a name="l00021"></a>00021
|
||||||
|
<a name="l00022"></a>00022 <span class="preprocessor">#if !defined(AFX_CHARTAXISLABEL_H__0E5519C8_A2F4_4CED_9681_32A56B25D0C5__INCLUDED_)</span>
|
||||||
|
<a name="l00023"></a>00023 <span class="preprocessor"></span><span class="preprocessor">#define AFX_CHARTAXISLABEL_H__0E5519C8_A2F4_4CED_9681_32A56B25D0C5__INCLUDED_</span>
|
||||||
|
<a name="l00024"></a>00024 <span class="preprocessor"></span>
|
||||||
|
<a name="l00025"></a>00025 <span class="preprocessor">#if _MSC_VER > 1000</span>
|
||||||
|
<a name="l00026"></a>00026 <span class="preprocessor"></span><span class="preprocessor">#pragma once</span>
|
||||||
|
<a name="l00027"></a>00027 <span class="preprocessor"></span><span class="preprocessor">#endif // _MSC_VER > 1000</span>
|
||||||
|
<a name="l00028"></a>00028 <span class="preprocessor"></span>
|
||||||
|
<a name="l00029"></a>00029 <span class="preprocessor">#include "ChartString.h"</span>
|
||||||
|
<a name="l00030"></a>00030 <span class="preprocessor">#include "ChartFont.h"</span>
|
||||||
|
<a name="l00031"></a>00031
|
||||||
|
<a name="l00032"></a>00032 <span class="keyword">class </span><a class="code" href="class_c_chart_ctrl.html" title="The main chart control class.">CChartCtrl</a>;
|
||||||
|
<a name="l00033"></a>00033 <span class="keyword">class </span><a class="code" href="class_c_chart_axis.html" title="Base class that takes care of the management of a chart axis.">CChartAxis</a>;
|
||||||
|
<a name="l00034"></a>00034
|
||||||
|
<a name="l00036"></a>00036
|
||||||
|
<a name="l00040"></a><a class="code" href="class_c_chart_axis_label.html">00040</a> <span class="keyword">class </span><a class="code" href="class_c_chart_axis_label.html" title="Draws the label of an axis.">CChartAxisLabel</a>
|
||||||
|
<a name="l00041"></a>00041 {
|
||||||
|
<a name="l00042"></a>00042 <span class="keyword">friend</span> <a class="code" href="class_c_chart_axis.html" title="Base class that takes care of the management of a chart axis.">CChartAxis</a>;
|
||||||
|
<a name="l00043"></a>00043
|
||||||
|
<a name="l00044"></a>00044 <span class="keyword">public</span>:
|
||||||
|
<a name="l00046"></a>00046 <span class="keywordtype">void</span> <a class="code" href="class_c_chart_axis_label.html#874ee8bbc05aced8d717822e355d7340" title="Sets the text of the axis label.">SetText</a>(<span class="keyword">const</span> TChartString& NewText);
|
||||||
|
<a name="l00048"></a><a class="code" href="class_c_chart_axis_label.html#c0aacb5d08b22eb026f17599a772d3e0">00048</a> TChartString <a class="code" href="class_c_chart_axis_label.html#c0aacb5d08b22eb026f17599a772d3e0" title="Retrieves the text of the axis label.">GetText</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_strLabelText; }
|
||||||
|
<a name="l00049"></a>00049
|
||||||
|
<a name="l00051"></a>00051
|
||||||
|
<a name="l00057"></a>00057 <span class="keywordtype">void</span> <a class="code" href="class_c_chart_axis_label.html#6109d04d8d35ae5aa81c43dc63627eea" title="Sets the font of the text.">SetFont</a>(<span class="keywordtype">int</span> nPointSize, <span class="keyword">const</span> TChartString& strFaceName);
|
||||||
|
<a name="l00059"></a>00059
|
||||||
|
<a name="l00065"></a>00065 <span class="keywordtype">void</span> <a class="code" href="class_c_chart_axis_label.html#6109d04d8d35ae5aa81c43dc63627eea" title="Sets the font of the text.">SetFont</a>(<span class="keyword">const</span> <a class="code" href="class_c_chart_font.html" title="Wrapper class for fonts with advanced properties (italic, bold or underlined).">CChartFont</a>& newFont);
|
||||||
|
<a name="l00066"></a>00066
|
||||||
|
<a name="l00068"></a>00068 <span class="keywordtype">void</span> <a class="code" href="class_c_chart_axis_label.html#40a8111868f5a57f9d5248a56d3f5c8f" title="Shows/hides the title.">SetVisible</a>(<span class="keywordtype">bool</span> bVisible);
|
||||||
|
<a name="l00070"></a><a class="code" href="class_c_chart_axis_label.html#04462dd4988a32f369e22201179d0ff7">00070</a> <span class="keywordtype">bool</span> <a class="code" href="class_c_chart_axis_label.html#04462dd4988a32f369e22201179d0ff7" title="Returns true if the title is visible.">IsVisible</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_bIsVisible; }
|
||||||
|
<a name="l00071"></a>00071
|
||||||
|
<a name="l00073"></a><a class="code" href="class_c_chart_axis_label.html#52c77bb4c58de1cb92492302c41bdb92">00073</a> COLORREF <a class="code" href="class_c_chart_axis_label.html#52c77bb4c58de1cb92492302c41bdb92" title="Retrieves the text color.">GetColor</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_TextColor; }
|
||||||
|
<a name="l00075"></a>00075 <span class="keywordtype">void</span> <a class="code" href="class_c_chart_axis_label.html#f1dd3e458ba086f127c636292d2f7ac9" title="Sets the text color.">SetColor</a>(COLORREF NewColor);
|
||||||
|
<a name="l00076"></a>00076
|
||||||
|
<a name="l00077"></a>00077 <span class="keyword">private</span>:
|
||||||
|
<a name="l00079"></a>00079 <a class="code" href="class_c_chart_axis_label.html" title="Draws the label of an axis.">CChartAxisLabel</a>();
|
||||||
|
<a name="l00081"></a>00081 <span class="keyword">virtual</span> ~<a class="code" href="class_c_chart_axis_label.html" title="Draws the label of an axis.">CChartAxisLabel</a>();
|
||||||
|
<a name="l00082"></a>00082
|
||||||
|
<a name="l00084"></a>00084 <span class="keywordtype">void</span> SetHorizontal(<span class="keywordtype">bool</span> bHorizontal);
|
||||||
|
<a name="l00086"></a>00086 <span class="keywordtype">void</span> SetPosition(<span class="keywordtype">int</span> LeftBorder, <span class="keywordtype">int</span> TopBorder, CDC *pDC);
|
||||||
|
<a name="l00088"></a>00088 <span class="keywordtype">void</span> Draw(CDC* pDC);
|
||||||
|
<a name="l00090"></a>00090 CSize GetSize(CDC* pDC) <span class="keyword">const</span>;
|
||||||
|
<a name="l00091"></a>00091
|
||||||
|
<a name="l00092"></a>00092
|
||||||
|
<a name="l00094"></a>00094 <a class="code" href="class_c_chart_ctrl.html" title="The main chart control class.">CChartCtrl</a>* m_pParentCtrl;
|
||||||
|
<a name="l00096"></a>00096 <span class="keywordtype">bool</span> m_bIsVisible;
|
||||||
|
<a name="l00097"></a>00097
|
||||||
|
<a name="l00099"></a>00099 CRect m_TextRect;
|
||||||
|
<a name="l00101"></a>00101 COLORREF m_TextColor;
|
||||||
|
<a name="l00102"></a>00102
|
||||||
|
<a name="l00104"></a>00104 <span class="keywordtype">bool</span> m_bIsHorizontal;
|
||||||
|
<a name="l00106"></a>00106 <a class="code" href="class_c_chart_font.html" title="Wrapper class for fonts with advanced properties (italic, bold or underlined).">CChartFont</a> m_Font;
|
||||||
|
<a name="l00107"></a>00107
|
||||||
|
<a name="l00109"></a>00109 TChartString m_strLabelText;
|
||||||
|
<a name="l00110"></a>00110 };
|
||||||
|
<a name="l00111"></a>00111
|
||||||
|
<a name="l00112"></a>00112 <span class="preprocessor">#endif // !defined(AFX_CHARTAXISLABEL_H__0E5519C8_A2F4_4CED_9681_32A56B25D0C5__INCLUDED_)</span>
|
||||||
|
</pre></div></div>
|
||||||
|
<hr size="1"><address style="text-align: right;"><small>Generated on Sun Jan 17 13:33:09 2010 for ChartDemo by
|
||||||
|
<a href="http://www.doxygen.org/index.html">
|
||||||
|
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.8 </small></address>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -0,0 +1,239 @@
|
||||||
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||||
|
<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
|
||||||
|
<title>ChartDemo: E:/Sources Misc/ChartDemo/ChartAxisOld.h Source File</title>
|
||||||
|
<link href="tabs.css" rel="stylesheet" type="text/css">
|
||||||
|
<link href="doxygen.css" rel="stylesheet" type="text/css">
|
||||||
|
</head><body>
|
||||||
|
<!-- Generated by Doxygen 1.5.8 -->
|
||||||
|
<div class="navigation" id="top">
|
||||||
|
<div class="tabs">
|
||||||
|
<ul>
|
||||||
|
<li><a href="index.html"><span>Main Page</span></a></li>
|
||||||
|
<li><a href="annotated.html"><span>Classes</span></a></li>
|
||||||
|
<li class="current"><a href="files.html"><span>Files</span></a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="tabs">
|
||||||
|
<ul>
|
||||||
|
<li><a href="files.html"><span>File List</span></a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<h1>E:/Sources Misc/ChartDemo/ChartAxisOld.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span>
|
||||||
|
<a name="l00002"></a>00002 <span class="comment"> *</span>
|
||||||
|
<a name="l00003"></a>00003 <span class="comment"> * ChartAxis.h</span>
|
||||||
|
<a name="l00004"></a>00004 <span class="comment"> *</span>
|
||||||
|
<a name="l00005"></a>00005 <span class="comment"> * Written by Cédric Moonen (cedric_moonen@hotmail.com)</span>
|
||||||
|
<a name="l00006"></a>00006 <span class="comment"> *</span>
|
||||||
|
<a name="l00007"></a>00007 <span class="comment"> *</span>
|
||||||
|
<a name="l00008"></a>00008 <span class="comment"> *</span>
|
||||||
|
<a name="l00009"></a>00009 <span class="comment"> * This code may be used for any non-commercial and commercial purposes in a compiled form.</span>
|
||||||
|
<a name="l00010"></a>00010 <span class="comment"> * The code may be redistributed as long as it remains unmodified and providing that the </span>
|
||||||
|
<a name="l00011"></a>00011 <span class="comment"> * author name and this disclaimer remain intact. The sources can be modified WITH the author </span>
|
||||||
|
<a name="l00012"></a>00012 <span class="comment"> * consent only.</span>
|
||||||
|
<a name="l00013"></a>00013 <span class="comment"> * </span>
|
||||||
|
<a name="l00014"></a>00014 <span class="comment"> * This code is provided without any garanties. I cannot be held responsible for the damage or</span>
|
||||||
|
<a name="l00015"></a>00015 <span class="comment"> * the loss of time it causes. Use it at your own risks</span>
|
||||||
|
<a name="l00016"></a>00016 <span class="comment"> *</span>
|
||||||
|
<a name="l00017"></a>00017 <span class="comment"> * An e-mail to notify me that you are using this code is appreciated also.</span>
|
||||||
|
<a name="l00018"></a>00018 <span class="comment"> *</span>
|
||||||
|
<a name="l00019"></a>00019 <span class="comment"> *</span>
|
||||||
|
<a name="l00020"></a>00020 <span class="comment"> */</span>
|
||||||
|
<a name="l00021"></a>00021
|
||||||
|
<a name="l00022"></a>00022 <span class="preprocessor">#if !defined(AFX_CHARTAXIS_H__063D695C_43CF_4A46_8AA0_C7E00268E0D3__INCLUDED_)</span>
|
||||||
|
<a name="l00023"></a>00023 <span class="preprocessor"></span><span class="preprocessor">#define AFX_CHARTAXIS_H__063D695C_43CF_4A46_8AA0_C7E00268E0D3__INCLUDED_</span>
|
||||||
|
<a name="l00024"></a>00024 <span class="preprocessor"></span>
|
||||||
|
<a name="l00025"></a>00025 <span class="preprocessor">#if _MSC_VER > 1000</span>
|
||||||
|
<a name="l00026"></a>00026 <span class="preprocessor"></span><span class="preprocessor">#pragma once</span>
|
||||||
|
<a name="l00027"></a>00027 <span class="preprocessor"></span><span class="preprocessor">#endif // _MSC_VER > 1000</span>
|
||||||
|
<a name="l00028"></a>00028 <span class="preprocessor"></span>
|
||||||
|
<a name="l00029"></a>00029 <span class="preprocessor">#include "ChartObject.h"</span>
|
||||||
|
<a name="l00030"></a>00030 <span class="preprocessor">#include "ChartScrollBar.h"</span>
|
||||||
|
<a name="l00031"></a>00031 <span class="preprocessor">#include "ChartString.h"</span>
|
||||||
|
<a name="l00032"></a>00032 <span class="preprocessor">#include <afx.h></span>
|
||||||
|
<a name="l00033"></a>00033
|
||||||
|
<a name="l00034"></a>00034 <span class="preprocessor">#include <list></span>
|
||||||
|
<a name="l00035"></a>00035
|
||||||
|
<a name="l00036"></a>00036 <span class="keyword">class </span>CChartGrid;
|
||||||
|
<a name="l00037"></a>00037 <span class="keyword">class </span>CChartSerie;
|
||||||
|
<a name="l00038"></a>00038 <span class="keyword">class </span>CChartAxisLabel;
|
||||||
|
<a name="l00039"></a>00039
|
||||||
|
<a name="l00040"></a>00040 <span class="keyword">class </span>CChartAxis : <span class="keyword">public</span> CChartObject
|
||||||
|
<a name="l00041"></a>00041 {
|
||||||
|
<a name="l00042"></a>00042 <span class="keyword">friend</span> <a class="code" href="class_c_chart_ctrl.html" title="The main chart control class.">CChartCtrl</a>;
|
||||||
|
<a name="l00043"></a>00043 <span class="keyword">friend</span> CChartGrid;
|
||||||
|
<a name="l00044"></a>00044 <span class="keyword">friend</span> CChartSerie;
|
||||||
|
<a name="l00045"></a>00045 <span class="keyword">friend</span> CChartScrollBar;
|
||||||
|
<a name="l00046"></a>00046
|
||||||
|
<a name="l00047"></a>00047 <span class="keyword">public</span>:
|
||||||
|
<a name="l00048"></a>00048
|
||||||
|
<a name="l00049"></a>00049 <span class="keyword">enum</span> AxisType
|
||||||
|
<a name="l00050"></a>00050 {
|
||||||
|
<a name="l00051"></a>00051 atStandard = 0,
|
||||||
|
<a name="l00052"></a>00052 atLogarithmic,
|
||||||
|
<a name="l00053"></a>00053 atDateTime
|
||||||
|
<a name="l00054"></a>00054 };
|
||||||
|
<a name="l00055"></a>00055 <span class="keywordtype">void</span> SetAxisType(AxisType Type);
|
||||||
|
<a name="l00056"></a>00056 AxisType GetAxisType()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_AxisType; }
|
||||||
|
<a name="l00057"></a>00057
|
||||||
|
<a name="l00058"></a>00058 <span class="keyword">enum</span> TimeInterval
|
||||||
|
<a name="l00059"></a>00059 {
|
||||||
|
<a name="l00060"></a>00060 tiSecond,
|
||||||
|
<a name="l00061"></a>00061 tiMinute,
|
||||||
|
<a name="l00062"></a>00062 tiHour,
|
||||||
|
<a name="l00063"></a>00063 tiDay,
|
||||||
|
<a name="l00064"></a>00064 tiMonth,
|
||||||
|
<a name="l00065"></a>00065 tiYear
|
||||||
|
<a name="l00066"></a>00066 };
|
||||||
|
<a name="l00067"></a>00067 <span class="keywordtype">void</span> SetDateTimeIncrement(<span class="keywordtype">bool</span> bAuto, TimeInterval Interval, <span class="keywordtype">int</span> Multiplier);
|
||||||
|
<a name="l00068"></a>00068 <span class="keywordtype">void</span> SetTickIncrement(<span class="keywordtype">bool</span> bAuto, <span class="keywordtype">double</span> Increment);
|
||||||
|
<a name="l00069"></a>00069 <span class="keywordtype">double</span> GetTickIncrement()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_TickIncrement; }
|
||||||
|
<a name="l00070"></a>00070
|
||||||
|
<a name="l00071"></a>00071 <span class="keywordtype">void</span> SetDateTimeFormat(<span class="keywordtype">bool</span> bAutomatic, <span class="keyword">const</span> TChartString& strFormat);
|
||||||
|
<a name="l00072"></a>00072
|
||||||
|
<a name="l00073"></a>00073 <span class="keywordtype">int</span> GetPosition();
|
||||||
|
<a name="l00074"></a>00074
|
||||||
|
<a name="l00075"></a>00075 <span class="keywordtype">void</span> SetInverted(<span class="keywordtype">bool</span> bNewValue);
|
||||||
|
<a name="l00076"></a>00076 <span class="keywordtype">bool</span> IsInverted()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_bIsInverted; }
|
||||||
|
<a name="l00077"></a>00077 <span class="keywordtype">void</span> SetLogarithmic(<span class="keywordtype">bool</span> bNewValue)
|
||||||
|
<a name="l00078"></a>00078 {
|
||||||
|
<a name="l00079"></a>00079 <span class="keywordflow">if</span> (bNewValue)
|
||||||
|
<a name="l00080"></a>00080 m_AxisType = atLogarithmic;
|
||||||
|
<a name="l00081"></a>00081 <span class="keywordflow">else</span>
|
||||||
|
<a name="l00082"></a>00082 m_AxisType = atStandard;
|
||||||
|
<a name="l00083"></a>00083 RefreshAutoAxis();
|
||||||
|
<a name="l00084"></a>00084 }
|
||||||
|
<a name="l00085"></a>00085 <span class="keywordtype">bool</span> IsLogarithmic()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> (m_AxisType == atLogarithmic); }
|
||||||
|
<a name="l00086"></a>00086 <span class="keywordtype">void</span> SetAutomatic(<span class="keywordtype">bool</span> bNewValue);
|
||||||
|
<a name="l00087"></a>00087 <span class="keywordtype">bool</span> IsAutomatic()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_bIsAutomatic; }
|
||||||
|
<a name="l00088"></a>00088
|
||||||
|
<a name="l00089"></a>00089 <span class="keywordtype">void</span> SetMinMax(<span class="keywordtype">double</span> Minimum, <span class="keywordtype">double</span> Maximum);
|
||||||
|
<a name="l00090"></a>00090 <span class="keywordtype">void</span> GetMinMax(<span class="keywordtype">double</span>& Minimum, <span class="keywordtype">double</span>& Maximum)<span class="keyword"> const</span>
|
||||||
|
<a name="l00091"></a>00091 <span class="keyword"> </span>{
|
||||||
|
<a name="l00092"></a>00092 Minimum = m_MinValue;
|
||||||
|
<a name="l00093"></a>00093 Maximum = m_MaxValue;
|
||||||
|
<a name="l00094"></a>00094 }
|
||||||
|
<a name="l00095"></a>00095
|
||||||
|
<a name="l00096"></a>00096 <span class="keywordtype">long</span> ValueToScreen(<span class="keywordtype">double</span> Value) <span class="keyword">const</span>;
|
||||||
|
<a name="l00097"></a>00097 <span class="keywordtype">double</span> ScreenToValue(<span class="keywordtype">long</span> ScreenVal) <span class="keyword">const</span>;
|
||||||
|
<a name="l00098"></a>00098
|
||||||
|
<a name="l00099"></a>00099 <span class="keywordtype">void</span> SetTextColor(COLORREF NewColor);
|
||||||
|
<a name="l00100"></a>00100 COLORREF GetTextColor()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_TextColor; }
|
||||||
|
<a name="l00101"></a>00101
|
||||||
|
<a name="l00102"></a>00102 <span class="keywordtype">void</span> SetFont(<span class="keywordtype">int</span> nPointSize, <span class="keyword">const</span> TChartString& strFaceName);
|
||||||
|
<a name="l00103"></a>00103
|
||||||
|
<a name="l00104"></a>00104 CChartAxisLabel* GetLabel()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_pAxisLabel; }
|
||||||
|
<a name="l00105"></a>00105 CChartGrid* GetGrid()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_pAxisGrid; }
|
||||||
|
<a name="l00106"></a>00106
|
||||||
|
<a name="l00107"></a>00107 CChartAxis(<a class="code" href="class_c_chart_ctrl.html" title="The main chart control class.">CChartCtrl</a>* pParent,<span class="keywordtype">bool</span> bHoriz);
|
||||||
|
<a name="l00108"></a>00108 <span class="keyword">virtual</span> ~CChartAxis();
|
||||||
|
<a name="l00109"></a>00109
|
||||||
|
<a name="l00110"></a>00110 <span class="keywordtype">void</span> SetMarginSize(<span class="keywordtype">bool</span> bAuto, <span class="keywordtype">int</span> iNewSize);
|
||||||
|
<a name="l00111"></a>00111
|
||||||
|
<a name="l00112"></a>00112 <span class="keywordtype">void</span> SetPanZoomEnabled(<span class="keywordtype">bool</span> bEnabled) { m_bZoomEnabled = bEnabled; }
|
||||||
|
<a name="l00113"></a>00113 <span class="keywordtype">void</span> SetZoomLimit(<span class="keywordtype">double</span> dLimit) { m_dZoomLimit = dLimit; }
|
||||||
|
<a name="l00114"></a>00114
|
||||||
|
<a name="l00115"></a>00115 <span class="keywordtype">void</span> EnableScrollBar(<span class="keywordtype">bool</span> bEnabled);
|
||||||
|
<a name="l00116"></a>00116 <span class="keywordtype">bool</span> ScrollBarEnabled()<span class="keyword"> const </span>
|
||||||
|
<a name="l00117"></a>00117 <span class="keyword"> </span>{
|
||||||
|
<a name="l00118"></a>00118 <span class="keywordflow">if</span> (m_pScrollBar)
|
||||||
|
<a name="l00119"></a>00119 <span class="keywordflow">return</span> (m_pScrollBar->GetEnabled());
|
||||||
|
<a name="l00120"></a>00120 <span class="keywordflow">else</span>
|
||||||
|
<a name="l00121"></a>00121 <span class="keywordflow">return</span> <span class="keyword">false</span>;
|
||||||
|
<a name="l00122"></a>00122 }
|
||||||
|
<a name="l00123"></a>00123 <span class="keywordtype">void</span> SetAutoHideScrollBar(<span class="keywordtype">bool</span> bAutoHide);
|
||||||
|
<a name="l00124"></a>00124 <span class="keywordtype">bool</span> GetAutoHideScrollBar() <span class="keyword">const</span>;
|
||||||
|
<a name="l00125"></a>00125
|
||||||
|
<a name="l00126"></a>00126 <span class="keyword">private</span>:
|
||||||
|
<a name="l00127"></a>00127 <span class="keywordtype">void</span> CalculateTickIncrement();
|
||||||
|
<a name="l00128"></a>00128 <span class="keywordtype">void</span> CalculateFirstTick();
|
||||||
|
<a name="l00129"></a>00129 <span class="keywordtype">double</span> GetNextTickValue(<span class="keywordtype">double</span> Previous);
|
||||||
|
<a name="l00130"></a>00130 CString GetTickLabel(<span class="keywordtype">double</span> Tick);
|
||||||
|
<a name="l00131"></a>00131 CSize GetLargestTick(CDC* pDC);
|
||||||
|
<a name="l00132"></a>00132 <span class="keywordtype">void</span> Recalculate();
|
||||||
|
<a name="l00133"></a>00133 COleDateTime AddMonthToDate(<span class="keyword">const</span> COleDateTime& Date, <span class="keywordtype">int</span> iMonthsToAdd);
|
||||||
|
<a name="l00134"></a>00134 <span class="keywordtype">void</span> DrawLabel(CDC* pDC);
|
||||||
|
<a name="l00135"></a>00135 <span class="keywordtype">void</span> RefreshDTTickFormat();
|
||||||
|
<a name="l00136"></a>00136
|
||||||
|
<a name="l00137"></a>00137 <span class="keywordtype">void</span> PanAxis(<span class="keywordtype">long</span> PanStart, <span class="keywordtype">long</span> PanEnd);
|
||||||
|
<a name="l00138"></a>00138 <span class="keywordtype">void</span> SetZoomMinMax(<span class="keywordtype">double</span> Minimum, <span class="keywordtype">double</span> Maximum);
|
||||||
|
<a name="l00139"></a>00139 <span class="keywordtype">void</span> UndoZoom();
|
||||||
|
<a name="l00140"></a>00140
|
||||||
|
<a name="l00141"></a>00141 <span class="keywordtype">void</span> SetDecimals(<span class="keywordtype">int</span> NewValue) { m_DecCount = NewValue; }
|
||||||
|
<a name="l00142"></a>00142 <span class="keywordtype">bool</span> IsHorizontal()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_bIsHorizontal; }
|
||||||
|
<a name="l00143"></a>00143
|
||||||
|
<a name="l00144"></a>00144 <span class="keywordtype">int</span> GetAxisLenght() <span class="keyword">const</span>;
|
||||||
|
<a name="l00145"></a>00145 <span class="keywordtype">void</span> SetSecondary(<span class="keywordtype">bool</span> bNewVal) { m_bIsSecondary = bNewVal; }
|
||||||
|
<a name="l00146"></a>00146 <span class="keywordtype">bool</span> GetSecondary()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_bIsSecondary; }
|
||||||
|
<a name="l00147"></a>00147
|
||||||
|
<a name="l00148"></a>00148 <span class="keywordtype">bool</span> RefreshAutoAxis();
|
||||||
|
<a name="l00149"></a>00149 <span class="keywordtype">void</span> GetSeriesMinMax(<span class="keywordtype">double</span>& Minimum, <span class="keywordtype">double</span>& Maximum);
|
||||||
|
<a name="l00150"></a>00150
|
||||||
|
<a name="l00151"></a>00151 <span class="keywordtype">void</span> SetAxisSize(CRect ControlRect,CRect MarginRect);
|
||||||
|
<a name="l00152"></a>00152 <span class="keywordtype">int</span> ClipMargin(CRect ControlRect,CRect& MarginRect,CDC* pDC); <span class="comment">// Allows to calculate the margin required to displayys ticks and text</span>
|
||||||
|
<a name="l00153"></a>00153
|
||||||
|
<a name="l00154"></a>00154 <span class="keywordtype">void</span> Draw(CDC* pDC);
|
||||||
|
<a name="l00155"></a>00155
|
||||||
|
<a name="l00156"></a>00156 <span class="comment">// To register/Unregister series related to this axis</span>
|
||||||
|
<a name="l00157"></a>00157 <span class="keywordtype">void</span> RegisterSeries(CChartSerie* pSeries);
|
||||||
|
<a name="l00158"></a>00158 <span class="keywordtype">void</span> UnregisterSeries(CChartSerie* pSeries);
|
||||||
|
<a name="l00159"></a>00159
|
||||||
|
<a name="l00160"></a>00160 <span class="keywordtype">void</span> CreateScrollBar();
|
||||||
|
<a name="l00161"></a>00161 <span class="keywordtype">void</span> UpdateScrollBarPos();
|
||||||
|
<a name="l00162"></a>00162 <span class="keywordtype">void</span> RefreshScrollBar();
|
||||||
|
<a name="l00163"></a>00163
|
||||||
|
<a name="l00164"></a>00164 AxisType m_AxisType; <span class="comment">// Type of the axis (standard, log or date/time)</span>
|
||||||
|
<a name="l00165"></a>00165
|
||||||
|
<a name="l00166"></a>00166 <span class="keywordtype">bool</span> m_bIsHorizontal; <span class="comment">// Indicates if this is an horizontal or vertical axis</span>
|
||||||
|
<a name="l00167"></a>00167 <span class="keywordtype">bool</span> m_bIsInverted; <span class="comment">// Indicates if the axis is inverted</span>
|
||||||
|
<a name="l00168"></a>00168 <span class="keywordtype">bool</span> m_bIsAutomatic; <span class="comment">// Indicates if the axis is automatic</span>
|
||||||
|
<a name="l00169"></a>00169
|
||||||
|
<a name="l00170"></a>00170 <span class="keywordtype">bool</span> m_bIsSecondary; <span class="comment">// If the axis is secondary, it will be positioned to </span>
|
||||||
|
<a name="l00171"></a>00171 <span class="comment">// the right (vertical) or to the top (horizontal)</span>
|
||||||
|
<a name="l00172"></a>00172 <span class="keywordtype">double</span> m_MaxValue; <span class="comment">// Maximum value on the axis</span>
|
||||||
|
<a name="l00173"></a>00173 <span class="keywordtype">double</span> m_MinValue;
|
||||||
|
<a name="l00174"></a>00174 <span class="keywordtype">double</span> m_UnzoomMin; <span class="comment">// Min and max values of the axis before it has been zoomed</span>
|
||||||
|
<a name="l00175"></a>00175 <span class="keywordtype">double</span> m_UnzoomMax; <span class="comment">// (used when we unzoom the chart -> go back to previous state)</span>
|
||||||
|
<a name="l00176"></a>00176
|
||||||
|
<a name="l00177"></a>00177 <span class="keywordtype">bool</span> m_bAutoTicks; <span class="comment">// Specify if the tick increment is manual or automatic</span>
|
||||||
|
<a name="l00178"></a>00178 <span class="keywordtype">double</span> m_TickIncrement; <span class="comment">// Indicates the space between ticks (in axis value) or for log axis the mult base between two ticks</span>
|
||||||
|
<a name="l00179"></a>00179 <span class="keywordtype">double</span> m_FirstTickVal;
|
||||||
|
<a name="l00180"></a>00180
|
||||||
|
<a name="l00181"></a>00181 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> m_DecCount; <span class="comment">// Number of decimals to display</span>
|
||||||
|
<a name="l00182"></a>00182 <span class="keywordtype">int</span> m_StartPos; <span class="comment">// Start position of the axis </span>
|
||||||
|
<a name="l00183"></a>00183 <span class="keywordtype">int</span> m_EndPos;
|
||||||
|
<a name="l00184"></a>00184
|
||||||
|
<a name="l00185"></a>00185 <span class="keywordtype">int</span> m_nFontSize;
|
||||||
|
<a name="l00186"></a>00186 TChartString m_strFontName;
|
||||||
|
<a name="l00187"></a>00187
|
||||||
|
<a name="l00188"></a>00188 CChartGrid* m_pAxisGrid;
|
||||||
|
<a name="l00189"></a>00189 CChartAxisLabel* m_pAxisLabel;
|
||||||
|
<a name="l00190"></a>00190
|
||||||
|
<a name="l00191"></a>00191 <span class="keyword">typedef</span> std::list<CChartSerie*> SeriesList;
|
||||||
|
<a name="l00192"></a>00192 SeriesList m_pRelatedSeries; <span class="comment">// List containing pointers to series related to this axis</span>
|
||||||
|
<a name="l00193"></a>00193
|
||||||
|
<a name="l00194"></a>00194 <span class="comment">// The user can specify the size of the margin, instead of</span>
|
||||||
|
<a name="l00195"></a>00195 <span class="comment">// having it calculated automatically</span>
|
||||||
|
<a name="l00196"></a>00196 <span class="keywordtype">bool</span> m_bAutoMargin;
|
||||||
|
<a name="l00197"></a>00197 <span class="keywordtype">int</span> m_iMarginSize;
|
||||||
|
<a name="l00198"></a>00198
|
||||||
|
<a name="l00199"></a>00199 COLORREF m_TextColor;
|
||||||
|
<a name="l00200"></a>00200
|
||||||
|
<a name="l00201"></a>00201 <span class="comment">// Data for the date/time axis type.</span>
|
||||||
|
<a name="l00202"></a>00202 TChartString m_strDTTickFormat; <span class="comment">// Format of the date/time tick labels</span>
|
||||||
|
<a name="l00203"></a>00203 <span class="keywordtype">bool</span> m_bAutoTickFormat;
|
||||||
|
<a name="l00204"></a>00204 TimeInterval m_BaseInterval;
|
||||||
|
<a name="l00205"></a>00205 <span class="keywordtype">int</span> m_iDTTickIntervalMult;
|
||||||
|
<a name="l00206"></a>00206
|
||||||
|
<a name="l00207"></a>00207 <span class="keywordtype">bool</span> m_bZoomEnabled;
|
||||||
|
<a name="l00208"></a>00208 <span class="keywordtype">double</span> m_dZoomLimit;
|
||||||
|
<a name="l00209"></a>00209
|
||||||
|
<a name="l00210"></a>00210 CChartScrollBar* m_pScrollBar;
|
||||||
|
<a name="l00211"></a>00211 };
|
||||||
|
<a name="l00212"></a>00212
|
||||||
|
<a name="l00213"></a>00213 <span class="preprocessor">#endif // !defined(AFX_CHARTAXIS_H__063D695C_43CF_4A46_8AA0_C7E00268E0D3__INCLUDED_)</span>
|
||||||
|
</pre></div></div>
|
||||||
|
<hr size="1"><address style="text-align: right;"><small>Generated on Sun Feb 1 14:21:48 2009 for ChartDemo by
|
||||||
|
<a href="http://www.doxygen.org/index.html">
|
||||||
|
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.8 </small></address>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -0,0 +1,95 @@
|
||||||
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||||
|
<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
|
||||||
|
<title>ChartDemo: E:/Sources Misc/ChartDemo/ChartCtrl/ChartBalloonLabel.h Source File</title>
|
||||||
|
<link href="tabs.css" rel="stylesheet" type="text/css">
|
||||||
|
<link href="doxygen.css" rel="stylesheet" type="text/css">
|
||||||
|
</head><body>
|
||||||
|
<!-- Generated by Doxygen 1.5.8 -->
|
||||||
|
<div class="navigation" id="top">
|
||||||
|
<div class="tabs">
|
||||||
|
<ul>
|
||||||
|
<li><a href="index.html"><span>Main Page</span></a></li>
|
||||||
|
<li><a href="pages.html"><span>Related Pages</span></a></li>
|
||||||
|
<li><a href="annotated.html"><span>Classes</span></a></li>
|
||||||
|
<li class="current"><a href="files.html"><span>Files</span></a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="tabs">
|
||||||
|
<ul>
|
||||||
|
<li><a href="files.html"><span>File List</span></a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<h1>E:/Sources Misc/ChartDemo/ChartCtrl/ChartBalloonLabel.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span>
|
||||||
|
<a name="l00002"></a>00002 <span class="comment"> *</span>
|
||||||
|
<a name="l00003"></a>00003 <span class="comment"> * ChartBalloonLabel.h</span>
|
||||||
|
<a name="l00004"></a>00004 <span class="comment"> *</span>
|
||||||
|
<a name="l00005"></a>00005 <span class="comment"> * Written by Cédric Moonen (cedric_moonen@hotmail.com)</span>
|
||||||
|
<a name="l00006"></a>00006 <span class="comment"> *</span>
|
||||||
|
<a name="l00007"></a>00007 <span class="comment"> *</span>
|
||||||
|
<a name="l00008"></a>00008 <span class="comment"> *</span>
|
||||||
|
<a name="l00009"></a>00009 <span class="comment"> * This code may be used for any non-commercial and commercial purposes in a compiled form.</span>
|
||||||
|
<a name="l00010"></a>00010 <span class="comment"> * The code may be redistributed as long as it remains unmodified and providing that the </span>
|
||||||
|
<a name="l00011"></a>00011 <span class="comment"> * author name and this disclaimer remain intact. The sources can be modified WITH the author </span>
|
||||||
|
<a name="l00012"></a>00012 <span class="comment"> * consent only.</span>
|
||||||
|
<a name="l00013"></a>00013 <span class="comment"> * </span>
|
||||||
|
<a name="l00014"></a>00014 <span class="comment"> * This code is provided without any garanties. I cannot be held responsible for the damage or</span>
|
||||||
|
<a name="l00015"></a>00015 <span class="comment"> * the loss of time it causes. Use it at your own risks</span>
|
||||||
|
<a name="l00016"></a>00016 <span class="comment"> *</span>
|
||||||
|
<a name="l00017"></a>00017 <span class="comment"> * An e-mail to notify me that you are using this code is appreciated also.</span>
|
||||||
|
<a name="l00018"></a>00018 <span class="comment"> *</span>
|
||||||
|
<a name="l00019"></a>00019 <span class="comment"> *</span>
|
||||||
|
<a name="l00020"></a>00020 <span class="comment"> */</span>
|
||||||
|
<a name="l00021"></a>00021
|
||||||
|
<a name="l00022"></a>00022 <span class="preprocessor">#ifndef _CHARTBALLOONLABEL_H_ </span>
|
||||||
|
<a name="l00023"></a>00023 <span class="preprocessor"></span><span class="preprocessor">#define _CHARTBALLOONLABEL_H_</span>
|
||||||
|
<a name="l00024"></a>00024 <span class="preprocessor"></span>
|
||||||
|
<a name="l00025"></a>00025 <span class="preprocessor">#include "ChartLabel.h"</span>
|
||||||
|
<a name="l00026"></a>00026 <span class="preprocessor">#include "ChartFont.h"</span>
|
||||||
|
<a name="l00027"></a>00027
|
||||||
|
<a name="l00029"></a>00029
|
||||||
|
<a name="l00034"></a>00034 <span class="keyword">template</span> <<span class="keyword">class</span> Po<span class="keywordtype">int</span>Type>
|
||||||
|
<a name="l00035"></a><a class="code" href="class_c_chart_balloon_label.html">00035</a> <span class="keyword">class </span><a class="code" href="class_c_chart_balloon_label.html" title="Specialization of the CChartLabel to display a balloon label.">CChartBalloonLabel</a> : <span class="keyword">public</span> <a class="code" href="class_c_chart_label.html" title="Draws a label containing some text which is attached to a point of a series.">CChartLabel</a><PointType>
|
||||||
|
<a name="l00036"></a>00036 {
|
||||||
|
<a name="l00037"></a>00037 <span class="keyword">friend</span> <a class="code" href="class_c_chart_serie_base.html">CChartSerieBase<PointType></a>;
|
||||||
|
<a name="l00038"></a>00038
|
||||||
|
<a name="l00039"></a>00039 <span class="keyword">public</span>:
|
||||||
|
<a name="l00041"></a>00041 <span class="keywordtype">void</span> <a class="code" href="class_c_chart_balloon_label.html#637efd47da88d8bc9b207c6176484187" title="Sets the background color of the text area.">SetBackgroundColor</a>(COLORREF colBackground);
|
||||||
|
<a name="l00043"></a><a class="code" href="class_c_chart_balloon_label.html#43cefc851d29bcbb7c35de98b21163d4">00043</a> COLORREF <a class="code" href="class_c_chart_balloon_label.html#43cefc851d29bcbb7c35de98b21163d4" title="Retrieves the background color of the text area.">GetBackgroundColor</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_colBackground; }
|
||||||
|
<a name="l00045"></a>00045 <span class="keywordtype">void</span> <a class="code" href="class_c_chart_balloon_label.html#58b330f70bb517893ae604a20562e293" title="Sets the color of the line connecting the point to the text area.">SetLineColor</a>(COLORREF colArrow);
|
||||||
|
<a name="l00047"></a><a class="code" href="class_c_chart_balloon_label.html#9be7e959dbfcbcd5b6e42f7a22db683b">00047</a> COLORREF <a class="code" href="class_c_chart_balloon_label.html#9be7e959dbfcbcd5b6e42f7a22db683b" title="Retrieves the color of the line connecting the point to the text area.">GetLineColor</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_colLine; }
|
||||||
|
<a name="l00049"></a>00049 <span class="keywordtype">void</span> <a class="code" href="class_c_chart_balloon_label.html#1fd60c34d8eb49c31662fcfcddc6c759" title="Sets the color of border&#39;s text area.">SetBorderColor</a>(COLORREF colBorder);
|
||||||
|
<a name="l00051"></a><a class="code" href="class_c_chart_balloon_label.html#b428ccd54c70563abe49d1f8ed8f270d">00051</a> COLORREF <a class="code" href="class_c_chart_balloon_label.html#b428ccd54c70563abe49d1f8ed8f270d" title="Retrieves the color of border&#39;s text area.">GetBorderColor</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_colBorder; }
|
||||||
|
<a name="l00052"></a>00052
|
||||||
|
<a name="l00054"></a>00054 <span class="keywordtype">void</span> <a class="code" href="class_c_chart_balloon_label.html#b3b7b88ca6079c833d17dd690a3562e2" title="Specifies if the text area is rounded or not.">SetRoundedRect</a>(<span class="keywordtype">bool</span> bRounded);
|
||||||
|
<a name="l00056"></a><a class="code" href="class_c_chart_balloon_label.html#43470e0fc84d74f5b6072b89c87c0e91">00056</a> <span class="keywordtype">bool</span> <a class="code" href="class_c_chart_balloon_label.html#43470e0fc84d74f5b6072b89c87c0e91" title="Returns true if the text area is rounded.">GetRoundedRect</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_bRoundedRect; }
|
||||||
|
<a name="l00057"></a>00057
|
||||||
|
<a name="l00059"></a>00059
|
||||||
|
<a name="l00065"></a>00065 <span class="keywordtype">void</span> <a class="code" href="class_c_chart_balloon_label.html#31ffe0ed485cfd31537b70bb1f89611e" title="Sets the font of the text.">SetFont</a>(<span class="keywordtype">int</span> nPointSize, <span class="keyword">const</span> TChartString& strFaceName);
|
||||||
|
<a name="l00067"></a>00067
|
||||||
|
<a name="l00073"></a>00073 <span class="keywordtype">void</span> <a class="code" href="class_c_chart_balloon_label.html#31ffe0ed485cfd31537b70bb1f89611e" title="Sets the font of the text.">SetFont</a>(<span class="keyword">const</span> <a class="code" href="class_c_chart_font.html" title="Wrapper class for fonts with advanced properties (italic, bold or underlined).">CChartFont</a>& newFont);
|
||||||
|
<a name="l00074"></a>00074
|
||||||
|
<a name="l00076"></a>00076 <a class="code" href="class_c_chart_balloon_label.html#a17c9886425bb25dddb193050e81b461" title="Constructor.">CChartBalloonLabel</a>(<a class="code" href="class_c_chart_ctrl.html" title="The main chart control class.">CChartCtrl</a>* pParentCtrl, <a class="code" href="class_c_chart_serie_base.html">CChartSerieBase<PointType></a>* pParentSeries);
|
||||||
|
<a name="l00078"></a>00078 <a class="code" href="class_c_chart_balloon_label.html#1c050bfd239cb0c783fdde369e51b85b" title="Destructor.">~CChartBalloonLabel</a>();
|
||||||
|
<a name="l00079"></a>00079
|
||||||
|
<a name="l00080"></a>00080 <span class="keyword">protected</span>:
|
||||||
|
<a name="l00082"></a>00082 <span class="keywordtype">void</span> <a class="code" href="class_c_chart_balloon_label.html#adeb3183a9594378fd64cf774d549de6" title="Draw the label.">Draw</a>(CDC* pDC, <span class="keywordtype">unsigned</span> uPointIndex);
|
||||||
|
<a name="l00083"></a>00083
|
||||||
|
<a name="l00084"></a>00084 <span class="keyword">private</span>:
|
||||||
|
<a name="l00086"></a>00086 COLORREF m_colLine;
|
||||||
|
<a name="l00088"></a>00088 COLORREF m_colBackground;
|
||||||
|
<a name="l00090"></a>00090 COLORREF m_colBorder;
|
||||||
|
<a name="l00091"></a>00091
|
||||||
|
<a name="l00093"></a>00093 <a class="code" href="class_c_chart_font.html" title="Wrapper class for fonts with advanced properties (italic, bold or underlined).">CChartFont</a> m_Font;
|
||||||
|
<a name="l00094"></a>00094
|
||||||
|
<a name="l00096"></a>00096 <span class="keywordtype">bool</span> m_bRoundedRect;
|
||||||
|
<a name="l00097"></a>00097 };
|
||||||
|
<a name="l00098"></a>00098
|
||||||
|
<a name="l00099"></a>00099 <span class="preprocessor">#include "ChartBalloonLabel.inl"</span>
|
||||||
|
<a name="l00100"></a>00100
|
||||||
|
<a name="l00101"></a>00101 <span class="preprocessor">#endif // _CHARTBALLOONLABEL_H_</span>
|
||||||
|
</pre></div></div>
|
||||||
|
<hr size="1"><address style="text-align: right;"><small>Generated on Sun Jan 17 13:33:09 2010 for ChartDemo by
|
||||||
|
<a href="http://www.doxygen.org/index.html">
|
||||||
|
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.8 </small></address>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -0,0 +1,148 @@
|
||||||
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||||
|
<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
|
||||||
|
<title>ChartDemo: E:/Sources Misc/ChartDemo/ChartCtrl/ChartBarSerie.h Source File</title>
|
||||||
|
<link href="tabs.css" rel="stylesheet" type="text/css">
|
||||||
|
<link href="doxygen.css" rel="stylesheet" type="text/css">
|
||||||
|
</head><body>
|
||||||
|
<!-- Generated by Doxygen 1.5.8 -->
|
||||||
|
<div class="navigation" id="top">
|
||||||
|
<div class="tabs">
|
||||||
|
<ul>
|
||||||
|
<li><a href="index.html"><span>Main Page</span></a></li>
|
||||||
|
<li><a href="pages.html"><span>Related Pages</span></a></li>
|
||||||
|
<li><a href="annotated.html"><span>Classes</span></a></li>
|
||||||
|
<li class="current"><a href="files.html"><span>Files</span></a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="tabs">
|
||||||
|
<ul>
|
||||||
|
<li><a href="files.html"><span>File List</span></a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<h1>E:/Sources Misc/ChartDemo/ChartCtrl/ChartBarSerie.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span>
|
||||||
|
<a name="l00002"></a>00002 <span class="comment"> *</span>
|
||||||
|
<a name="l00003"></a>00003 <span class="comment"> * ChartBarSerie.h</span>
|
||||||
|
<a name="l00004"></a>00004 <span class="comment"> *</span>
|
||||||
|
<a name="l00005"></a>00005 <span class="comment"> * Written by Cédric Moonen (cedric_moonen@hotmail.com)</span>
|
||||||
|
<a name="l00006"></a>00006 <span class="comment"> *</span>
|
||||||
|
<a name="l00007"></a>00007 <span class="comment"> *</span>
|
||||||
|
<a name="l00008"></a>00008 <span class="comment"> *</span>
|
||||||
|
<a name="l00009"></a>00009 <span class="comment"> * This code may be used for any non-commercial and commercial purposes in a compiled form.</span>
|
||||||
|
<a name="l00010"></a>00010 <span class="comment"> * The code may be redistributed as long as it remains unmodified and providing that the </span>
|
||||||
|
<a name="l00011"></a>00011 <span class="comment"> * author name and this disclaimer remain intact. The sources can be modified WITH the author </span>
|
||||||
|
<a name="l00012"></a>00012 <span class="comment"> * consent only.</span>
|
||||||
|
<a name="l00013"></a>00013 <span class="comment"> * </span>
|
||||||
|
<a name="l00014"></a>00014 <span class="comment"> * This code is provided without any garanties. I cannot be held responsible for the damage or</span>
|
||||||
|
<a name="l00015"></a>00015 <span class="comment"> * the loss of time it causes. Use it at your own risks</span>
|
||||||
|
<a name="l00016"></a>00016 <span class="comment"> *</span>
|
||||||
|
<a name="l00017"></a>00017 <span class="comment"> * An e-mail to notify me that you are using this code is appreciated also.</span>
|
||||||
|
<a name="l00018"></a>00018 <span class="comment"> *</span>
|
||||||
|
<a name="l00019"></a>00019 <span class="comment"> *</span>
|
||||||
|
<a name="l00020"></a>00020 <span class="comment"> */</span>
|
||||||
|
<a name="l00021"></a>00021
|
||||||
|
<a name="l00022"></a>00022 <span class="preprocessor">#pragma once</span>
|
||||||
|
<a name="l00023"></a>00023 <span class="preprocessor"></span><span class="preprocessor">#include "ChartXYSerie.h"</span>
|
||||||
|
<a name="l00024"></a>00024 <span class="preprocessor">#include "ChartGradient.h"</span>
|
||||||
|
<a name="l00025"></a>00025 <span class="preprocessor">#include <list></span>
|
||||||
|
<a name="l00026"></a>00026
|
||||||
|
<a name="l00028"></a>00028
|
||||||
|
<a name="l00038"></a><a class="code" href="class_c_chart_bar_serie.html">00038</a> <span class="keyword">class </span><a class="code" href="class_c_chart_bar_serie.html" title="Specialization of a CChartSerie to display a bars series.">CChartBarSerie</a> : <span class="keyword">public</span> <a class="code" href="class_c_chart_x_y_serie.html" title="Specialization of a CChartSerieBase for series having data with an X and an Y value...">CChartXYSerie</a>
|
||||||
|
<a name="l00039"></a>00039 {
|
||||||
|
<a name="l00040"></a>00040 <span class="keyword">public</span>:
|
||||||
|
<a name="l00042"></a>00042 <a class="code" href="class_c_chart_bar_serie.html#05cae99f4f8c3c413913f0ee55f1cddc" title="Constructor.">CChartBarSerie</a>(<a class="code" href="class_c_chart_ctrl.html" title="The main chart control class.">CChartCtrl</a>* pParent);
|
||||||
|
<a name="l00044"></a>00044 <a class="code" href="class_c_chart_bar_serie.html#f17c82f287b9e3bdcb0bfb44740c085b" title="Destructor.">~CChartBarSerie</a>();
|
||||||
|
<a name="l00045"></a>00045
|
||||||
|
<a name="l00047"></a>00047 <span class="keywordtype">void</span> <a class="code" href="class_c_chart_bar_serie.html#20ce485665c27c0b9a645e77721da93c" title="Specifies if the bars are vertical or horizontal.">SetHorizontal</a>(<span class="keywordtype">bool</span> bHorizontal);
|
||||||
|
<a name="l00049"></a><a class="code" href="class_c_chart_bar_serie.html#870117e88804601968a15176b5b00625">00049</a> <span class="keywordtype">bool</span> <a class="code" href="class_c_chart_bar_serie.html#870117e88804601968a15176b5b00625" title="Returns true if bars are horizontal, false otherwise.">GetHorizontal</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_bHorizontal; }
|
||||||
|
<a name="l00050"></a>00050
|
||||||
|
<a name="l00052"></a>00052 <span class="keywordtype">void</span> <a class="code" href="class_c_chart_bar_serie.html#f936ce9f2e08c89e3e1fdee221fdd2e9" title="Sets the bars border color.">SetBorderColor</a>(COLORREF BorderColor);
|
||||||
|
<a name="l00054"></a><a class="code" href="class_c_chart_bar_serie.html#30b9d6b27438a8040cc40d68e7ff74ae">00054</a> COLORREF <a class="code" href="class_c_chart_bar_serie.html#30b9d6b27438a8040cc40d68e7ff74ae" title="Returns the bars border color.">GetBorderColor</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_BorderColor; }
|
||||||
|
<a name="l00056"></a>00056 <span class="keywordtype">void</span> <a class="code" href="class_c_chart_bar_serie.html#d106f77a1fca397d7cf091b9322bbf84" title="Sets the bars border width.">SetBorderWidth</a>(<span class="keywordtype">int</span> Width);
|
||||||
|
<a name="l00058"></a><a class="code" href="class_c_chart_bar_serie.html#1b3e0cb1970bb22e045628780a6218ae">00058</a> <span class="keywordtype">int</span> <a class="code" href="class_c_chart_bar_serie.html#1b3e0cb1970bb22e045628780a6218ae" title="Returns the bars border width.">GetBorderWidth</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_iBorderWidth; }
|
||||||
|
<a name="l00060"></a>00060 <span class="keywordtype">void</span> <a class="code" href="class_c_chart_bar_serie.html#47ed2782d775df69aa5018a85f44ed41" title="Sets the bars width (in pixels).">SetBarWidth</a>(<span class="keywordtype">int</span> Width);
|
||||||
|
<a name="l00062"></a><a class="code" href="class_c_chart_bar_serie.html#8e4ab7a0af3097d935922f12ba9c4f3d">00062</a> <span class="keywordtype">int</span> <a class="code" href="class_c_chart_bar_serie.html#8e4ab7a0af3097d935922f12ba9c4f3d" title="Returns the bars width (in pixels).">GetBarWidth</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_iBarWidth; }
|
||||||
|
<a name="l00063"></a>00063
|
||||||
|
<a name="l00065"></a>00065
|
||||||
|
<a name="l00069"></a>00069 <span class="keywordtype">void</span> <a class="code" href="class_c_chart_bar_serie.html#6d3435c3aed16932f8e7eff77dccdd15" title="Set the group Id of the series.">SetGroupId</a>(<span class="keywordtype">unsigned</span> GroupId);
|
||||||
|
<a name="l00071"></a><a class="code" href="class_c_chart_bar_serie.html#49f2d1b1359904abbdc526e2f0ef1f79">00071</a> <span class="keywordtype">unsigned</span> <a class="code" href="class_c_chart_bar_serie.html#49f2d1b1359904abbdc526e2f0ef1f79" title="Returns the group Id of the series.">GetGroupId</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_uGroupId; }
|
||||||
|
<a name="l00072"></a>00072
|
||||||
|
<a name="l00074"></a>00074
|
||||||
|
<a name="l00079"></a>00079 <span class="keywordtype">void</span> <a class="code" href="class_c_chart_bar_serie.html#e71413d96c465b3817f1a3e38f172991" title="Specifies if the series is stacked with other bar series.">SetStacked</a>(<span class="keywordtype">bool</span> bStacked);
|
||||||
|
<a name="l00081"></a>00081 <span class="keywordtype">bool</span> <a class="code" href="class_c_chart_bar_serie.html#4471f2073992b01919342a128b9ffbbe" title="Returns true if the series is stacked.">IsStacked</a>();
|
||||||
|
<a name="l00082"></a>00082
|
||||||
|
<a name="l00084"></a>00084 <span class="keywordtype">void</span> <a class="code" href="class_c_chart_bar_serie.html#97475ad09ac06af0d9b0a719eaa4cc9a" title="Specifies if a gradient is applied to the bars.">ShowGradient</a>(<span class="keywordtype">bool</span> bShow);
|
||||||
|
<a name="l00086"></a>00086
|
||||||
|
<a name="l00093"></a>00093 <span class="keywordtype">void</span> <a class="code" href="class_c_chart_bar_serie.html#64f4107f6c697c104a09ff53e3b1d424" title="Sets the gradient style.">SetGradient</a>(COLORREF GradientColor, EGradientType GradientType);
|
||||||
|
<a name="l00094"></a>00094
|
||||||
|
<a name="l00096"></a><a class="code" href="class_c_chart_bar_serie.html#9f45f9eb57c9e5ece67adac71b4fffe1">00096</a> <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="class_c_chart_bar_serie.html#9f45f9eb57c9e5ece67adac71b4fffe1" title="Static function used to specify the space (in pixels) between series of the same...">SetInterSpace</a>(<span class="keywordtype">int</span> Space) { m_iInterSpace = Space; }
|
||||||
|
<a name="l00098"></a><a class="code" href="class_c_chart_bar_serie.html#a127aeb7d339f6ea056573b37e9c6998">00098</a> <span class="keyword">static</span> <span class="keywordtype">int</span> <a class="code" href="class_c_chart_bar_serie.html#a127aeb7d339f6ea056573b37e9c6998" title="Static function returning the space between series of the same group.">GetInterSpace</a>() { <span class="keywordflow">return</span> m_iInterSpace; }
|
||||||
|
<a name="l00099"></a>00099
|
||||||
|
<a name="l00101"></a>00101
|
||||||
|
<a name="l00110"></a><a class="code" href="class_c_chart_bar_serie.html#03c8e2170ffe73224bb2434613e484e5">00110</a> <span class="keywordtype">void</span> <a class="code" href="class_c_chart_bar_serie.html#03c8e2170ffe73224bb2434613e484e5" title="Specifies a base line for the bars.">SetBaseLine</a>(<span class="keywordtype">bool</span> bAutomatic, <span class="keywordtype">double</span> dBaseLine)
|
||||||
|
<a name="l00111"></a>00111 {
|
||||||
|
<a name="l00112"></a>00112 m_bAutoBaseLine = bAutomatic;
|
||||||
|
<a name="l00113"></a>00113 m_dBaseLine = dBaseLine;
|
||||||
|
<a name="l00114"></a>00114 }
|
||||||
|
<a name="l00115"></a>00115
|
||||||
|
<a name="l00117"></a>00117
|
||||||
|
<a name="l00127"></a>00127 <span class="keywordtype">bool</span> <a class="code" href="class_c_chart_bar_serie.html#49c4128340700712f2be11449d59cfee" title="Check whether a screen point is on the series.">IsPointOnSerie</a>(<span class="keyword">const</span> CPoint& screenPoint, <span class="keywordtype">unsigned</span>& uIndex) <span class="keyword">const</span>;
|
||||||
|
<a name="l00128"></a>00128
|
||||||
|
<a name="l00129"></a>00129 <span class="keyword">private</span>:
|
||||||
|
<a name="l00130"></a>00130 <span class="keyword">typedef</span> std::list<CChartBarSerie*> TBarSeriesList;
|
||||||
|
<a name="l00131"></a>00131
|
||||||
|
<a name="l00133"></a>00133
|
||||||
|
<a name="l00140"></a>00140 <span class="keywordtype">void</span> DrawLegend(CDC* pDC, <span class="keyword">const</span> CRect& rectBitmap) <span class="keyword">const</span>;
|
||||||
|
<a name="l00141"></a>00141
|
||||||
|
<a name="l00143"></a>00143
|
||||||
|
<a name="l00150"></a>00150 <span class="keywordtype">void</span> Draw(CDC* pDC);
|
||||||
|
<a name="l00152"></a>00152
|
||||||
|
<a name="l00157"></a>00157 <span class="keywordtype">void</span> DrawAll(CDC *pDC);
|
||||||
|
<a name="l00158"></a>00158
|
||||||
|
<a name="l00159"></a>00159 <span class="keywordtype">void</span> DrawBar(CDC* pDC, CBrush* pFillBrush, CBrush* pBorderBrush,
|
||||||
|
<a name="l00160"></a>00160 CRect BarRect);
|
||||||
|
<a name="l00161"></a>00161
|
||||||
|
<a name="l00162"></a>00162 <span class="comment">// Retrieves the offset of the serie along the minor axis (horizontal</span>
|
||||||
|
<a name="l00163"></a>00163 <span class="comment">// axis for vertical bars). This offset is based on series with the</span>
|
||||||
|
<a name="l00164"></a>00164 <span class="comment">// same group Id.</span>
|
||||||
|
<a name="l00165"></a>00165 <span class="keywordtype">int</span> GetMinorOffset() <span class="keyword">const</span>;
|
||||||
|
<a name="l00166"></a>00166 CRect GetBarRectangle(<span class="keywordtype">unsigned</span> uPointIndex, <span class="keywordtype">int</span> minorOffset) <span class="keyword">const</span>;
|
||||||
|
<a name="l00167"></a>00167
|
||||||
|
<a name="l00168"></a>00168 <span class="keywordtype">void</span> RefreshStackedCache() <span class="keyword">const</span>;
|
||||||
|
<a name="l00169"></a>00169
|
||||||
|
<a name="l00170"></a>00170
|
||||||
|
<a name="l00172"></a>00172 <span class="keyword">static</span> <span class="keywordtype">int</span> m_iInterSpace;
|
||||||
|
<a name="l00174"></a>00174 <span class="keyword">static</span> TBarSeriesList m_lstBarSeries;
|
||||||
|
<a name="l00175"></a>00175
|
||||||
|
<a name="l00177"></a>00177 <span class="keywordtype">bool</span> m_bHorizontal;
|
||||||
|
<a name="l00178"></a>00178
|
||||||
|
<a name="l00179"></a>00179 <span class="comment">// The base line specifies the position (in terms of the value</span>
|
||||||
|
<a name="l00180"></a>00180 <span class="comment">// axis) where the bars start from. If m_bAutoBaseLine is true</span>
|
||||||
|
<a name="l00181"></a>00181 <span class="comment">// they start from the axis position.</span>
|
||||||
|
<a name="l00182"></a>00182 <span class="keywordtype">double</span> m_dBaseLine;
|
||||||
|
<a name="l00183"></a>00183 <span class="keywordtype">bool</span> m_bAutoBaseLine;
|
||||||
|
<a name="l00184"></a>00184
|
||||||
|
<a name="l00185"></a>00185 <span class="comment">// Specifies to which group this series belongs to. Series in the same group are</span>
|
||||||
|
<a name="l00186"></a>00186 <span class="comment">// 'stacked' next to each other.</span>
|
||||||
|
<a name="l00187"></a>00187 <span class="keywordtype">unsigned</span> m_uGroupId;
|
||||||
|
<a name="l00188"></a>00188
|
||||||
|
<a name="l00189"></a>00189 <span class="keywordtype">int</span> m_iBarWidth;
|
||||||
|
<a name="l00190"></a>00190 <span class="keywordtype">int</span> m_iBorderWidth;
|
||||||
|
<a name="l00191"></a>00191 COLORREF m_BorderColor;
|
||||||
|
<a name="l00192"></a>00192
|
||||||
|
<a name="l00193"></a>00193 <span class="keywordtype">bool</span> m_bGradient;
|
||||||
|
<a name="l00194"></a>00194 COLORREF m_GradientColor;
|
||||||
|
<a name="l00195"></a>00195 EGradientType m_GradientType;
|
||||||
|
<a name="l00196"></a>00196
|
||||||
|
<a name="l00197"></a>00197 <span class="comment">// Specifies if the bar series has to be stacked with other bar </span>
|
||||||
|
<a name="l00198"></a>00198 <span class="comment">// series with the same group Id</span>
|
||||||
|
<a name="l00199"></a>00199 <span class="keywordtype">bool</span> m_bStacked;
|
||||||
|
<a name="l00200"></a>00200
|
||||||
|
<a name="l00201"></a>00201 <span class="comment">// Cache of the stacked series with the same group Id as this series.</span>
|
||||||
|
<a name="l00202"></a>00202 <span class="keyword">mutable</span> TBarSeriesList m_lstStackedSeries;
|
||||||
|
<a name="l00203"></a>00203 };
|
||||||
|
</pre></div></div>
|
||||||
|
<hr size="1"><address style="text-align: right;"><small>Generated on Sun Jan 17 13:33:09 2010 for ChartDemo by
|
||||||
|
<a href="http://www.doxygen.org/index.html">
|
||||||
|
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.8 </small></address>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -0,0 +1,110 @@
|
||||||
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||||
|
<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
|
||||||
|
<title>ChartDemo: E:/Sources Misc/ChartDemo/ChartCtrl/ChartCandlestickSerie.h Source File</title>
|
||||||
|
<link href="tabs.css" rel="stylesheet" type="text/css">
|
||||||
|
<link href="doxygen.css" rel="stylesheet" type="text/css">
|
||||||
|
</head><body>
|
||||||
|
<!-- Generated by Doxygen 1.5.8 -->
|
||||||
|
<div class="navigation" id="top">
|
||||||
|
<div class="tabs">
|
||||||
|
<ul>
|
||||||
|
<li><a href="index.html"><span>Main Page</span></a></li>
|
||||||
|
<li><a href="pages.html"><span>Related Pages</span></a></li>
|
||||||
|
<li><a href="annotated.html"><span>Classes</span></a></li>
|
||||||
|
<li class="current"><a href="files.html"><span>Files</span></a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="tabs">
|
||||||
|
<ul>
|
||||||
|
<li><a href="files.html"><span>File List</span></a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<h1>E:/Sources Misc/ChartDemo/ChartCtrl/ChartCandlestickSerie.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span>
|
||||||
|
<a name="l00002"></a>00002 <span class="comment"> *</span>
|
||||||
|
<a name="l00003"></a>00003 <span class="comment"> * ChartCandlestickSerie.h</span>
|
||||||
|
<a name="l00004"></a>00004 <span class="comment"> *</span>
|
||||||
|
<a name="l00005"></a>00005 <span class="comment"> * Written by Cédric Moonen (cedric_moonen@hotmail.com)</span>
|
||||||
|
<a name="l00006"></a>00006 <span class="comment"> *</span>
|
||||||
|
<a name="l00007"></a>00007 <span class="comment"> *</span>
|
||||||
|
<a name="l00008"></a>00008 <span class="comment"> *</span>
|
||||||
|
<a name="l00009"></a>00009 <span class="comment"> * This code may be used for any non-commercial and commercial purposes in a compiled form.</span>
|
||||||
|
<a name="l00010"></a>00010 <span class="comment"> * The code may be redistributed as long as it remains unmodified and providing that the </span>
|
||||||
|
<a name="l00011"></a>00011 <span class="comment"> * author name and this disclaimer remain intact. The sources can be modified WITH the author </span>
|
||||||
|
<a name="l00012"></a>00012 <span class="comment"> * consent only.</span>
|
||||||
|
<a name="l00013"></a>00013 <span class="comment"> * </span>
|
||||||
|
<a name="l00014"></a>00014 <span class="comment"> * This code is provided without any garanties. I cannot be held responsible for the damage or</span>
|
||||||
|
<a name="l00015"></a>00015 <span class="comment"> * the loss of time it causes. Use it at your own risks</span>
|
||||||
|
<a name="l00016"></a>00016 <span class="comment"> *</span>
|
||||||
|
<a name="l00017"></a>00017 <span class="comment"> * An e-mail to notify me that you are using this code is appreciated also.</span>
|
||||||
|
<a name="l00018"></a>00018 <span class="comment"> *</span>
|
||||||
|
<a name="l00019"></a>00019 <span class="comment"> *</span>
|
||||||
|
<a name="l00020"></a>00020 <span class="comment"> */</span>
|
||||||
|
<a name="l00021"></a>00021
|
||||||
|
<a name="l00022"></a>00022 <span class="preprocessor">#pragma once</span>
|
||||||
|
<a name="l00023"></a>00023 <span class="preprocessor"></span><span class="preprocessor">#include "ChartSerieBase.h"</span>
|
||||||
|
<a name="l00024"></a>00024
|
||||||
|
<a name="l00026"></a><a class="code" href="struct_s_chart_candlestick_point.html">00026</a> <span class="keyword">struct </span><a class="code" href="struct_s_chart_candlestick_point.html" title="Point structure used as template parameter for candlestick series.">SChartCandlestickPoint</a>
|
||||||
|
<a name="l00027"></a>00027 {
|
||||||
|
<a name="l00028"></a>00028 <a class="code" href="struct_s_chart_candlestick_point.html" title="Point structure used as template parameter for candlestick series.">SChartCandlestickPoint</a>() { }
|
||||||
|
<a name="l00029"></a>00029 <a class="code" href="struct_s_chart_candlestick_point.html" title="Point structure used as template parameter for candlestick series.">SChartCandlestickPoint</a>(<span class="keywordtype">double</span> XValue, <span class="keywordtype">double</span> LowVal,
|
||||||
|
<a name="l00030"></a>00030 <span class="keywordtype">double</span> HighVal, <span class="keywordtype">double</span> OpenVal, <span class="keywordtype">double</span> CloseVal):
|
||||||
|
<a name="l00031"></a>00031 <a class="code" href="struct_s_chart_candlestick_point.html#d2ce24468c17142b4bf3d9e7f873740d" title="The X value of the point (usually, a time).">XVal</a>(XValue), <a class="code" href="struct_s_chart_candlestick_point.html#b50a9bf3311fafe6b9f85472cba2fa61" title="The low market price.">Low</a>(LowVal), <a class="code" href="struct_s_chart_candlestick_point.html#7c08d0de3d24dd94ffb2d61cd21408e1" title="The high market price.">High</a>(HighVal),
|
||||||
|
<a name="l00032"></a>00032 <a class="code" href="struct_s_chart_candlestick_point.html#7943760bf7be7b2fa8989d31452a72d5" title="The open market price.">Open</a>(OpenVal), <a class="code" href="struct_s_chart_candlestick_point.html#00fb9c2c2cc1f90baf52729a8650466d" title="The close market price.">Close</a>(CloseVal) { }
|
||||||
|
<a name="l00033"></a>00033
|
||||||
|
<a name="l00035"></a><a class="code" href="struct_s_chart_candlestick_point.html#d2ce24468c17142b4bf3d9e7f873740d">00035</a> <span class="keywordtype">double</span> <a class="code" href="struct_s_chart_candlestick_point.html#d2ce24468c17142b4bf3d9e7f873740d" title="The X value of the point (usually, a time).">XVal</a>;
|
||||||
|
<a name="l00037"></a><a class="code" href="struct_s_chart_candlestick_point.html#b50a9bf3311fafe6b9f85472cba2fa61">00037</a> <span class="keywordtype">double</span> <a class="code" href="struct_s_chart_candlestick_point.html#b50a9bf3311fafe6b9f85472cba2fa61" title="The low market price.">Low</a>;
|
||||||
|
<a name="l00039"></a><a class="code" href="struct_s_chart_candlestick_point.html#7c08d0de3d24dd94ffb2d61cd21408e1">00039</a> <span class="keywordtype">double</span> <a class="code" href="struct_s_chart_candlestick_point.html#7c08d0de3d24dd94ffb2d61cd21408e1" title="The high market price.">High</a>;
|
||||||
|
<a name="l00041"></a><a class="code" href="struct_s_chart_candlestick_point.html#7943760bf7be7b2fa8989d31452a72d5">00041</a> <span class="keywordtype">double</span> <a class="code" href="struct_s_chart_candlestick_point.html#7943760bf7be7b2fa8989d31452a72d5" title="The open market price.">Open</a>;
|
||||||
|
<a name="l00043"></a><a class="code" href="struct_s_chart_candlestick_point.html#00fb9c2c2cc1f90baf52729a8650466d">00043</a> <span class="keywordtype">double</span> <a class="code" href="struct_s_chart_candlestick_point.html#00fb9c2c2cc1f90baf52729a8650466d" title="The close market price.">Close</a>;
|
||||||
|
<a name="l00044"></a>00044
|
||||||
|
<a name="l00046"></a><a class="code" href="struct_s_chart_candlestick_point.html#288c201af466fc9dbf9b4f7bcfaa0859">00046</a> <span class="keywordtype">double</span> <a class="code" href="struct_s_chart_candlestick_point.html#288c201af466fc9dbf9b4f7bcfaa0859" title="Returns the X value of the point.">GetX</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="struct_s_chart_candlestick_point.html#d2ce24468c17142b4bf3d9e7f873740d" title="The X value of the point (usually, a time).">XVal</a>; }
|
||||||
|
<a name="l00048"></a><a class="code" href="struct_s_chart_candlestick_point.html#cbc4b2866a0847368b0e3f293ff6dc45">00048</a> <span class="keywordtype">double</span> <a class="code" href="struct_s_chart_candlestick_point.html#cbc4b2866a0847368b0e3f293ff6dc45" title="Returns the Y value of the point, which is the average between low and high.">GetY</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> (<a class="code" href="struct_s_chart_candlestick_point.html#b50a9bf3311fafe6b9f85472cba2fa61" title="The low market price.">Low</a>+<a class="code" href="struct_s_chart_candlestick_point.html#7c08d0de3d24dd94ffb2d61cd21408e1" title="The high market price.">High</a>)/2; }
|
||||||
|
<a name="l00050"></a><a class="code" href="struct_s_chart_candlestick_point.html#397cbaa6c52c2be644372b4ae5a8ca2c">00050</a> <span class="keywordtype">double</span> <a class="code" href="struct_s_chart_candlestick_point.html#397cbaa6c52c2be644372b4ae5a8ca2c" title="Returns the minimum X value of the point.">GetXMin</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="struct_s_chart_candlestick_point.html#d2ce24468c17142b4bf3d9e7f873740d" title="The X value of the point (usually, a time).">XVal</a>; }
|
||||||
|
<a name="l00052"></a><a class="code" href="struct_s_chart_candlestick_point.html#c19425e2021dc959e3cb9ece80a5e92e">00052</a> <span class="keywordtype">double</span> <a class="code" href="struct_s_chart_candlestick_point.html#c19425e2021dc959e3cb9ece80a5e92e" title="Returns the maximum X value of the point.">GetXMax</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="struct_s_chart_candlestick_point.html#d2ce24468c17142b4bf3d9e7f873740d" title="The X value of the point (usually, a time).">XVal</a>; }
|
||||||
|
<a name="l00054"></a><a class="code" href="struct_s_chart_candlestick_point.html#3fa9f6146145b8a20329b0a532f16baa">00054</a> <span class="keywordtype">double</span> <a class="code" href="struct_s_chart_candlestick_point.html#3fa9f6146145b8a20329b0a532f16baa" title="Returns the minimum Y value of the point (the low value).">GetYMin</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="struct_s_chart_candlestick_point.html#b50a9bf3311fafe6b9f85472cba2fa61" title="The low market price.">Low</a>; }
|
||||||
|
<a name="l00056"></a><a class="code" href="struct_s_chart_candlestick_point.html#e2e520702fd471c5cb9cbf92ea3c7402">00056</a> <span class="keywordtype">double</span> <a class="code" href="struct_s_chart_candlestick_point.html#e2e520702fd471c5cb9cbf92ea3c7402" title="Returns the maximum Y value of the point (the high value).">GetYMax</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="struct_s_chart_candlestick_point.html#7c08d0de3d24dd94ffb2d61cd21408e1" title="The high market price.">High</a>; }
|
||||||
|
<a name="l00057"></a>00057 };
|
||||||
|
<a name="l00058"></a>00058
|
||||||
|
<a name="l00060"></a>00060
|
||||||
|
<a name="l00066"></a><a class="code" href="class_c_chart_candlestick_serie.html">00066</a> <span class="keyword">class </span><a class="code" href="class_c_chart_candlestick_serie.html" title="Specialization of a CChartSerieBase to display a candlestick series.">CChartCandlestickSerie</a> : <span class="keyword">public</span> <a class="code" href="class_c_chart_serie_base.html" title="Base class for all series of the control.">CChartSerieBase</a><SChartCandlestickPoint>
|
||||||
|
<a name="l00067"></a>00067 {
|
||||||
|
<a name="l00068"></a>00068 <span class="keyword">public</span>:
|
||||||
|
<a name="l00070"></a>00070 <a class="code" href="class_c_chart_candlestick_serie.html#43f5d27027e3a611c28d6a4ef0e9c98b" title="Constructor.">CChartCandlestickSerie</a>(<a class="code" href="class_c_chart_ctrl.html" title="The main chart control class.">CChartCtrl</a>* pParent);
|
||||||
|
<a name="l00072"></a>00072 <a class="code" href="class_c_chart_candlestick_serie.html#04b56e714d0015bd5a7ca2c4f46f36b7" title="Destructor.">~CChartCandlestickSerie</a>();
|
||||||
|
<a name="l00073"></a>00073
|
||||||
|
<a name="l00075"></a>00075
|
||||||
|
<a name="l00082"></a>00082 <span class="keywordtype">bool</span> <a class="code" href="class_c_chart_candlestick_serie.html#3f7b68f44e5ec0305992f4ff30d60b67" title="Tests if a certain screen point is on the series.">IsPointOnSerie</a>(<span class="keyword">const</span> CPoint& screenPoint, <span class="keywordtype">unsigned</span>& uIndex) <span class="keyword">const</span>;
|
||||||
|
<a name="l00083"></a>00083
|
||||||
|
<a name="l00085"></a>00085
|
||||||
|
<a name="l00097"></a>00097 <span class="keywordtype">void</span> <a class="code" href="class_c_chart_candlestick_serie.html#342f777200b38e00523f825076d958e2" title="Adds a new point in the series.">AddPoint</a>(<span class="keywordtype">double</span> XVal, <span class="keywordtype">double</span> Low, <span class="keywordtype">double</span> High,
|
||||||
|
<a name="l00098"></a>00098 <span class="keywordtype">double</span> Open, <span class="keywordtype">double</span> Close);
|
||||||
|
<a name="l00100"></a>00100 <span class="keywordtype">void</span> <a class="code" href="class_c_chart_candlestick_serie.html#0cbbf2ab644c1ebf3fcb861892f8b399" title="Sets the width (in pixels) of all candlestick points in the series.">SetWidth</a>(<span class="keywordtype">int</span> Width);
|
||||||
|
<a name="l00102"></a><a class="code" href="class_c_chart_candlestick_serie.html#87659b59d107206725a7014ec7ae545c">00102</a> <span class="keywordtype">int</span> <a class="code" href="class_c_chart_candlestick_serie.html#87659b59d107206725a7014ec7ae545c" title="Returns the width (in pixels) of a point in the series.">GetWidth</a>() { <span class="keywordflow">return</span> m_iCandlestickWidth; }
|
||||||
|
<a name="l00103"></a>00103
|
||||||
|
<a name="l00104"></a>00104 <span class="keyword">protected</span>:
|
||||||
|
<a name="l00106"></a>00106
|
||||||
|
<a name="l00112"></a>00112 <span class="keywordtype">void</span> <a class="code" href="class_c_chart_candlestick_serie.html#18a147258e21691b989cff0ad90269ee" title="Draws the legend icon for the series.">DrawLegend</a>(CDC* pDC, <span class="keyword">const</span> CRect& rectBitmap) <span class="keyword">const</span>;
|
||||||
|
<a name="l00113"></a>00113
|
||||||
|
<a name="l00115"></a>00115
|
||||||
|
<a name="l00121"></a>00121 <span class="keywordtype">void</span> <a class="code" href="class_c_chart_candlestick_serie.html#73544370476b42322e1c17edf580eb5a" title="Draws the most recent points of the series.">Draw</a>(CDC* pDC);
|
||||||
|
<a name="l00123"></a>00123
|
||||||
|
<a name="l00127"></a>00127 <span class="keywordtype">void</span> <a class="code" href="class_c_chart_candlestick_serie.html#588ed1d8d6dd07f33d3cfce10289543f" title="Redraws the full series.">DrawAll</a>(CDC *pDC);
|
||||||
|
<a name="l00128"></a>00128
|
||||||
|
<a name="l00129"></a>00129 <span class="keyword">private</span>:
|
||||||
|
<a name="l00131"></a>00131 <span class="keywordtype">void</span> DrawCandleStick(CDC *pDC, <a class="code" href="struct_s_chart_candlestick_point.html" title="Point structure used as template parameter for candlestick series.">SChartCandlestickPoint</a> Point);
|
||||||
|
<a name="l00132"></a>00132
|
||||||
|
<a name="l00134"></a>00134 <span class="keywordtype">int</span> m_iCandlestickWidth;
|
||||||
|
<a name="l00135"></a>00135
|
||||||
|
<a name="l00136"></a>00136 <span class="comment">// Caches the pen and brushes to avoid creating them for each point</span>
|
||||||
|
<a name="l00137"></a>00137 <span class="keyword">mutable</span> CBrush ShadowBrush;
|
||||||
|
<a name="l00138"></a>00138 <span class="keyword">mutable</span> CPen NewPen;
|
||||||
|
<a name="l00139"></a>00139 <span class="keyword">mutable</span> CPen ShadowPen;
|
||||||
|
<a name="l00140"></a>00140 <span class="keyword">mutable</span> CBrush BrushFill;
|
||||||
|
<a name="l00141"></a>00141 <span class="keyword">mutable</span> CBrush BrushEmpty;
|
||||||
|
<a name="l00142"></a>00142 };
|
||||||
|
</pre></div></div>
|
||||||
|
<hr size="1"><address style="text-align: right;"><small>Generated on Sun Jan 17 13:33:09 2010 for ChartDemo by
|
||||||
|
<a href="http://www.doxygen.org/index.html">
|
||||||
|
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.8 </small></address>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -0,0 +1,77 @@
|
||||||
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||||
|
<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
|
||||||
|
<title>ChartDemo: E:/Sources Misc/ChartDemo/ChartCtrl/ChartCrossHairCursor.h Source File</title>
|
||||||
|
<link href="tabs.css" rel="stylesheet" type="text/css">
|
||||||
|
<link href="doxygen.css" rel="stylesheet" type="text/css">
|
||||||
|
</head><body>
|
||||||
|
<!-- Generated by Doxygen 1.5.8 -->
|
||||||
|
<div class="navigation" id="top">
|
||||||
|
<div class="tabs">
|
||||||
|
<ul>
|
||||||
|
<li><a href="index.html"><span>Main Page</span></a></li>
|
||||||
|
<li><a href="pages.html"><span>Related Pages</span></a></li>
|
||||||
|
<li><a href="annotated.html"><span>Classes</span></a></li>
|
||||||
|
<li class="current"><a href="files.html"><span>Files</span></a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="tabs">
|
||||||
|
<ul>
|
||||||
|
<li><a href="files.html"><span>File List</span></a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<h1>E:/Sources Misc/ChartDemo/ChartCtrl/ChartCrossHairCursor.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span>
|
||||||
|
<a name="l00002"></a>00002 <span class="comment"> *</span>
|
||||||
|
<a name="l00003"></a>00003 <span class="comment"> * ChartCrossHairCursor.h</span>
|
||||||
|
<a name="l00004"></a>00004 <span class="comment"> *</span>
|
||||||
|
<a name="l00005"></a>00005 <span class="comment"> * Written by Cédric Moonen (cedric_moonen@hotmail.com)</span>
|
||||||
|
<a name="l00006"></a>00006 <span class="comment"> *</span>
|
||||||
|
<a name="l00007"></a>00007 <span class="comment"> *</span>
|
||||||
|
<a name="l00008"></a>00008 <span class="comment"> *</span>
|
||||||
|
<a name="l00009"></a>00009 <span class="comment"> * This code may be used for any non-commercial and commercial purposes in a compiled form.</span>
|
||||||
|
<a name="l00010"></a>00010 <span class="comment"> * The code may be redistributed as long as it remains unmodified and providing that the </span>
|
||||||
|
<a name="l00011"></a>00011 <span class="comment"> * author name and this disclaimer remain intact. The sources can be modified WITH the author </span>
|
||||||
|
<a name="l00012"></a>00012 <span class="comment"> * consent only.</span>
|
||||||
|
<a name="l00013"></a>00013 <span class="comment"> * </span>
|
||||||
|
<a name="l00014"></a>00014 <span class="comment"> * This code is provided without any garanties. I cannot be held responsible for the damage or</span>
|
||||||
|
<a name="l00015"></a>00015 <span class="comment"> * the loss of time it causes. Use it at your own risks</span>
|
||||||
|
<a name="l00016"></a>00016 <span class="comment"> *</span>
|
||||||
|
<a name="l00017"></a>00017 <span class="comment"> * An e-mail to notify me that you are using this code is appreciated also.</span>
|
||||||
|
<a name="l00018"></a>00018 <span class="comment"> *</span>
|
||||||
|
<a name="l00019"></a>00019 <span class="comment"> *</span>
|
||||||
|
<a name="l00020"></a>00020 <span class="comment"> */</span>
|
||||||
|
<a name="l00021"></a>00021
|
||||||
|
<a name="l00022"></a>00022 <span class="preprocessor">#ifndef _CHARTCROSSHAIRCURSOR_H_</span>
|
||||||
|
<a name="l00023"></a>00023 <span class="preprocessor"></span><span class="preprocessor">#define _CHARTCROSSHAIRCURSOR_H_</span>
|
||||||
|
<a name="l00024"></a>00024 <span class="preprocessor"></span>
|
||||||
|
<a name="l00025"></a>00025 <span class="preprocessor">#include "ChartCursor.h"</span>
|
||||||
|
<a name="l00026"></a>00026
|
||||||
|
<a name="l00027"></a>00027 <span class="keyword">class </span><a class="code" href="class_c_chart_axis.html" title="Base class that takes care of the management of a chart axis.">CChartAxis</a>;
|
||||||
|
<a name="l00028"></a>00028
|
||||||
|
<a name="l00030"></a>00030
|
||||||
|
<a name="l00037"></a><a class="code" href="class_c_chart_cross_hair_cursor.html">00037</a> <span class="keyword">class </span><a class="code" href="class_c_chart_cross_hair_cursor.html" title="Specialization of a CChartCursor class for a cross-hair cursor.">CChartCrossHairCursor</a> : <span class="keyword">public</span> <a class="code" href="class_c_chart_cursor.html" title="Base class for cursors which can be added to the chart control.">CChartCursor</a>
|
||||||
|
<a name="l00038"></a>00038 {
|
||||||
|
<a name="l00039"></a>00039 <span class="keyword">friend</span> <a class="code" href="class_c_chart_ctrl.html" title="The main chart control class.">CChartCtrl</a>;
|
||||||
|
<a name="l00040"></a>00040
|
||||||
|
<a name="l00041"></a>00041 <span class="keyword">protected</span>:
|
||||||
|
<a name="l00043"></a>00043 <span class="keywordtype">void</span> <a class="code" href="class_c_chart_cross_hair_cursor.html#94b2631efaf940e76aeb5dfc71135641" title="Called when the mouse is moved over the plot area.">OnMouseMove</a>(CPoint mousePoint);
|
||||||
|
<a name="l00045"></a>00045 <span class="keywordtype">void</span> <a class="code" href="class_c_chart_cross_hair_cursor.html#26ffb6c3dd890380307baa531be1e2c2" title="Draws the cursor.">Draw</a>(CDC* pDC);
|
||||||
|
<a name="l00046"></a>00046
|
||||||
|
<a name="l00047"></a>00047 <span class="keyword">private</span>:
|
||||||
|
<a name="l00049"></a>00049
|
||||||
|
<a name="l00057"></a>00057 <a class="code" href="class_c_chart_cross_hair_cursor.html" title="Specialization of a CChartCursor class for a cross-hair cursor.">CChartCrossHairCursor</a>(<a class="code" href="class_c_chart_ctrl.html" title="The main chart control class.">CChartCtrl</a>* pParent, <a class="code" href="class_c_chart_axis.html" title="Base class that takes care of the management of a chart axis.">CChartAxis</a>* pHorizAxis, <a class="code" href="class_c_chart_axis.html" title="Base class that takes care of the management of a chart axis.">CChartAxis</a>* pVertAxis);
|
||||||
|
<a name="l00059"></a>00059 ~<a class="code" href="class_c_chart_cross_hair_cursor.html" title="Specialization of a CChartCursor class for a cross-hair cursor.">CChartCrossHairCursor</a>();
|
||||||
|
<a name="l00060"></a>00060
|
||||||
|
<a name="l00062"></a>00062 <a class="code" href="class_c_chart_axis.html" title="Base class that takes care of the management of a chart axis.">CChartAxis</a>* m_pHorizontalAxis;
|
||||||
|
<a name="l00064"></a>00064 <a class="code" href="class_c_chart_axis.html" title="Base class that takes care of the management of a chart axis.">CChartAxis</a>* m_pVerticalAxis;
|
||||||
|
<a name="l00065"></a>00065
|
||||||
|
<a name="l00067"></a>00067 <span class="keywordtype">long</span> m_lXPos;
|
||||||
|
<a name="l00069"></a>00069 <span class="keywordtype">long</span> m_lYPos;
|
||||||
|
<a name="l00070"></a>00070 };
|
||||||
|
<a name="l00071"></a>00071
|
||||||
|
<a name="l00072"></a>00072 <span class="preprocessor">#endif // _CHARTCROSSHAIRCURSOR_H_</span>
|
||||||
|
</pre></div></div>
|
||||||
|
<hr size="1"><address style="text-align: right;"><small>Generated on Sun Jan 17 13:33:09 2010 for ChartDemo by
|
||||||
|
<a href="http://www.doxygen.org/index.html">
|
||||||
|
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.8 </small></address>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -0,0 +1,305 @@
|
||||||
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||||
|
<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
|
||||||
|
<title>ChartDemo: E:/Sources Misc/ChartDemo/ChartCtrl/ChartCtrl.h Source File</title>
|
||||||
|
<link href="tabs.css" rel="stylesheet" type="text/css">
|
||||||
|
<link href="doxygen.css" rel="stylesheet" type="text/css">
|
||||||
|
</head><body>
|
||||||
|
<!-- Generated by Doxygen 1.5.8 -->
|
||||||
|
<div class="navigation" id="top">
|
||||||
|
<div class="tabs">
|
||||||
|
<ul>
|
||||||
|
<li><a href="index.html"><span>Main Page</span></a></li>
|
||||||
|
<li><a href="pages.html"><span>Related Pages</span></a></li>
|
||||||
|
<li><a href="annotated.html"><span>Classes</span></a></li>
|
||||||
|
<li class="current"><a href="files.html"><span>Files</span></a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="tabs">
|
||||||
|
<ul>
|
||||||
|
<li><a href="files.html"><span>File List</span></a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<h1>E:/Sources Misc/ChartDemo/ChartCtrl/ChartCtrl.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span>
|
||||||
|
<a name="l00002"></a>00002 <span class="comment"> *</span>
|
||||||
|
<a name="l00003"></a>00003 <span class="comment"> * ChartCtrl.h</span>
|
||||||
|
<a name="l00004"></a>00004 <span class="comment"> *</span>
|
||||||
|
<a name="l00005"></a>00005 <span class="comment"> * Written by Cédric Moonen (cedric_moonen@hotmail.com)</span>
|
||||||
|
<a name="l00006"></a>00006 <span class="comment"> *</span>
|
||||||
|
<a name="l00007"></a>00007 <span class="comment"> *</span>
|
||||||
|
<a name="l00008"></a>00008 <span class="comment"> *</span>
|
||||||
|
<a name="l00009"></a>00009 <span class="comment"> * This code may be used for any non-commercial and commercial purposes in a compiled form.</span>
|
||||||
|
<a name="l00010"></a>00010 <span class="comment"> * The code may be redistributed as long as it remains unmodified and providing that the </span>
|
||||||
|
<a name="l00011"></a>00011 <span class="comment"> * author name and this disclaimer remain intact. The sources can be modified WITH the author </span>
|
||||||
|
<a name="l00012"></a>00012 <span class="comment"> * consent only.</span>
|
||||||
|
<a name="l00013"></a>00013 <span class="comment"> * </span>
|
||||||
|
<a name="l00014"></a>00014 <span class="comment"> * This code is provided without any garanties. I cannot be held responsible for the damage or</span>
|
||||||
|
<a name="l00015"></a>00015 <span class="comment"> * the loss of time it causes. Use it at your own risks</span>
|
||||||
|
<a name="l00016"></a>00016 <span class="comment"> *</span>
|
||||||
|
<a name="l00017"></a>00017 <span class="comment"> * An e-mail to notify me that you are using this code is appreciated also.</span>
|
||||||
|
<a name="l00018"></a>00018 <span class="comment"> *</span>
|
||||||
|
<a name="l00019"></a>00019 <span class="comment"> *</span>
|
||||||
|
<a name="l00020"></a>00020 <span class="comment"> */</span>
|
||||||
|
<a name="l00021"></a>00021
|
||||||
|
<a name="l00022"></a>00022
|
||||||
|
<a name="l00023"></a>00023 <span class="preprocessor">#pragma once</span>
|
||||||
|
<a name="l00024"></a>00024 <span class="preprocessor"></span>
|
||||||
|
<a name="l00025"></a>00025 <span class="preprocessor">#if _MSC_VER >= 1000</span>
|
||||||
|
<a name="l00026"></a>00026 <span class="preprocessor"></span><span class="preprocessor">#pragma once</span>
|
||||||
|
<a name="l00027"></a>00027 <span class="preprocessor"></span><span class="preprocessor">#endif // _MSC_VER >= 1000</span>
|
||||||
|
<a name="l00028"></a>00028 <span class="preprocessor"></span>
|
||||||
|
<a name="l00029"></a>00029 <span class="preprocessor">#include "ChartSerie.h"</span>
|
||||||
|
<a name="l00030"></a>00030 <span class="preprocessor">#include "ChartAxis.h"</span>
|
||||||
|
<a name="l00031"></a>00031 <span class="preprocessor">#include "ChartGrid.h"</span>
|
||||||
|
<a name="l00032"></a>00032 <span class="preprocessor">#include "ChartLegend.h"</span>
|
||||||
|
<a name="l00033"></a>00033 <span class="preprocessor">#include "ChartTitle.h"</span>
|
||||||
|
<a name="l00034"></a>00034 <span class="preprocessor">#include "ChartGradient.h"</span>
|
||||||
|
<a name="l00035"></a>00035 <span class="preprocessor">#include "ChartCursor.h"</span>
|
||||||
|
<a name="l00036"></a>00036 <span class="preprocessor">#include "ChartMouseListener.h"</span>
|
||||||
|
<a name="l00037"></a>00037 <span class="preprocessor">#include "ChartStandardAxis.h"</span>
|
||||||
|
<a name="l00038"></a>00038 <span class="preprocessor">#include "ChartLogarithmicAxis.h"</span>
|
||||||
|
<a name="l00039"></a>00039 <span class="preprocessor">#include "ChartDateTimeAxis.h"</span>
|
||||||
|
<a name="l00040"></a>00040 <span class="preprocessor">#include "ChartCrossHairCursor.h"</span>
|
||||||
|
<a name="l00041"></a>00041 <span class="preprocessor">#include "ChartDragLineCursor.h"</span>
|
||||||
|
<a name="l00042"></a>00042
|
||||||
|
<a name="l00043"></a>00043 <span class="preprocessor">#include <map></span>
|
||||||
|
<a name="l00044"></a>00044
|
||||||
|
<a name="l00045"></a>00045
|
||||||
|
<a name="l00046"></a>00046 <span class="keyword">class </span><a class="code" href="class_c_chart_standard_axis.html" title="Specialization of a CChartAxis class to display standard values.">CChartStandardAxis</a>;
|
||||||
|
<a name="l00047"></a>00047 <span class="keyword">class </span><a class="code" href="class_c_chart_logarithmic_axis.html" title="Specialization of a CChartAxis to display a logarithmic scale.">CChartLogarithmicAxis</a>;
|
||||||
|
<a name="l00048"></a>00048 <span class="keyword">class </span><a class="code" href="class_c_chart_date_time_axis.html" title="A specialization of the CChartAxis class for displaying date and time data.">CChartDateTimeAxis</a>;
|
||||||
|
<a name="l00049"></a>00049 <span class="keyword">class </span><a class="code" href="class_c_chart_cross_hair_cursor.html" title="Specialization of a CChartCursor class for a cross-hair cursor.">CChartCrossHairCursor</a>;
|
||||||
|
<a name="l00050"></a>00050 <span class="keyword">class </span><a class="code" href="class_c_chart_drag_line_cursor.html" title="Specialization of a CChartCursor class for a dragline cursor.">CChartDragLineCursor</a>;
|
||||||
|
<a name="l00051"></a>00051
|
||||||
|
<a name="l00052"></a>00052 <span class="keyword">class </span><a class="code" href="class_c_chart_points_serie.html" title="Specialization of a CChartSerie to display a points series.">CChartPointsSerie</a>;
|
||||||
|
<a name="l00053"></a>00053 <span class="keyword">class </span><a class="code" href="class_c_chart_line_serie.html" title="Specialization of a CChartSerie to display a line series.">CChartLineSerie</a>;
|
||||||
|
<a name="l00054"></a>00054 <span class="keyword">class </span><a class="code" href="class_c_chart_surface_serie.html" title="Specialization of a CChartSerie to display a surface series.">CChartSurfaceSerie</a>;
|
||||||
|
<a name="l00055"></a>00055 <span class="keyword">class </span><a class="code" href="class_c_chart_bar_serie.html" title="Specialization of a CChartSerie to display a bars series.">CChartBarSerie</a>;
|
||||||
|
<a name="l00056"></a>00056 <span class="keyword">class </span><a class="code" href="class_c_chart_candlestick_serie.html" title="Specialization of a CChartSerieBase to display a candlestick series.">CChartCandlestickSerie</a>;
|
||||||
|
<a name="l00057"></a>00057 <span class="keyword">class </span><a class="code" href="class_c_chart_gantt_serie.html" title="Specialization of a CChartSerieBase to display a gantt series.">CChartGanttSerie</a>;
|
||||||
|
<a name="l00058"></a>00058
|
||||||
|
<a name="l00060"></a>00060 <span class="comment">// CChartCtrl window</span>
|
||||||
|
<a name="l00061"></a>00061
|
||||||
|
<a name="l00063"></a>00063
|
||||||
|
<a name="l00066"></a><a class="code" href="class_c_chart_ctrl.html">00066</a> <span class="keyword">class </span><a class="code" href="class_c_chart_ctrl.html" title="The main chart control class.">CChartCtrl</a> : <span class="keyword">public</span> CWnd
|
||||||
|
<a name="l00067"></a>00067 {
|
||||||
|
<a name="l00068"></a>00068
|
||||||
|
<a name="l00069"></a>00069 <span class="keyword">public</span>:
|
||||||
|
<a name="l00071"></a>00071
|
||||||
|
<a name="l00074"></a>00074 CDC* <a class="code" href="class_c_chart_ctrl.html#7eb83f30c58c547003b8475e952f9dad" title="Retrieves de device context.">GetDC</a>();
|
||||||
|
<a name="l00076"></a><a class="code" href="class_c_chart_ctrl.html#6b37a22c4da3490d368363a83b2f6253">00076</a> CRect <a class="code" href="class_c_chart_ctrl.html#6b37a22c4da3490d368363a83b2f6253" title="Retrieves the plotting rectangle.">GetPlottingRect</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_PlottingRect; }
|
||||||
|
<a name="l00077"></a>00077
|
||||||
|
<a name="l00079"></a><a class="code" href="class_c_chart_ctrl.html#71b90984862569848a3a60210a5dc1a9">00079</a> <a class="code" href="class_c_chart_legend.html" title="This class is responsible for the legend displayed on the control.">CChartLegend</a>* <a class="code" href="class_c_chart_ctrl.html#71b90984862569848a3a60210a5dc1a9" title="Returns a pointer to the legend object.">GetLegend</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_pLegend; }
|
||||||
|
<a name="l00081"></a><a class="code" href="class_c_chart_ctrl.html#7f303be46f9fecae1ca6311dc5a17e98">00081</a> <a class="code" href="class_c_chart_title.html" title="This class is responsible for the titles displayed on the control.">CChartTitle</a>* <a class="code" href="class_c_chart_ctrl.html#7f303be46f9fecae1ca6311dc5a17e98" title="Returns a pointer to the title object.">GetTitle</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_pTitles; }
|
||||||
|
<a name="l00082"></a>00082
|
||||||
|
<a name="l00084"></a><a class="code" href="class_c_chart_ctrl.html#28d7cd5253e1e7970ffbd2838a028419">00084</a> <span class="keyword">enum</span> <a class="code" href="class_c_chart_ctrl.html#28d7cd5253e1e7970ffbd2838a028419" title="An enumeration of the different axis positions.">EAxisPos</a>
|
||||||
|
<a name="l00085"></a>00085 {
|
||||||
|
<a name="l00086"></a>00086 LeftAxis = 0,
|
||||||
|
<a name="l00087"></a>00087 BottomAxis,
|
||||||
|
<a name="l00088"></a>00088 RightAxis,
|
||||||
|
<a name="l00089"></a>00089 TopAxis
|
||||||
|
<a name="l00090"></a>00090 };
|
||||||
|
<a name="l00091"></a>00091
|
||||||
|
<a name="l00093"></a>00093
|
||||||
|
<a name="l00098"></a>00098 <a class="code" href="class_c_chart_standard_axis.html" title="Specialization of a CChartAxis class to display standard values.">CChartStandardAxis</a>* <a class="code" href="class_c_chart_ctrl.html#5ac2726eb8085645d4afa25f8d0e9153" title="Create and attach a standard axis to the control.">CreateStandardAxis</a>(<a class="code" href="class_c_chart_ctrl.html#28d7cd5253e1e7970ffbd2838a028419" title="An enumeration of the different axis positions.">EAxisPos</a> axisPos);
|
||||||
|
<a name="l00100"></a>00100
|
||||||
|
<a name="l00105"></a>00105 <a class="code" href="class_c_chart_logarithmic_axis.html" title="Specialization of a CChartAxis to display a logarithmic scale.">CChartLogarithmicAxis</a>* <a class="code" href="class_c_chart_ctrl.html#e486f97544fc5c408e18daf0e6aafe68" title="Create and attach a logarithmic axis to the control.">CreateLogarithmicAxis</a>(<a class="code" href="class_c_chart_ctrl.html#28d7cd5253e1e7970ffbd2838a028419" title="An enumeration of the different axis positions.">EAxisPos</a> axisPos);
|
||||||
|
<a name="l00107"></a>00107
|
||||||
|
<a name="l00112"></a>00112 <a class="code" href="class_c_chart_date_time_axis.html" title="A specialization of the CChartAxis class for displaying date and time data.">CChartDateTimeAxis</a>* <a class="code" href="class_c_chart_ctrl.html#139df86f220cc33e8661d012e4f39a38" title="Create and attach a date/time axis to the control.">CreateDateTimeAxis</a>(<a class="code" href="class_c_chart_ctrl.html#28d7cd5253e1e7970ffbd2838a028419" title="An enumeration of the different axis positions.">EAxisPos</a> axisPos);
|
||||||
|
<a name="l00114"></a>00114
|
||||||
|
<a name="l00131"></a>00131 <span class="keywordtype">void</span> <a class="code" href="class_c_chart_ctrl.html#033fb8812e4df872c4ecae989f9a37eb" title="Attach a custom axis to the control.">AttachCustomAxis</a>(<a class="code" href="class_c_chart_axis.html" title="Base class that takes care of the management of a chart axis.">CChartAxis</a>* pAxis, <a class="code" href="class_c_chart_ctrl.html#28d7cd5253e1e7970ffbd2838a028419" title="An enumeration of the different axis positions.">EAxisPos</a> axisPos);
|
||||||
|
<a name="l00132"></a>00132
|
||||||
|
<a name="l00134"></a>00134
|
||||||
|
<a name="l00144"></a>00144 <a class="code" href="class_c_chart_points_serie.html" title="Specialization of a CChartSerie to display a points series.">CChartPointsSerie</a>* <a class="code" href="class_c_chart_ctrl.html#12edc002960c38d129152c10e96cf81c" title="Create and attach a point series to the control.">CreatePointsSerie</a>(<span class="keywordtype">bool</span> bSecondaryHorizAxis=<span class="keyword">false</span>, <span class="keywordtype">bool</span> bSecondaryVertAxis=<span class="keyword">false</span>);
|
||||||
|
<a name="l00146"></a>00146
|
||||||
|
<a name="l00158"></a>00158 <a class="code" href="class_c_chart_line_serie.html" title="Specialization of a CChartSerie to display a line series.">CChartLineSerie</a>* <a class="code" href="class_c_chart_ctrl.html#3e92e6744ffe32b53773cf547529c875" title="Create and attach a line series to the control.">CreateLineSerie</a>(<span class="keywordtype">bool</span> bSecondaryHorizAxis=<span class="keyword">false</span>, <span class="keywordtype">bool</span> bSecondaryVertAxis=<span class="keyword">false</span>);
|
||||||
|
<a name="l00160"></a>00160
|
||||||
|
<a name="l00172"></a>00172 <a class="code" href="class_c_chart_surface_serie.html" title="Specialization of a CChartSerie to display a surface series.">CChartSurfaceSerie</a>* <a class="code" href="class_c_chart_ctrl.html#8e955846e668b3cb860d08550f995aa2" title="Create and attach a surface series to the control.">CreateSurfaceSerie</a>(<span class="keywordtype">bool</span> bSecondaryHorizAxis=<span class="keyword">false</span>, <span class="keywordtype">bool</span> bSecondaryVertAxis=<span class="keyword">false</span>);
|
||||||
|
<a name="l00174"></a>00174
|
||||||
|
<a name="l00184"></a>00184 <a class="code" href="class_c_chart_bar_serie.html" title="Specialization of a CChartSerie to display a bars series.">CChartBarSerie</a>* <a class="code" href="class_c_chart_ctrl.html#c166a75bb6f77ee1855debe7d6cd3338" title="Create and attach a bar series to the control.">CreateBarSerie</a>(<span class="keywordtype">bool</span> bSecondaryHorizAxis=<span class="keyword">false</span>, <span class="keywordtype">bool</span> bSecondaryVertAxis=<span class="keyword">false</span>);
|
||||||
|
<a name="l00186"></a>00186
|
||||||
|
<a name="l00196"></a>00196 <a class="code" href="class_c_chart_candlestick_serie.html" title="Specialization of a CChartSerieBase to display a candlestick series.">CChartCandlestickSerie</a>* <a class="code" href="class_c_chart_ctrl.html#d77ceffac6ea6ee9b5c682c833018221" title="Create and attach a candlestick series to the control.">CreateCandlestickSerie</a>(<span class="keywordtype">bool</span> bSecondaryHorizAxis=<span class="keyword">false</span>, <span class="keywordtype">bool</span> bSecondaryVertAxis=<span class="keyword">false</span>);
|
||||||
|
<a name="l00198"></a>00198
|
||||||
|
<a name="l00208"></a>00208 <a class="code" href="class_c_chart_gantt_serie.html" title="Specialization of a CChartSerieBase to display a gantt series.">CChartGanttSerie</a>* <a class="code" href="class_c_chart_ctrl.html#570fba5a86bbbacb0c03f408ef767327" title="Create and attach a gantt series to the control.">CreateGanttSerie</a>(<span class="keywordtype">bool</span> bSecondaryHorizAxis=<span class="keyword">false</span>, <span class="keywordtype">bool</span> bSecondaryVertAxis=<span class="keyword">false</span>);
|
||||||
|
<a name="l00210"></a>00210
|
||||||
|
<a name="l00227"></a>00227 <span class="keywordtype">void</span> <a class="code" href="class_c_chart_ctrl.html#5ab5b2ae76f9ad0130a164d28efb1f5b" title="Attaches a custom series to the chart.">AttachCustomSerie</a>(<a class="code" href="class_c_chart_serie.html" title="Abstract class that provides a common &quot;interface&quot; for all series in the...">CChartSerie</a>* pNewSeries, <span class="keywordtype">bool</span> bSecondaryHorizAxis=<span class="keyword">false</span>, <span class="keywordtype">bool</span> bSecondaryVertAxis=<span class="keyword">false</span>);
|
||||||
|
<a name="l00229"></a>00229
|
||||||
|
<a name="l00234"></a>00234 <a class="code" href="class_c_chart_serie.html" title="Abstract class that provides a common &quot;interface&quot; for all series in the...">CChartSerie</a>* <a class="code" href="class_c_chart_ctrl.html#3c1119756906792a51ab691191e488af" title="Retrieves a specific series from the chart.">GetSerie</a>(<span class="keywordtype">unsigned</span> uSerieId) <span class="keyword">const</span>;
|
||||||
|
<a name="l00236"></a>00236
|
||||||
|
<a name="l00240"></a>00240 <span class="keywordtype">void</span> <a class="code" href="class_c_chart_ctrl.html#8b7cd54df388e7a1dacb6b637f77551e" title="Removes a specific series from the chart.">RemoveSerie</a>(<span class="keywordtype">unsigned</span> uSerieId);
|
||||||
|
<a name="l00242"></a>00242 <span class="keywordtype">void</span> <a class="code" href="class_c_chart_ctrl.html#6fef22e15e44fa2fafe8f924498a81c9" title="Removes all the series from the chart.">RemoveAllSeries</a>();
|
||||||
|
<a name="l00244"></a>00244 <span class="keywordtype">size_t</span> <a class="code" href="class_c_chart_ctrl.html#d79d9e5978eb957366dbe3d4d71c4902" title="Returns the number of series in the chart.">GetSeriesCount</a>() <span class="keyword">const</span>;
|
||||||
|
<a name="l00245"></a>00245
|
||||||
|
<a name="l00247"></a>00247
|
||||||
|
<a name="l00258"></a>00258 <a class="code" href="class_c_chart_cross_hair_cursor.html" title="Specialization of a CChartCursor class for a cross-hair cursor.">CChartCrossHairCursor</a>* <a class="code" href="class_c_chart_ctrl.html#06f647456e4a0716355b6c79cacce71f" title="Create and attach a cross-hair cursor to the control.">CreateCrossHairCursor</a>(<span class="keywordtype">bool</span> bSecondaryHorizAxis=<span class="keyword">false</span>, <span class="keywordtype">bool</span> bSecondaryVertAxis=<span class="keyword">false</span>);
|
||||||
|
<a name="l00260"></a>00260
|
||||||
|
<a name="l00269"></a>00269 <a class="code" href="class_c_chart_drag_line_cursor.html" title="Specialization of a CChartCursor class for a dragline cursor.">CChartDragLineCursor</a>* <a class="code" href="class_c_chart_ctrl.html#fc19342eec58562148b11b255ede154e" title="Create and attach a drag-line cursor to the control.">CreateDragLineCursor</a>(<a class="code" href="class_c_chart_ctrl.html#28d7cd5253e1e7970ffbd2838a028419" title="An enumeration of the different axis positions.">EAxisPos</a> relatedAxis);
|
||||||
|
<a name="l00271"></a>00271
|
||||||
|
<a name="l00277"></a>00277 <span class="keywordtype">void</span> <a class="code" href="class_c_chart_ctrl.html#81c624348084247a037e014ad2bd3a86" title="Attach a custom cursor to the control.">AttachCustomCursor</a>(<a class="code" href="class_c_chart_cursor.html" title="Base class for cursors which can be added to the chart control.">CChartCursor</a>* pCursor);
|
||||||
|
<a name="l00279"></a>00279
|
||||||
|
<a name="l00284"></a>00284 <span class="keywordtype">void</span> <a class="code" href="class_c_chart_ctrl.html#dfbc638ec9af58004c98cba37b9d8b4c" title="Removes a cursor with a specific Id from the control.">RemoveCursor</a>(<span class="keywordtype">unsigned</span> cursorId);
|
||||||
|
<a name="l00285"></a>00285
|
||||||
|
<a name="l00287"></a>00287 <span class="keywordtype">void</span> <a class="code" href="class_c_chart_ctrl.html#c291e28722ae86db4c721fa0dd6fb060" title="Shows/hides the mouse cursor when it is over the plotting area.">ShowMouseCursor</a>(<span class="keywordtype">bool</span> bShow);
|
||||||
|
<a name="l00288"></a>00288
|
||||||
|
<a name="l00289"></a>00289 <a class="code" href="class_c_chart_axis.html" title="Base class that takes care of the management of a chart axis.">CChartAxis</a>* GetBottomAxis() <span class="keyword">const</span>;
|
||||||
|
<a name="l00290"></a>00290 <a class="code" href="class_c_chart_axis.html" title="Base class that takes care of the management of a chart axis.">CChartAxis</a>* GetLeftAxis() <span class="keyword">const</span>;
|
||||||
|
<a name="l00291"></a>00291 <a class="code" href="class_c_chart_axis.html" title="Base class that takes care of the management of a chart axis.">CChartAxis</a>* GetTopAxis() <span class="keyword">const</span>;
|
||||||
|
<a name="l00292"></a>00292 <a class="code" href="class_c_chart_axis.html" title="Base class that takes care of the management of a chart axis.">CChartAxis</a>* GetRightAxis() <span class="keyword">const</span>;
|
||||||
|
<a name="l00294"></a>00294
|
||||||
|
<a name="l00299"></a><a class="code" href="class_c_chart_ctrl.html#f7283d9146c122e4580444355ea2951e">00299</a> <a class="code" href="class_c_chart_axis.html" title="Base class that takes care of the management of a chart axis.">CChartAxis</a>* <a class="code" href="class_c_chart_ctrl.html#f7283d9146c122e4580444355ea2951e" title="Returns a specific axis attached to the control.">GetAxis</a>(<a class="code" href="class_c_chart_ctrl.html#28d7cd5253e1e7970ffbd2838a028419" title="An enumeration of the different axis positions.">EAxisPos</a> axisPos)<span class="keyword"> const</span>
|
||||||
|
<a name="l00300"></a>00300 <span class="keyword"> </span>{
|
||||||
|
<a name="l00301"></a>00301 <span class="keywordflow">return</span> m_pAxes[axisPos];
|
||||||
|
<a name="l00302"></a>00302 }
|
||||||
|
<a name="l00303"></a>00303
|
||||||
|
<a name="l00305"></a><a class="code" href="class_c_chart_ctrl.html#58f25dcbd40c1e2ff76aabc3d7dd89a1">00305</a> UINT <a class="code" href="class_c_chart_ctrl.html#58f25dcbd40c1e2ff76aabc3d7dd89a1" title="Returns the type of the edge used as border.">GetEdgeType</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> EdgeType; }
|
||||||
|
<a name="l00307"></a>00307
|
||||||
|
<a name="l00312"></a><a class="code" href="class_c_chart_ctrl.html#563757fa50cbea7cf59f3198c488f099">00312</a> <span class="keywordtype">void</span> <a class="code" href="class_c_chart_ctrl.html#563757fa50cbea7cf59f3198c488f099" title="Sets the edge type.">SetEdgeType</a>(UINT NewEdge)
|
||||||
|
<a name="l00313"></a>00313 {
|
||||||
|
<a name="l00314"></a>00314 EdgeType = NewEdge;
|
||||||
|
<a name="l00315"></a>00315 <a class="code" href="class_c_chart_ctrl.html#0da996ee17f075ae68e81e9b38670435" title="Forces a refresh of the control.">RefreshCtrl</a>();
|
||||||
|
<a name="l00316"></a>00316 }
|
||||||
|
<a name="l00317"></a>00317
|
||||||
|
<a name="l00319"></a><a class="code" href="class_c_chart_ctrl.html#7b7896c0f8b00298b29da08d7af334c7">00319</a> COLORREF <a class="code" href="class_c_chart_ctrl.html#7b7896c0f8b00298b29da08d7af334c7" title="Returns the background color.">GetBackColor</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_BackColor; }
|
||||||
|
<a name="l00321"></a><a class="code" href="class_c_chart_ctrl.html#f5e0c98f70ec80366519cf4bb53b673a">00321</a> <span class="keywordtype">void</span> <a class="code" href="class_c_chart_ctrl.html#f5e0c98f70ec80366519cf4bb53b673a" title="Sets the background color.">SetBackColor</a>(COLORREF NewCol)
|
||||||
|
<a name="l00322"></a>00322 {
|
||||||
|
<a name="l00323"></a>00323 m_BackColor = NewCol;
|
||||||
|
<a name="l00324"></a>00324 m_bBackGradient = <span class="keyword">false</span>;
|
||||||
|
<a name="l00325"></a>00325 <a class="code" href="class_c_chart_ctrl.html#0da996ee17f075ae68e81e9b38670435" title="Forces a refresh of the control.">RefreshCtrl</a>();
|
||||||
|
<a name="l00326"></a>00326 }
|
||||||
|
<a name="l00328"></a><a class="code" href="class_c_chart_ctrl.html#8761c0b97fc83ee817e5331cd6427640">00328</a> COLORREF <a class="code" href="class_c_chart_ctrl.html#8761c0b97fc83ee817e5331cd6427640" title="Returns the color of the plotting area&#39;s border.">GetBorderColor</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_BorderColor; }
|
||||||
|
<a name="l00330"></a><a class="code" href="class_c_chart_ctrl.html#5ce83aa18830eb77fe86f6f0e9fbca5c">00330</a> <span class="keywordtype">void</span> <a class="code" href="class_c_chart_ctrl.html#5ce83aa18830eb77fe86f6f0e9fbca5c" title="Sets the color of the plotting area&#39;s border.">SetBorderColor</a>(COLORREF NewCol) { m_BorderColor = NewCol; <a class="code" href="class_c_chart_ctrl.html#0da996ee17f075ae68e81e9b38670435" title="Forces a refresh of the control.">RefreshCtrl</a>(); }
|
||||||
|
<a name="l00332"></a><a class="code" href="class_c_chart_ctrl.html#16ad1084a1fc0b81fc5fbec67ac61225">00332</a> COLORREF <a class="code" href="class_c_chart_ctrl.html#16ad1084a1fc0b81fc5fbec67ac61225" title="Returns the color of the zoom rectangle.">GetZoomRectColor</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_ZoomRectColor; }
|
||||||
|
<a name="l00334"></a><a class="code" href="class_c_chart_ctrl.html#7768a52e5e832e56d209d47c1d1d2353">00334</a> <span class="keywordtype">void</span> <a class="code" href="class_c_chart_ctrl.html#7768a52e5e832e56d209d47c1d1d2353" title="Sets the color of the zoom rectangle.">SetZoomRectColor</a>(COLORREF NewCol) { m_ZoomRectColor = NewCol; <a class="code" href="class_c_chart_ctrl.html#0da996ee17f075ae68e81e9b38670435" title="Forces a refresh of the control.">RefreshCtrl</a>(); }
|
||||||
|
<a name="l00336"></a>00336
|
||||||
|
<a name="l00348"></a>00348 <span class="keywordtype">void</span> <a class="code" href="class_c_chart_ctrl.html#eba2c09d64040effe8f34bb20be233b3" title="Sets a gradient background.">SetBackGradient</a>(COLORREF Col1, COLORREF Col2, EGradientType GradientType);
|
||||||
|
<a name="l00349"></a>00349
|
||||||
|
<a name="l00351"></a><a class="code" href="class_c_chart_ctrl.html#90bdfd131496b3c57a35728cfea14555">00351</a> <span class="keywordtype">void</span> <a class="code" href="class_c_chart_ctrl.html#90bdfd131496b3c57a35728cfea14555" title="Enables/disables the pan feature.">SetPanEnabled</a>(<span class="keywordtype">bool</span> bEnabled) { m_bPanEnabled = bEnabled; }
|
||||||
|
<a name="l00353"></a><a class="code" href="class_c_chart_ctrl.html#284f24403873ab07b7269460edf17118">00353</a> <span class="keywordtype">bool</span> <a class="code" href="class_c_chart_ctrl.html#284f24403873ab07b7269460edf17118" title="Returns true if the pan feature is enabled.">GetPanEnabled</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_bPanEnabled; }
|
||||||
|
<a name="l00355"></a><a class="code" href="class_c_chart_ctrl.html#0d48ddf5d039855f2ca492351b34e911">00355</a> <span class="keywordtype">void</span> <a class="code" href="class_c_chart_ctrl.html#0d48ddf5d039855f2ca492351b34e911" title="Enables/disables the zoom feature.">SetZoomEnabled</a>(<span class="keywordtype">bool</span> bEnabled) { m_bZoomEnabled = bEnabled; }
|
||||||
|
<a name="l00357"></a><a class="code" href="class_c_chart_ctrl.html#0c4353590178e76e508899344819049e">00357</a> <span class="keywordtype">bool</span> <a class="code" href="class_c_chart_ctrl.html#0c4353590178e76e508899344819049e" title="Returns true if the zoom feature is enabled.">GetZoomEnabled</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_bZoomEnabled; }
|
||||||
|
<a name="l00359"></a>00359 <span class="keywordtype">void</span> <a class="code" href="class_c_chart_ctrl.html#39a297d54bf34bcb0fb4b828144101c8" title="Undo all pan and zoom operations that were done on the chart.">UndoPanZoom</a>();
|
||||||
|
<a name="l00360"></a>00360
|
||||||
|
<a name="l00362"></a>00362
|
||||||
|
<a name="l00365"></a>00365 <span class="keywordtype">void</span> <a class="code" href="class_c_chart_ctrl.html#0da996ee17f075ae68e81e9b38670435" title="Forces a refresh of the control.">RefreshCtrl</a>();
|
||||||
|
<a name="l00367"></a>00367
|
||||||
|
<a name="l00374"></a>00374 <span class="keywordtype">void</span> <a class="code" href="class_c_chart_ctrl.html#8c888f1b6cfd77487dbad88707c449be" title="Enables/disables the refresh of the control.">EnableRefresh</a>(<span class="keywordtype">bool</span> bEnable);
|
||||||
|
<a name="l00376"></a>00376
|
||||||
|
<a name="l00386"></a>00386 <span class="keywordtype">int</span> <a class="code" href="class_c_chart_ctrl.html#1508a990e3ee11b4eb295f1df6449c37" title="Creates the control dynamically.">Create</a>(CWnd* pParentWnd, <span class="keyword">const</span> RECT& rect, UINT nID, DWORD dwStyle=WS_VISIBLE);
|
||||||
|
<a name="l00387"></a>00387
|
||||||
|
<a name="l00389"></a>00389 <span class="keyword">static</span> <span class="keywordtype">double</span> <a class="code" href="class_c_chart_ctrl.html#5f04f51f5d74a29ba0e5d8100313c2f9" title="Helper function to convert a date to a double value.">DateToValue</a>(<span class="keyword">const</span> COleDateTime& Date);
|
||||||
|
<a name="l00391"></a>00391 <span class="keyword">static</span> COleDateTime <a class="code" href="class_c_chart_ctrl.html#355792ea4e0bc6dda66910409d22a2d1" title="Helper function to convert a double value to a date.">ValueToDate</a>(<span class="keywordtype">double</span> Value);
|
||||||
|
<a name="l00392"></a>00392
|
||||||
|
<a name="l00394"></a>00394
|
||||||
|
<a name="l00401"></a>00401 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="class_c_chart_ctrl.html#1a1c8856c1153cf65dbf639256bf1f03" title="Print the chart.">Print</a>(<span class="keyword">const</span> TChartString& strTitle, CPrintDialog* pPrntDialog = NULL);
|
||||||
|
<a name="l00402"></a>00402
|
||||||
|
<a name="l00403"></a>00403 <span class="preprocessor">#if _MFC_VER > 0x0600</span>
|
||||||
|
<a name="l00405"></a>00405 <span class="preprocessor"></span>
|
||||||
|
<a name="l00419"></a>00419 <span class="preprocessor"> void SaveAsImage(const TChartString& strFilename, const CRect& rect, </span>
|
||||||
|
<a name="l00420"></a>00420 <span class="preprocessor"></span> <span class="keywordtype">int</span> nBPP, REFGUID guidFileType= GUID_NULL);
|
||||||
|
<a name="l00421"></a>00421 <span class="preprocessor">#endif</span>
|
||||||
|
<a name="l00422"></a>00422 <span class="preprocessor"></span>
|
||||||
|
<a name="l00424"></a>00424 <a class="code" href="class_c_chart_ctrl.html#ac67bd59aadf956ea8fcf2b933ba13a9" title="Default constructor.">CChartCtrl</a>();
|
||||||
|
<a name="l00426"></a>00426 <span class="keyword">virtual</span> <a class="code" href="class_c_chart_ctrl.html#e7683743f220c085fd43e1ab89f55c23" title="Default destructor.">~CChartCtrl</a>();
|
||||||
|
<a name="l00427"></a>00427
|
||||||
|
<a name="l00429"></a>00429
|
||||||
|
<a name="l00434"></a><a class="code" href="class_c_chart_ctrl.html#58213a4a92ca79f58bc1f4615a9a6b16">00434</a> <span class="keywordtype">void</span> <a class="code" href="class_c_chart_ctrl.html#58213a4a92ca79f58bc1f4615a9a6b16" title="Register a mouse listener with the control.">RegisterMouseListener</a>(<a class="code" href="class_c_chart_mouse_listener.html" title="Listener for mouse events occuring on the chart control.">CChartMouseListener</a>* pMouseListener) { m_pMouseListener = pMouseListener;}
|
||||||
|
<a name="l00435"></a>00435
|
||||||
|
<a name="l00437"></a>00437
|
||||||
|
<a name="l00441"></a>00441 <span class="keywordtype">void</span> <a class="code" href="class_c_chart_ctrl.html#df7e0680c430c94b490abca3601fe500" title="Tell the control to set the current series to the first series.">GoToFirstSerie</a>();
|
||||||
|
<a name="l00443"></a>00443
|
||||||
|
<a name="l00452"></a>00452 <a class="code" href="class_c_chart_serie.html" title="Abstract class that provides a common &quot;interface&quot; for all series in the...">CChartSerie</a>* <a class="code" href="class_c_chart_ctrl.html#79833e51527801b30cb26197b34c15d8" title="Returns the next series in the control.">GetNextSerie</a>();
|
||||||
|
<a name="l00453"></a>00453
|
||||||
|
<a name="l00455"></a>00455 <span class="keywordtype">void</span> <a class="code" href="class_c_chart_ctrl.html#feb25bdbea159c7e89d3293ba80347d3" title="Refreshes all the axes which are automatic for the screen.">RefreshScreenAutoAxes</a>();
|
||||||
|
<a name="l00456"></a>00456
|
||||||
|
<a name="l00457"></a>00457 <span class="comment">// Generated message map functions</span>
|
||||||
|
<a name="l00458"></a>00458 <span class="keyword">protected</span>:
|
||||||
|
<a name="l00459"></a>00459 <span class="comment">//{{AFX_MSG(CChartCtrl)</span>
|
||||||
|
<a name="l00460"></a>00460 afx_msg <span class="keywordtype">void</span> OnPaint();
|
||||||
|
<a name="l00461"></a>00461 afx_msg BOOL OnEraseBkgnd(CDC* pDC);
|
||||||
|
<a name="l00462"></a>00462 afx_msg <span class="keywordtype">void</span> OnSize(UINT nType, <span class="keywordtype">int</span> cx, <span class="keywordtype">int</span> cy);
|
||||||
|
<a name="l00463"></a>00463 afx_msg <span class="keywordtype">void</span> OnMouseMove(UINT nFlags, CPoint point);
|
||||||
|
<a name="l00464"></a>00464 afx_msg <span class="keywordtype">void</span> OnLButtonDown(UINT nFlags, CPoint point);
|
||||||
|
<a name="l00465"></a>00465 afx_msg <span class="keywordtype">void</span> OnLButtonUp(UINT nFlags, CPoint point);
|
||||||
|
<a name="l00466"></a>00466 afx_msg <span class="keywordtype">void</span> OnLButtonDblClk(UINT nFlags, CPoint point);
|
||||||
|
<a name="l00467"></a>00467 afx_msg <span class="keywordtype">void</span> OnRButtonDown(UINT nFlags, CPoint point);
|
||||||
|
<a name="l00468"></a>00468 afx_msg <span class="keywordtype">void</span> OnRButtonUp(UINT nFlags, CPoint point);
|
||||||
|
<a name="l00469"></a>00469 afx_msg <span class="keywordtype">void</span> OnRButtonDblClk(UINT nFlags, CPoint point);
|
||||||
|
<a name="l00470"></a>00470 afx_msg <span class="keywordtype">void</span> OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
|
||||||
|
<a name="l00471"></a>00471 afx_msg <span class="keywordtype">void</span> OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
|
||||||
|
<a name="l00472"></a>00472 <span class="comment">//}}AFX_MSG</span>
|
||||||
|
<a name="l00473"></a>00473 DECLARE_MESSAGE_MAP()
|
||||||
|
<a name="l00474"></a>00474
|
||||||
|
<a name="l00475"></a>00475 protected:
|
||||||
|
<a name="l00476"></a>00476 virtual <span class="keywordtype">void</span> OnBeginPrinting(CDC *pDC, CPrintInfo *pInfo);
|
||||||
|
<a name="l00477"></a>00477 virtual <span class="keywordtype">void</span> OnPrint(CDC *pDC, CPrintInfo *pInfo);
|
||||||
|
<a name="l00478"></a>00478 virtual <span class="keywordtype">void</span> OnEndPrinting(CDC *pDC, CPrintInfo *pInfo);
|
||||||
|
<a name="l00479"></a>00479
|
||||||
|
<a name="l00480"></a>00480 <span class="comment">// This function can be called to draw the chart</span>
|
||||||
|
<a name="l00481"></a>00481 <span class="comment">// on the screen or for printing.</span>
|
||||||
|
<a name="l00482"></a>00482 virtual <span class="keywordtype">void</span> DrawChart(CDC* pDC, CRect ChartRect);
|
||||||
|
<a name="l00483"></a>00483 virtual <span class="keywordtype">void</span> DrawBackground(CDC* pDC, CRect ChartRect);
|
||||||
|
<a name="l00484"></a>00484
|
||||||
|
<a name="l00485"></a>00485 private:
|
||||||
|
<a name="l00487"></a>00487 <span class="keywordtype">bool</span> RegisterWindowClass();
|
||||||
|
<a name="l00488"></a>00488
|
||||||
|
<a name="l00490"></a>00490
|
||||||
|
<a name="l00497"></a>00497 <span class="keywordtype">void</span> SendMouseEvent(<a class="code" href="class_c_chart_mouse_listener.html" title="Listener for mouse events occuring on the chart control.">CChartMouseListener</a>::MouseEvent mouseEvent, const CPoint& screenPoint) const;
|
||||||
|
<a name="l00498"></a>00498
|
||||||
|
<a name="l00500"></a>00500 <span class="keywordtype">int</span> m_iEnableRefresh ;
|
||||||
|
<a name="l00502"></a>00502
|
||||||
|
<a name="l00506"></a>00506 <span class="keywordtype">bool</span> m_bPendingRefresh;
|
||||||
|
<a name="l00508"></a>00508 CDC m_BackgroundDC;
|
||||||
|
<a name="l00510"></a>00510 <span class="keywordtype">bool</span> m_bMemDCCreated;
|
||||||
|
<a name="l00511"></a>00511
|
||||||
|
<a name="l00513"></a>00513 <span class="keywordtype">bool</span> m_bBackGradient;
|
||||||
|
<a name="l00515"></a>00515 COLORREF m_BackGradientCol1;
|
||||||
|
<a name="l00517"></a>00517 COLORREF m_BackGradientCol2;
|
||||||
|
<a name="l00519"></a>00519 EGradientType m_BackGradientType;
|
||||||
|
<a name="l00521"></a>00521 COLORREF m_BackColor;
|
||||||
|
<a name="l00523"></a>00523 COLORREF m_BorderColor;
|
||||||
|
<a name="l00525"></a>00525 UINT EdgeType;
|
||||||
|
<a name="l00526"></a>00526
|
||||||
|
<a name="l00528"></a>00528 CRect m_PlottingRect;
|
||||||
|
<a name="l00529"></a>00529
|
||||||
|
<a name="l00530"></a>00530 typedef std::map<<span class="keywordtype">unsigned</span>, <a class="code" href="class_c_chart_serie.html" title="Abstract class that provides a common &quot;interface&quot; for all series in the...">CChartSerie</a>*> TSeriesMap;
|
||||||
|
<a name="l00532"></a>00532 TSeriesMap m_mapSeries;
|
||||||
|
<a name="l00534"></a>00534 <a class="code" href="class_c_chart_axis.html" title="Base class that takes care of the management of a chart axis.">CChartAxis</a>* m_pAxes[4];
|
||||||
|
<a name="l00535"></a>00535
|
||||||
|
<a name="l00537"></a>00537 <a class="code" href="class_c_chart_legend.html" title="This class is responsible for the legend displayed on the control.">CChartLegend</a>* m_pLegend;
|
||||||
|
<a name="l00539"></a>00539 <a class="code" href="class_c_chart_title.html" title="This class is responsible for the titles displayed on the control.">CChartTitle</a>* m_pTitles;
|
||||||
|
<a name="l00540"></a>00540
|
||||||
|
<a name="l00542"></a>00542 <span class="keywordtype">bool</span> m_bPanEnabled;
|
||||||
|
<a name="l00544"></a>00544 <span class="keywordtype">bool</span> m_bRMouseDown;
|
||||||
|
<a name="l00546"></a>00546 CPoint m_PanAnchor;
|
||||||
|
<a name="l00547"></a>00547
|
||||||
|
<a name="l00549"></a>00549 <span class="keywordtype">bool</span> m_bZoomEnabled;
|
||||||
|
<a name="l00551"></a>00551 <span class="keywordtype">bool</span> m_bLMouseDown;
|
||||||
|
<a name="l00553"></a>00553 CRect m_rectZoomArea;
|
||||||
|
<a name="l00555"></a>00555 COLORREF m_ZoomRectColor;
|
||||||
|
<a name="l00556"></a>00556
|
||||||
|
<a name="l00558"></a>00558 <span class="keywordtype">bool</span> m_bToolBarCreated;
|
||||||
|
<a name="l00559"></a>00559
|
||||||
|
<a name="l00561"></a>00561 CFont m_PrinterFont;
|
||||||
|
<a name="l00563"></a>00563 CSize m_LogicalPageSize;
|
||||||
|
<a name="l00565"></a>00565 CSize m_PaperSize;
|
||||||
|
<a name="l00566"></a>00566
|
||||||
|
<a name="l00567"></a>00567 typedef std::map<<span class="keywordtype">unsigned</span>, <a class="code" href="class_c_chart_cursor.html" title="Base class for cursors which can be added to the chart control.">CChartCursor</a>*> TCursorMap;
|
||||||
|
<a name="l00569"></a>00569 TCursorMap m_mapCursors;
|
||||||
|
<a name="l00570"></a>00570
|
||||||
|
<a name="l00572"></a>00572 <a class="code" href="class_c_chart_mouse_listener.html" title="Listener for mouse events occuring on the chart control.">CChartMouseListener</a>* m_pMouseListener;
|
||||||
|
<a name="l00573"></a>00573
|
||||||
|
<a name="l00575"></a>00575 <span class="keywordtype">bool</span> m_bMouseVisible;
|
||||||
|
<a name="l00576"></a>00576
|
||||||
|
<a name="l00577"></a>00577 typedef TSeriesMap::const_iterator TSeriesMapIter;
|
||||||
|
<a name="l00579"></a>00579 TSeriesMapIter m_currentSeries;
|
||||||
|
<a name="l00580"></a>00580 };
|
||||||
|
<a name="l00581"></a>00581
|
||||||
|
<a name="l00583"></a>00583
|
||||||
|
<a name="l00584"></a>00584 <span class="comment">//{{AFX_INSERT_LOCATION}}</span>
|
||||||
|
<a name="l00585"></a>00585 <span class="comment">// Microsoft Visual C++ will insert additional declarations immediately before the previous line.</span>
|
||||||
|
<a name="l00586"></a>00586
|
||||||
|
</pre></div></div>
|
||||||
|
<hr size="1"><address style="text-align: right;"><small>Generated on Sun Jan 17 13:33:09 2010 for ChartDemo by
|
||||||
|
<a href="http://www.doxygen.org/index.html">
|
||||||
|
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.8 </small></address>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -0,0 +1,105 @@
|
||||||
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||||
|
<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
|
||||||
|
<title>ChartDemo: E:/Sources Misc/ChartDemo/ChartCtrl/ChartCursor.h Source File</title>
|
||||||
|
<link href="tabs.css" rel="stylesheet" type="text/css">
|
||||||
|
<link href="doxygen.css" rel="stylesheet" type="text/css">
|
||||||
|
</head><body>
|
||||||
|
<!-- Generated by Doxygen 1.5.8 -->
|
||||||
|
<div class="navigation" id="top">
|
||||||
|
<div class="tabs">
|
||||||
|
<ul>
|
||||||
|
<li><a href="index.html"><span>Main Page</span></a></li>
|
||||||
|
<li><a href="pages.html"><span>Related Pages</span></a></li>
|
||||||
|
<li><a href="annotated.html"><span>Classes</span></a></li>
|
||||||
|
<li class="current"><a href="files.html"><span>Files</span></a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="tabs">
|
||||||
|
<ul>
|
||||||
|
<li><a href="files.html"><span>File List</span></a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<h1>E:/Sources Misc/ChartDemo/ChartCtrl/ChartCursor.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span>
|
||||||
|
<a name="l00002"></a>00002 <span class="comment"> *</span>
|
||||||
|
<a name="l00003"></a>00003 <span class="comment"> * ChartCursor.h</span>
|
||||||
|
<a name="l00004"></a>00004 <span class="comment"> *</span>
|
||||||
|
<a name="l00005"></a>00005 <span class="comment"> * Written by Cédric Moonen (cedric_moonen@hotmail.com)</span>
|
||||||
|
<a name="l00006"></a>00006 <span class="comment"> *</span>
|
||||||
|
<a name="l00007"></a>00007 <span class="comment"> *</span>
|
||||||
|
<a name="l00008"></a>00008 <span class="comment"> *</span>
|
||||||
|
<a name="l00009"></a>00009 <span class="comment"> * This code may be used for any non-commercial and commercial purposes in a compiled form.</span>
|
||||||
|
<a name="l00010"></a>00010 <span class="comment"> * The code may be redistributed as long as it remains unmodified and providing that the </span>
|
||||||
|
<a name="l00011"></a>00011 <span class="comment"> * author name and this disclaimer remain intact. The sources can be modified WITH the author </span>
|
||||||
|
<a name="l00012"></a>00012 <span class="comment"> * consent only.</span>
|
||||||
|
<a name="l00013"></a>00013 <span class="comment"> * </span>
|
||||||
|
<a name="l00014"></a>00014 <span class="comment"> * This code is provided without any garanties. I cannot be held responsible for the damage or</span>
|
||||||
|
<a name="l00015"></a>00015 <span class="comment"> * the loss of time it causes. Use it at your own risks</span>
|
||||||
|
<a name="l00016"></a>00016 <span class="comment"> *</span>
|
||||||
|
<a name="l00017"></a>00017 <span class="comment"> * An e-mail to notify me that you are using this code is appreciated also.</span>
|
||||||
|
<a name="l00018"></a>00018 <span class="comment"> *</span>
|
||||||
|
<a name="l00019"></a>00019 <span class="comment"> *</span>
|
||||||
|
<a name="l00020"></a>00020 <span class="comment"> */</span>
|
||||||
|
<a name="l00021"></a>00021
|
||||||
|
<a name="l00022"></a>00022 <span class="preprocessor">#ifndef _CHARTCURSOR_H_</span>
|
||||||
|
<a name="l00023"></a>00023 <span class="preprocessor"></span><span class="preprocessor">#define _CHARTCURSOR_H_</span>
|
||||||
|
<a name="l00024"></a>00024 <span class="preprocessor"></span>
|
||||||
|
<a name="l00025"></a>00025 <span class="preprocessor">#include <list></span>
|
||||||
|
<a name="l00026"></a>00026
|
||||||
|
<a name="l00027"></a>00027 <span class="keyword">class </span><a class="code" href="class_c_chart_ctrl.html" title="The main chart control class.">CChartCtrl</a>;
|
||||||
|
<a name="l00028"></a>00028 <span class="keyword">class </span><a class="code" href="class_c_chart_cursor.html" title="Base class for cursors which can be added to the chart control.">CChartCursor</a>;
|
||||||
|
<a name="l00029"></a>00029
|
||||||
|
<a name="l00031"></a>00031
|
||||||
|
<a name="l00035"></a><a class="code" href="class_c_chart_cursor_listener.html">00035</a> <span class="keyword">class </span><a class="code" href="class_c_chart_cursor_listener.html" title="Interface to implement in order to be notified about a cursor movement.">CChartCursorListener</a>
|
||||||
|
<a name="l00036"></a>00036 {
|
||||||
|
<a name="l00037"></a>00037 <span class="keyword">public</span>:
|
||||||
|
<a name="l00039"></a>00039 <a class="code" href="class_c_chart_cursor_listener.html#249e51c76383c8e727eba793b99455a5" title="Default constructor.">CChartCursorListener</a>();
|
||||||
|
<a name="l00041"></a>00041 <span class="keyword">virtual</span> <a class="code" href="class_c_chart_cursor_listener.html#a495e18fbabff51261b47a4a79473db6" title="Destructor.">~CChartCursorListener</a>();
|
||||||
|
<a name="l00042"></a>00042
|
||||||
|
<a name="l00044"></a>00044
|
||||||
|
<a name="l00054"></a>00054 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="class_c_chart_cursor_listener.html#f33ee6368a4a6382523eff1c835ef2e4" title="Pure virtual function to implement in order to be notified about a cursor movement...">OnCursorMoved</a>(<a class="code" href="class_c_chart_cursor.html" title="Base class for cursors which can be added to the chart control.">CChartCursor</a>* pCursor, <span class="keywordtype">double</span> xValue, <span class="keywordtype">double</span> yValue) = 0;
|
||||||
|
<a name="l00055"></a>00055 };
|
||||||
|
<a name="l00056"></a>00056
|
||||||
|
<a name="l00058"></a>00058
|
||||||
|
<a name="l00063"></a><a class="code" href="class_c_chart_cursor.html">00063</a> <span class="keyword">class </span><a class="code" href="class_c_chart_cursor.html" title="Base class for cursors which can be added to the chart control.">CChartCursor</a>
|
||||||
|
<a name="l00064"></a>00064 {
|
||||||
|
<a name="l00065"></a>00065 <span class="keyword">friend</span> <a class="code" href="class_c_chart_ctrl.html" title="The main chart control class.">CChartCtrl</a>;
|
||||||
|
<a name="l00066"></a>00066
|
||||||
|
<a name="l00067"></a>00067 <span class="keyword">public</span>:
|
||||||
|
<a name="l00069"></a>00069 <span class="keywordtype">void</span> <a class="code" href="class_c_chart_cursor.html#bd4387de9a97c4469f78c86e04dd2e69" title="Sets the cursor color.">SetColor</a>(COLORREF cursorColor);
|
||||||
|
<a name="l00071"></a><a class="code" href="class_c_chart_cursor.html#4b2f24e0bbbfb236c52b94050d2f5a07">00071</a> <span class="keywordtype">unsigned</span> <a class="code" href="class_c_chart_cursor.html#4b2f24e0bbbfb236c52b94050d2f5a07" title="Retrieves the cursor Id.">GetCursorId</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="class_c_chart_cursor.html#634c001d77168bbe68963644774eac4e" title="The Id of this curosr.">m_uCursorId</a>; }
|
||||||
|
<a name="l00072"></a>00072
|
||||||
|
<a name="l00074"></a>00074 <span class="keywordtype">void</span> <a class="code" href="class_c_chart_cursor.html#93f4600582c8942db0b01eee3c882a3f" title="Registers a cursor listener with this cursor.">RegisterListener</a>(<a class="code" href="class_c_chart_cursor_listener.html" title="Interface to implement in order to be notified about a cursor movement.">CChartCursorListener</a>* pListener);
|
||||||
|
<a name="l00075"></a>00075
|
||||||
|
<a name="l00076"></a>00076 <span class="keyword">protected</span>:
|
||||||
|
<a name="l00078"></a>00078 <a class="code" href="class_c_chart_cursor.html#255fd9c02744eab27d12551a218c19d8" title="Default constructor.">CChartCursor</a>(<a class="code" href="class_c_chart_ctrl.html" title="The main chart control class.">CChartCtrl</a>* pParent);
|
||||||
|
<a name="l00080"></a>00080 <span class="keyword">virtual</span> <a class="code" href="class_c_chart_cursor.html#ed9723360dfa27567b8dfb34f4bd6ca9" title="Default destructor.">~CChartCursor</a>();
|
||||||
|
<a name="l00081"></a>00081
|
||||||
|
<a name="l00083"></a>00083
|
||||||
|
<a name="l00087"></a>00087 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="class_c_chart_cursor.html#fe447ebc13060419ef7b60410ba5532b" title="Pure virtual function that is called when the mouse moved on the plot area.">OnMouseMove</a>(CPoint mousePoint) = 0;
|
||||||
|
<a name="l00089"></a>00089
|
||||||
|
<a name="l00093"></a><a class="code" href="class_c_chart_cursor.html#bd95379b8f28b93191de1bf5e02a0126">00093</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="class_c_chart_cursor.html#bd95379b8f28b93191de1bf5e02a0126" title="Virtual function that is called when the left mouse button is pressed.">OnMouseButtonDown</a>(CPoint <span class="comment">/*mousePoint*/</span>) { }
|
||||||
|
<a name="l00095"></a>00095
|
||||||
|
<a name="l00099"></a><a class="code" href="class_c_chart_cursor.html#93394fc366bf6f76aa0f4cea0858a8f1">00099</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="class_c_chart_cursor.html#93394fc366bf6f76aa0f4cea0858a8f1" title="Virtual function that is called when the left mouse button is released.">OnMouseButtonUp</a>(CPoint <span class="comment">/*mousePoint*/</span>) { }
|
||||||
|
<a name="l00100"></a>00100
|
||||||
|
<a name="l00102"></a>00102 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="class_c_chart_cursor.html#122c0784ebeec719cf040692fe218f09" title="Pure virtual function that draws the cursor.">Draw</a>(CDC* pDC) = 0;
|
||||||
|
<a name="l00104"></a>00104
|
||||||
|
<a name="l00107"></a>00107 <span class="keywordtype">void</span> <a class="code" href="class_c_chart_cursor.html#99684299e615294469bfb4f0c6079dc8" title="Function that is called by the child classes when the cursor has been moved.">CursorMoved</a>(<span class="keywordtype">double</span> newXValue, <span class="keywordtype">double</span> newYValue);
|
||||||
|
<a name="l00108"></a>00108
|
||||||
|
<a name="l00109"></a>00109
|
||||||
|
<a name="l00111"></a><a class="code" href="class_c_chart_cursor.html#82f0fae88de7676e725cb394c7350bbe">00111</a> COLORREF <a class="code" href="class_c_chart_cursor.html#82f0fae88de7676e725cb394c7350bbe" title="The color of the cursor.">m_colCursor</a>;
|
||||||
|
<a name="l00113"></a><a class="code" href="class_c_chart_cursor.html#c913e38511292baeb5b8f1ae26e32444">00113</a> <a class="code" href="class_c_chart_ctrl.html" title="The main chart control class.">CChartCtrl</a>* <a class="code" href="class_c_chart_cursor.html#c913e38511292baeb5b8f1ae26e32444" title="The parent charting control.">m_pParentCtrl</a>;
|
||||||
|
<a name="l00114"></a>00114
|
||||||
|
<a name="l00116"></a><a class="code" href="class_c_chart_cursor.html#a60c63b9ba30caae2c4d4971a2d617af">00116</a> <span class="keyword">static</span> <span class="keywordtype">unsigned</span> <a class="code" href="class_c_chart_cursor.html#a60c63b9ba30caae2c4d4971a2d617af" title="Static variable holding the next free cursor Id.">m_uNextFreeId</a>;
|
||||||
|
<a name="l00118"></a><a class="code" href="class_c_chart_cursor.html#634c001d77168bbe68963644774eac4e">00118</a> <span class="keywordtype">unsigned</span> <a class="code" href="class_c_chart_cursor.html#634c001d77168bbe68963644774eac4e" title="The Id of this curosr.">m_uCursorId</a>;
|
||||||
|
<a name="l00119"></a>00119
|
||||||
|
<a name="l00120"></a>00120 <span class="keyword">typedef</span> std::list<CChartCursorListener*> TListenerList;
|
||||||
|
<a name="l00122"></a><a class="code" href="class_c_chart_cursor.html#fbe312c829d2bbcdd73ce92211e1614c">00122</a> TListenerList <a class="code" href="class_c_chart_cursor.html#fbe312c829d2bbcdd73ce92211e1614c" title="List of all listeners registered with this cursor.">m_lstListeners</a>;
|
||||||
|
<a name="l00123"></a>00123 };
|
||||||
|
<a name="l00124"></a>00124
|
||||||
|
<a name="l00125"></a>00125 <span class="preprocessor">#endif // _CHARTCURSOR_H_</span>
|
||||||
|
</pre></div></div>
|
||||||
|
<hr size="1"><address style="text-align: right;"><small>Generated on Sun Jan 17 13:33:09 2010 for ChartDemo by
|
||||||
|
<a href="http://www.doxygen.org/index.html">
|
||||||
|
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.8 </small></address>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -0,0 +1,109 @@
|
||||||
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||||
|
<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
|
||||||
|
<title>ChartDemo: E:/Sources Misc/ChartDemo/ChartCtrl/ChartDateTimeAxis.h Source File</title>
|
||||||
|
<link href="tabs.css" rel="stylesheet" type="text/css">
|
||||||
|
<link href="doxygen.css" rel="stylesheet" type="text/css">
|
||||||
|
</head><body>
|
||||||
|
<!-- Generated by Doxygen 1.5.8 -->
|
||||||
|
<div class="navigation" id="top">
|
||||||
|
<div class="tabs">
|
||||||
|
<ul>
|
||||||
|
<li><a href="index.html"><span>Main Page</span></a></li>
|
||||||
|
<li><a href="pages.html"><span>Related Pages</span></a></li>
|
||||||
|
<li><a href="annotated.html"><span>Classes</span></a></li>
|
||||||
|
<li class="current"><a href="files.html"><span>Files</span></a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="tabs">
|
||||||
|
<ul>
|
||||||
|
<li><a href="files.html"><span>File List</span></a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<h1>E:/Sources Misc/ChartDemo/ChartCtrl/ChartDateTimeAxis.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span>
|
||||||
|
<a name="l00002"></a>00002 <span class="comment"> *</span>
|
||||||
|
<a name="l00003"></a>00003 <span class="comment"> * ChartDateTimeAxis.h</span>
|
||||||
|
<a name="l00004"></a>00004 <span class="comment"> *</span>
|
||||||
|
<a name="l00005"></a>00005 <span class="comment"> * Written by Cédric Moonen (cedric_moonen@hotmail.com)</span>
|
||||||
|
<a name="l00006"></a>00006 <span class="comment"> *</span>
|
||||||
|
<a name="l00007"></a>00007 <span class="comment"> *</span>
|
||||||
|
<a name="l00008"></a>00008 <span class="comment"> *</span>
|
||||||
|
<a name="l00009"></a>00009 <span class="comment"> * This code may be used for any non-commercial and commercial purposes in a compiled form.</span>
|
||||||
|
<a name="l00010"></a>00010 <span class="comment"> * The code may be redistributed as long as it remains unmodified and providing that the </span>
|
||||||
|
<a name="l00011"></a>00011 <span class="comment"> * author name and this disclaimer remain intact. The sources can be modified WITH the author </span>
|
||||||
|
<a name="l00012"></a>00012 <span class="comment"> * consent only.</span>
|
||||||
|
<a name="l00013"></a>00013 <span class="comment"> * </span>
|
||||||
|
<a name="l00014"></a>00014 <span class="comment"> * This code is provided without any garanties. I cannot be held responsible for the damage or</span>
|
||||||
|
<a name="l00015"></a>00015 <span class="comment"> * the loss of time it causes. Use it at your own risks</span>
|
||||||
|
<a name="l00016"></a>00016 <span class="comment"> *</span>
|
||||||
|
<a name="l00017"></a>00017 <span class="comment"> * An e-mail to notify me that you are using this code is appreciated also.</span>
|
||||||
|
<a name="l00018"></a>00018 <span class="comment"> *</span>
|
||||||
|
<a name="l00019"></a>00019 <span class="comment"> *</span>
|
||||||
|
<a name="l00020"></a>00020 <span class="comment"> */</span>
|
||||||
|
<a name="l00021"></a>00021
|
||||||
|
<a name="l00022"></a>00022 <span class="preprocessor">#ifndef _CHARTDATETIMEAXIS_H_</span>
|
||||||
|
<a name="l00023"></a>00023 <span class="preprocessor"></span><span class="preprocessor">#define _CHARTDATETIMEAXIS_H_</span>
|
||||||
|
<a name="l00024"></a>00024 <span class="preprocessor"></span>
|
||||||
|
<a name="l00025"></a>00025 <span class="preprocessor">#include "ChartAxis.h"</span>
|
||||||
|
<a name="l00026"></a>00026 <span class="preprocessor">#include "ChartString.h"</span>
|
||||||
|
<a name="l00027"></a>00027
|
||||||
|
<a name="l00029"></a><a class="code" href="class_c_chart_date_time_axis.html">00029</a> <span class="keyword">class </span><a class="code" href="class_c_chart_date_time_axis.html" title="A specialization of the CChartAxis class for displaying date and time data.">CChartDateTimeAxis</a> : <span class="keyword">public</span> <a class="code" href="class_c_chart_axis.html" title="Base class that takes care of the management of a chart axis.">CChartAxis</a>
|
||||||
|
<a name="l00030"></a>00030 {
|
||||||
|
<a name="l00031"></a>00031 <span class="keyword">friend</span> <a class="code" href="class_c_chart_ctrl.html" title="The main chart control class.">CChartCtrl</a>;
|
||||||
|
<a name="l00032"></a>00032
|
||||||
|
<a name="l00033"></a>00033 <span class="keyword">public</span>:
|
||||||
|
<a name="l00035"></a><a class="code" href="class_c_chart_date_time_axis.html#783a3bd7291b25d95d05514150434c8f">00035</a> <span class="keyword">enum</span> <a class="code" href="class_c_chart_date_time_axis.html#783a3bd7291b25d95d05514150434c8f" title="Enum listing the different base intervals.">TimeInterval</a>
|
||||||
|
<a name="l00036"></a>00036 {
|
||||||
|
<a name="l00037"></a>00037 tiSecond,
|
||||||
|
<a name="l00038"></a>00038 tiMinute,
|
||||||
|
<a name="l00039"></a>00039 tiHour,
|
||||||
|
<a name="l00040"></a>00040 tiDay,
|
||||||
|
<a name="l00041"></a>00041 tiMonth,
|
||||||
|
<a name="l00042"></a>00042 tiYear
|
||||||
|
<a name="l00043"></a>00043 };
|
||||||
|
<a name="l00044"></a>00044
|
||||||
|
<a name="l00046"></a>00046
|
||||||
|
<a name="l00064"></a>00064 <span class="keywordtype">void</span> <a class="code" href="class_c_chart_date_time_axis.html#fc19163a7fa7d95276852c0b6c58af7e" title="Sets the tick increment.">SetTickIncrement</a>(<span class="keywordtype">bool</span> bAuto, <a class="code" href="class_c_chart_date_time_axis.html#783a3bd7291b25d95d05514150434c8f" title="Enum listing the different base intervals.">TimeInterval</a> Interval, <span class="keywordtype">int</span> Multiplier);
|
||||||
|
<a name="l00066"></a>00066
|
||||||
|
<a name="l00074"></a>00074 <span class="keywordtype">void</span> <a class="code" href="class_c_chart_date_time_axis.html#9cdd6aa9c910a7ff159e07387fb5e06a" title="Sets the format of the tick labels.">SetTickLabelFormat</a>(<span class="keywordtype">bool</span> bAutomatic, <span class="keyword">const</span> TChartString& strFormat);
|
||||||
|
<a name="l00076"></a>00076
|
||||||
|
<a name="l00089"></a>00089 <span class="keywordtype">void</span> <a class="code" href="class_c_chart_date_time_axis.html#672859f53992cf52e6763661c2271a85" title="Sets the reference tick.">SetReferenceTick</a>(COleDateTime referenceTick);
|
||||||
|
<a name="l00090"></a>00090
|
||||||
|
<a name="l00091"></a>00091 <span class="keyword">private</span>:
|
||||||
|
<a name="l00093"></a>00093 <a class="code" href="class_c_chart_date_time_axis.html" title="A specialization of the CChartAxis class for displaying date and time data.">CChartDateTimeAxis</a>();
|
||||||
|
<a name="l00095"></a>00095 ~<a class="code" href="class_c_chart_date_time_axis.html" title="A specialization of the CChartAxis class for displaying date and time data.">CChartDateTimeAxis</a>();
|
||||||
|
<a name="l00096"></a>00096
|
||||||
|
<a name="l00097"></a>00097 <span class="keywordtype">double</span> GetFirstTickValue() <span class="keyword">const</span>;
|
||||||
|
<a name="l00098"></a>00098 <span class="keywordtype">bool</span> GetNextTickValue(<span class="keywordtype">double</span> dCurrentTick, <span class="keywordtype">double</span>& dNextTick) <span class="keyword">const</span>;
|
||||||
|
<a name="l00099"></a>00099 TChartString GetTickLabel(<span class="keywordtype">double</span> TickValue) <span class="keyword">const</span>;
|
||||||
|
<a name="l00100"></a>00100 <span class="keywordtype">long</span> ValueToScreenDiscrete(<span class="keywordtype">double</span> Value) <span class="keyword">const</span>;
|
||||||
|
<a name="l00101"></a>00101 <span class="keywordtype">long</span> GetTickPos(<span class="keywordtype">double</span> TickVal) <span class="keyword">const</span>;
|
||||||
|
<a name="l00102"></a>00102
|
||||||
|
<a name="l00103"></a>00103 <span class="keywordtype">void</span> RefreshTickIncrement();
|
||||||
|
<a name="l00104"></a>00104 <span class="keywordtype">void</span> RefreshFirstTick();
|
||||||
|
<a name="l00106"></a>00106 <span class="keywordtype">void</span> RefreshDTTickFormat();
|
||||||
|
<a name="l00107"></a>00107
|
||||||
|
<a name="l00109"></a>00109
|
||||||
|
<a name="l00118"></a>00118 COleDateTime AddMonthToDate(<span class="keyword">const</span> COleDateTime& Date,
|
||||||
|
<a name="l00119"></a>00119 <span class="keywordtype">int</span> iMonthsToAdd) <span class="keyword">const</span>;
|
||||||
|
<a name="l00120"></a>00120
|
||||||
|
<a name="l00121"></a>00121 <span class="keywordtype">double</span> GetTickBeforeVal(<span class="keywordtype">double</span> dValue) <span class="keyword">const</span>;
|
||||||
|
<a name="l00122"></a>00122
|
||||||
|
<a name="l00124"></a>00124 TChartString m_strDTTickFormat;
|
||||||
|
<a name="l00126"></a>00126 <span class="keywordtype">bool</span> m_bAutoTickFormat;
|
||||||
|
<a name="l00128"></a>00128
|
||||||
|
<a name="l00134"></a>00134 <a class="code" href="class_c_chart_date_time_axis.html#783a3bd7291b25d95d05514150434c8f" title="Enum listing the different base intervals.">TimeInterval</a> m_BaseInterval;
|
||||||
|
<a name="l00136"></a>00136
|
||||||
|
<a name="l00141"></a>00141 <span class="keywordtype">int</span> m_iDTTickIntervalMult;
|
||||||
|
<a name="l00142"></a>00142
|
||||||
|
<a name="l00144"></a>00144 <span class="keywordtype">double</span> m_dFirstTickValue;
|
||||||
|
<a name="l00145"></a>00145
|
||||||
|
<a name="l00147"></a>00147 COleDateTime m_ReferenceTick;
|
||||||
|
<a name="l00148"></a>00148 };
|
||||||
|
<a name="l00149"></a>00149
|
||||||
|
<a name="l00150"></a>00150 <span class="preprocessor">#endif // _CHARTDATETIMEAXIS_H_</span>
|
||||||
|
</pre></div></div>
|
||||||
|
<hr size="1"><address style="text-align: right;"><small>Generated on Sun Jan 17 13:33:09 2010 for ChartDemo by
|
||||||
|
<a href="http://www.doxygen.org/index.html">
|
||||||
|
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.8 </small></address>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -0,0 +1,72 @@
|
||||||
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||||
|
<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
|
||||||
|
<title>ChartDemo: E:/Sources Misc/ChartDemo/ChartDemo.h Source File</title>
|
||||||
|
<link href="tabs.css" rel="stylesheet" type="text/css">
|
||||||
|
<link href="doxygen.css" rel="stylesheet" type="text/css">
|
||||||
|
</head><body>
|
||||||
|
<!-- Generated by Doxygen 1.5.8 -->
|
||||||
|
<div class="navigation" id="top">
|
||||||
|
<div class="tabs">
|
||||||
|
<ul>
|
||||||
|
<li><a href="index.html"><span>Main Page</span></a></li>
|
||||||
|
<li class="current"><a href="files.html"><span>Files</span></a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="tabs">
|
||||||
|
<ul>
|
||||||
|
<li><a href="files.html"><span>File List</span></a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<h1>E:/Sources Misc/ChartDemo/ChartDemo.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">// ChartDemo.h : main header file for the CHARTDEMO application</span>
|
||||||
|
<a name="l00002"></a>00002 <span class="comment">//</span>
|
||||||
|
<a name="l00003"></a>00003
|
||||||
|
<a name="l00004"></a>00004 <span class="preprocessor">#if !defined(AFX_CHARTDEMO_H__B7735086_C0AE_4EB2_91AF_2AA128DA4EBD__INCLUDED_)</span>
|
||||||
|
<a name="l00005"></a>00005 <span class="preprocessor"></span><span class="preprocessor">#define AFX_CHARTDEMO_H__B7735086_C0AE_4EB2_91AF_2AA128DA4EBD__INCLUDED_</span>
|
||||||
|
<a name="l00006"></a>00006 <span class="preprocessor"></span>
|
||||||
|
<a name="l00007"></a>00007 <span class="preprocessor">#if _MSC_VER > 1000</span>
|
||||||
|
<a name="l00008"></a>00008 <span class="preprocessor"></span><span class="preprocessor">#pragma once</span>
|
||||||
|
<a name="l00009"></a>00009 <span class="preprocessor"></span><span class="preprocessor">#endif // _MSC_VER > 1000</span>
|
||||||
|
<a name="l00010"></a>00010 <span class="preprocessor"></span>
|
||||||
|
<a name="l00011"></a>00011 <span class="preprocessor">#ifndef __AFXWIN_H__</span>
|
||||||
|
<a name="l00012"></a>00012 <span class="preprocessor"></span><span class="preprocessor"> #error include 'stdafx.h' before including this file for PCH</span>
|
||||||
|
<a name="l00013"></a>00013 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
|
||||||
|
<a name="l00014"></a>00014 <span class="preprocessor"></span>
|
||||||
|
<a name="l00015"></a>00015 <span class="preprocessor">#include "resource.h"</span> <span class="comment">// main symbols</span>
|
||||||
|
<a name="l00016"></a>00016
|
||||||
|
<a name="l00018"></a>00018 <span class="comment">// CChartDemoApp:</span>
|
||||||
|
<a name="l00019"></a>00019 <span class="comment">// See ChartDemo.cpp for the implementation of this class</span>
|
||||||
|
<a name="l00020"></a>00020 <span class="comment">//</span>
|
||||||
|
<a name="l00021"></a>00021
|
||||||
|
<a name="l00022"></a>00022 <span class="keyword">class </span>CChartDemoApp : <span class="keyword">public</span> CWinApp
|
||||||
|
<a name="l00023"></a>00023 {
|
||||||
|
<a name="l00024"></a>00024 <span class="keyword">public</span>:
|
||||||
|
<a name="l00025"></a>00025 CChartDemoApp();
|
||||||
|
<a name="l00026"></a>00026
|
||||||
|
<a name="l00027"></a>00027 <span class="comment">// Overrides</span>
|
||||||
|
<a name="l00028"></a>00028 <span class="comment">// ClassWizard generated virtual function overrides</span>
|
||||||
|
<a name="l00029"></a>00029 <span class="comment">//{{AFX_VIRTUAL(CChartDemoApp)</span>
|
||||||
|
<a name="l00030"></a>00030 <span class="keyword">public</span>:
|
||||||
|
<a name="l00031"></a>00031 <span class="keyword">virtual</span> BOOL InitInstance();
|
||||||
|
<a name="l00032"></a>00032 <span class="comment">//}}AFX_VIRTUAL</span>
|
||||||
|
<a name="l00033"></a>00033
|
||||||
|
<a name="l00034"></a>00034 <span class="comment">// Implementation</span>
|
||||||
|
<a name="l00035"></a>00035
|
||||||
|
<a name="l00036"></a>00036 <span class="comment">//{{AFX_MSG(CChartDemoApp)</span>
|
||||||
|
<a name="l00037"></a>00037 <span class="comment">// NOTE - the ClassWizard will add and remove member functions here.</span>
|
||||||
|
<a name="l00038"></a>00038 <span class="comment">// DO NOT EDIT what you see in these blocks of generated code !</span>
|
||||||
|
<a name="l00039"></a>00039 <span class="comment">//}}AFX_MSG</span>
|
||||||
|
<a name="l00040"></a>00040 DECLARE_MESSAGE_MAP()
|
||||||
|
<a name="l00041"></a>00041 };
|
||||||
|
<a name="l00042"></a>00042
|
||||||
|
<a name="l00043"></a>00043
|
||||||
|
<a name="l00045"></a>00045
|
||||||
|
<a name="l00046"></a>00046 <span class="comment">//{{AFX_INSERT_LOCATION}}</span>
|
||||||
|
<a name="l00047"></a>00047 <span class="comment">// Microsoft Visual C++ will insert additional declarations immediately before the previous line.</span>
|
||||||
|
<a name="l00048"></a>00048
|
||||||
|
<a name="l00049"></a>00049 <span class="preprocessor">#endif // !defined(AFX_CHARTDEMO_H__B7735086_C0AE_4EB2_91AF_2AA128DA4EBD__INCLUDED_)</span>
|
||||||
|
</pre></div></div>
|
||||||
|
<hr size="1"><address style="text-align: right;"><small>Generated on Sat Mar 7 11:33:23 2009 for ChartDemo by
|
||||||
|
<a href="http://www.doxygen.org/index.html">
|
||||||
|
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.8 </small></address>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -0,0 +1,108 @@
|
||||||
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||||
|
<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
|
||||||
|
<title>ChartDemo: E:/Sources Misc/ChartDemo/ChartDemoDlg.h Source File</title>
|
||||||
|
<link href="tabs.css" rel="stylesheet" type="text/css">
|
||||||
|
<link href="doxygen.css" rel="stylesheet" type="text/css">
|
||||||
|
</head><body>
|
||||||
|
<!-- Generated by Doxygen 1.5.8 -->
|
||||||
|
<div class="navigation" id="top">
|
||||||
|
<div class="tabs">
|
||||||
|
<ul>
|
||||||
|
<li><a href="index.html"><span>Main Page</span></a></li>
|
||||||
|
<li class="current"><a href="files.html"><span>Files</span></a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="tabs">
|
||||||
|
<ul>
|
||||||
|
<li><a href="files.html"><span>File List</span></a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<h1>E:/Sources Misc/ChartDemo/ChartDemoDlg.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">// ChartDemoDlg.h : header file</span>
|
||||||
|
<a name="l00002"></a>00002 <span class="comment">//</span>
|
||||||
|
<a name="l00003"></a>00003
|
||||||
|
<a name="l00004"></a>00004 <span class="preprocessor">#if !defined(AFX_CHARTDEMODLG_H__1C3B17D7_0821_47FC_B873_9D9337728F79__INCLUDED_)</span>
|
||||||
|
<a name="l00005"></a>00005 <span class="preprocessor"></span><span class="preprocessor">#define AFX_CHARTDEMODLG_H__1C3B17D7_0821_47FC_B873_9D9337728F79__INCLUDED_</span>
|
||||||
|
<a name="l00006"></a>00006 <span class="preprocessor"></span>
|
||||||
|
<a name="l00007"></a>00007 <span class="preprocessor">#if _MSC_VER > 1000</span>
|
||||||
|
<a name="l00008"></a>00008 <span class="preprocessor"></span><span class="preprocessor">#pragma once</span>
|
||||||
|
<a name="l00009"></a>00009 <span class="preprocessor"></span><span class="preprocessor">#endif // _MSC_VER > 1000</span>
|
||||||
|
<a name="l00010"></a>00010 <span class="preprocessor"></span>
|
||||||
|
<a name="l00011"></a>00011 <span class="preprocessor">#include "ChartCtrl.h"</span>
|
||||||
|
<a name="l00012"></a>00012 <span class="preprocessor">#include "ColourPicker.h"</span>
|
||||||
|
<a name="l00013"></a>00013 <span class="preprocessor">#include "ChartLineSerie.h"</span>
|
||||||
|
<a name="l00014"></a>00014 <span class="preprocessor">#include "ChartLabel.h"</span>
|
||||||
|
<a name="l00015"></a>00015
|
||||||
|
<a name="l00017"></a>00017 <span class="comment">// CChartDemoDlg dialog</span>
|
||||||
|
<a name="l00018"></a>00018
|
||||||
|
<a name="l00019"></a>00019 <span class="keyword">class </span>CChartDemoDlg : <span class="keyword">public</span> CDialog
|
||||||
|
<a name="l00020"></a>00020 {
|
||||||
|
<a name="l00021"></a>00021 <span class="comment">// Construction</span>
|
||||||
|
<a name="l00022"></a>00022 <span class="keyword">public</span>:
|
||||||
|
<a name="l00023"></a>00023 CChartDemoDlg(CWnd* pParent = NULL); <span class="comment">// standard constructor</span>
|
||||||
|
<a name="l00024"></a>00024
|
||||||
|
<a name="l00025"></a>00025 <span class="comment">// Dialog Data</span>
|
||||||
|
<a name="l00026"></a>00026 <span class="comment">//{{AFX_DATA(CChartDemoDlg)</span>
|
||||||
|
<a name="l00027"></a>00027 <span class="keyword">enum</span> { IDD = IDD_CHARTDEMO_DIALOG };
|
||||||
|
<a name="l00028"></a>00028 CEdit m_TitlesEdit;
|
||||||
|
<a name="l00029"></a>00029 CListBox m_SeriesList;
|
||||||
|
<a name="l00030"></a>00030 CEdit m_AxisMinValEdit;
|
||||||
|
<a name="l00031"></a>00031 CEdit m_AxisMaxValEdit;
|
||||||
|
<a name="l00032"></a>00032 CButton m_LegendVisBtn;
|
||||||
|
<a name="l00033"></a>00033 CColourPicker m_BackgndColSel;
|
||||||
|
<a name="l00034"></a>00034 <span class="comment">//}}AFX_DATA</span>
|
||||||
|
<a name="l00035"></a>00035
|
||||||
|
<a name="l00036"></a>00036 <span class="comment">// ClassWizard generated virtual function overrides</span>
|
||||||
|
<a name="l00037"></a>00037 <span class="comment">//{{AFX_VIRTUAL(CChartDemoDlg)</span>
|
||||||
|
<a name="l00038"></a>00038 <span class="keyword">protected</span>:
|
||||||
|
<a name="l00039"></a>00039 <span class="keyword">virtual</span> <span class="keywordtype">void</span> DoDataExchange(CDataExchange* pDX); <span class="comment">// DDX/DDV support</span>
|
||||||
|
<a name="l00040"></a>00040 <span class="comment">//}}AFX_VIRTUAL</span>
|
||||||
|
<a name="l00041"></a>00041
|
||||||
|
<a name="l00042"></a>00042 <span class="comment">// Implementation</span>
|
||||||
|
<a name="l00043"></a>00043 <span class="keyword">protected</span>:
|
||||||
|
<a name="l00044"></a>00044 HICON m_hIcon;
|
||||||
|
<a name="l00045"></a>00045
|
||||||
|
<a name="l00046"></a>00046 <span class="comment">// Generated message map functions</span>
|
||||||
|
<a name="l00047"></a>00047 <span class="comment">//{{AFX_MSG(CChartDemoDlg)</span>
|
||||||
|
<a name="l00048"></a>00048 <span class="keyword">virtual</span> BOOL OnInitDialog();
|
||||||
|
<a name="l00049"></a>00049 afx_msg <span class="keywordtype">void</span> OnSysCommand(UINT nID, LPARAM lParam);
|
||||||
|
<a name="l00050"></a>00050 afx_msg <span class="keywordtype">void</span> OnPaint();
|
||||||
|
<a name="l00051"></a>00051 afx_msg HCURSOR OnQueryDragIcon();
|
||||||
|
<a name="l00052"></a>00052 afx_msg <span class="keywordtype">void</span> OnAddseries();
|
||||||
|
<a name="l00053"></a>00053 afx_msg <span class="keywordtype">void</span> OnLegendVisible();
|
||||||
|
<a name="l00054"></a>00054 afx_msg <span class="keywordtype">void</span> OnBottomAxisRadio();
|
||||||
|
<a name="l00055"></a>00055 afx_msg <span class="keywordtype">void</span> OnLeftAxisRadio();
|
||||||
|
<a name="l00056"></a>00056 afx_msg <span class="keywordtype">void</span> OnRightAxisRadio();
|
||||||
|
<a name="l00057"></a>00057 afx_msg <span class="keywordtype">void</span> OnTopAxisRadio();
|
||||||
|
<a name="l00058"></a>00058 afx_msg <span class="keywordtype">void</span> OnAxisAutomaticCheck();
|
||||||
|
<a name="l00059"></a>00059 afx_msg <span class="keywordtype">void</span> OnAxisGridVisCheck();
|
||||||
|
<a name="l00060"></a>00060 afx_msg <span class="keywordtype">void</span> OnAxisLogarithmicCheck();
|
||||||
|
<a name="l00061"></a>00061 afx_msg <span class="keywordtype">void</span> OnAxisVisibleCheck();
|
||||||
|
<a name="l00062"></a>00062 afx_msg <span class="keywordtype">void</span> OnAxisScrollBarCheck();
|
||||||
|
<a name="l00063"></a>00063 afx_msg LONG OnChangeBckCol(UINT lParam, LONG wParam);
|
||||||
|
<a name="l00064"></a>00064 afx_msg <span class="keywordtype">void</span> OnChangeAxisMax();
|
||||||
|
<a name="l00065"></a>00065 afx_msg <span class="keywordtype">void</span> OnChangeAxisMin();
|
||||||
|
<a name="l00066"></a>00066 afx_msg <span class="keywordtype">void</span> OnAxisInvertedCheck();
|
||||||
|
<a name="l00067"></a>00067 afx_msg <span class="keywordtype">void</span> OnChangeAxisLabel();
|
||||||
|
<a name="l00068"></a>00068 afx_msg <span class="keywordtype">void</span> OnDeleteSeries();
|
||||||
|
<a name="l00069"></a>00069 afx_msg <span class="keywordtype">void</span> OnChangeTitle();
|
||||||
|
<a name="l00070"></a>00070 afx_msg <span class="keywordtype">void</span> OnPanCheck();
|
||||||
|
<a name="l00071"></a>00071 afx_msg <span class="keywordtype">void</span> OnZoomCheck();
|
||||||
|
<a name="l00072"></a>00072 <span class="comment">//}}AFX_MSG</span>
|
||||||
|
<a name="l00073"></a>00073 DECLARE_MESSAGE_MAP()
|
||||||
|
<a name="l00074"></a>00074
|
||||||
|
<a name="l00075"></a>00075 CChartAxis* GetSelectedAxis();
|
||||||
|
<a name="l00076"></a>00076
|
||||||
|
<a name="l00077"></a>00077 CChartCtrl m_ChartCtrl;
|
||||||
|
<a name="l00078"></a>00078 CChartLineSerie* m_pSerie;
|
||||||
|
<a name="l00079"></a>00079 };
|
||||||
|
<a name="l00080"></a>00080
|
||||||
|
<a name="l00081"></a>00081 <span class="comment">//{{AFX_INSERT_LOCATION}}</span>
|
||||||
|
<a name="l00082"></a>00082 <span class="comment">// Microsoft Visual C++ will insert additional declarations immediately before the previous line.</span>
|
||||||
|
<a name="l00083"></a>00083
|
||||||
|
<a name="l00084"></a>00084 <span class="preprocessor">#endif // !defined(AFX_CHARTDEMODLG_H__1C3B17D7_0821_47FC_B873_9D9337728F79__INCLUDED_)</span>
|
||||||
|
</pre></div></div>
|
||||||
|
<hr size="1"><address style="text-align: right;"><small>Generated on Sat Mar 7 11:33:23 2009 for ChartDemo by
|
||||||
|
<a href="http://www.doxygen.org/index.html">
|
||||||
|
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.8 </small></address>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -0,0 +1,81 @@
|
||||||
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||||
|
<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
|
||||||
|
<title>ChartDemo: E:/Sources Misc/ChartDemo/ChartCtrl/ChartDragLineCursor.h Source File</title>
|
||||||
|
<link href="tabs.css" rel="stylesheet" type="text/css">
|
||||||
|
<link href="doxygen.css" rel="stylesheet" type="text/css">
|
||||||
|
</head><body>
|
||||||
|
<!-- Generated by Doxygen 1.5.8 -->
|
||||||
|
<div class="navigation" id="top">
|
||||||
|
<div class="tabs">
|
||||||
|
<ul>
|
||||||
|
<li><a href="index.html"><span>Main Page</span></a></li>
|
||||||
|
<li><a href="pages.html"><span>Related Pages</span></a></li>
|
||||||
|
<li><a href="annotated.html"><span>Classes</span></a></li>
|
||||||
|
<li class="current"><a href="files.html"><span>Files</span></a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="tabs">
|
||||||
|
<ul>
|
||||||
|
<li><a href="files.html"><span>File List</span></a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<h1>E:/Sources Misc/ChartDemo/ChartCtrl/ChartDragLineCursor.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span>
|
||||||
|
<a name="l00002"></a>00002 <span class="comment"> *</span>
|
||||||
|
<a name="l00003"></a>00003 <span class="comment"> * ChartDragLineCursor.h</span>
|
||||||
|
<a name="l00004"></a>00004 <span class="comment"> *</span>
|
||||||
|
<a name="l00005"></a>00005 <span class="comment"> * Written by Cédric Moonen (cedric_moonen@hotmail.com)</span>
|
||||||
|
<a name="l00006"></a>00006 <span class="comment"> *</span>
|
||||||
|
<a name="l00007"></a>00007 <span class="comment"> *</span>
|
||||||
|
<a name="l00008"></a>00008 <span class="comment"> *</span>
|
||||||
|
<a name="l00009"></a>00009 <span class="comment"> * This code may be used for any non-commercial and commercial purposes in a compiled form.</span>
|
||||||
|
<a name="l00010"></a>00010 <span class="comment"> * The code may be redistributed as long as it remains unmodified and providing that the </span>
|
||||||
|
<a name="l00011"></a>00011 <span class="comment"> * author name and this disclaimer remain intact. The sources can be modified WITH the author </span>
|
||||||
|
<a name="l00012"></a>00012 <span class="comment"> * consent only.</span>
|
||||||
|
<a name="l00013"></a>00013 <span class="comment"> * </span>
|
||||||
|
<a name="l00014"></a>00014 <span class="comment"> * This code is provided without any garanties. I cannot be held responsible for the damage or</span>
|
||||||
|
<a name="l00015"></a>00015 <span class="comment"> * the loss of time it causes. Use it at your own risks</span>
|
||||||
|
<a name="l00016"></a>00016 <span class="comment"> *</span>
|
||||||
|
<a name="l00017"></a>00017 <span class="comment"> * An e-mail to notify me that you are using this code is appreciated also.</span>
|
||||||
|
<a name="l00018"></a>00018 <span class="comment"> *</span>
|
||||||
|
<a name="l00019"></a>00019 <span class="comment"> *</span>
|
||||||
|
<a name="l00020"></a>00020 <span class="comment"> */</span>
|
||||||
|
<a name="l00021"></a>00021
|
||||||
|
<a name="l00022"></a>00022 <span class="preprocessor">#ifndef _CHARTDRAGLINECURSOR_H_</span>
|
||||||
|
<a name="l00023"></a>00023 <span class="preprocessor"></span><span class="preprocessor">#define _CHARTDRAGLINECURSOR_H_</span>
|
||||||
|
<a name="l00024"></a>00024 <span class="preprocessor"></span>
|
||||||
|
<a name="l00025"></a>00025 <span class="preprocessor">#include "ChartCursor.h"</span>
|
||||||
|
<a name="l00026"></a>00026
|
||||||
|
<a name="l00027"></a>00027 <span class="keyword">class </span><a class="code" href="class_c_chart_axis.html" title="Base class that takes care of the management of a chart axis.">CChartAxis</a>;
|
||||||
|
<a name="l00028"></a>00028
|
||||||
|
<a name="l00030"></a>00030
|
||||||
|
<a name="l00038"></a><a class="code" href="class_c_chart_drag_line_cursor.html">00038</a> <span class="keyword">class </span><a class="code" href="class_c_chart_drag_line_cursor.html" title="Specialization of a CChartCursor class for a dragline cursor.">CChartDragLineCursor</a> : <span class="keyword">public</span> <a class="code" href="class_c_chart_cursor.html" title="Base class for cursors which can be added to the chart control.">CChartCursor</a>
|
||||||
|
<a name="l00039"></a>00039 {
|
||||||
|
<a name="l00040"></a>00040 <span class="keyword">friend</span> <a class="code" href="class_c_chart_ctrl.html" title="The main chart control class.">CChartCtrl</a>;
|
||||||
|
<a name="l00041"></a>00041
|
||||||
|
<a name="l00042"></a>00042 <span class="keyword">public</span>:
|
||||||
|
<a name="l00044"></a>00044 <span class="keywordtype">void</span> <a class="code" href="class_c_chart_drag_line_cursor.html#391dcf99ce816da36b444a9890615f8c" title="Sets the position (by value) of the cursor.">SetPosition</a>(<span class="keywordtype">double</span> dPosition);
|
||||||
|
<a name="l00045"></a>00045
|
||||||
|
<a name="l00046"></a>00046 <span class="keyword">protected</span>:
|
||||||
|
<a name="l00048"></a>00048 <span class="keywordtype">void</span> <a class="code" href="class_c_chart_drag_line_cursor.html#c844f049640ccc6d73d4cb21b6ae8c63" title="Called when the mouse is moved over the plot area.">OnMouseMove</a>(CPoint mousePoint);
|
||||||
|
<a name="l00050"></a>00050 <span class="keywordtype">void</span> <a class="code" href="class_c_chart_drag_line_cursor.html#1b397fe1c95e3b5f2b901f9728d3a58d" title="Called when the mouse button is pressed over the plot area.">OnMouseButtonDown</a>(CPoint mousePoint);
|
||||||
|
<a name="l00052"></a>00052 <span class="keywordtype">void</span> <a class="code" href="class_c_chart_drag_line_cursor.html#e4b7d1c533b38e06186305d4a28d1a9c" title="Called when the mouse button is released over the plot area.">OnMouseButtonUp</a>(CPoint mousePoint);
|
||||||
|
<a name="l00053"></a>00053
|
||||||
|
<a name="l00055"></a>00055 <span class="keywordtype">void</span> <a class="code" href="class_c_chart_drag_line_cursor.html#78d054565c8095f2c541f8f6d0e9bcaf" title="Draw the cursor.">Draw</a>(CDC* pDC);
|
||||||
|
<a name="l00056"></a>00056
|
||||||
|
<a name="l00057"></a>00057 <span class="keyword">private</span>:
|
||||||
|
<a name="l00059"></a>00059 <a class="code" href="class_c_chart_drag_line_cursor.html" title="Specialization of a CChartCursor class for a dragline cursor.">CChartDragLineCursor</a>(<a class="code" href="class_c_chart_ctrl.html" title="The main chart control class.">CChartCtrl</a>* pParent, <a class="code" href="class_c_chart_axis.html" title="Base class that takes care of the management of a chart axis.">CChartAxis</a>* pRelatedAxis);
|
||||||
|
<a name="l00061"></a>00061 ~<a class="code" href="class_c_chart_drag_line_cursor.html" title="Specialization of a CChartCursor class for a dragline cursor.">CChartDragLineCursor</a>();
|
||||||
|
<a name="l00062"></a>00062
|
||||||
|
<a name="l00064"></a>00064 <a class="code" href="class_c_chart_axis.html" title="Base class that takes care of the management of a chart axis.">CChartAxis</a>* m_pRelatedAxis;
|
||||||
|
<a name="l00065"></a>00065
|
||||||
|
<a name="l00067"></a>00067 <span class="keywordtype">bool</span> m_bDragged;
|
||||||
|
<a name="l00069"></a>00069 <span class="keywordtype">long</span> m_lPosition;
|
||||||
|
<a name="l00070"></a>00070 };
|
||||||
|
<a name="l00071"></a>00071
|
||||||
|
<a name="l00072"></a>00072 <span class="preprocessor">#endif // _CHARTDRAGLINECURSOR_H_</span>
|
||||||
|
</pre></div></div>
|
||||||
|
<hr size="1"><address style="text-align: right;"><small>Generated on Sun Jan 17 13:33:09 2010 for ChartDemo by
|
||||||
|
<a href="http://www.doxygen.org/index.html">
|
||||||
|
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.8 </small></address>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -0,0 +1,94 @@
|
||||||
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||||
|
<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
|
||||||
|
<title>ChartDemo: E:/Sources Misc/ChartDemo/ChartCtrl/ChartFont.h Source File</title>
|
||||||
|
<link href="tabs.css" rel="stylesheet" type="text/css">
|
||||||
|
<link href="doxygen.css" rel="stylesheet" type="text/css">
|
||||||
|
</head><body>
|
||||||
|
<!-- Generated by Doxygen 1.5.8 -->
|
||||||
|
<div class="navigation" id="top">
|
||||||
|
<div class="tabs">
|
||||||
|
<ul>
|
||||||
|
<li><a href="index.html"><span>Main Page</span></a></li>
|
||||||
|
<li><a href="pages.html"><span>Related Pages</span></a></li>
|
||||||
|
<li><a href="annotated.html"><span>Classes</span></a></li>
|
||||||
|
<li class="current"><a href="files.html"><span>Files</span></a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="tabs">
|
||||||
|
<ul>
|
||||||
|
<li><a href="files.html"><span>File List</span></a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<h1>E:/Sources Misc/ChartDemo/ChartCtrl/ChartFont.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span>
|
||||||
|
<a name="l00002"></a>00002 <span class="comment"> *</span>
|
||||||
|
<a name="l00003"></a>00003 <span class="comment"> * ChartFont.h</span>
|
||||||
|
<a name="l00004"></a>00004 <span class="comment"> *</span>
|
||||||
|
<a name="l00005"></a>00005 <span class="comment"> * Written by Cédric Moonen (cedric_moonen@hotmail.com)</span>
|
||||||
|
<a name="l00006"></a>00006 <span class="comment"> *</span>
|
||||||
|
<a name="l00007"></a>00007 <span class="comment"> *</span>
|
||||||
|
<a name="l00008"></a>00008 <span class="comment"> *</span>
|
||||||
|
<a name="l00009"></a>00009 <span class="comment"> * This code may be used for any non-commercial and commercial purposes in a compiled form.</span>
|
||||||
|
<a name="l00010"></a>00010 <span class="comment"> * The code may be redistributed as long as it remains unmodified and providing that the </span>
|
||||||
|
<a name="l00011"></a>00011 <span class="comment"> * author name and this disclaimer remain intact. The sources can be modified WITH the author </span>
|
||||||
|
<a name="l00012"></a>00012 <span class="comment"> * consent only.</span>
|
||||||
|
<a name="l00013"></a>00013 <span class="comment"> * </span>
|
||||||
|
<a name="l00014"></a>00014 <span class="comment"> * This code is provided without any garanties. I cannot be held responsible for the damage or</span>
|
||||||
|
<a name="l00015"></a>00015 <span class="comment"> * the loss of time it causes. Use it at your own risks</span>
|
||||||
|
<a name="l00016"></a>00016 <span class="comment"> *</span>
|
||||||
|
<a name="l00017"></a>00017 <span class="comment"> * An e-mail to notify me that you are using this code is appreciated also.</span>
|
||||||
|
<a name="l00018"></a>00018 <span class="comment"> *</span>
|
||||||
|
<a name="l00019"></a>00019 <span class="comment"> *</span>
|
||||||
|
<a name="l00020"></a>00020 <span class="comment"> */</span>
|
||||||
|
<a name="l00021"></a>00021
|
||||||
|
<a name="l00022"></a>00022 <span class="preprocessor">#ifndef _CHARTFONT_H_</span>
|
||||||
|
<a name="l00023"></a>00023 <span class="preprocessor"></span><span class="preprocessor">#define _CHARTFONT_H_</span>
|
||||||
|
<a name="l00024"></a>00024 <span class="preprocessor"></span>
|
||||||
|
<a name="l00025"></a>00025 <span class="preprocessor">#include "ChartString.h"</span>
|
||||||
|
<a name="l00026"></a>00026 <span class="preprocessor">#include <afx.h></span>
|
||||||
|
<a name="l00027"></a>00027
|
||||||
|
<a name="l00029"></a><a class="code" href="class_c_chart_font.html">00029</a> <span class="keyword">class </span><a class="code" href="class_c_chart_font.html" title="Wrapper class for fonts with advanced properties (italic, bold or underlined).">CChartFont</a>
|
||||||
|
<a name="l00030"></a>00030 {
|
||||||
|
<a name="l00031"></a>00031 <span class="keyword">public</span>:
|
||||||
|
<a name="l00033"></a>00033 <a class="code" href="class_c_chart_font.html#90c3a9a6bfae7ab0a1f980bc59ef7740" title="Default constructor.">CChartFont</a>(<span class="keyword">const</span> <a class="code" href="class_c_chart_font.html" title="Wrapper class for fonts with advanced properties (italic, bold or underlined).">CChartFont</a>& copy);
|
||||||
|
<a name="l00035"></a>00035
|
||||||
|
<a name="l00041"></a>00041 <a class="code" href="class_c_chart_font.html#90c3a9a6bfae7ab0a1f980bc59ef7740" title="Default constructor.">CChartFont</a>(<span class="keyword">const</span> TChartString& strFaceName, <span class="keywordtype">int</span> iPointSize);
|
||||||
|
<a name="l00043"></a>00043
|
||||||
|
<a name="l00047"></a>00047 <a class="code" href="class_c_chart_font.html#90c3a9a6bfae7ab0a1f980bc59ef7740" title="Default constructor.">CChartFont</a>();
|
||||||
|
<a name="l00049"></a>00049 <a class="code" href="class_c_chart_font.html#48deff80a8cb751107571e070661727e" title="Destructor.">~CChartFont</a>();
|
||||||
|
<a name="l00050"></a>00050
|
||||||
|
<a name="l00052"></a>00052
|
||||||
|
<a name="l00064"></a>00064 <span class="keywordtype">void</span> <a class="code" href="class_c_chart_font.html#efa7ca312692b28d4a0b83ebb58bfbb1" title="Sets the font with extended properties.">SetFont</a>(<span class="keyword">const</span> TChartString& strFaceName, <span class="keywordtype">int</span> iPointSize,
|
||||||
|
<a name="l00065"></a>00065 <span class="keywordtype">bool</span> bItalic=<span class="keyword">false</span>, <span class="keywordtype">bool</span> bBold=<span class="keyword">false</span>, <span class="keywordtype">bool</span> bUnderline=<span class="keyword">false</span>);
|
||||||
|
<a name="l00066"></a>00066
|
||||||
|
<a name="l00068"></a>00068
|
||||||
|
<a name="l00073"></a>00073 <span class="keywordtype">void</span> <a class="code" href="class_c_chart_font.html#53d1277bada4a96e7c435cd976340da0" title="Select this font in the device context passed in argument.">SelectFont</a>(CDC* pDC) <span class="keyword">const</span>;
|
||||||
|
<a name="l00075"></a>00075 <span class="keywordtype">void</span> <a class="code" href="class_c_chart_font.html#ceb7f6c71c10c0aca1b6298a5ed358ad" title="Reset the font to its original in the device context.">UnselectFont</a>(CDC* pDC) <span class="keyword">const</span>;
|
||||||
|
<a name="l00076"></a>00076
|
||||||
|
<a name="l00078"></a>00078
|
||||||
|
<a name="l00081"></a>00081 <span class="keywordtype">void</span> <a class="code" href="class_c_chart_font.html#254be0d9eac8d9b98245e787f57b215c" title="Sets the text in vertical mode.">SetVertical</a>(<span class="keywordtype">bool</span> bVertical);
|
||||||
|
<a name="l00082"></a>00082
|
||||||
|
<a name="l00084"></a>00084 <span class="keywordtype">void</span> <a class="code" href="class_c_chart_font.html#e82aee1219413e43d6a05e4c0862b044" title="Assignement operator.">operator=</a>(<span class="keyword">const</span> <a class="code" href="class_c_chart_font.html" title="Wrapper class for fonts with advanced properties (italic, bold or underlined).">CChartFont</a>& objectSrc);
|
||||||
|
<a name="l00085"></a>00085
|
||||||
|
<a name="l00086"></a>00086 <span class="keyword">private</span>:
|
||||||
|
<a name="l00088"></a>00088 TChartString m_strFaceName;
|
||||||
|
<a name="l00090"></a>00090 <span class="keywordtype">int</span> m_iPointSize;
|
||||||
|
<a name="l00091"></a>00091
|
||||||
|
<a name="l00093"></a>00093 <span class="keywordtype">bool</span> m_bItalic;
|
||||||
|
<a name="l00095"></a>00095 <span class="keywordtype">bool</span> m_bBold;
|
||||||
|
<a name="l00097"></a>00097 <span class="keywordtype">bool</span> m_bUnderline;
|
||||||
|
<a name="l00098"></a>00098
|
||||||
|
<a name="l00100"></a>00100 <span class="keywordtype">bool</span> m_bVertical;
|
||||||
|
<a name="l00101"></a>00101
|
||||||
|
<a name="l00103"></a>00103 <span class="keyword">mutable</span> CFont m_Font;
|
||||||
|
<a name="l00105"></a>00105 <span class="keyword">mutable</span> <span class="keywordtype">bool</span> m_bDirty;
|
||||||
|
<a name="l00106"></a>00106
|
||||||
|
<a name="l00108"></a>00108 <span class="keyword">mutable</span> CFont* m_pOldFont;
|
||||||
|
<a name="l00109"></a>00109 };
|
||||||
|
<a name="l00110"></a>00110
|
||||||
|
<a name="l00111"></a>00111 <span class="preprocessor">#endif // _CHARTFONT_H_</span>
|
||||||
|
</pre></div></div>
|
||||||
|
<hr size="1"><address style="text-align: right;"><small>Generated on Sun Jan 17 13:33:09 2010 for ChartDemo by
|
||||||
|
<a href="http://www.doxygen.org/index.html">
|
||||||
|
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.8 </small></address>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -0,0 +1,116 @@
|
||||||
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||||
|
<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
|
||||||
|
<title>ChartDemo: E:/Sources Misc/ChartDemo/ChartCtrl/ChartGanttSerie.h Source File</title>
|
||||||
|
<link href="tabs.css" rel="stylesheet" type="text/css">
|
||||||
|
<link href="doxygen.css" rel="stylesheet" type="text/css">
|
||||||
|
</head><body>
|
||||||
|
<!-- Generated by Doxygen 1.5.8 -->
|
||||||
|
<div class="navigation" id="top">
|
||||||
|
<div class="tabs">
|
||||||
|
<ul>
|
||||||
|
<li><a href="index.html"><span>Main Page</span></a></li>
|
||||||
|
<li><a href="pages.html"><span>Related Pages</span></a></li>
|
||||||
|
<li><a href="annotated.html"><span>Classes</span></a></li>
|
||||||
|
<li class="current"><a href="files.html"><span>Files</span></a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="tabs">
|
||||||
|
<ul>
|
||||||
|
<li><a href="files.html"><span>File List</span></a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<h1>E:/Sources Misc/ChartDemo/ChartCtrl/ChartGanttSerie.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span>
|
||||||
|
<a name="l00002"></a>00002 <span class="comment"> *</span>
|
||||||
|
<a name="l00003"></a>00003 <span class="comment"> * ChartGanttSerie.h</span>
|
||||||
|
<a name="l00004"></a>00004 <span class="comment"> *</span>
|
||||||
|
<a name="l00005"></a>00005 <span class="comment"> * Written by Cédric Moonen (cedric_moonen@hotmail.com)</span>
|
||||||
|
<a name="l00006"></a>00006 <span class="comment"> *</span>
|
||||||
|
<a name="l00007"></a>00007 <span class="comment"> *</span>
|
||||||
|
<a name="l00008"></a>00008 <span class="comment"> *</span>
|
||||||
|
<a name="l00009"></a>00009 <span class="comment"> * This code may be used for any non-commercial and commercial purposes in a compiled form.</span>
|
||||||
|
<a name="l00010"></a>00010 <span class="comment"> * The code may be redistributed as long as it remains unmodified and providing that the </span>
|
||||||
|
<a name="l00011"></a>00011 <span class="comment"> * author name and this disclaimer remain intact. The sources can be modified WITH the author </span>
|
||||||
|
<a name="l00012"></a>00012 <span class="comment"> * consent only.</span>
|
||||||
|
<a name="l00013"></a>00013 <span class="comment"> * </span>
|
||||||
|
<a name="l00014"></a>00014 <span class="comment"> * This code is provided without any garanties. I cannot be held responsible for the damage or</span>
|
||||||
|
<a name="l00015"></a>00015 <span class="comment"> * the loss of time it causes. Use it at your own risks</span>
|
||||||
|
<a name="l00016"></a>00016 <span class="comment"> *</span>
|
||||||
|
<a name="l00017"></a>00017 <span class="comment"> * An e-mail to notify me that you are using this code is appreciated also.</span>
|
||||||
|
<a name="l00018"></a>00018 <span class="comment"> *</span>
|
||||||
|
<a name="l00019"></a>00019 <span class="comment"> *</span>
|
||||||
|
<a name="l00020"></a>00020 <span class="comment"> */</span>
|
||||||
|
<a name="l00021"></a>00021
|
||||||
|
<a name="l00022"></a>00022 <span class="preprocessor">#pragma once</span>
|
||||||
|
<a name="l00023"></a>00023 <span class="preprocessor"></span><span class="preprocessor">#include "ChartSerieBase.h"</span>
|
||||||
|
<a name="l00024"></a>00024
|
||||||
|
<a name="l00026"></a><a class="code" href="struct_s_chart_gantt_point.html">00026</a> <span class="keyword">struct </span><a class="code" href="struct_s_chart_gantt_point.html" title="Point structure used as template parameter for gantt series.">SChartGanttPoint</a>
|
||||||
|
<a name="l00027"></a>00027 {
|
||||||
|
<a name="l00029"></a><a class="code" href="struct_s_chart_gantt_point.html#4679225acdd9977911b77b685783f300">00029</a> <a class="code" href="struct_s_chart_gantt_point.html#4679225acdd9977911b77b685783f300" title="Default constructor.">SChartGanttPoint</a>() : <a class="code" href="struct_s_chart_gantt_point.html#8039e290a13ea1391fc33b90a7aa8542" title="The start time of the gantt point.">StartTime</a>(0.0), <a class="code" href="struct_s_chart_gantt_point.html#9c578dbcbdc93032122dd23caa044fe9" title="The end time of the gantt point.">EndTime</a>(0.0), <a class="code" href="struct_s_chart_gantt_point.html#b1b8a17aaf677b687c08fae0e5a7b2a3" title="The Y value of the gantt point.">YValue</a>(0.0) { }
|
||||||
|
<a name="l00031"></a><a class="code" href="struct_s_chart_gantt_point.html#a98ec78d5aff8740b03a3e4eb838a8a2">00031</a> <a class="code" href="struct_s_chart_gantt_point.html#4679225acdd9977911b77b685783f300" title="Default constructor.">SChartGanttPoint</a>(<span class="keywordtype">double</span> Start, <span class="keywordtype">double</span> End, <span class="keywordtype">double</span> YVal)
|
||||||
|
<a name="l00032"></a>00032 : <a class="code" href="struct_s_chart_gantt_point.html#8039e290a13ea1391fc33b90a7aa8542" title="The start time of the gantt point.">StartTime</a>(Start), <a class="code" href="struct_s_chart_gantt_point.html#9c578dbcbdc93032122dd23caa044fe9" title="The end time of the gantt point.">EndTime</a>(End), <a class="code" href="struct_s_chart_gantt_point.html#b1b8a17aaf677b687c08fae0e5a7b2a3" title="The Y value of the gantt point.">YValue</a>(YVal) { }
|
||||||
|
<a name="l00033"></a>00033
|
||||||
|
<a name="l00035"></a><a class="code" href="struct_s_chart_gantt_point.html#8039e290a13ea1391fc33b90a7aa8542">00035</a> <span class="keywordtype">double</span> <a class="code" href="struct_s_chart_gantt_point.html#8039e290a13ea1391fc33b90a7aa8542" title="The start time of the gantt point.">StartTime</a>;
|
||||||
|
<a name="l00037"></a><a class="code" href="struct_s_chart_gantt_point.html#9c578dbcbdc93032122dd23caa044fe9">00037</a> <span class="keywordtype">double</span> <a class="code" href="struct_s_chart_gantt_point.html#9c578dbcbdc93032122dd23caa044fe9" title="The end time of the gantt point.">EndTime</a>;
|
||||||
|
<a name="l00039"></a><a class="code" href="struct_s_chart_gantt_point.html#b1b8a17aaf677b687c08fae0e5a7b2a3">00039</a> <span class="keywordtype">double</span> <a class="code" href="struct_s_chart_gantt_point.html#b1b8a17aaf677b687c08fae0e5a7b2a3" title="The Y value of the gantt point.">YValue</a>;
|
||||||
|
<a name="l00040"></a>00040
|
||||||
|
<a name="l00042"></a><a class="code" href="struct_s_chart_gantt_point.html#8d18df542330f8248a40c41ff271b756">00042</a> <span class="keywordtype">double</span> <a class="code" href="struct_s_chart_gantt_point.html#8d18df542330f8248a40c41ff271b756" title="Returns the X value of the point, which is the average between start time and end...">GetX</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> (<a class="code" href="struct_s_chart_gantt_point.html#9c578dbcbdc93032122dd23caa044fe9" title="The end time of the gantt point.">EndTime</a>-<a class="code" href="struct_s_chart_gantt_point.html#8039e290a13ea1391fc33b90a7aa8542" title="The start time of the gantt point.">StartTime</a>)/2; }
|
||||||
|
<a name="l00044"></a><a class="code" href="struct_s_chart_gantt_point.html#b21b1b2cfb22e7c1292f873d3177d8eb">00044</a> <span class="keywordtype">double</span> <a class="code" href="struct_s_chart_gantt_point.html#b21b1b2cfb22e7c1292f873d3177d8eb" title="Returns the Y value.">GetY</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="struct_s_chart_gantt_point.html#b1b8a17aaf677b687c08fae0e5a7b2a3" title="The Y value of the gantt point.">YValue</a>; }
|
||||||
|
<a name="l00046"></a><a class="code" href="struct_s_chart_gantt_point.html#bd783b90d088b058263138be75b58faa">00046</a> <span class="keywordtype">double</span> <a class="code" href="struct_s_chart_gantt_point.html#bd783b90d088b058263138be75b58faa" title="Returns the start time.">GetXMin</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="struct_s_chart_gantt_point.html#8039e290a13ea1391fc33b90a7aa8542" title="The start time of the gantt point.">StartTime</a>; }
|
||||||
|
<a name="l00048"></a><a class="code" href="struct_s_chart_gantt_point.html#d963c737eafe287bf55e89ad772e03cb">00048</a> <span class="keywordtype">double</span> <a class="code" href="struct_s_chart_gantt_point.html#d963c737eafe287bf55e89ad772e03cb" title="Returns the end time.">GetXMax</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="struct_s_chart_gantt_point.html#9c578dbcbdc93032122dd23caa044fe9" title="The end time of the gantt point.">EndTime</a>; }
|
||||||
|
<a name="l00050"></a><a class="code" href="struct_s_chart_gantt_point.html#699c1c61d94d768140d478537999fd21">00050</a> <span class="keywordtype">double</span> <a class="code" href="struct_s_chart_gantt_point.html#699c1c61d94d768140d478537999fd21" title="Returns the Y value.">GetYMin</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="struct_s_chart_gantt_point.html#b1b8a17aaf677b687c08fae0e5a7b2a3" title="The Y value of the gantt point.">YValue</a>; }
|
||||||
|
<a name="l00052"></a><a class="code" href="struct_s_chart_gantt_point.html#acb13ec0d7260c1d34eddf9218880c7e">00052</a> <span class="keywordtype">double</span> <a class="code" href="struct_s_chart_gantt_point.html#acb13ec0d7260c1d34eddf9218880c7e" title="Returns the Y value.">GetYMax</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="struct_s_chart_gantt_point.html#b1b8a17aaf677b687c08fae0e5a7b2a3" title="The Y value of the gantt point.">YValue</a>; }
|
||||||
|
<a name="l00053"></a>00053 };
|
||||||
|
<a name="l00054"></a>00054
|
||||||
|
<a name="l00056"></a>00056
|
||||||
|
<a name="l00063"></a><a class="code" href="class_c_chart_gantt_serie.html">00063</a> <span class="keyword">class </span><a class="code" href="class_c_chart_gantt_serie.html" title="Specialization of a CChartSerieBase to display a gantt series.">CChartGanttSerie</a> : <span class="keyword">public</span> <a class="code" href="class_c_chart_serie_base.html" title="Base class for all series of the control.">CChartSerieBase</a><SChartGanttPoint>
|
||||||
|
<a name="l00064"></a>00064 {
|
||||||
|
<a name="l00065"></a>00065 <span class="keyword">public</span>:
|
||||||
|
<a name="l00067"></a>00067 <a class="code" href="class_c_chart_gantt_serie.html#a56c6915075088cd0d721fac9c5f72a6" title="Constructor.">CChartGanttSerie</a>(<a class="code" href="class_c_chart_ctrl.html" title="The main chart control class.">CChartCtrl</a>* pParent);
|
||||||
|
<a name="l00069"></a>00069 <a class="code" href="class_c_chart_gantt_serie.html#f3c6a96334d352dc23c966dcc2fbb67c" title="Destructor.">~CChartGanttSerie</a>();
|
||||||
|
<a name="l00070"></a>00070
|
||||||
|
<a name="l00072"></a>00072
|
||||||
|
<a name="l00080"></a>00080 <span class="keywordtype">void</span> <a class="code" href="class_c_chart_gantt_serie.html#80bce81a3c72fc388ae24d155f676c02" title="Adds a new point to the series.">AddPoint</a>(<span class="keywordtype">double</span> StartTime, <span class="keywordtype">double</span> EndTime, <span class="keywordtype">double</span> YValue);
|
||||||
|
<a name="l00081"></a>00081
|
||||||
|
<a name="l00083"></a>00083
|
||||||
|
<a name="l00090"></a>00090 <span class="keywordtype">bool</span> <a class="code" href="class_c_chart_gantt_serie.html#233df9834c1c65a6e551101a665addfd" title="Tests if a certain screen point is on the series.">IsPointOnSerie</a>(<span class="keyword">const</span> CPoint& screenPoint, <span class="keywordtype">unsigned</span>& uIndex) <span class="keyword">const</span>;
|
||||||
|
<a name="l00091"></a>00091
|
||||||
|
<a name="l00093"></a>00093 <span class="keywordtype">void</span> <a class="code" href="class_c_chart_gantt_serie.html#9c6c1dff4283bc23226904ee1398bde6" title="Sets the bars border color.">SetBorderColor</a>(COLORREF BorderColor);
|
||||||
|
<a name="l00095"></a><a class="code" href="class_c_chart_gantt_serie.html#300dd70e722de80b33d427280b0a5758">00095</a> COLORREF <a class="code" href="class_c_chart_gantt_serie.html#300dd70e722de80b33d427280b0a5758" title="Returns the bars border color.">GetBorderColor</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_BorderColor; }
|
||||||
|
<a name="l00097"></a>00097 <span class="keywordtype">void</span> <a class="code" href="class_c_chart_gantt_serie.html#aaa2e466f8f53da1c84820ff544efcb0" title="Sets the bars border width.">SetBorderWidth</a>(<span class="keywordtype">int</span> Width);
|
||||||
|
<a name="l00099"></a><a class="code" href="class_c_chart_gantt_serie.html#70426eb540303a29cef660873ea66c1b">00099</a> <span class="keywordtype">int</span> <a class="code" href="class_c_chart_gantt_serie.html#70426eb540303a29cef660873ea66c1b" title="Returns the bars border width.">GetBorderWidth</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_iBorderWidth; }
|
||||||
|
<a name="l00101"></a>00101 <span class="keywordtype">void</span> <a class="code" href="class_c_chart_gantt_serie.html#353a591f9b66988d44ab96211d41f75a" title="Sets the bars width (in pixels).">SetBarWidth</a>(<span class="keywordtype">int</span> Width);
|
||||||
|
<a name="l00103"></a><a class="code" href="class_c_chart_gantt_serie.html#1e81a6bc92360c62cde924e6fd5c4b31">00103</a> <span class="keywordtype">int</span> <a class="code" href="class_c_chart_gantt_serie.html#1e81a6bc92360c62cde924e6fd5c4b31" title="Returns the bars width (in pixels).">GetBarWidth</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_iBarWidth; }
|
||||||
|
<a name="l00104"></a>00104
|
||||||
|
<a name="l00106"></a>00106 <span class="keywordtype">void</span> <a class="code" href="class_c_chart_gantt_serie.html#a227b87ef2ae585adb48f6b306274526" title="Specifies if a gradient is applied to the bars.">ShowGradient</a>(<span class="keywordtype">bool</span> bShow);
|
||||||
|
<a name="l00108"></a>00108
|
||||||
|
<a name="l00115"></a>00115 <span class="keywordtype">void</span> <a class="code" href="class_c_chart_gantt_serie.html#1fd1a7ffcdd1fb80d78a9243f8a47ca3" title="Sets the gradient style.">SetGradient</a>(COLORREF GradientColor, EGradientType GradientType);
|
||||||
|
<a name="l00116"></a>00116
|
||||||
|
<a name="l00117"></a>00117 <span class="keyword">protected</span>:
|
||||||
|
<a name="l00119"></a>00119
|
||||||
|
<a name="l00125"></a>00125 <span class="keywordtype">void</span> <a class="code" href="class_c_chart_gantt_serie.html#9dd98507133d52742ac012399b6335a7" title="Draws the legend icon for the series.">DrawLegend</a>(CDC* pDC, <span class="keyword">const</span> CRect& rectBitmap) <span class="keyword">const</span>;
|
||||||
|
<a name="l00126"></a>00126
|
||||||
|
<a name="l00128"></a>00128
|
||||||
|
<a name="l00134"></a>00134 <span class="keywordtype">void</span> <a class="code" href="class_c_chart_gantt_serie.html#f82a8643c50f10c7893c1e83f1d9c43f" title="Draws the most recent points of the series.">Draw</a>(CDC* pDC);
|
||||||
|
<a name="l00136"></a>00136
|
||||||
|
<a name="l00140"></a>00140 <span class="keywordtype">void</span> <a class="code" href="class_c_chart_gantt_serie.html#888aa7dab2231e3af81bed326ead772f" title="Redraws the full series.">DrawAll</a>(CDC *pDC);
|
||||||
|
<a name="l00141"></a>00141
|
||||||
|
<a name="l00142"></a>00142 <span class="keyword">private</span>:
|
||||||
|
<a name="l00144"></a>00144 CRect GetBarRectangle(<span class="keywordtype">unsigned</span> uPointIndex) <span class="keyword">const</span>;
|
||||||
|
<a name="l00145"></a>00145
|
||||||
|
<a name="l00146"></a>00146 <span class="keywordtype">void</span> DrawBar(CDC* pDC, CBrush* pFillBrush, CBrush* pBorderBrush,
|
||||||
|
<a name="l00147"></a>00147 CRect BarRect);
|
||||||
|
<a name="l00148"></a>00148
|
||||||
|
<a name="l00150"></a>00150 <span class="keywordtype">int</span> m_iBarWidth;
|
||||||
|
<a name="l00152"></a>00152 <span class="keywordtype">int</span> m_iBorderWidth;
|
||||||
|
<a name="l00154"></a>00154 COLORREF m_BorderColor;
|
||||||
|
<a name="l00155"></a>00155
|
||||||
|
<a name="l00157"></a>00157 <span class="keywordtype">bool</span> m_bGradient;
|
||||||
|
<a name="l00159"></a>00159 COLORREF m_GradientColor;
|
||||||
|
<a name="l00161"></a>00161 EGradientType m_GradientType;
|
||||||
|
<a name="l00162"></a>00162 };
|
||||||
|
</pre></div></div>
|
||||||
|
<hr size="1"><address style="text-align: right;"><small>Generated on Sun Jan 17 13:33:09 2010 for ChartDemo by
|
||||||
|
<a href="http://www.doxygen.org/index.html">
|
||||||
|
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.8 </small></address>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -0,0 +1,69 @@
|
||||||
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||||
|
<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
|
||||||
|
<title>ChartDemo: E:/Sources Misc/ChartDemo/ChartCtrl/ChartGradient.h Source File</title>
|
||||||
|
<link href="tabs.css" rel="stylesheet" type="text/css">
|
||||||
|
<link href="doxygen.css" rel="stylesheet" type="text/css">
|
||||||
|
</head><body>
|
||||||
|
<!-- Generated by Doxygen 1.5.8 -->
|
||||||
|
<div class="navigation" id="top">
|
||||||
|
<div class="tabs">
|
||||||
|
<ul>
|
||||||
|
<li><a href="index.html"><span>Main Page</span></a></li>
|
||||||
|
<li><a href="pages.html"><span>Related Pages</span></a></li>
|
||||||
|
<li><a href="annotated.html"><span>Classes</span></a></li>
|
||||||
|
<li class="current"><a href="files.html"><span>Files</span></a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="tabs">
|
||||||
|
<ul>
|
||||||
|
<li><a href="files.html"><span>File List</span></a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<h1>E:/Sources Misc/ChartDemo/ChartCtrl/ChartGradient.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span>
|
||||||
|
<a name="l00002"></a>00002 <span class="comment"> *</span>
|
||||||
|
<a name="l00003"></a>00003 <span class="comment"> * ChartGradient.h</span>
|
||||||
|
<a name="l00004"></a>00004 <span class="comment"> *</span>
|
||||||
|
<a name="l00005"></a>00005 <span class="comment"> * Written by Cédric Moonen (cedric_moonen@hotmail.com)</span>
|
||||||
|
<a name="l00006"></a>00006 <span class="comment"> *</span>
|
||||||
|
<a name="l00007"></a>00007 <span class="comment"> *</span>
|
||||||
|
<a name="l00008"></a>00008 <span class="comment"> *</span>
|
||||||
|
<a name="l00009"></a>00009 <span class="comment"> * This code may be used for any non-commercial and commercial purposes in a compiled form.</span>
|
||||||
|
<a name="l00010"></a>00010 <span class="comment"> * The code may be redistributed as long as it remains unmodified and providing that the </span>
|
||||||
|
<a name="l00011"></a>00011 <span class="comment"> * author name and this disclaimer remain intact. The sources can be modified WITH the author </span>
|
||||||
|
<a name="l00012"></a>00012 <span class="comment"> * consent only.</span>
|
||||||
|
<a name="l00013"></a>00013 <span class="comment"> * </span>
|
||||||
|
<a name="l00014"></a>00014 <span class="comment"> * This code is provided without any garanties. I cannot be held responsible for the damage or</span>
|
||||||
|
<a name="l00015"></a>00015 <span class="comment"> * the loss of time it causes. Use it at your own risks</span>
|
||||||
|
<a name="l00016"></a>00016 <span class="comment"> *</span>
|
||||||
|
<a name="l00017"></a>00017 <span class="comment"> * An e-mail to notify me that you are using this code is appreciated also.</span>
|
||||||
|
<a name="l00018"></a>00018 <span class="comment"> *</span>
|
||||||
|
<a name="l00019"></a>00019 <span class="comment"> *</span>
|
||||||
|
<a name="l00020"></a>00020 <span class="comment"> */</span>
|
||||||
|
<a name="l00021"></a>00021
|
||||||
|
<a name="l00022"></a>00022 <span class="preprocessor">#pragma once</span>
|
||||||
|
<a name="l00023"></a>00023 <span class="preprocessor"></span>
|
||||||
|
<a name="l00025"></a>00025 <span class="keyword">enum</span> EGradientType
|
||||||
|
<a name="l00026"></a>00026 {
|
||||||
|
<a name="l00028"></a>00028 gtHorizontal,
|
||||||
|
<a name="l00030"></a>00030 gtVertical,
|
||||||
|
<a name="l00032"></a>00032 gtHorizontalDouble,
|
||||||
|
<a name="l00034"></a>00034 gtVerticalDouble
|
||||||
|
<a name="l00035"></a>00035 };
|
||||||
|
<a name="l00036"></a>00036
|
||||||
|
<a name="l00038"></a>00038
|
||||||
|
<a name="l00042"></a><a class="code" href="class_c_chart_gradient.html">00042</a> <span class="keyword">class </span><a class="code" href="class_c_chart_gradient.html" title="Helper class to draw gradient.">CChartGradient</a>
|
||||||
|
<a name="l00043"></a>00043 {
|
||||||
|
<a name="l00044"></a>00044 <span class="keyword">public</span>:
|
||||||
|
<a name="l00046"></a>00046 <a class="code" href="class_c_chart_gradient.html#5148b25772ce9e17de793986f7937063" title="Constructor.">CChartGradient</a>();
|
||||||
|
<a name="l00048"></a>00048 <a class="code" href="class_c_chart_gradient.html#39119f7cef6052950506384062188a71" title="Destructor.">~CChartGradient</a>();
|
||||||
|
<a name="l00049"></a>00049
|
||||||
|
<a name="l00051"></a>00051
|
||||||
|
<a name="l00063"></a>00063 <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="class_c_chart_gradient.html#5d1e4e2688565cc5e41e82ae72867407" title="Draws a gradient between two colors inside a rectangle.">DrawGradient</a>(CDC* pDC, <span class="keyword">const</span> CRect& GradientRect, COLORREF Color1,
|
||||||
|
<a name="l00064"></a>00064 COLORREF Color2, EGradientType GradientType);
|
||||||
|
<a name="l00065"></a>00065 };
|
||||||
|
</pre></div></div>
|
||||||
|
<hr size="1"><address style="text-align: right;"><small>Generated on Sun Jan 17 13:33:09 2010 for ChartDemo by
|
||||||
|
<a href="http://www.doxygen.org/index.html">
|
||||||
|
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.8 </small></address>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -0,0 +1,93 @@
|
||||||
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||||
|
<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
|
||||||
|
<title>ChartDemo: E:/Sources Misc/ChartDemo/ChartCtrl/ChartGrid.h Source File</title>
|
||||||
|
<link href="tabs.css" rel="stylesheet" type="text/css">
|
||||||
|
<link href="doxygen.css" rel="stylesheet" type="text/css">
|
||||||
|
</head><body>
|
||||||
|
<!-- Generated by Doxygen 1.5.8 -->
|
||||||
|
<div class="navigation" id="top">
|
||||||
|
<div class="tabs">
|
||||||
|
<ul>
|
||||||
|
<li><a href="index.html"><span>Main Page</span></a></li>
|
||||||
|
<li><a href="pages.html"><span>Related Pages</span></a></li>
|
||||||
|
<li><a href="annotated.html"><span>Classes</span></a></li>
|
||||||
|
<li class="current"><a href="files.html"><span>Files</span></a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="tabs">
|
||||||
|
<ul>
|
||||||
|
<li><a href="files.html"><span>File List</span></a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<h1>E:/Sources Misc/ChartDemo/ChartCtrl/ChartGrid.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span>
|
||||||
|
<a name="l00002"></a>00002 <span class="comment"> *</span>
|
||||||
|
<a name="l00003"></a>00003 <span class="comment"> * ChartGrid.h</span>
|
||||||
|
<a name="l00004"></a>00004 <span class="comment"> *</span>
|
||||||
|
<a name="l00005"></a>00005 <span class="comment"> * Written by Cédric Moonen (cedric_moonen@hotmail.com)</span>
|
||||||
|
<a name="l00006"></a>00006 <span class="comment"> *</span>
|
||||||
|
<a name="l00007"></a>00007 <span class="comment"> *</span>
|
||||||
|
<a name="l00008"></a>00008 <span class="comment"> *</span>
|
||||||
|
<a name="l00009"></a>00009 <span class="comment"> * This code may be used for any non-commercial and commercial purposes in a compiled form.</span>
|
||||||
|
<a name="l00010"></a>00010 <span class="comment"> * The code may be redistributed as long as it remains unmodified and providing that the </span>
|
||||||
|
<a name="l00011"></a>00011 <span class="comment"> * author name and this disclaimer remain intact. The sources can be modified WITH the author </span>
|
||||||
|
<a name="l00012"></a>00012 <span class="comment"> * consent only.</span>
|
||||||
|
<a name="l00013"></a>00013 <span class="comment"> * </span>
|
||||||
|
<a name="l00014"></a>00014 <span class="comment"> * This code is provided without any garanties. I cannot be held responsible for the damage or</span>
|
||||||
|
<a name="l00015"></a>00015 <span class="comment"> * the loss of time it causes. Use it at your own risks</span>
|
||||||
|
<a name="l00016"></a>00016 <span class="comment"> *</span>
|
||||||
|
<a name="l00017"></a>00017 <span class="comment"> * An e-mail to notify me that you are using this code is appreciated also.</span>
|
||||||
|
<a name="l00018"></a>00018 <span class="comment"> *</span>
|
||||||
|
<a name="l00019"></a>00019 <span class="comment"> *</span>
|
||||||
|
<a name="l00020"></a>00020 <span class="comment"> */</span>
|
||||||
|
<a name="l00021"></a>00021
|
||||||
|
<a name="l00022"></a>00022 <span class="preprocessor">#if !defined(AFX_CHARTGRID_H__ECCBEFF4_2365_49CD_A865_F1B4DD8CA138__INCLUDED_)</span>
|
||||||
|
<a name="l00023"></a>00023 <span class="preprocessor"></span><span class="preprocessor">#define AFX_CHARTGRID_H__ECCBEFF4_2365_49CD_A865_F1B4DD8CA138__INCLUDED_</span>
|
||||||
|
<a name="l00024"></a>00024 <span class="preprocessor"></span>
|
||||||
|
<a name="l00025"></a>00025 <span class="preprocessor">#if _MSC_VER > 1000</span>
|
||||||
|
<a name="l00026"></a>00026 <span class="preprocessor"></span><span class="preprocessor">#pragma once</span>
|
||||||
|
<a name="l00027"></a>00027 <span class="preprocessor"></span><span class="preprocessor">#endif // _MSC_VER > 1000</span>
|
||||||
|
<a name="l00028"></a>00028 <span class="preprocessor"></span>
|
||||||
|
<a name="l00029"></a>00029 <span class="preprocessor">#include <list></span>
|
||||||
|
<a name="l00030"></a>00030 <span class="preprocessor">#include "ChartCtrl.h"</span>
|
||||||
|
<a name="l00031"></a>00031
|
||||||
|
<a name="l00032"></a>00032
|
||||||
|
<a name="l00033"></a>00033 <span class="keyword">class </span><a class="code" href="class_c_chart_axis.html" title="Base class that takes care of the management of a chart axis.">CChartAxis</a>;
|
||||||
|
<a name="l00034"></a>00034
|
||||||
|
<a name="l00036"></a>00036
|
||||||
|
<a name="l00039"></a><a class="code" href="class_c_chart_grid.html">00039</a> <span class="keyword">class </span><a class="code" href="class_c_chart_grid.html" title="Class which draws the grid associated with a specific axis.">CChartGrid</a>
|
||||||
|
<a name="l00040"></a>00040 {
|
||||||
|
<a name="l00041"></a>00041 <span class="keyword">friend</span> <a class="code" href="class_c_chart_axis.html" title="Base class that takes care of the management of a chart axis.">CChartAxis</a>;
|
||||||
|
<a name="l00042"></a>00042
|
||||||
|
<a name="l00043"></a>00043 <span class="keyword">public</span>:
|
||||||
|
<a name="l00045"></a>00045 <span class="keywordtype">void</span> <a class="code" href="class_c_chart_grid.html#2465051644e8cd67fdc01715831dc6c4" title="Shows/hides the grid.">SetVisible</a>(<span class="keywordtype">bool</span> bVisible);
|
||||||
|
<a name="l00047"></a><a class="code" href="class_c_chart_grid.html#5622130837c1b5e05de5dafa4d5f8fde">00047</a> <span class="keywordtype">bool</span> <a class="code" href="class_c_chart_grid.html#5622130837c1b5e05de5dafa4d5f8fde" title="Returns true if the grid is visible.">IsVisible</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_bIsVisible; }
|
||||||
|
<a name="l00048"></a>00048
|
||||||
|
<a name="l00050"></a>00050 <span class="keywordtype">void</span> <a class="code" href="class_c_chart_grid.html#afd18660d15497a597be95a6ff4eec90" title="Sets the color of the grid.">SetColor</a>(COLORREF NewColor);
|
||||||
|
<a name="l00052"></a><a class="code" href="class_c_chart_grid.html#032d1e7202483e48a4b4bc12a1b99e83">00052</a> COLORREF <a class="code" href="class_c_chart_grid.html#032d1e7202483e48a4b4bc12a1b99e83" title="Returns the grid color.">GetColor</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_GridColor; }
|
||||||
|
<a name="l00053"></a>00053
|
||||||
|
<a name="l00054"></a>00054 <span class="keyword">private</span>:
|
||||||
|
<a name="l00056"></a>00056 <a class="code" href="class_c_chart_grid.html" title="Class which draws the grid associated with a specific axis.">CChartGrid</a>();
|
||||||
|
<a name="l00058"></a>00058 <span class="keyword">virtual</span> ~<a class="code" href="class_c_chart_grid.html" title="Class which draws the grid associated with a specific axis.">CChartGrid</a>();
|
||||||
|
<a name="l00059"></a>00059
|
||||||
|
<a name="l00061"></a>00061 <span class="keywordtype">void</span> Draw(CDC* pDC);
|
||||||
|
<a name="l00062"></a>00062
|
||||||
|
<a name="l00064"></a>00064 <span class="keywordtype">void</span> AddTick(<span class="keywordtype">int</span> Position);
|
||||||
|
<a name="l00066"></a>00066 <span class="keywordtype">void</span> ClearTicks();
|
||||||
|
<a name="l00067"></a>00067
|
||||||
|
<a name="l00068"></a>00068
|
||||||
|
<a name="l00070"></a>00070 COLORREF m_GridColor;
|
||||||
|
<a name="l00071"></a>00071
|
||||||
|
<a name="l00073"></a>00073 <a class="code" href="class_c_chart_ctrl.html" title="The main chart control class.">CChartCtrl</a>* m_pParentCtrl;
|
||||||
|
<a name="l00075"></a>00075 <span class="keywordtype">bool</span> m_bIsVisible;
|
||||||
|
<a name="l00076"></a>00076
|
||||||
|
<a name="l00078"></a>00078 std::list<int> m_lstTickPos;
|
||||||
|
<a name="l00080"></a>00080 <span class="keywordtype">bool</span> m_bIsHorizontal;
|
||||||
|
<a name="l00081"></a>00081 };
|
||||||
|
<a name="l00082"></a>00082
|
||||||
|
<a name="l00083"></a>00083 <span class="preprocessor">#endif // !defined(AFX_CHARTGRID_H__ECCBEFF4_2365_49CD_A865_F1B4DD8CA138__INCLUDED_)</span>
|
||||||
|
</pre></div></div>
|
||||||
|
<hr size="1"><address style="text-align: right;"><small>Generated on Sun Jan 17 13:33:09 2010 for ChartDemo by
|
||||||
|
<a href="http://www.doxygen.org/index.html">
|
||||||
|
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.8 </small></address>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -0,0 +1,104 @@
|
||||||
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||||
|
<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
|
||||||
|
<title>ChartDemo: E:/Sources Misc/ChartDemo/ChartCtrl/ChartLabel.h Source File</title>
|
||||||
|
<link href="tabs.css" rel="stylesheet" type="text/css">
|
||||||
|
<link href="doxygen.css" rel="stylesheet" type="text/css">
|
||||||
|
</head><body>
|
||||||
|
<!-- Generated by Doxygen 1.5.8 -->
|
||||||
|
<div class="navigation" id="top">
|
||||||
|
<div class="tabs">
|
||||||
|
<ul>
|
||||||
|
<li><a href="index.html"><span>Main Page</span></a></li>
|
||||||
|
<li><a href="pages.html"><span>Related Pages</span></a></li>
|
||||||
|
<li><a href="annotated.html"><span>Classes</span></a></li>
|
||||||
|
<li class="current"><a href="files.html"><span>Files</span></a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="tabs">
|
||||||
|
<ul>
|
||||||
|
<li><a href="files.html"><span>File List</span></a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<h1>E:/Sources Misc/ChartDemo/ChartCtrl/ChartLabel.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span>
|
||||||
|
<a name="l00002"></a>00002 <span class="comment"> *</span>
|
||||||
|
<a name="l00003"></a>00003 <span class="comment"> * ChartLabel.h</span>
|
||||||
|
<a name="l00004"></a>00004 <span class="comment"> *</span>
|
||||||
|
<a name="l00005"></a>00005 <span class="comment"> * Written by Cédric Moonen (cedric_moonen@hotmail.com)</span>
|
||||||
|
<a name="l00006"></a>00006 <span class="comment"> *</span>
|
||||||
|
<a name="l00007"></a>00007 <span class="comment"> *</span>
|
||||||
|
<a name="l00008"></a>00008 <span class="comment"> *</span>
|
||||||
|
<a name="l00009"></a>00009 <span class="comment"> * This code may be used for any non-commercial and commercial purposes in a compiled form.</span>
|
||||||
|
<a name="l00010"></a>00010 <span class="comment"> * The code may be redistributed as long as it remains unmodified and providing that the </span>
|
||||||
|
<a name="l00011"></a>00011 <span class="comment"> * author name and this disclaimer remain intact. The sources can be modified WITH the author </span>
|
||||||
|
<a name="l00012"></a>00012 <span class="comment"> * consent only.</span>
|
||||||
|
<a name="l00013"></a>00013 <span class="comment"> * </span>
|
||||||
|
<a name="l00014"></a>00014 <span class="comment"> * This code is provided without any garanties. I cannot be held responsible for the damage or</span>
|
||||||
|
<a name="l00015"></a>00015 <span class="comment"> * the loss of time it causes. Use it at your own risks</span>
|
||||||
|
<a name="l00016"></a>00016 <span class="comment"> *</span>
|
||||||
|
<a name="l00017"></a>00017 <span class="comment"> * An e-mail to notify me that you are using this code is appreciated also.</span>
|
||||||
|
<a name="l00018"></a>00018 <span class="comment"> *</span>
|
||||||
|
<a name="l00019"></a>00019 <span class="comment"> *</span>
|
||||||
|
<a name="l00020"></a>00020 <span class="comment"> */</span>
|
||||||
|
<a name="l00021"></a>00021
|
||||||
|
<a name="l00022"></a>00022 <span class="preprocessor">#ifndef _CHARTLABEL_H_ </span>
|
||||||
|
<a name="l00023"></a>00023 <span class="preprocessor"></span><span class="preprocessor">#define _CHARTLABEL_H_</span>
|
||||||
|
<a name="l00024"></a>00024 <span class="preprocessor"></span>
|
||||||
|
<a name="l00025"></a>00025 <span class="keyword">template</span> <<span class="keyword">class</span> Po<span class="keywordtype">int</span>Type>
|
||||||
|
<a name="l00026"></a>00026 <span class="keyword">class </span><a class="code" href="class_c_chart_serie_base.html" title="Base class for all series of the control.">CChartSerieBase</a>;
|
||||||
|
<a name="l00027"></a>00027
|
||||||
|
<a name="l00029"></a>00029
|
||||||
|
<a name="l00041"></a>00041 <span class="keyword">template</span> <<span class="keyword">class</span> Po<span class="keywordtype">int</span>Type>
|
||||||
|
<a name="l00042"></a><a class="code" href="class_c_chart_label_provider.html">00042</a> <span class="keyword">class </span><a class="code" href="class_c_chart_label_provider.html" title="Interface which should be implemented in order to provide text to a label.">CChartLabelProvider</a>
|
||||||
|
<a name="l00043"></a>00043 {
|
||||||
|
<a name="l00044"></a>00044 <span class="keyword">public</span>:
|
||||||
|
<a name="l00046"></a><a class="code" href="class_c_chart_label_provider.html#fc5d2e9d973ee6f4fc6e62d4b48edca2">00046</a> <a class="code" href="class_c_chart_label_provider.html#fc5d2e9d973ee6f4fc6e62d4b48edca2" title="Constructor.">CChartLabelProvider</a>() { }
|
||||||
|
<a name="l00048"></a><a class="code" href="class_c_chart_label_provider.html#a55954f86930b3f6e0488259cd9742e7">00048</a> <span class="keyword">virtual</span> <a class="code" href="class_c_chart_label_provider.html#a55954f86930b3f6e0488259cd9742e7" title="Destructor.">~CChartLabelProvider</a>() { }
|
||||||
|
<a name="l00049"></a>00049
|
||||||
|
<a name="l00051"></a>00051
|
||||||
|
<a name="l00058"></a>00058 <span class="keyword">virtual</span> TChartString <a class="code" href="class_c_chart_label_provider.html#46f5e0217500131d8341c3c0994c0e22" title="Method to override in order to provide the text of the label.">GetText</a>(<a class="code" href="class_c_chart_serie_base.html">CChartSerieBase<PointType></a>* pSerie,
|
||||||
|
<a name="l00059"></a>00059 <span class="keywordtype">unsigned</span> PointIndex) = 0;
|
||||||
|
<a name="l00060"></a>00060 };
|
||||||
|
<a name="l00061"></a>00061
|
||||||
|
<a name="l00063"></a>00063
|
||||||
|
<a name="l00066"></a>00066 <span class="keyword">template</span> <<span class="keyword">class</span> Po<span class="keywordtype">int</span>Type>
|
||||||
|
<a name="l00067"></a><a class="code" href="class_c_chart_label.html">00067</a> <span class="keyword">class </span><a class="code" href="class_c_chart_label.html" title="Draws a label containing some text which is attached to a point of a series.">CChartLabel</a>
|
||||||
|
<a name="l00068"></a>00068 {
|
||||||
|
<a name="l00069"></a>00069 <span class="keyword">friend</span> <a class="code" href="class_c_chart_serie_base.html">CChartSerieBase<PointType></a>;
|
||||||
|
<a name="l00070"></a>00070
|
||||||
|
<a name="l00071"></a>00071 <span class="keyword">public</span>:
|
||||||
|
<a name="l00073"></a>00073 <span class="keywordtype">void</span> <a class="code" href="class_c_chart_label.html#042cb1c703d7f20a0a278ddbc99272e3" title="Sets a static text to be displayed in the label.">SetLabelText</a>(<span class="keyword">const</span> TChartString& strText);
|
||||||
|
<a name="l00075"></a>00075
|
||||||
|
<a name="l00081"></a>00081 <span class="keywordtype">void</span> <a class="code" href="class_c_chart_label.html#b8bd7d088fcdf5c882d7cd6eb2c734e3" title="Sets the font of the text label.">SetFont</a>(<span class="keywordtype">int</span> nPointSize, <span class="keyword">const</span> TChartString& strFaceName);
|
||||||
|
<a name="l00083"></a>00083 <span class="keywordtype">void</span> <a class="code" href="class_c_chart_label.html#f07a65750da5af94309c910d126abdb9" title="Shows/hides the label.">SetVisisble</a>(<span class="keywordtype">bool</span> bVisible);
|
||||||
|
<a name="l00085"></a><a class="code" href="class_c_chart_label.html#d36b64fd481be8576af80a57c27bd28f">00085</a> <span class="keywordtype">void</span> <a class="code" href="class_c_chart_label.html#d36b64fd481be8576af80a57c27bd28f" title="Sets a label provider for more flexibility in how the text is supplied.">SetLabelProvider</a>(<a class="code" href="class_c_chart_label_provider.html" title="Interface which should be implemented in order to provide text to a label.">CChartLabelProvider<PointType></a>* pProvider)
|
||||||
|
<a name="l00086"></a>00086 {
|
||||||
|
<a name="l00087"></a>00087 <a class="code" href="class_c_chart_label.html#028d77d38b739975fcdb9d95eac6615e" title="The text provider.">m_pLabelProvider</a> = pProvider;
|
||||||
|
<a name="l00088"></a>00088 }
|
||||||
|
<a name="l00089"></a>00089
|
||||||
|
<a name="l00090"></a>00090 <span class="keyword">protected</span>:
|
||||||
|
<a name="l00092"></a>00092 <a class="code" href="class_c_chart_label.html#7381104af9f14ae6e8ee105cd8682bc2" title="Constructor.">CChartLabel</a>(<a class="code" href="class_c_chart_ctrl.html" title="The main chart control class.">CChartCtrl</a>* pParentCtrl, <a class="code" href="class_c_chart_serie_base.html">CChartSerieBase<PointType></a>* pParentSeries);
|
||||||
|
<a name="l00094"></a>00094 <span class="keyword">virtual</span> <a class="code" href="class_c_chart_label.html#af10230b8475ece188afdff4326eaed8" title="Destructor.">~CChartLabel</a>();
|
||||||
|
<a name="l00095"></a>00095
|
||||||
|
<a name="l00097"></a>00097
|
||||||
|
<a name="l00100"></a>00100 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="class_c_chart_label.html#cdfdfc71ab1cbf546414acbbc9559aa3" title="Draws the label.">Draw</a>(CDC* pDC, <span class="keywordtype">unsigned</span> uPointIndex) = 0;
|
||||||
|
<a name="l00101"></a>00101
|
||||||
|
<a name="l00103"></a><a class="code" href="class_c_chart_label.html#811aae254fd0e587bc3d0aba7c001dea">00103</a> <span class="keywordtype">bool</span> <a class="code" href="class_c_chart_label.html#811aae254fd0e587bc3d0aba7c001dea" title="Specifies if the label is visible or not.">m_bIsVisible</a>;
|
||||||
|
<a name="l00105"></a><a class="code" href="class_c_chart_label.html#3e95dc93bc0026b13a8ffe7cbd4fba9d">00105</a> <span class="keywordtype">int</span> <a class="code" href="class_c_chart_label.html#3e95dc93bc0026b13a8ffe7cbd4fba9d" title="The text font size.">m_iFontSize</a>;
|
||||||
|
<a name="l00107"></a><a class="code" href="class_c_chart_label.html#548beb2be24174b79074ef804bb1eca4">00107</a> TChartString <a class="code" href="class_c_chart_label.html#548beb2be24174b79074ef804bb1eca4" title="The text font face name.">m_strFontName</a>;
|
||||||
|
<a name="l00108"></a>00108
|
||||||
|
<a name="l00110"></a><a class="code" href="class_c_chart_label.html#26c5d0bedcb6f09460b4d91a5a6e862e">00110</a> TChartString <a class="code" href="class_c_chart_label.html#26c5d0bedcb6f09460b4d91a5a6e862e" title="The static text of the label.">m_strLabelText</a>;
|
||||||
|
<a name="l00112"></a><a class="code" href="class_c_chart_label.html#028d77d38b739975fcdb9d95eac6615e">00112</a> <a class="code" href="class_c_chart_label_provider.html" title="Interface which should be implemented in order to provide text to a label.">CChartLabelProvider<PointType></a>* <a class="code" href="class_c_chart_label.html#028d77d38b739975fcdb9d95eac6615e" title="The text provider.">m_pLabelProvider</a>;
|
||||||
|
<a name="l00113"></a>00113
|
||||||
|
<a name="l00115"></a><a class="code" href="class_c_chart_label.html#eb9daf5c020076f4a15d9265b9a1d945">00115</a> <a class="code" href="class_c_chart_ctrl.html" title="The main chart control class.">CChartCtrl</a>* <a class="code" href="class_c_chart_label.html#eb9daf5c020076f4a15d9265b9a1d945" title="The parent charting control.">m_pParentCtrl</a>;
|
||||||
|
<a name="l00117"></a><a class="code" href="class_c_chart_label.html#d594073c8d445b9ea9ec015c300b0423">00117</a> <a class="code" href="class_c_chart_serie_base.html" title="Base class for all series of the control.">CChartSerieBase<PointType></a>* <a class="code" href="class_c_chart_label.html#d594073c8d445b9ea9ec015c300b0423" title="The parent series.">m_pParentSeries</a>;
|
||||||
|
<a name="l00118"></a>00118 };
|
||||||
|
<a name="l00119"></a>00119
|
||||||
|
<a name="l00120"></a>00120 <span class="preprocessor">#include "ChartLabel.inl"</span>
|
||||||
|
<a name="l00121"></a>00121
|
||||||
|
<a name="l00122"></a>00122 <span class="preprocessor">#endif // _CHARTLABEL_H_</span>
|
||||||
|
</pre></div></div>
|
||||||
|
<hr size="1"><address style="text-align: right;"><small>Generated on Sun Jan 17 13:33:09 2010 for ChartDemo by
|
||||||
|
<a href="http://www.doxygen.org/index.html">
|
||||||
|
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.8 </small></address>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -0,0 +1,130 @@
|
||||||
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||||
|
<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
|
||||||
|
<title>ChartDemo: E:/Sources Misc/ChartDemo/ChartCtrl/ChartLegend.h Source File</title>
|
||||||
|
<link href="tabs.css" rel="stylesheet" type="text/css">
|
||||||
|
<link href="doxygen.css" rel="stylesheet" type="text/css">
|
||||||
|
</head><body>
|
||||||
|
<!-- Generated by Doxygen 1.5.8 -->
|
||||||
|
<div class="navigation" id="top">
|
||||||
|
<div class="tabs">
|
||||||
|
<ul>
|
||||||
|
<li><a href="index.html"><span>Main Page</span></a></li>
|
||||||
|
<li><a href="pages.html"><span>Related Pages</span></a></li>
|
||||||
|
<li><a href="annotated.html"><span>Classes</span></a></li>
|
||||||
|
<li class="current"><a href="files.html"><span>Files</span></a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="tabs">
|
||||||
|
<ul>
|
||||||
|
<li><a href="files.html"><span>File List</span></a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<h1>E:/Sources Misc/ChartDemo/ChartCtrl/ChartLegend.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span>
|
||||||
|
<a name="l00002"></a>00002 <span class="comment"> *</span>
|
||||||
|
<a name="l00003"></a>00003 <span class="comment"> * ChartLegend.h</span>
|
||||||
|
<a name="l00004"></a>00004 <span class="comment"> *</span>
|
||||||
|
<a name="l00005"></a>00005 <span class="comment"> * Written by Cédric Moonen (cedric_moonen@hotmail.com)</span>
|
||||||
|
<a name="l00006"></a>00006 <span class="comment"> *</span>
|
||||||
|
<a name="l00007"></a>00007 <span class="comment"> *</span>
|
||||||
|
<a name="l00008"></a>00008 <span class="comment"> *</span>
|
||||||
|
<a name="l00009"></a>00009 <span class="comment"> * This code may be used for any non-commercial and commercial purposes in a compiled form.</span>
|
||||||
|
<a name="l00010"></a>00010 <span class="comment"> * The code may be redistributed as long as it remains unmodified and providing that the </span>
|
||||||
|
<a name="l00011"></a>00011 <span class="comment"> * author name and this disclaimer remain intact. The sources can be modified WITH the author </span>
|
||||||
|
<a name="l00012"></a>00012 <span class="comment"> * consent only.</span>
|
||||||
|
<a name="l00013"></a>00013 <span class="comment"> * </span>
|
||||||
|
<a name="l00014"></a>00014 <span class="comment"> * This code is provided without any garanties. I cannot be held responsible for the damage or</span>
|
||||||
|
<a name="l00015"></a>00015 <span class="comment"> * the loss of time it causes. Use it at your own risks</span>
|
||||||
|
<a name="l00016"></a>00016 <span class="comment"> *</span>
|
||||||
|
<a name="l00017"></a>00017 <span class="comment"> * An e-mail to notify me that you are using this code is appreciated also.</span>
|
||||||
|
<a name="l00018"></a>00018 <span class="comment"> *</span>
|
||||||
|
<a name="l00019"></a>00019 <span class="comment"> *</span>
|
||||||
|
<a name="l00020"></a>00020 <span class="comment"> */</span>
|
||||||
|
<a name="l00021"></a>00021
|
||||||
|
<a name="l00022"></a>00022 <span class="preprocessor">#if !defined(AFX_CHARTLEGEND_H__CD72E5A0_8F52_472A_A611_C588F642080B__INCLUDED_)</span>
|
||||||
|
<a name="l00023"></a>00023 <span class="preprocessor"></span><span class="preprocessor">#define AFX_CHARTLEGEND_H__CD72E5A0_8F52_472A_A611_C588F642080B__INCLUDED_</span>
|
||||||
|
<a name="l00024"></a>00024 <span class="preprocessor"></span>
|
||||||
|
<a name="l00025"></a>00025 <span class="preprocessor">#if _MSC_VER > 1000</span>
|
||||||
|
<a name="l00026"></a>00026 <span class="preprocessor"></span><span class="preprocessor">#pragma once</span>
|
||||||
|
<a name="l00027"></a>00027 <span class="preprocessor"></span><span class="preprocessor">#endif // _MSC_VER > 1000</span>
|
||||||
|
<a name="l00028"></a>00028 <span class="preprocessor"></span>
|
||||||
|
<a name="l00029"></a>00029 <span class="preprocessor">#include "ChartCtrl.h"</span>
|
||||||
|
<a name="l00030"></a>00030
|
||||||
|
<a name="l00031"></a>00031 <span class="preprocessor">#include "ChartString.h"</span>
|
||||||
|
<a name="l00032"></a>00032
|
||||||
|
<a name="l00033"></a>00033 <span class="keyword">class </span><a class="code" href="class_c_chart_serie.html" title="Abstract class that provides a common &quot;interface&quot; for all series in the...">CChartSerie</a>;
|
||||||
|
<a name="l00034"></a>00034
|
||||||
|
<a name="l00036"></a>00036
|
||||||
|
<a name="l00041"></a><a class="code" href="class_c_chart_legend.html">00041</a> <span class="keyword">class </span><a class="code" href="class_c_chart_legend.html" title="This class is responsible for the legend displayed on the control.">CChartLegend</a>
|
||||||
|
<a name="l00042"></a>00042 {
|
||||||
|
<a name="l00043"></a>00043 <span class="keyword">friend</span> <a class="code" href="class_c_chart_ctrl.html" title="The main chart control class.">CChartCtrl</a>;
|
||||||
|
<a name="l00044"></a>00044
|
||||||
|
<a name="l00045"></a>00045 <span class="keyword">public</span>:
|
||||||
|
<a name="l00047"></a>00047 <span class="keywordtype">void</span> <a class="code" href="class_c_chart_legend.html#a23df25eefd5506133162db7b291fdfe" title="Sets the font used to display the series names.">SetFont</a>(<span class="keywordtype">int</span> iPointSize, <span class="keyword">const</span> TChartString& strFaceName);
|
||||||
|
<a name="l00048"></a>00048
|
||||||
|
<a name="l00050"></a><a class="code" href="class_c_chart_legend.html#b638f2259d00f46816a5c0bba7529a54">00050</a> <span class="keyword">enum</span> <a class="code" href="class_c_chart_legend.html#b638f2259d00f46816a5c0bba7529a54" title="Enumeration specifying on which side of the control the legend is docked.">DockSide</a>
|
||||||
|
<a name="l00051"></a>00051 {
|
||||||
|
<a name="l00052"></a>00052 dsDockRight,
|
||||||
|
<a name="l00053"></a>00053 dsDockLeft,
|
||||||
|
<a name="l00054"></a>00054 dsDockTop,
|
||||||
|
<a name="l00055"></a>00055 dsDockBottom
|
||||||
|
<a name="l00056"></a>00056 };
|
||||||
|
<a name="l00057"></a>00057
|
||||||
|
<a name="l00059"></a>00059 <span class="keywordtype">void</span> <a class="code" href="class_c_chart_legend.html#37edaeb7516a4c0e0473f30afd211aec" title="Dock the legend on a specific side of the control. Default is right.">DockLegend</a>(<a class="code" href="class_c_chart_legend.html#b638f2259d00f46816a5c0bba7529a54" title="Enumeration specifying on which side of the control the legend is docked.">DockSide</a> dsSide);
|
||||||
|
<a name="l00061"></a>00061
|
||||||
|
<a name="l00070"></a>00070 <span class="keywordtype">void</span> <a class="code" href="class_c_chart_legend.html#398a83f500e7d3ec88b53baac0caa8f9" title="Undock the legend.">UndockLegend</a>(<span class="keywordtype">int</span> iLeftPos, <span class="keywordtype">int</span> iTopPos);
|
||||||
|
<a name="l00071"></a>00071
|
||||||
|
<a name="l00073"></a>00073 <span class="keywordtype">void</span> <a class="code" href="class_c_chart_legend.html#316543887a3a6af4a4133049a6574130" title="Sets the background of the legend transparent.">SetTransparent</a>(<span class="keywordtype">bool</span> bTransparent);
|
||||||
|
<a name="l00075"></a>00075
|
||||||
|
<a name="l00079"></a>00079 <span class="keywordtype">void</span> <a class="code" href="class_c_chart_legend.html#0bb7fb625a300c260390c96422db725b" title="Sets the legend in horizontal/vertical mode.">SetHorizontalMode</a>(<span class="keywordtype">bool</span> bHorizontal);
|
||||||
|
<a name="l00080"></a>00080
|
||||||
|
<a name="l00082"></a>00082 <span class="keywordtype">void</span> <a class="code" href="class_c_chart_legend.html#ea145cd45c337496e726a9a958205f1b" title="Sets the legend visible/invisible.">SetVisible</a>(<span class="keywordtype">bool</span> bVisible);
|
||||||
|
<a name="l00084"></a><a class="code" href="class_c_chart_legend.html#b2c65ac7823a1551eff83709f4310ddf">00084</a> <span class="keywordtype">bool</span> <a class="code" href="class_c_chart_legend.html#b2c65ac7823a1551eff83709f4310ddf" title="Returns true if the legend is visible.">IsVisible</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_bIsVisible; }
|
||||||
|
<a name="l00085"></a>00085
|
||||||
|
<a name="l00087"></a><a class="code" href="class_c_chart_legend.html#03431c7ae2764527fead0db1f129c187">00087</a> COLORREF <a class="code" href="class_c_chart_legend.html#03431c7ae2764527fead0db1f129c187" title="Returns the back color of the legend.">GetBackColor</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_BackColor; }
|
||||||
|
<a name="l00089"></a>00089 <span class="keywordtype">void</span> <a class="code" href="class_c_chart_legend.html#949ef9f6d4d372efec72017fa5d101d6" title="Sets the back color of the legend.">SetBackColor</a>(COLORREF NewColor);
|
||||||
|
<a name="l00091"></a><a class="code" href="class_c_chart_legend.html#89ee10fed100ff1b19c16908bc79491d">00091</a> COLORREF <a class="code" href="class_c_chart_legend.html#89ee10fed100ff1b19c16908bc79491d" title="Returns the shadow color.">GetShadowColor</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_ShadowColor; }
|
||||||
|
<a name="l00093"></a>00093 <span class="keywordtype">void</span> <a class="code" href="class_c_chart_legend.html#db9a437ec8a341503bcf03ad8f04b780" title="Sets the shadow color.">SetShadowColor</a>(COLORREF NewColor);
|
||||||
|
<a name="l00095"></a>00095 <span class="keywordtype">void</span> <a class="code" href="class_c_chart_legend.html#3e492ab1e36f3e861b82dd688f35ab2b" title="Enables/disables the shadow.">EnableShadow</a>(<span class="keywordtype">bool</span> bEnable);
|
||||||
|
<a name="l00097"></a>00097 <span class="keywordtype">void</span> <a class="code" href="class_c_chart_legend.html#4fe2a3537a6f8474cd2fe5010ecb0dcc" title="Sets the shadow depth (in pixels).">SetShadowDepth</a>(<span class="keywordtype">int</span> Depth);
|
||||||
|
<a name="l00098"></a>00098
|
||||||
|
<a name="l00100"></a>00100 BOOL <a class="code" href="class_c_chart_legend.html#de42499c29132ecdda476afb6a9b366c" title="Returns true if the screen point is on the legend region.">IsPointInside</a>(<span class="keyword">const</span> CPoint& screenPoint) <span class="keyword">const</span>;
|
||||||
|
<a name="l00101"></a>00101
|
||||||
|
<a name="l00102"></a>00102 <span class="keyword">private</span>:
|
||||||
|
<a name="l00104"></a>00104 <a class="code" href="class_c_chart_legend.html" title="This class is responsible for the legend displayed on the control.">CChartLegend</a>(<a class="code" href="class_c_chart_ctrl.html" title="The main chart control class.">CChartCtrl</a>* pParent);
|
||||||
|
<a name="l00106"></a>00106 <span class="keyword">virtual</span> ~<a class="code" href="class_c_chart_legend.html" title="This class is responsible for the legend displayed on the control.">CChartLegend</a>();
|
||||||
|
<a name="l00107"></a>00107
|
||||||
|
<a name="l00109"></a>00109 <span class="keywordtype">void</span> Draw(CDC* pDC);
|
||||||
|
<a name="l00111"></a>00111 <span class="keywordtype">void</span> ClipArea(CRect& rcControl, CDC* pDC);
|
||||||
|
<a name="l00113"></a>00113 <span class="keywordtype">void</span> UpdatePosition(CDC* pDC, <span class="keyword">const</span> CRect& rcControl);
|
||||||
|
<a name="l00114"></a>00114
|
||||||
|
<a name="l00116"></a>00116 <a class="code" href="class_c_chart_ctrl.html" title="The main chart control class.">CChartCtrl</a>* m_pParentCtrl;
|
||||||
|
<a name="l00118"></a>00118 CRect m_LegendRect;
|
||||||
|
<a name="l00119"></a>00119
|
||||||
|
<a name="l00121"></a>00121 TChartString m_strFontName;
|
||||||
|
<a name="l00123"></a>00123 <span class="keywordtype">int</span> m_iFontSize;
|
||||||
|
<a name="l00124"></a>00124
|
||||||
|
<a name="l00126"></a>00126 <span class="keywordtype">bool</span> m_bDocked;
|
||||||
|
<a name="l00128"></a>00128 <a class="code" href="class_c_chart_legend.html#b638f2259d00f46816a5c0bba7529a54" title="Enumeration specifying on which side of the control the legend is docked.">DockSide</a> m_DockSide;
|
||||||
|
<a name="l00129"></a>00129
|
||||||
|
<a name="l00131"></a>00131 <span class="keywordtype">int</span> m_iLeftPos;
|
||||||
|
<a name="l00133"></a>00133 <span class="keywordtype">int</span> m_iTopPos;
|
||||||
|
<a name="l00134"></a>00134
|
||||||
|
<a name="l00136"></a>00136 <span class="keywordtype">bool</span> m_bIsVisible;
|
||||||
|
<a name="l00138"></a>00138 <span class="keywordtype">bool</span> m_bIsTransparent;
|
||||||
|
<a name="l00140"></a>00140 <span class="keywordtype">bool</span> m_bIsHorizontal;
|
||||||
|
<a name="l00142"></a>00142 <span class="keywordtype">bool</span> m_bShadow;
|
||||||
|
<a name="l00144"></a>00144 <span class="keywordtype">int</span> m_iShadowDepth;
|
||||||
|
<a name="l00145"></a>00145
|
||||||
|
<a name="l00147"></a>00147 COLORREF m_BackColor;
|
||||||
|
<a name="l00149"></a>00149 COLORREF m_ShadowColor;
|
||||||
|
<a name="l00150"></a>00150
|
||||||
|
<a name="l00152"></a>00152 CSize m_BitmapSize;
|
||||||
|
<a name="l00153"></a>00153 };
|
||||||
|
<a name="l00154"></a>00154
|
||||||
|
<a name="l00155"></a>00155 <span class="preprocessor">#endif // !defined(AFX_CHARTLEGEND_H__CD72E5A0_8F52_472A_A611_C588F642080B__INCLUDED_)</span>
|
||||||
|
</pre></div></div>
|
||||||
|
<hr size="1"><address style="text-align: right;"><small>Generated on Sun Jan 17 13:33:09 2010 for ChartDemo by
|
||||||
|
<a href="http://www.doxygen.org/index.html">
|
||||||
|
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.8 </small></address>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -0,0 +1,95 @@
|
||||||
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||||
|
<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
|
||||||
|
<title>ChartDemo: E:/Sources Misc/ChartDemo/ChartCtrl/ChartLineSerie.h Source File</title>
|
||||||
|
<link href="tabs.css" rel="stylesheet" type="text/css">
|
||||||
|
<link href="doxygen.css" rel="stylesheet" type="text/css">
|
||||||
|
</head><body>
|
||||||
|
<!-- Generated by Doxygen 1.5.8 -->
|
||||||
|
<div class="navigation" id="top">
|
||||||
|
<div class="tabs">
|
||||||
|
<ul>
|
||||||
|
<li><a href="index.html"><span>Main Page</span></a></li>
|
||||||
|
<li><a href="pages.html"><span>Related Pages</span></a></li>
|
||||||
|
<li><a href="annotated.html"><span>Classes</span></a></li>
|
||||||
|
<li class="current"><a href="files.html"><span>Files</span></a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="tabs">
|
||||||
|
<ul>
|
||||||
|
<li><a href="files.html"><span>File List</span></a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<h1>E:/Sources Misc/ChartDemo/ChartCtrl/ChartLineSerie.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span>
|
||||||
|
<a name="l00002"></a>00002 <span class="comment"> *</span>
|
||||||
|
<a name="l00003"></a>00003 <span class="comment"> * ChartLineSerie.h</span>
|
||||||
|
<a name="l00004"></a>00004 <span class="comment"> *</span>
|
||||||
|
<a name="l00005"></a>00005 <span class="comment"> * Written by Cédric Moonen (cedric_moonen@hotmail.com)</span>
|
||||||
|
<a name="l00006"></a>00006 <span class="comment"> *</span>
|
||||||
|
<a name="l00007"></a>00007 <span class="comment"> *</span>
|
||||||
|
<a name="l00008"></a>00008 <span class="comment"> *</span>
|
||||||
|
<a name="l00009"></a>00009 <span class="comment"> * This code may be used for any non-commercial and commercial purposes in a compiled form.</span>
|
||||||
|
<a name="l00010"></a>00010 <span class="comment"> * The code may be redistributed as long as it remains unmodified and providing that the </span>
|
||||||
|
<a name="l00011"></a>00011 <span class="comment"> * author name and this disclaimer remain intact. The sources can be modified WITH the author </span>
|
||||||
|
<a name="l00012"></a>00012 <span class="comment"> * consent only.</span>
|
||||||
|
<a name="l00013"></a>00013 <span class="comment"> * </span>
|
||||||
|
<a name="l00014"></a>00014 <span class="comment"> * This code is provided without any garanties. I cannot be held responsible for the damage or</span>
|
||||||
|
<a name="l00015"></a>00015 <span class="comment"> * the loss of time it causes. Use it at your own risks</span>
|
||||||
|
<a name="l00016"></a>00016 <span class="comment"> *</span>
|
||||||
|
<a name="l00017"></a>00017 <span class="comment"> * An e-mail to notify me that you are using this code is appreciated also.</span>
|
||||||
|
<a name="l00018"></a>00018 <span class="comment"> *</span>
|
||||||
|
<a name="l00019"></a>00019 <span class="comment"> *</span>
|
||||||
|
<a name="l00020"></a>00020 <span class="comment"> */</span>
|
||||||
|
<a name="l00021"></a>00021
|
||||||
|
<a name="l00022"></a>00022 <span class="preprocessor">#if !defined(AFX_CHARTLINESERIE_H__792C2F20_9650_42FA_B13D_E63911C98CE5__INCLUDED_)</span>
|
||||||
|
<a name="l00023"></a>00023 <span class="preprocessor"></span><span class="preprocessor">#define AFX_CHARTLINESERIE_H__792C2F20_9650_42FA_B13D_E63911C98CE5__INCLUDED_</span>
|
||||||
|
<a name="l00024"></a>00024 <span class="preprocessor"></span>
|
||||||
|
<a name="l00025"></a>00025 <span class="preprocessor">#if _MSC_VER > 1000</span>
|
||||||
|
<a name="l00026"></a>00026 <span class="preprocessor"></span><span class="preprocessor">#pragma once</span>
|
||||||
|
<a name="l00027"></a>00027 <span class="preprocessor"></span><span class="preprocessor">#endif // _MSC_VER > 1000</span>
|
||||||
|
<a name="l00028"></a>00028 <span class="preprocessor"></span>
|
||||||
|
<a name="l00029"></a>00029 <span class="preprocessor">#include "ChartXYSerie.h"</span>
|
||||||
|
<a name="l00030"></a>00030
|
||||||
|
<a name="l00032"></a>00032
|
||||||
|
<a name="l00036"></a><a class="code" href="class_c_chart_line_serie.html">00036</a> <span class="keyword">class </span><a class="code" href="class_c_chart_line_serie.html" title="Specialization of a CChartSerie to display a line series.">CChartLineSerie</a> : <span class="keyword">public</span> <a class="code" href="class_c_chart_x_y_serie.html" title="Specialization of a CChartSerieBase for series having data with an X and an Y value...">CChartXYSerie</a>
|
||||||
|
<a name="l00037"></a>00037 {
|
||||||
|
<a name="l00038"></a>00038 <span class="keyword">public</span>:
|
||||||
|
<a name="l00040"></a>00040
|
||||||
|
<a name="l00043"></a><a class="code" href="class_c_chart_line_serie.html#b2f2633d0e4c2780ee41a26e6a3492f5">00043</a> <span class="keywordtype">int</span> <a class="code" href="class_c_chart_line_serie.html#b2f2633d0e4c2780ee41a26e6a3492f5" title="Returns the pen style (plain, dashed, dotted, ...).">GetPenStyle</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_iPenStyle; }
|
||||||
|
<a name="l00045"></a>00045
|
||||||
|
<a name="l00048"></a>00048 <span class="keywordtype">void</span> <a class="code" href="class_c_chart_line_serie.html#ba44000020146023fee8a8288a431622" title="Sets the pen style (plain, dashed, dotted, ...).">SetPenStyle</a>(<span class="keywordtype">int</span> NewStyle);
|
||||||
|
<a name="l00049"></a>00049
|
||||||
|
<a name="l00051"></a><a class="code" href="class_c_chart_line_serie.html#4b5b1152532fc9cc0c9fd3ddc71a20db">00051</a> <span class="keywordtype">int</span> <a class="code" href="class_c_chart_line_serie.html#4b5b1152532fc9cc0c9fd3ddc71a20db" title="Returns the pen width.">GetWidth</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_iLineWidth; }
|
||||||
|
<a name="l00053"></a>00053 <span class="keywordtype">void</span> <a class="code" href="class_c_chart_line_serie.html#2af961d832b31887abb5e760422a1ef9" title="Sets the pen width.">SetWidth</a>(<span class="keywordtype">int</span> PenWidth);
|
||||||
|
<a name="l00055"></a>00055 <span class="keywordtype">void</span> <a class="code" href="class_c_chart_line_serie.html#6fd06f0fe61a9a901a1a9f38eb93a41d" title="Enables the smoothing of the curve (slower).">SetSmooth</a>(<span class="keywordtype">bool</span> bSmooth);
|
||||||
|
<a name="l00056"></a>00056
|
||||||
|
<a name="l00058"></a>00058 <a class="code" href="class_c_chart_line_serie.html#17fc1db38a517bfad155825f20429838" title="Constructor.">CChartLineSerie</a>(<a class="code" href="class_c_chart_ctrl.html" title="The main chart control class.">CChartCtrl</a>* pParent);
|
||||||
|
<a name="l00060"></a>00060 <span class="keyword">virtual</span> <a class="code" href="class_c_chart_line_serie.html#48e4ad1596894ed696491362f68dd722" title="Destructor.">~CChartLineSerie</a>();
|
||||||
|
<a name="l00061"></a>00061
|
||||||
|
<a name="l00063"></a>00063
|
||||||
|
<a name="l00074"></a>00074 <span class="keywordtype">bool</span> <a class="code" href="class_c_chart_line_serie.html#d30c44e96b7551d1d4576da40ac683f6" title="Check whether a screen point is on the series.">IsPointOnSerie</a>(<span class="keyword">const</span> CPoint& screenPoint, <span class="keywordtype">unsigned</span>& uIndex) <span class="keyword">const</span>;
|
||||||
|
<a name="l00075"></a>00075
|
||||||
|
<a name="l00076"></a>00076 <span class="keyword">private</span>:
|
||||||
|
<a name="l00078"></a>00078
|
||||||
|
<a name="l00084"></a>00084 <span class="keywordtype">void</span> DrawLegend(CDC* pDC, <span class="keyword">const</span> CRect& rectBitmap) <span class="keyword">const</span>;
|
||||||
|
<a name="l00085"></a>00085
|
||||||
|
<a name="l00087"></a>00087
|
||||||
|
<a name="l00093"></a>00093 <span class="keywordtype">void</span> Draw(CDC* pDC);
|
||||||
|
<a name="l00095"></a>00095
|
||||||
|
<a name="l00099"></a>00099 <span class="keywordtype">void</span> DrawAll(CDC *pDC);
|
||||||
|
<a name="l00100"></a>00100
|
||||||
|
<a name="l00102"></a>00102 <span class="keywordtype">bool</span> IsNearLine(<span class="keywordtype">long</span> Axl, <span class="keywordtype">long</span> Ayl,<span class="keywordtype">long</span> Bxl,
|
||||||
|
<a name="l00103"></a>00103 <span class="keywordtype">long</span> Byl, <span class="keywordtype">long</span> Cxl, <span class="keywordtype">long</span> Cyl) <span class="keyword">const</span>;
|
||||||
|
<a name="l00104"></a>00104
|
||||||
|
<a name="l00105"></a>00105
|
||||||
|
<a name="l00107"></a>00107 <span class="keywordtype">int</span> m_iLineWidth;
|
||||||
|
<a name="l00109"></a>00109 <span class="keywordtype">int</span> m_iPenStyle;
|
||||||
|
<a name="l00111"></a>00111 <span class="keywordtype">bool</span> m_bSmooth;
|
||||||
|
<a name="l00112"></a>00112 };
|
||||||
|
<a name="l00113"></a>00113
|
||||||
|
<a name="l00114"></a>00114 <span class="preprocessor">#endif // !defined(AFX_CHARTLINESERIE_H__792C2F20_9650_42FA_B13D_E63911C98CE5__INCLUDED_)</span>
|
||||||
|
</pre></div></div>
|
||||||
|
<hr size="1"><address style="text-align: right;"><small>Generated on Sun Jan 17 13:33:09 2010 for ChartDemo by
|
||||||
|
<a href="http://www.doxygen.org/index.html">
|
||||||
|
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.8 </small></address>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -0,0 +1,82 @@
|
||||||
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||||
|
<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
|
||||||
|
<title>ChartDemo: E:/Sources Misc/ChartDemo/ChartCtrl/ChartLogarithmicAxis.h Source File</title>
|
||||||
|
<link href="tabs.css" rel="stylesheet" type="text/css">
|
||||||
|
<link href="doxygen.css" rel="stylesheet" type="text/css">
|
||||||
|
</head><body>
|
||||||
|
<!-- Generated by Doxygen 1.5.8 -->
|
||||||
|
<div class="navigation" id="top">
|
||||||
|
<div class="tabs">
|
||||||
|
<ul>
|
||||||
|
<li><a href="index.html"><span>Main Page</span></a></li>
|
||||||
|
<li><a href="pages.html"><span>Related Pages</span></a></li>
|
||||||
|
<li><a href="annotated.html"><span>Classes</span></a></li>
|
||||||
|
<li class="current"><a href="files.html"><span>Files</span></a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="tabs">
|
||||||
|
<ul>
|
||||||
|
<li><a href="files.html"><span>File List</span></a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<h1>E:/Sources Misc/ChartDemo/ChartCtrl/ChartLogarithmicAxis.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span>
|
||||||
|
<a name="l00002"></a>00002 <span class="comment"> *</span>
|
||||||
|
<a name="l00003"></a>00003 <span class="comment"> * ChartLogarithmicAxis.h</span>
|
||||||
|
<a name="l00004"></a>00004 <span class="comment"> *</span>
|
||||||
|
<a name="l00005"></a>00005 <span class="comment"> * Written by Cédric Moonen (cedric_moonen@hotmail.com)</span>
|
||||||
|
<a name="l00006"></a>00006 <span class="comment"> *</span>
|
||||||
|
<a name="l00007"></a>00007 <span class="comment"> *</span>
|
||||||
|
<a name="l00008"></a>00008 <span class="comment"> *</span>
|
||||||
|
<a name="l00009"></a>00009 <span class="comment"> * This code may be used for any non-commercial and commercial purposes in a compiled form.</span>
|
||||||
|
<a name="l00010"></a>00010 <span class="comment"> * The code may be redistributed as long as it remains unmodified and providing that the </span>
|
||||||
|
<a name="l00011"></a>00011 <span class="comment"> * author name and this disclaimer remain intact. The sources can be modified WITH the author </span>
|
||||||
|
<a name="l00012"></a>00012 <span class="comment"> * consent only.</span>
|
||||||
|
<a name="l00013"></a>00013 <span class="comment"> * </span>
|
||||||
|
<a name="l00014"></a>00014 <span class="comment"> * This code is provided without any garanties. I cannot be held responsible for the damage or</span>
|
||||||
|
<a name="l00015"></a>00015 <span class="comment"> * the loss of time it causes. Use it at your own risks</span>
|
||||||
|
<a name="l00016"></a>00016 <span class="comment"> *</span>
|
||||||
|
<a name="l00017"></a>00017 <span class="comment"> * An e-mail to notify me that you are using this code is appreciated also.</span>
|
||||||
|
<a name="l00018"></a>00018 <span class="comment"> *</span>
|
||||||
|
<a name="l00019"></a>00019 <span class="comment"> *</span>
|
||||||
|
<a name="l00020"></a>00020 <span class="comment"> */</span>
|
||||||
|
<a name="l00021"></a>00021
|
||||||
|
<a name="l00022"></a>00022 <span class="preprocessor">#ifndef _CHARTLOGARITHMICAXIS_H_</span>
|
||||||
|
<a name="l00023"></a>00023 <span class="preprocessor"></span><span class="preprocessor">#define _CHARTLOGARITHMICAXIS_H_</span>
|
||||||
|
<a name="l00024"></a>00024 <span class="preprocessor"></span>
|
||||||
|
<a name="l00025"></a>00025 <span class="preprocessor">#include "ChartAxis.h"</span>
|
||||||
|
<a name="l00026"></a>00026
|
||||||
|
<a name="l00028"></a>00028
|
||||||
|
<a name="l00032"></a><a class="code" href="class_c_chart_logarithmic_axis.html">00032</a> <span class="keyword">class </span><a class="code" href="class_c_chart_logarithmic_axis.html" title="Specialization of a CChartAxis to display a logarithmic scale.">CChartLogarithmicAxis</a> : <span class="keyword">public</span> <a class="code" href="class_c_chart_axis.html" title="Base class that takes care of the management of a chart axis.">CChartAxis</a>
|
||||||
|
<a name="l00033"></a>00033 {
|
||||||
|
<a name="l00034"></a>00034 <span class="keyword">friend</span> <a class="code" href="class_c_chart_ctrl.html" title="The main chart control class.">CChartCtrl</a>;
|
||||||
|
<a name="l00035"></a>00035
|
||||||
|
<a name="l00036"></a>00036 <span class="keyword">private</span>:
|
||||||
|
<a name="l00038"></a>00038 <a class="code" href="class_c_chart_logarithmic_axis.html" title="Specialization of a CChartAxis to display a logarithmic scale.">CChartLogarithmicAxis</a>();
|
||||||
|
<a name="l00040"></a>00040 ~<a class="code" href="class_c_chart_logarithmic_axis.html" title="Specialization of a CChartAxis to display a logarithmic scale.">CChartLogarithmicAxis</a>();
|
||||||
|
<a name="l00041"></a>00041
|
||||||
|
<a name="l00042"></a>00042 <span class="keywordtype">double</span> ScreenToValue(<span class="keywordtype">long</span> ScreenVal) <span class="keyword">const</span>;
|
||||||
|
<a name="l00043"></a>00043 <span class="keywordtype">void</span> PanAxis(<span class="keywordtype">long</span> PanStart, <span class="keywordtype">long</span> PanEnd);
|
||||||
|
<a name="l00044"></a>00044
|
||||||
|
<a name="l00045"></a>00045 <span class="keywordtype">double</span> GetFirstTickValue() <span class="keyword">const</span>;
|
||||||
|
<a name="l00046"></a>00046 <span class="keywordtype">bool</span> GetNextTickValue(<span class="keywordtype">double</span> dCurrentTick, <span class="keywordtype">double</span>& dNextTick) <span class="keyword">const</span>;
|
||||||
|
<a name="l00047"></a>00047 TChartString GetTickLabel(<span class="keywordtype">double</span> TickValue) <span class="keyword">const</span>;
|
||||||
|
<a name="l00048"></a>00048 <span class="keywordtype">long</span> ValueToScreenStandard(<span class="keywordtype">double</span> Value) <span class="keyword">const</span>;
|
||||||
|
<a name="l00049"></a>00049 <span class="keywordtype">long</span> ValueToScreenDiscrete(<span class="keywordtype">double</span> Value) <span class="keyword">const</span>;
|
||||||
|
<a name="l00050"></a>00050 <span class="keywordtype">long</span> GetTickPos(<span class="keywordtype">double</span> TickVal) <span class="keyword">const</span>;
|
||||||
|
<a name="l00051"></a>00051
|
||||||
|
<a name="l00052"></a>00052 <span class="keywordtype">void</span> RefreshTickIncrement();
|
||||||
|
<a name="l00053"></a>00053 <span class="keywordtype">void</span> RefreshFirstTick();
|
||||||
|
<a name="l00054"></a>00054
|
||||||
|
<a name="l00055"></a>00055 <span class="keywordtype">void</span> GetScrollbarSteps(<span class="keywordtype">int</span>& iTotalSteps, <span class="keywordtype">int</span>& iCurrentStep);
|
||||||
|
<a name="l00056"></a>00056 <span class="keywordtype">void</span> SetAxisToScrollStep(<span class="keywordtype">int</span> iPreviousStep, <span class="keywordtype">int</span> iCurrentStep, <span class="keywordtype">bool</span> bScrollInverted);
|
||||||
|
<a name="l00057"></a>00057
|
||||||
|
<a name="l00059"></a>00059 <span class="keywordtype">double</span> m_dFirstTickValue;
|
||||||
|
<a name="l00060"></a>00060 };
|
||||||
|
<a name="l00061"></a>00061
|
||||||
|
<a name="l00062"></a>00062 <span class="preprocessor">#endif // _CHARTLOGARITHMICAXIS_H_</span>
|
||||||
|
</pre></div></div>
|
||||||
|
<hr size="1"><address style="text-align: right;"><small>Generated on Sun Jan 17 13:33:09 2010 for ChartDemo by
|
||||||
|
<a href="http://www.doxygen.org/index.html">
|
||||||
|
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.8 </small></address>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -0,0 +1,83 @@
|
||||||
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||||
|
<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
|
||||||
|
<title>ChartDemo: E:/Sources Misc/ChartDemo/ChartCtrl/ChartMouseListener.h Source File</title>
|
||||||
|
<link href="tabs.css" rel="stylesheet" type="text/css">
|
||||||
|
<link href="doxygen.css" rel="stylesheet" type="text/css">
|
||||||
|
</head><body>
|
||||||
|
<!-- Generated by Doxygen 1.5.8 -->
|
||||||
|
<div class="navigation" id="top">
|
||||||
|
<div class="tabs">
|
||||||
|
<ul>
|
||||||
|
<li><a href="index.html"><span>Main Page</span></a></li>
|
||||||
|
<li><a href="pages.html"><span>Related Pages</span></a></li>
|
||||||
|
<li><a href="annotated.html"><span>Classes</span></a></li>
|
||||||
|
<li class="current"><a href="files.html"><span>Files</span></a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="tabs">
|
||||||
|
<ul>
|
||||||
|
<li><a href="files.html"><span>File List</span></a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<h1>E:/Sources Misc/ChartDemo/ChartCtrl/ChartMouseListener.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span>
|
||||||
|
<a name="l00002"></a>00002 <span class="comment"> *</span>
|
||||||
|
<a name="l00003"></a>00003 <span class="comment"> * ChartMouseListener.h</span>
|
||||||
|
<a name="l00004"></a>00004 <span class="comment"> *</span>
|
||||||
|
<a name="l00005"></a>00005 <span class="comment"> * Written by Cédric Moonen (cedric_moonen@hotmail.com)</span>
|
||||||
|
<a name="l00006"></a>00006 <span class="comment"> *</span>
|
||||||
|
<a name="l00007"></a>00007 <span class="comment"> *</span>
|
||||||
|
<a name="l00008"></a>00008 <span class="comment"> *</span>
|
||||||
|
<a name="l00009"></a>00009 <span class="comment"> * This code may be used for any non-commercial and commercial purposes in a compiled form.</span>
|
||||||
|
<a name="l00010"></a>00010 <span class="comment"> * The code may be redistributed as long as it remains unmodified and providing that the </span>
|
||||||
|
<a name="l00011"></a>00011 <span class="comment"> * author name and this disclaimer remain intact. The sources can be modified WITH the author </span>
|
||||||
|
<a name="l00012"></a>00012 <span class="comment"> * consent only.</span>
|
||||||
|
<a name="l00013"></a>00013 <span class="comment"> * </span>
|
||||||
|
<a name="l00014"></a>00014 <span class="comment"> * This code is provided without any garanties. I cannot be held responsible for the damage or</span>
|
||||||
|
<a name="l00015"></a>00015 <span class="comment"> * the loss of time it causes. Use it at your own risks</span>
|
||||||
|
<a name="l00016"></a>00016 <span class="comment"> *</span>
|
||||||
|
<a name="l00017"></a>00017 <span class="comment"> * An e-mail to notify me that you are using this code is appreciated also.</span>
|
||||||
|
<a name="l00018"></a>00018 <span class="comment"> *</span>
|
||||||
|
<a name="l00019"></a>00019 <span class="comment"> *</span>
|
||||||
|
<a name="l00020"></a>00020 <span class="comment"> */</span>
|
||||||
|
<a name="l00021"></a>00021
|
||||||
|
<a name="l00022"></a>00022 <span class="preprocessor">#ifndef _CHARTMOUSELISTENER_H_</span>
|
||||||
|
<a name="l00023"></a>00023 <span class="preprocessor"></span><span class="preprocessor">#define _CHARTMOUSELISTENER_H_</span>
|
||||||
|
<a name="l00024"></a>00024 <span class="preprocessor"></span>
|
||||||
|
<a name="l00025"></a>00025 <span class="preprocessor">#pragma warning( disable : 4100 )</span>
|
||||||
|
<a name="l00026"></a>00026 <span class="preprocessor"></span>
|
||||||
|
<a name="l00028"></a>00028
|
||||||
|
<a name="l00033"></a><a class="code" href="class_c_chart_mouse_listener.html">00033</a> <span class="keyword">class </span><a class="code" href="class_c_chart_mouse_listener.html" title="Listener for mouse events occuring on the chart control.">CChartMouseListener</a>
|
||||||
|
<a name="l00034"></a>00034 {
|
||||||
|
<a name="l00035"></a>00035 <span class="keyword">public</span>:
|
||||||
|
<a name="l00037"></a><a class="code" href="class_c_chart_mouse_listener.html#77ff7968f3679b499c8158973bfa9489">00037</a> <a class="code" href="class_c_chart_mouse_listener.html#77ff7968f3679b499c8158973bfa9489" title="Constructor.">CChartMouseListener</a>() { }
|
||||||
|
<a name="l00039"></a><a class="code" href="class_c_chart_mouse_listener.html#127748a0914f8fdeb391c77912038cc7">00039</a> <span class="keyword">virtual</span> <a class="code" href="class_c_chart_mouse_listener.html#127748a0914f8fdeb391c77912038cc7" title="Destructor.">~CChartMouseListener</a>() { }
|
||||||
|
<a name="l00040"></a>00040
|
||||||
|
<a name="l00042"></a><a class="code" href="class_c_chart_mouse_listener.html#cffa1073dca632eca72f7339ecb350d7">00042</a> <span class="keyword">enum</span> <a class="code" href="class_c_chart_mouse_listener.html#cffa1073dca632eca72f7339ecb350d7" title="Enumeration listing the type of mouse events.">MouseEvent</a>
|
||||||
|
<a name="l00043"></a>00043 {
|
||||||
|
<a name="l00044"></a>00044 MouseMove,
|
||||||
|
<a name="l00045"></a>00045 LButtonUp,
|
||||||
|
<a name="l00046"></a>00046 LButtonDown,
|
||||||
|
<a name="l00047"></a>00047 LButtonDoubleClick,
|
||||||
|
<a name="l00048"></a>00048 RButtonUp,
|
||||||
|
<a name="l00049"></a>00049 RButtonDown,
|
||||||
|
<a name="l00050"></a>00050 RButtonDoubleClick,
|
||||||
|
<a name="l00051"></a>00051 };
|
||||||
|
<a name="l00052"></a>00052
|
||||||
|
<a name="l00054"></a>00054
|
||||||
|
<a name="l00060"></a><a class="code" href="class_c_chart_mouse_listener.html#ccb46591a6ff19b5e789f04988294b81">00060</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="class_c_chart_mouse_listener.html#ccb46591a6ff19b5e789f04988294b81" title="Virtual function to implement in order to be notified when the title is clicked.">OnMouseEventTitle</a>(<a class="code" href="class_c_chart_mouse_listener.html#cffa1073dca632eca72f7339ecb350d7" title="Enumeration listing the type of mouse events.">MouseEvent</a> mouseEvent, CPoint point) { }
|
||||||
|
<a name="l00062"></a>00062
|
||||||
|
<a name="l00070"></a><a class="code" href="class_c_chart_mouse_listener.html#4a9a76163cd0ed652be5fc516ec5dded">00070</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="class_c_chart_mouse_listener.html#4a9a76163cd0ed652be5fc516ec5dded" title="Virtual function to implement in order to be notified when an axis is clicked.">OnMouseEventAxis</a>(<a class="code" href="class_c_chart_mouse_listener.html#cffa1073dca632eca72f7339ecb350d7" title="Enumeration listing the type of mouse events.">MouseEvent</a> mouseEvent, CPoint point,
|
||||||
|
<a name="l00071"></a>00071 <a class="code" href="class_c_chart_axis.html" title="Base class that takes care of the management of a chart axis.">CChartAxis</a>* pAxisClicked) { }
|
||||||
|
<a name="l00073"></a>00073
|
||||||
|
<a name="l00079"></a><a class="code" href="class_c_chart_mouse_listener.html#64fd6fc4da12a033dc271c2cde31513a">00079</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="class_c_chart_mouse_listener.html#64fd6fc4da12a033dc271c2cde31513a" title="Virtual function to implement in order to be notified when the legend is clicked...">OnMouseEventLegend</a>(<a class="code" href="class_c_chart_mouse_listener.html#cffa1073dca632eca72f7339ecb350d7" title="Enumeration listing the type of mouse events.">MouseEvent</a> mouseEvent, CPoint point) { }
|
||||||
|
<a name="l00081"></a>00081
|
||||||
|
<a name="l00087"></a><a class="code" href="class_c_chart_mouse_listener.html#339729bb430d803412d9705f85be5094">00087</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="class_c_chart_mouse_listener.html#339729bb430d803412d9705f85be5094" title="Virtual function to implement in order to be notified when the plotting area is clicked...">OnMouseEventPlotArea</a>(<a class="code" href="class_c_chart_mouse_listener.html#cffa1073dca632eca72f7339ecb350d7" title="Enumeration listing the type of mouse events.">MouseEvent</a> mouseEvent, CPoint point) { }
|
||||||
|
<a name="l00088"></a>00088 };
|
||||||
|
<a name="l00089"></a>00089
|
||||||
|
<a name="l00090"></a>00090 <span class="preprocessor">#endif // _CHARTMOUSELISTENER_H_</span>
|
||||||
|
</pre></div></div>
|
||||||
|
<hr size="1"><address style="text-align: right;"><small>Generated on Sun Jan 17 13:33:09 2010 for ChartDemo by
|
||||||
|
<a href="http://www.doxygen.org/index.html">
|
||||||
|
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.8 </small></address>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -0,0 +1,126 @@
|
||||||
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||||
|
<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
|
||||||
|
<title>ChartDemo: E:/Sources Misc/ChartDemo/ChartObject.h Source File</title>
|
||||||
|
<link href="tabs.css" rel="stylesheet" type="text/css">
|
||||||
|
<link href="doxygen.css" rel="stylesheet" type="text/css">
|
||||||
|
</head><body>
|
||||||
|
<!-- Generated by Doxygen 1.5.8 -->
|
||||||
|
<div class="navigation" id="top">
|
||||||
|
<div class="tabs">
|
||||||
|
<ul>
|
||||||
|
<li><a href="index.html"><span>Main Page</span></a></li>
|
||||||
|
<li><a href="annotated.html"><span>Classes</span></a></li>
|
||||||
|
<li class="current"><a href="files.html"><span>Files</span></a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="tabs">
|
||||||
|
<ul>
|
||||||
|
<li><a href="files.html"><span>File List</span></a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<h1>E:/Sources Misc/ChartDemo/ChartObject.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span>
|
||||||
|
<a name="l00002"></a>00002 <span class="comment"> *</span>
|
||||||
|
<a name="l00003"></a>00003 <span class="comment"> * ChartObject.h</span>
|
||||||
|
<a name="l00004"></a>00004 <span class="comment"> *</span>
|
||||||
|
<a name="l00005"></a>00005 <span class="comment"> * Written by Cédric Moonen (cedric_moonen@hotmail.com)</span>
|
||||||
|
<a name="l00006"></a>00006 <span class="comment"> *</span>
|
||||||
|
<a name="l00007"></a>00007 <span class="comment"> *</span>
|
||||||
|
<a name="l00008"></a>00008 <span class="comment"> *</span>
|
||||||
|
<a name="l00009"></a>00009 <span class="comment"> * This code may be used for any non-commercial and commercial purposes in a compiled form.</span>
|
||||||
|
<a name="l00010"></a>00010 <span class="comment"> * The code may be redistributed as long as it remains unmodified and providing that the </span>
|
||||||
|
<a name="l00011"></a>00011 <span class="comment"> * author name and this disclaimer remain intact. The sources can be modified WITH the author </span>
|
||||||
|
<a name="l00012"></a>00012 <span class="comment"> * consent only.</span>
|
||||||
|
<a name="l00013"></a>00013 <span class="comment"> * </span>
|
||||||
|
<a name="l00014"></a>00014 <span class="comment"> * This code is provided without any garanties. I cannot be held responsible for the damage or</span>
|
||||||
|
<a name="l00015"></a>00015 <span class="comment"> * the loss of time it causes. Use it at your own risks</span>
|
||||||
|
<a name="l00016"></a>00016 <span class="comment"> *</span>
|
||||||
|
<a name="l00017"></a>00017 <span class="comment"> * An e-mail to notify me that you are using this code is appreciated also.</span>
|
||||||
|
<a name="l00018"></a>00018 <span class="comment"> *</span>
|
||||||
|
<a name="l00019"></a>00019 <span class="comment"> *</span>
|
||||||
|
<a name="l00020"></a>00020 <span class="comment"> */</span>
|
||||||
|
<a name="l00021"></a>00021
|
||||||
|
<a name="l00022"></a>00022 <span class="preprocessor">#if !defined(AFX_CHARTOBJECT_H__6ED024F2_00D9_45D5_AB83_258EF0075288__INCLUDED_)</span>
|
||||||
|
<a name="l00023"></a>00023 <span class="preprocessor"></span><span class="preprocessor">#define AFX_CHARTOBJECT_H__6ED024F2_00D9_45D5_AB83_258EF0075288__INCLUDED_</span>
|
||||||
|
<a name="l00024"></a>00024 <span class="preprocessor"></span>
|
||||||
|
<a name="l00025"></a>00025 <span class="preprocessor">#if _MSC_VER > 1000</span>
|
||||||
|
<a name="l00026"></a>00026 <span class="preprocessor"></span><span class="preprocessor">#pragma once</span>
|
||||||
|
<a name="l00027"></a>00027 <span class="preprocessor"></span><span class="preprocessor">#endif // _MSC_VER > 1000</span>
|
||||||
|
<a name="l00028"></a>00028 <span class="preprocessor"></span>
|
||||||
|
<a name="l00029"></a>00029 <span class="preprocessor">#include <afx.h></span>
|
||||||
|
<a name="l00030"></a>00030 <span class="preprocessor">#include <afxwin.h></span>
|
||||||
|
<a name="l00031"></a>00031
|
||||||
|
<a name="l00032"></a>00032 <span class="keyword">class </span><a class="code" href="class_c_chart_ctrl.html" title="The main chart control class.">CChartCtrl</a>;
|
||||||
|
<a name="l00033"></a>00033
|
||||||
|
<a name="l00034"></a>00034 <span class="keyword">class </span>CChartObject
|
||||||
|
<a name="l00035"></a>00035 {
|
||||||
|
<a name="l00036"></a>00036 <span class="keyword">friend</span> <a class="code" href="class_c_chart_ctrl.html" title="The main chart control class.">CChartCtrl</a>;
|
||||||
|
<a name="l00037"></a>00037
|
||||||
|
<a name="l00038"></a>00038 <span class="keyword">public</span>:
|
||||||
|
<a name="l00039"></a>00039 CChartObject(<a class="code" href="class_c_chart_ctrl.html" title="The main chart control class.">CChartCtrl</a>* pOwner);
|
||||||
|
<a name="l00040"></a>00040 <span class="keyword">virtual</span> ~CChartObject();
|
||||||
|
<a name="l00041"></a>00041
|
||||||
|
<a name="l00042"></a>00042 <span class="keywordtype">void</span> SetVisible(<span class="keywordtype">bool</span> bVisible);
|
||||||
|
<a name="l00043"></a>00043 <span class="keywordtype">bool</span> IsVisible()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_bIsVisible; }
|
||||||
|
<a name="l00044"></a>00044
|
||||||
|
<a name="l00045"></a>00045 COLORREF GetColor()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_ObjectColor; }
|
||||||
|
<a name="l00046"></a>00046 <span class="keywordtype">void</span> SetColor(COLORREF NewColor);
|
||||||
|
<a name="l00047"></a>00047 COLORREF GetShadowColor()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_ShadowColor; }
|
||||||
|
<a name="l00048"></a>00048 <span class="keywordtype">void</span> SetShadowColor(COLORREF NewColor);
|
||||||
|
<a name="l00049"></a>00049
|
||||||
|
<a name="l00050"></a>00050 <span class="keywordtype">void</span> EnableShadow(<span class="keywordtype">bool</span> bEnable);
|
||||||
|
<a name="l00051"></a>00051 <span class="keywordtype">void</span> SetShadowDepth(<span class="keywordtype">int</span> Depth);
|
||||||
|
<a name="l00052"></a>00052
|
||||||
|
<a name="l00053"></a>00053 <span class="keywordtype">bool</span> Clip(<span class="keywordtype">int</span>& dX, <span class="keywordtype">int</span>& dY)<span class="keyword"> const</span>
|
||||||
|
<a name="l00054"></a>00054 <span class="keyword"> </span>{
|
||||||
|
<a name="l00055"></a>00055 <span class="keywordtype">bool</span> bResult = <span class="keyword">true</span>;
|
||||||
|
<a name="l00056"></a>00056
|
||||||
|
<a name="l00057"></a>00057 <span class="keywordflow">if</span> (dX>m_ObjectRect.right)
|
||||||
|
<a name="l00058"></a>00058 {
|
||||||
|
<a name="l00059"></a>00059 dX = m_ObjectRect.right;
|
||||||
|
<a name="l00060"></a>00060 bResult = <span class="keyword">false</span>;
|
||||||
|
<a name="l00061"></a>00061 }
|
||||||
|
<a name="l00062"></a>00062 <span class="keywordflow">if</span> (dX<m_ObjectRect.left)
|
||||||
|
<a name="l00063"></a>00063 {
|
||||||
|
<a name="l00064"></a>00064 dX = m_ObjectRect.left;
|
||||||
|
<a name="l00065"></a>00065 bResult = <span class="keyword">false</span>;
|
||||||
|
<a name="l00066"></a>00066 }
|
||||||
|
<a name="l00067"></a>00067 <span class="keywordflow">if</span> (dY>m_ObjectRect.bottom)
|
||||||
|
<a name="l00068"></a>00068 {
|
||||||
|
<a name="l00069"></a>00069 dY = m_ObjectRect.bottom;
|
||||||
|
<a name="l00070"></a>00070 bResult = <span class="keyword">false</span>;
|
||||||
|
<a name="l00071"></a>00071 }
|
||||||
|
<a name="l00072"></a>00072 <span class="keywordflow">if</span> (dY<m_ObjectRect.top)
|
||||||
|
<a name="l00073"></a>00073 {
|
||||||
|
<a name="l00074"></a>00074 dY = m_ObjectRect.top;
|
||||||
|
<a name="l00075"></a>00075 bResult = <span class="keyword">false</span>;
|
||||||
|
<a name="l00076"></a>00076 }
|
||||||
|
<a name="l00077"></a>00077
|
||||||
|
<a name="l00078"></a>00078 <span class="keywordflow">return</span> bResult;
|
||||||
|
<a name="l00079"></a>00079 }
|
||||||
|
<a name="l00080"></a>00080
|
||||||
|
<a name="l00081"></a>00081
|
||||||
|
<a name="l00082"></a>00082
|
||||||
|
<a name="l00083"></a>00083 <span class="keyword">protected</span>:
|
||||||
|
<a name="l00084"></a>00084 <span class="keywordtype">void</span> SetRect(CRect NewTect) { m_ObjectRect = NewTect; }
|
||||||
|
<a name="l00085"></a>00085
|
||||||
|
<a name="l00086"></a>00086 CRect m_ObjectRect; <span class="comment">// Size of the object</span>
|
||||||
|
<a name="l00087"></a>00087 COLORREF m_ObjectColor; <span class="comment">// Color of the objet</span>
|
||||||
|
<a name="l00088"></a>00088
|
||||||
|
<a name="l00089"></a>00089 <a class="code" href="class_c_chart_ctrl.html" title="The main chart control class.">CChartCtrl</a>* m_pParent; <span class="comment">// Owner of the object</span>
|
||||||
|
<a name="l00090"></a>00090 <span class="keywordtype">bool</span> m_bIsVisible;
|
||||||
|
<a name="l00091"></a>00091 <span class="keywordtype">bool</span> m_bShadow; <span class="comment">// Specifies if the object generate a shadow.</span>
|
||||||
|
<a name="l00092"></a>00092 <span class="comment">// This is not supported for all objects.</span>
|
||||||
|
<a name="l00093"></a>00093 COLORREF m_ShadowColor;
|
||||||
|
<a name="l00094"></a>00094 <span class="keywordtype">int</span> m_iShadowDepth;
|
||||||
|
<a name="l00095"></a>00095
|
||||||
|
<a name="l00096"></a>00096 <span class="keyword">private</span>:
|
||||||
|
<a name="l00097"></a>00097 <span class="keyword">virtual</span> <span class="keywordtype">void</span> Draw(CDC* pDC) = 0;
|
||||||
|
<a name="l00098"></a>00098 };
|
||||||
|
<a name="l00099"></a>00099
|
||||||
|
<a name="l00100"></a>00100 <span class="preprocessor">#endif // !defined(AFX_CHARTOBJECT_H__6ED024F2_00D9_45D5_AB83_258EF0075288__INCLUDED_)</span>
|
||||||
|
</pre></div></div>
|
||||||
|
<hr size="1"><address style="text-align: right;"><small>Generated on Sun Feb 1 14:25:46 2009 for ChartDemo by
|
||||||
|
<a href="http://www.doxygen.org/index.html">
|
||||||
|
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.8 </small></address>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -0,0 +1,107 @@
|
||||||
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||||
|
<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
|
||||||
|
<title>ChartDemo: E:/Sources Misc/ChartDemo/ChartPointLabel.h Source File</title>
|
||||||
|
<link href="tabs.css" rel="stylesheet" type="text/css">
|
||||||
|
<link href="doxygen.css" rel="stylesheet" type="text/css">
|
||||||
|
</head><body>
|
||||||
|
<!-- Generated by Doxygen 1.5.8 -->
|
||||||
|
<div class="navigation" id="top">
|
||||||
|
<div class="tabs">
|
||||||
|
<ul>
|
||||||
|
<li><a href="index.html"><span>Main Page</span></a></li>
|
||||||
|
<li><a href="annotated.html"><span>Classes</span></a></li>
|
||||||
|
<li class="current"><a href="files.html"><span>Files</span></a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="tabs">
|
||||||
|
<ul>
|
||||||
|
<li><a href="files.html"><span>File List</span></a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<h1>E:/Sources Misc/ChartDemo/ChartPointLabel.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span>
|
||||||
|
<a name="l00002"></a>00002 <span class="comment"> *</span>
|
||||||
|
<a name="l00003"></a>00003 <span class="comment"> * ChartPointLabel.h</span>
|
||||||
|
<a name="l00004"></a>00004 <span class="comment"> *</span>
|
||||||
|
<a name="l00005"></a>00005 <span class="comment"> * Written by Cédric Moonen (cedric_moonen@hotmail.com)</span>
|
||||||
|
<a name="l00006"></a>00006 <span class="comment"> *</span>
|
||||||
|
<a name="l00007"></a>00007 <span class="comment"> *</span>
|
||||||
|
<a name="l00008"></a>00008 <span class="comment"> *</span>
|
||||||
|
<a name="l00009"></a>00009 <span class="comment"> * This code may be used for any non-commercial and commercial purposes in a compiled form.</span>
|
||||||
|
<a name="l00010"></a>00010 <span class="comment"> * The code may be redistributed as long as it remains unmodified and providing that the </span>
|
||||||
|
<a name="l00011"></a>00011 <span class="comment"> * author name and this disclaimer remain intact. The sources can be modified WITH the author </span>
|
||||||
|
<a name="l00012"></a>00012 <span class="comment"> * consent only.</span>
|
||||||
|
<a name="l00013"></a>00013 <span class="comment"> * </span>
|
||||||
|
<a name="l00014"></a>00014 <span class="comment"> * This code is provided without any garanties. I cannot be held responsible for the damage or</span>
|
||||||
|
<a name="l00015"></a>00015 <span class="comment"> * the loss of time it causes. Use it at your own risks</span>
|
||||||
|
<a name="l00016"></a>00016 <span class="comment"> *</span>
|
||||||
|
<a name="l00017"></a>00017 <span class="comment"> * An e-mail to notify me that you are using this code is appreciated also.</span>
|
||||||
|
<a name="l00018"></a>00018 <span class="comment"> *</span>
|
||||||
|
<a name="l00019"></a>00019 <span class="comment"> *</span>
|
||||||
|
<a name="l00020"></a>00020 <span class="comment"> */</span>
|
||||||
|
<a name="l00021"></a>00021
|
||||||
|
<a name="l00022"></a>00022 <span class="preprocessor">#ifndef _CHARTPOINTLABEL_H_ </span>
|
||||||
|
<a name="l00023"></a>00023 <span class="preprocessor"></span><span class="preprocessor">#define _CHARTPOINTLABEL_H_</span>
|
||||||
|
<a name="l00024"></a>00024 <span class="preprocessor"></span>
|
||||||
|
<a name="l00025"></a>00025 <span class="preprocessor">#include "ChartSerie.h"</span>
|
||||||
|
<a name="l00026"></a>00026
|
||||||
|
<a name="l00027"></a>00027 <span class="keyword">class </span>CChartLabelProvider
|
||||||
|
<a name="l00028"></a>00028 {
|
||||||
|
<a name="l00029"></a>00029 <span class="keyword">public</span>:
|
||||||
|
<a name="l00030"></a>00030 CChartLabelProvider() { }
|
||||||
|
<a name="l00031"></a>00031 <span class="keyword">virtual</span> ~CChartLabelProvider() { }
|
||||||
|
<a name="l00032"></a>00032
|
||||||
|
<a name="l00033"></a>00033 <span class="keyword">virtual</span> TChartString GetText(CChartSerie* pSerie, <span class="keywordtype">unsigned</span> uPtIndex) = 0;
|
||||||
|
<a name="l00034"></a>00034 };
|
||||||
|
<a name="l00035"></a>00035
|
||||||
|
<a name="l00036"></a>00036 <span class="keyword">class </span>CChartPointLabel
|
||||||
|
<a name="l00037"></a>00037 {
|
||||||
|
<a name="l00038"></a>00038 <span class="keyword">friend</span> CChartSerie;
|
||||||
|
<a name="l00039"></a>00039
|
||||||
|
<a name="l00040"></a>00040 <span class="keyword">public</span>:
|
||||||
|
<a name="l00041"></a>00041 <span class="keywordtype">void</span> SetLabelText(<span class="keyword">const</span> TChartString& strText);
|
||||||
|
<a name="l00042"></a>00042 <span class="keywordtype">void</span> SetFont(<span class="keywordtype">int</span> nPointSize, <span class="keyword">const</span> TChartString& strFaceName);
|
||||||
|
<a name="l00043"></a>00043
|
||||||
|
<a name="l00044"></a>00044 <span class="keywordtype">void</span> SetBackgroundColor(COLORREF colBackground);
|
||||||
|
<a name="l00045"></a>00045 COLORREF GetBackgroundColor()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_colBackground; }
|
||||||
|
<a name="l00046"></a>00046 <span class="keywordtype">void</span> SetArrowColor(COLORREF colArrow);
|
||||||
|
<a name="l00047"></a>00047 COLORREF GetArrowColor()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_colArrow; }
|
||||||
|
<a name="l00048"></a>00048 <span class="keywordtype">void</span> SetBorderColor(COLORREF colBorder);
|
||||||
|
<a name="l00049"></a>00049 COLORREF GetBorderColor()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_colBorder; }
|
||||||
|
<a name="l00050"></a>00050
|
||||||
|
<a name="l00051"></a>00051 <span class="keywordtype">void</span> SetRoundedRect(<span class="keywordtype">bool</span> bRounded);
|
||||||
|
<a name="l00052"></a>00052 <span class="keywordtype">bool</span> GetRoundedRect()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_bRoundedRect; }
|
||||||
|
<a name="l00053"></a>00053
|
||||||
|
<a name="l00054"></a>00054 <span class="keywordtype">void</span> SetLabelProvider(CChartLabelProvider* pProvider)
|
||||||
|
<a name="l00055"></a>00055 {
|
||||||
|
<a name="l00056"></a>00056 m_pLabelProvider = pProvider;
|
||||||
|
<a name="l00057"></a>00057 }
|
||||||
|
<a name="l00058"></a>00058
|
||||||
|
<a name="l00059"></a>00059 <span class="keyword">protected</span>:
|
||||||
|
<a name="l00060"></a>00060 CChartPointLabel(<a class="code" href="class_c_chart_ctrl.html" title="The main chart control class.">CChartCtrl</a>* pParentCtrl, CChartSerie* pParentSeries);
|
||||||
|
<a name="l00061"></a>00061 ~CChartPointLabel();
|
||||||
|
<a name="l00062"></a>00062
|
||||||
|
<a name="l00063"></a>00063 <span class="keywordtype">void</span> Draw(CDC* pDC, <span class="keywordtype">unsigned</span> uPointIndex);
|
||||||
|
<a name="l00064"></a>00064
|
||||||
|
<a name="l00065"></a>00065 <span class="keywordtype">int</span> m_iFontSize;
|
||||||
|
<a name="l00066"></a>00066 TChartString m_strFontName;
|
||||||
|
<a name="l00067"></a>00067
|
||||||
|
<a name="l00068"></a>00068 TChartString m_strLabelText;
|
||||||
|
<a name="l00069"></a>00069 CChartLabelProvider* m_pLabelProvider;
|
||||||
|
<a name="l00070"></a>00070
|
||||||
|
<a name="l00071"></a>00071 <a class="code" href="class_c_chart_ctrl.html" title="The main chart control class.">CChartCtrl</a>* m_pParentCtrl;
|
||||||
|
<a name="l00072"></a>00072 CChartSerie* m_pParentSeries;
|
||||||
|
<a name="l00073"></a>00073
|
||||||
|
<a name="l00074"></a>00074 COLORREF m_colArrow;
|
||||||
|
<a name="l00075"></a>00075 COLORREF m_colBackground;
|
||||||
|
<a name="l00076"></a>00076 COLORREF m_colBorder;
|
||||||
|
<a name="l00077"></a>00077
|
||||||
|
<a name="l00079"></a>00079 <span class="keywordtype">bool</span> m_bRoundedRect;
|
||||||
|
<a name="l00080"></a>00080 };
|
||||||
|
<a name="l00081"></a>00081
|
||||||
|
<a name="l00082"></a>00082 <span class="preprocessor">#endif // _CHARTPOINTLABEL_H_</span>
|
||||||
|
</pre></div></div>
|
||||||
|
<hr size="1"><address style="text-align: right;"><small>Generated on Mon Feb 23 20:14:50 2009 for ChartDemo by
|
||||||
|
<a href="http://www.doxygen.org/index.html">
|
||||||
|
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.8 </small></address>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -0,0 +1,112 @@
|
||||||
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||||
|
<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
|
||||||
|
<title>ChartDemo: E:/Sources Misc/ChartDemo/ChartCtrl/ChartPointsArray.h Source File</title>
|
||||||
|
<link href="tabs.css" rel="stylesheet" type="text/css">
|
||||||
|
<link href="doxygen.css" rel="stylesheet" type="text/css">
|
||||||
|
</head><body>
|
||||||
|
<!-- Generated by Doxygen 1.5.8 -->
|
||||||
|
<div class="navigation" id="top">
|
||||||
|
<div class="tabs">
|
||||||
|
<ul>
|
||||||
|
<li><a href="index.html"><span>Main Page</span></a></li>
|
||||||
|
<li><a href="pages.html"><span>Related Pages</span></a></li>
|
||||||
|
<li><a href="annotated.html"><span>Classes</span></a></li>
|
||||||
|
<li class="current"><a href="files.html"><span>Files</span></a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="tabs">
|
||||||
|
<ul>
|
||||||
|
<li><a href="files.html"><span>File List</span></a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<h1>E:/Sources Misc/ChartDemo/ChartCtrl/ChartPointsArray.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span>
|
||||||
|
<a name="l00002"></a>00002 <span class="comment"> *</span>
|
||||||
|
<a name="l00003"></a>00003 <span class="comment"> * ChartPointsArray.h</span>
|
||||||
|
<a name="l00004"></a>00004 <span class="comment"> *</span>
|
||||||
|
<a name="l00005"></a>00005 <span class="comment"> * Written by Cédric Moonen (cedric_moonen@hotmail.com)</span>
|
||||||
|
<a name="l00006"></a>00006 <span class="comment"> *</span>
|
||||||
|
<a name="l00007"></a>00007 <span class="comment"> *</span>
|
||||||
|
<a name="l00008"></a>00008 <span class="comment"> *</span>
|
||||||
|
<a name="l00009"></a>00009 <span class="comment"> * This code may be used for any non-commercial and commercial purposes in a compiled form.</span>
|
||||||
|
<a name="l00010"></a>00010 <span class="comment"> * The code may be redistributed as long as it remains unmodified and providing that the </span>
|
||||||
|
<a name="l00011"></a>00011 <span class="comment"> * author name and this disclaimer remain intact. The sources can be modified WITH the author </span>
|
||||||
|
<a name="l00012"></a>00012 <span class="comment"> * consent only.</span>
|
||||||
|
<a name="l00013"></a>00013 <span class="comment"> * </span>
|
||||||
|
<a name="l00014"></a>00014 <span class="comment"> * This code is provided without any garanties. I cannot be held responsible for the damage or</span>
|
||||||
|
<a name="l00015"></a>00015 <span class="comment"> * the loss of time it causes. Use it at your own risks</span>
|
||||||
|
<a name="l00016"></a>00016 <span class="comment"> *</span>
|
||||||
|
<a name="l00017"></a>00017 <span class="comment"> * An e-mail to notify me that you are using this code is appreciated also.</span>
|
||||||
|
<a name="l00018"></a>00018 <span class="comment"> *</span>
|
||||||
|
<a name="l00019"></a>00019 <span class="comment"> *</span>
|
||||||
|
<a name="l00020"></a>00020 <span class="comment"> */</span>
|
||||||
|
<a name="l00021"></a>00021
|
||||||
|
<a name="l00022"></a>00022 <span class="preprocessor">#pragma once</span>
|
||||||
|
<a name="l00023"></a>00023 <span class="preprocessor"></span>
|
||||||
|
<a name="l00024"></a>00024 <span class="preprocessor">#include "PointsOrdering.h"</span>
|
||||||
|
<a name="l00025"></a>00025
|
||||||
|
<a name="l00027"></a>00027
|
||||||
|
<a name="l00041"></a>00041 <span class="keyword">template</span> <<span class="keyword">class</span> T>
|
||||||
|
<a name="l00042"></a><a class="code" href="class_c_chart_points_array.html">00042</a> <span class="keyword">class </span><a class="code" href="class_c_chart_points_array.html" title="Manages an array of points which supports fast resizing.">CChartPointsArray</a>
|
||||||
|
<a name="l00043"></a>00043 {
|
||||||
|
<a name="l00044"></a>00044 <span class="keyword">public</span>:
|
||||||
|
<a name="l00046"></a>00046
|
||||||
|
<a name="l00050"></a>00050 <a class="code" href="class_c_chart_points_array.html#306219833d94da1fc1c916337ac7aa64" title="Constructor.">CChartPointsArray</a>(<span class="keywordtype">unsigned</span> iResize = 1000);
|
||||||
|
<a name="l00052"></a>00052 <a class="code" href="class_c_chart_points_array.html#76a2073ae326557e19dc20c32f03b2b3" title="Destructor.">~CChartPointsArray</a>();
|
||||||
|
<a name="l00053"></a>00053
|
||||||
|
<a name="l00055"></a><a class="code" href="class_c_chart_points_array.html#14e51004533e2a11a5439ddacf45c4df">00055</a> <span class="keywordtype">unsigned</span> <a class="code" href="class_c_chart_points_array.html#14e51004533e2a11a5439ddacf45c4df" title="Returns the number of points currently stored.">GetPointsCount</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_iCurrentPoints; }
|
||||||
|
<a name="l00057"></a><a class="code" href="class_c_chart_points_array.html#99b172d588b8f52a9d92a5e172c3b3ea">00057</a> <span class="keywordtype">void</span> <a class="code" href="class_c_chart_points_array.html#99b172d588b8f52a9d92a5e172c3b3ea" title="Sets the size by which the internal buffer is increased when reallocation occurs...">SetResize</a>(<span class="keywordtype">int</span> iResize) { m_iResize = iResize; }
|
||||||
|
<a name="l00058"></a>00058
|
||||||
|
<a name="l00060"></a>00060
|
||||||
|
<a name="l00064"></a>00064 <span class="keywordtype">void</span> <a class="code" href="class_c_chart_points_array.html#2436ef788bdddea716368bf9fd53b137" title="Adds a new point in the array.">AddPoint</a>(<span class="keyword">const</span> T& newPoint);
|
||||||
|
<a name="l00066"></a>00066
|
||||||
|
<a name="l00073"></a>00073 <span class="keywordtype">void</span> <a class="code" href="class_c_chart_points_array.html#31bf9b006fc415dc24825f4ac3e37fdb" title="Adds multiple points in the array.">AddPoints</a>(T* pPoints, <span class="keywordtype">unsigned</span> uCount);
|
||||||
|
<a name="l00075"></a>00075
|
||||||
|
<a name="l00083"></a>00083 <span class="keywordtype">void</span> <a class="code" href="class_c_chart_points_array.html#618bd5da7808d72f2be49426c7d4a1cf" title="Sets multiple points in the array.">SetPoints</a>(T* pPoints, <span class="keywordtype">unsigned</span> uCount);
|
||||||
|
<a name="l00085"></a>00085 <span class="keywordtype">void</span> <a class="code" href="class_c_chart_points_array.html#dd96443d7ca79ec5814bb407989b192e" title="Removes all the points from the array.">Clear</a>();
|
||||||
|
<a name="l00087"></a>00087 <span class="keywordtype">void</span> <a class="code" href="class_c_chart_points_array.html#3e079eead0d0591cb9b45f8b8fae81bc" title="Removes a certain amount of points from the begining of the series.">RemovePointsFromBegin</a>(<span class="keywordtype">unsigned</span> Count);
|
||||||
|
<a name="l00089"></a>00089 <span class="keywordtype">void</span> <a class="code" href="class_c_chart_points_array.html#89b388ad9dd6c2ae6dde667d28922487" title="Removes a certain amount of points from the end of the series.">RemovePointsFromEnd</a>(<span class="keywordtype">unsigned</span> Count);
|
||||||
|
<a name="l00091"></a>00091 T& <a class="code" href="class_c_chart_points_array.html#10599fee74f8498a04937904e01268dc" title="Retrieves the points at the specified index.">operator[]</a>(<span class="keywordtype">unsigned</span> Index);
|
||||||
|
<a name="l00093"></a>00093 <span class="keyword">const</span> T& <a class="code" href="class_c_chart_points_array.html#10599fee74f8498a04937904e01268dc" title="Retrieves the points at the specified index.">operator[]</a>(<span class="keywordtype">unsigned</span> Index) <span class="keyword">const</span>;
|
||||||
|
<a name="l00094"></a>00094
|
||||||
|
<a name="l00096"></a>00096 <span class="keywordtype">bool</span> <a class="code" href="class_c_chart_points_array.html#1138bafdd91a2c6ef305207a1a6b598d" title="Retrieves the minimum and maximum X values of the points stored in the array.">GetSerieXMinMax</a>(<span class="keywordtype">double</span>& Min, <span class="keywordtype">double</span>& Max) <span class="keyword">const</span>;
|
||||||
|
<a name="l00098"></a>00098 <span class="keywordtype">bool</span> <a class="code" href="class_c_chart_points_array.html#6ed3dbce7b7751bd39a82edd661a0f39" title="Retrieves the minimum and maximum Y values of the points stored in the array.">GetSerieYMinMax</a>(<span class="keywordtype">double</span>& Min, <span class="keywordtype">double</span>& Max) <span class="keyword">const</span>;
|
||||||
|
<a name="l00099"></a>00099
|
||||||
|
<a name="l00101"></a>00101
|
||||||
|
<a name="l00108"></a>00108 <span class="keywordtype">void</span> <a class="code" href="class_c_chart_points_array.html#ccfcfe146bb30456165bf541d0ade059" title="Specifies how the points should be ordered in the array.">SetOrdering</a>(PointsOrdering newOrdering);
|
||||||
|
<a name="l00110"></a><a class="code" href="class_c_chart_points_array.html#e59a67f001aa8d514f8c689b717930de">00110</a> PointsOrdering <a class="code" href="class_c_chart_points_array.html#e59a67f001aa8d514f8c689b717930de" title="Retrieves the ordering of the points in the array.">GetOrdering</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_Ordering; }
|
||||||
|
<a name="l00112"></a>00112 <span class="keywordtype">void</span> <a class="code" href="class_c_chart_points_array.html#e1cb8f6fddef4ad34dec4b6e4cd73069" title="Refreshes the point ordering.">ReorderPoints</a>();
|
||||||
|
<a name="l00113"></a>00113
|
||||||
|
<a name="l00115"></a>00115
|
||||||
|
<a name="l00128"></a>00128 <span class="keywordtype">bool</span> <a class="code" href="class_c_chart_points_array.html#2b4e7aa01948425b27cd91775dfba900" title="Retrieves the index of the points which are between two given values.">GetVisiblePoints</a>(<span class="keywordtype">double</span> dAxisMin, <span class="keywordtype">double</span> dAxisMax,
|
||||||
|
<a name="l00129"></a>00129 <span class="keywordtype">unsigned</span>& uFirstPt, <span class="keywordtype">unsigned</span>& uLastPt) <span class="keyword">const</span>;
|
||||||
|
<a name="l00130"></a>00130
|
||||||
|
<a name="l00131"></a>00131
|
||||||
|
<a name="l00133"></a><a class="code" href="class_c_chart_points_array.html#c73536ce52d2d4b8eddd4604aa5bde30">00133</a> T* <a class="code" href="class_c_chart_points_array.html#c73536ce52d2d4b8eddd4604aa5bde30" title="Returns the internal buffer of the array.">GetInternalBuffer</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_pPoints; }
|
||||||
|
<a name="l00134"></a>00134
|
||||||
|
<a name="l00135"></a>00135 <span class="keyword">private</span>:
|
||||||
|
<a name="l00137"></a>00137 <span class="keywordtype">double</span> m_dXMinVal;
|
||||||
|
<a name="l00139"></a>00139 <span class="keywordtype">double</span> m_dXMaxVal;
|
||||||
|
<a name="l00141"></a>00141 <span class="keywordtype">double</span> m_dYMinVal;
|
||||||
|
<a name="l00143"></a>00143 <span class="keywordtype">double</span> m_dYMaxVal;
|
||||||
|
<a name="l00144"></a>00144
|
||||||
|
<a name="l00146"></a>00146 <span class="keywordtype">void</span> RefreshMinMax();
|
||||||
|
<a name="l00148"></a>00148 <span class="keywordtype">void</span> InsertNewPoint(<span class="keyword">const</span> T& newPoint);
|
||||||
|
<a name="l00150"></a>00150 <span class="keywordtype">void</span> InsertPointAtPos(<span class="keyword">const</span> T& newPoint, <span class="keywordtype">int</span> iPos);
|
||||||
|
<a name="l00152"></a>00152 <span class="keyword">static</span> <span class="keywordtype">int</span> ComparePointsOnX(<span class="keywordtype">void</span> <span class="keyword">const</span>* pA, <span class="keywordtype">void</span> <span class="keyword">const</span>* pB);
|
||||||
|
<a name="l00154"></a>00154 <span class="keyword">static</span> <span class="keywordtype">int</span> ComparePointsOnY(<span class="keywordtype">void</span> <span class="keyword">const</span>* pA, <span class="keywordtype">void</span> <span class="keyword">const</span>* pB);
|
||||||
|
<a name="l00156"></a>00156 <span class="keywordtype">int</span> BinarySearch(<span class="keywordtype">unsigned</span> uLeft, <span class="keywordtype">unsigned</span> uRight, <span class="keywordtype">double</span> dFind) <span class="keyword">const</span>;
|
||||||
|
<a name="l00157"></a>00157
|
||||||
|
<a name="l00159"></a>00159 T* m_pPoints;
|
||||||
|
<a name="l00161"></a>00161 <span class="keywordtype">unsigned</span> m_iMaxPoints;
|
||||||
|
<a name="l00163"></a>00163 <span class="keywordtype">unsigned</span> m_iCurrentPoints;
|
||||||
|
<a name="l00165"></a>00165 <span class="keywordtype">unsigned</span> m_iResize;
|
||||||
|
<a name="l00167"></a>00167 PointsOrdering m_Ordering;
|
||||||
|
<a name="l00168"></a>00168 };
|
||||||
|
<a name="l00169"></a>00169
|
||||||
|
<a name="l00170"></a>00170 <span class="preprocessor">#include "ChartPointsArray.inl"</span>
|
||||||
|
</pre></div></div>
|
||||||
|
<hr size="1"><address style="text-align: right;"><small>Generated on Sun Jan 17 13:33:09 2010 for ChartDemo by
|
||||||
|
<a href="http://www.doxygen.org/index.html">
|
||||||
|
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.8 </small></address>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -0,0 +1,102 @@
|
||||||
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||||
|
<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
|
||||||
|
<title>ChartDemo: E:/Sources Misc/ChartDemo/ChartCtrl/ChartPointsSerie.h Source File</title>
|
||||||
|
<link href="tabs.css" rel="stylesheet" type="text/css">
|
||||||
|
<link href="doxygen.css" rel="stylesheet" type="text/css">
|
||||||
|
</head><body>
|
||||||
|
<!-- Generated by Doxygen 1.5.8 -->
|
||||||
|
<div class="navigation" id="top">
|
||||||
|
<div class="tabs">
|
||||||
|
<ul>
|
||||||
|
<li><a href="index.html"><span>Main Page</span></a></li>
|
||||||
|
<li><a href="pages.html"><span>Related Pages</span></a></li>
|
||||||
|
<li><a href="annotated.html"><span>Classes</span></a></li>
|
||||||
|
<li class="current"><a href="files.html"><span>Files</span></a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="tabs">
|
||||||
|
<ul>
|
||||||
|
<li><a href="files.html"><span>File List</span></a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<h1>E:/Sources Misc/ChartDemo/ChartCtrl/ChartPointsSerie.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span>
|
||||||
|
<a name="l00002"></a>00002 <span class="comment"> *</span>
|
||||||
|
<a name="l00003"></a>00003 <span class="comment"> * ChartPointsSerie.h</span>
|
||||||
|
<a name="l00004"></a>00004 <span class="comment"> *</span>
|
||||||
|
<a name="l00005"></a>00005 <span class="comment"> * Written by Cédric Moonen (cedric_moonen@hotmail.com)</span>
|
||||||
|
<a name="l00006"></a>00006 <span class="comment"> *</span>
|
||||||
|
<a name="l00007"></a>00007 <span class="comment"> *</span>
|
||||||
|
<a name="l00008"></a>00008 <span class="comment"> *</span>
|
||||||
|
<a name="l00009"></a>00009 <span class="comment"> * This code may be used for any non-commercial and commercial purposes in a compiled form.</span>
|
||||||
|
<a name="l00010"></a>00010 <span class="comment"> * The code may be redistributed as long as it remains unmodified and providing that the </span>
|
||||||
|
<a name="l00011"></a>00011 <span class="comment"> * author name and this disclaimer remain intact. The sources can be modified WITH the author </span>
|
||||||
|
<a name="l00012"></a>00012 <span class="comment"> * consent only.</span>
|
||||||
|
<a name="l00013"></a>00013 <span class="comment"> * </span>
|
||||||
|
<a name="l00014"></a>00014 <span class="comment"> * This code is provided without any garanties. I cannot be held responsible for the damage or</span>
|
||||||
|
<a name="l00015"></a>00015 <span class="comment"> * the loss of time it causes. Use it at your own risks</span>
|
||||||
|
<a name="l00016"></a>00016 <span class="comment"> *</span>
|
||||||
|
<a name="l00017"></a>00017 <span class="comment"> * An e-mail to notify me that you are using this code is appreciated also.</span>
|
||||||
|
<a name="l00018"></a>00018 <span class="comment"> *</span>
|
||||||
|
<a name="l00019"></a>00019 <span class="comment"> *</span>
|
||||||
|
<a name="l00020"></a>00020 <span class="comment"> */</span>
|
||||||
|
<a name="l00021"></a>00021
|
||||||
|
<a name="l00022"></a>00022 <span class="preprocessor">#if !defined(AFX_CHARTPOINTSSERIE_H__F66C180F_F04C_4E2D_878C_08BDBCE91863__INCLUDED_)</span>
|
||||||
|
<a name="l00023"></a>00023 <span class="preprocessor"></span><span class="preprocessor">#define AFX_CHARTPOINTSSERIE_H__F66C180F_F04C_4E2D_878C_08BDBCE91863__INCLUDED_</span>
|
||||||
|
<a name="l00024"></a>00024 <span class="preprocessor"></span>
|
||||||
|
<a name="l00025"></a>00025 <span class="preprocessor">#if _MSC_VER > 1000</span>
|
||||||
|
<a name="l00026"></a>00026 <span class="preprocessor"></span><span class="preprocessor">#pragma once</span>
|
||||||
|
<a name="l00027"></a>00027 <span class="preprocessor"></span><span class="preprocessor">#endif // _MSC_VER > 1000</span>
|
||||||
|
<a name="l00028"></a>00028 <span class="preprocessor"></span>
|
||||||
|
<a name="l00029"></a>00029 <span class="preprocessor">#include "ChartXYSerie.h"</span>
|
||||||
|
<a name="l00030"></a>00030
|
||||||
|
<a name="l00032"></a>00032
|
||||||
|
<a name="l00035"></a><a class="code" href="class_c_chart_points_serie.html">00035</a> <span class="keyword">class </span><a class="code" href="class_c_chart_points_serie.html" title="Specialization of a CChartSerie to display a points series.">CChartPointsSerie</a> : <span class="keyword">public</span> <a class="code" href="class_c_chart_x_y_serie.html" title="Specialization of a CChartSerieBase for series having data with an X and an Y value...">CChartXYSerie</a>
|
||||||
|
<a name="l00036"></a>00036 {
|
||||||
|
<a name="l00037"></a>00037 <span class="keyword">public</span>:
|
||||||
|
<a name="l00039"></a><a class="code" href="class_c_chart_points_serie.html#1c3c8b85498adc24771ff501645b1be8">00039</a> <span class="keyword">enum</span> <a class="code" href="class_c_chart_points_serie.html#1c3c8b85498adc24771ff501645b1be8" title="The different point shapes.">PointType</a>
|
||||||
|
<a name="l00040"></a>00040 {
|
||||||
|
<a name="l00041"></a>00041 ptEllipse=0,
|
||||||
|
<a name="l00042"></a>00042 ptRectangle=1,
|
||||||
|
<a name="l00043"></a>00043 ptTriangle=2
|
||||||
|
<a name="l00044"></a>00044 };
|
||||||
|
<a name="l00045"></a>00045
|
||||||
|
<a name="l00047"></a>00047 <span class="keywordtype">void</span> <a class="code" href="class_c_chart_points_serie.html#d83eb64abdf71a9a2eb36033cc97a32b" title="Sets the width and height of each points.">SetPointSize</a>(<span class="keywordtype">int</span> XSize, <span class="keywordtype">int</span> YSize);
|
||||||
|
<a name="l00049"></a><a class="code" href="class_c_chart_points_serie.html#bc86737dbc712394282675bfd0e2eae0">00049</a> <span class="keywordtype">void</span> <a class="code" href="class_c_chart_points_serie.html#bc86737dbc712394282675bfd0e2eae0" title="Retrieves the width and height of each points.">GetPointSize</a>(<span class="keywordtype">int</span>& XSize, <span class="keywordtype">int</span>& YSize)<span class="keyword"> const</span>
|
||||||
|
<a name="l00050"></a>00050 <span class="keyword"> </span>{
|
||||||
|
<a name="l00051"></a>00051 XSize = m_iXPointSize;
|
||||||
|
<a name="l00052"></a>00052 YSize = m_iYPointSize;
|
||||||
|
<a name="l00053"></a>00053 }
|
||||||
|
<a name="l00055"></a>00055 <span class="keywordtype">void</span> <a class="code" href="class_c_chart_points_serie.html#78e263b62e046ae765f5cdf3b7760442" title="Sets the points shape.">SetPointType</a>(<a class="code" href="class_c_chart_points_serie.html#1c3c8b85498adc24771ff501645b1be8" title="The different point shapes.">PointType</a> Type);
|
||||||
|
<a name="l00057"></a><a class="code" href="class_c_chart_points_serie.html#3522a357f3af5a82ad5f5950a9b8eb68">00057</a> <a class="code" href="class_c_chart_points_serie.html#1c3c8b85498adc24771ff501645b1be8" title="The different point shapes.">PointType</a> <a class="code" href="class_c_chart_points_serie.html#3522a357f3af5a82ad5f5950a9b8eb68" title="Returns the points shape.">GetPointType</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_iPointType; }
|
||||||
|
<a name="l00058"></a>00058
|
||||||
|
<a name="l00060"></a>00060 <span class="keywordtype">void</span> <a class="code" href="class_c_chart_points_serie.html#4c114ea9ddbf680f2ade770755bbb4e1" title="Sets the border color of the points.">SetBorderColor</a>(COLORREF Color);
|
||||||
|
<a name="l00062"></a><a class="code" href="class_c_chart_points_serie.html#a2a8c39d30f8556e595cf1184ef10eb0">00062</a> COLORREF <a class="code" href="class_c_chart_points_serie.html#a2a8c39d30f8556e595cf1184ef10eb0" title="Returns the border color of the points.">GetBorderColor</a>() { <span class="keywordflow">return</span> m_colBorder; }
|
||||||
|
<a name="l00063"></a>00063
|
||||||
|
<a name="l00065"></a>00065 <a class="code" href="class_c_chart_points_serie.html#f26f71f622ad00186992c17cdc7c8164" title="Constructor.">CChartPointsSerie</a>(<a class="code" href="class_c_chart_ctrl.html" title="The main chart control class.">CChartCtrl</a>* pParent);
|
||||||
|
<a name="l00067"></a>00067 <span class="keyword">virtual</span> <a class="code" href="class_c_chart_points_serie.html#443840d759ffcde1c40fd95ca9951788" title="Destructor.">~CChartPointsSerie</a>();
|
||||||
|
<a name="l00068"></a>00068
|
||||||
|
<a name="l00070"></a>00070
|
||||||
|
<a name="l00077"></a>00077 <span class="keywordtype">bool</span> <a class="code" href="class_c_chart_points_serie.html#da57c96010550fa96a65a803644e3521" title="Check whether a screen point is on the series.">IsPointOnSerie</a>(<span class="keyword">const</span> CPoint& screenPoint, <span class="keywordtype">unsigned</span>& uIndex) <span class="keyword">const</span>;
|
||||||
|
<a name="l00078"></a>00078
|
||||||
|
<a name="l00079"></a>00079 <span class="keyword">private</span>:
|
||||||
|
<a name="l00081"></a>00081
|
||||||
|
<a name="l00088"></a>00088 <span class="keywordtype">void</span> DrawLegend(CDC* pDC, <span class="keyword">const</span> CRect& rectBitmap) <span class="keyword">const</span>;
|
||||||
|
<a name="l00089"></a>00089
|
||||||
|
<a name="l00091"></a>00091
|
||||||
|
<a name="l00098"></a>00098 <span class="keywordtype">void</span> Draw(CDC* pDC);
|
||||||
|
<a name="l00100"></a>00100
|
||||||
|
<a name="l00105"></a>00105 <span class="keywordtype">void</span> DrawAll(CDC *pDC);
|
||||||
|
<a name="l00106"></a>00106
|
||||||
|
<a name="l00108"></a>00108 <span class="keywordtype">int</span> m_iXPointSize;
|
||||||
|
<a name="l00110"></a>00110 <span class="keywordtype">int</span> m_iYPointSize;
|
||||||
|
<a name="l00112"></a>00112 <a class="code" href="class_c_chart_points_serie.html#1c3c8b85498adc24771ff501645b1be8" title="The different point shapes.">PointType</a> m_iPointType;
|
||||||
|
<a name="l00114"></a>00114 COLORREF m_colBorder;
|
||||||
|
<a name="l00115"></a>00115 };
|
||||||
|
<a name="l00116"></a>00116
|
||||||
|
<a name="l00117"></a>00117 <span class="preprocessor">#endif // !defined(AFX_CHARTPOINTSSERIE_H__F66C180F_F04C_4E2D_878C_08BDBCE91863__INCLUDED_)</span>
|
||||||
|
</pre></div></div>
|
||||||
|
<hr size="1"><address style="text-align: right;"><small>Generated on Sun Jan 17 13:33:10 2010 for ChartDemo by
|
||||||
|
<a href="http://www.doxygen.org/index.html">
|
||||||
|
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.8 </small></address>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -0,0 +1,84 @@
|
||||||
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||||
|
<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
|
||||||
|
<title>ChartDemo: E:/Sources Misc/ChartDemo/ChartCtrl/ChartScrollBar.h Source File</title>
|
||||||
|
<link href="tabs.css" rel="stylesheet" type="text/css">
|
||||||
|
<link href="doxygen.css" rel="stylesheet" type="text/css">
|
||||||
|
</head><body>
|
||||||
|
<!-- Generated by Doxygen 1.5.8 -->
|
||||||
|
<div class="navigation" id="top">
|
||||||
|
<div class="tabs">
|
||||||
|
<ul>
|
||||||
|
<li><a href="index.html"><span>Main Page</span></a></li>
|
||||||
|
<li><a href="pages.html"><span>Related Pages</span></a></li>
|
||||||
|
<li><a href="annotated.html"><span>Classes</span></a></li>
|
||||||
|
<li class="current"><a href="files.html"><span>Files</span></a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="tabs">
|
||||||
|
<ul>
|
||||||
|
<li><a href="files.html"><span>File List</span></a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<h1>E:/Sources Misc/ChartDemo/ChartCtrl/ChartScrollBar.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span>
|
||||||
|
<a name="l00002"></a>00002 <span class="comment"> *</span>
|
||||||
|
<a name="l00003"></a>00003 <span class="comment"> * ChartScrollBar.h</span>
|
||||||
|
<a name="l00004"></a>00004 <span class="comment"> *</span>
|
||||||
|
<a name="l00005"></a>00005 <span class="comment"> * Written by Cédric Moonen (cedric_moonen@hotmail.com)</span>
|
||||||
|
<a name="l00006"></a>00006 <span class="comment"> *</span>
|
||||||
|
<a name="l00007"></a>00007 <span class="comment"> *</span>
|
||||||
|
<a name="l00008"></a>00008 <span class="comment"> *</span>
|
||||||
|
<a name="l00009"></a>00009 <span class="comment"> * This code may be used for any non-commercial and commercial purposes in a compiled form.</span>
|
||||||
|
<a name="l00010"></a>00010 <span class="comment"> * The code may be redistributed as long as it remains unmodified and providing that the </span>
|
||||||
|
<a name="l00011"></a>00011 <span class="comment"> * author name and this disclaimer remain intact. The sources can be modified WITH the author </span>
|
||||||
|
<a name="l00012"></a>00012 <span class="comment"> * consent only.</span>
|
||||||
|
<a name="l00013"></a>00013 <span class="comment"> * </span>
|
||||||
|
<a name="l00014"></a>00014 <span class="comment"> * This code is provided without any garanties. I cannot be held responsible for the damage or</span>
|
||||||
|
<a name="l00015"></a>00015 <span class="comment"> * the loss of time it causes. Use it at your own risks</span>
|
||||||
|
<a name="l00016"></a>00016 <span class="comment"> *</span>
|
||||||
|
<a name="l00017"></a>00017 <span class="comment"> * An e-mail to notify me that you are using this code is appreciated also.</span>
|
||||||
|
<a name="l00018"></a>00018 <span class="comment"> *</span>
|
||||||
|
<a name="l00019"></a>00019 <span class="comment"> *</span>
|
||||||
|
<a name="l00020"></a>00020 <span class="comment"> */</span>
|
||||||
|
<a name="l00021"></a>00021
|
||||||
|
<a name="l00022"></a>00022 <span class="preprocessor">#pragma once</span>
|
||||||
|
<a name="l00023"></a>00023 <span class="preprocessor"></span>
|
||||||
|
<a name="l00024"></a>00024 <span class="keyword">class </span><a class="code" href="class_c_chart_axis.html" title="Base class that takes care of the management of a chart axis.">CChartAxis</a>;
|
||||||
|
<a name="l00025"></a>00025
|
||||||
|
<a name="l00027"></a>00027
|
||||||
|
<a name="l00030"></a><a class="code" href="class_c_chart_scroll_bar.html">00030</a> <span class="keyword">class </span><a class="code" href="class_c_chart_scroll_bar.html" title="Class which manages the interaction with the axis scroll bar.">CChartScrollBar</a> : <span class="keyword">public</span> CScrollBar
|
||||||
|
<a name="l00031"></a>00031 {
|
||||||
|
<a name="l00032"></a>00032 <span class="keyword">friend</span> <a class="code" href="class_c_chart_axis.html" title="Base class that takes care of the management of a chart axis.">CChartAxis</a>;
|
||||||
|
<a name="l00033"></a>00033
|
||||||
|
<a name="l00034"></a>00034 <span class="keyword">public</span>:
|
||||||
|
<a name="l00036"></a>00036 <span class="keywordtype">void</span> <a class="code" href="class_c_chart_scroll_bar.html#fd81755f9221643097d71b0ad919d203" title="Creates the scroll bar within a specified rectangle.">CreateScrollBar</a>(<span class="keyword">const</span> CRect& PlottingRect);
|
||||||
|
<a name="l00037"></a>00037
|
||||||
|
<a name="l00039"></a>00039 <span class="keywordtype">void</span> <a class="code" href="class_c_chart_scroll_bar.html#9192b0e2c5bafdef560cdd28690299c6" title="Called on horizontal scrolling.">OnHScroll</a>(UINT nSBCode, UINT nPos);
|
||||||
|
<a name="l00041"></a>00041 <span class="keywordtype">void</span> <a class="code" href="class_c_chart_scroll_bar.html#80a7bccff25ffa0c7b928c4419b052d0" title="Called on vertical scrolling.">OnVScroll</a>(UINT nSBCode, UINT nPos);
|
||||||
|
<a name="l00043"></a>00043 <span class="keywordtype">void</span> <a class="code" href="class_c_chart_scroll_bar.html#a390273b9f3f4243e3667be5d09b5fcb" title="Refreshes the scroll bar position.">Refresh</a>();
|
||||||
|
<a name="l00044"></a>00044
|
||||||
|
<a name="l00046"></a><a class="code" href="class_c_chart_scroll_bar.html#8d49e8bb3d1d8e7f0606855137ae5114">00046</a> <span class="keywordtype">void</span> <a class="code" href="class_c_chart_scroll_bar.html#8d49e8bb3d1d8e7f0606855137ae5114" title="Enables/disables the scroll bar.">SetEnabled</a>(<span class="keywordtype">bool</span> bEnabled) { m_bEnabled = bEnabled; }
|
||||||
|
<a name="l00048"></a><a class="code" href="class_c_chart_scroll_bar.html#f71fa8b4d24a4b5d8ae6577b0a4691f5">00048</a> <span class="keywordtype">bool</span> <a class="code" href="class_c_chart_scroll_bar.html#f71fa8b4d24a4b5d8ae6577b0a4691f5" title="Returns true if the scroll bar is enabled.">GetEnabled</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_bEnabled; }
|
||||||
|
<a name="l00050"></a>00050
|
||||||
|
<a name="l00054"></a><a class="code" href="class_c_chart_scroll_bar.html#7a39f2691c50f60f85b5f6abffff10d5">00054</a> <span class="keywordtype">void</span> <a class="code" href="class_c_chart_scroll_bar.html#7a39f2691c50f60f85b5f6abffff10d5" title="Enables/disables the auto-hide mode.">SetAutoHide</a>(<span class="keywordtype">bool</span> bAutoHide) { m_bAutoHide = bAutoHide; }
|
||||||
|
<a name="l00056"></a><a class="code" href="class_c_chart_scroll_bar.html#f2ec9b07c5f1e800aee44fb844b8e5ad">00056</a> <span class="keywordtype">bool</span> <a class="code" href="class_c_chart_scroll_bar.html#f2ec9b07c5f1e800aee44fb844b8e5ad" title="Returns true if the auto-hide mode is activated.">GetAutoHide</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_bAutoHide; }
|
||||||
|
<a name="l00057"></a>00057
|
||||||
|
<a name="l00059"></a>00059 <span class="keywordtype">void</span> <a class="code" href="class_c_chart_scroll_bar.html#f7714e4b05c62bd3a4ad10e3e62fbd87" title="Called when the mouse enters the scroll bar area.">OnMouseEnter</a>();
|
||||||
|
<a name="l00061"></a>00061 <span class="keywordtype">void</span> <a class="code" href="class_c_chart_scroll_bar.html#cec567d8be6853724afd047a5a74a6c9" title="Called when the mouse leaves the scroll bar area.">OnMouseLeave</a>();
|
||||||
|
<a name="l00062"></a>00062
|
||||||
|
<a name="l00063"></a>00063 <span class="keyword">private</span>:
|
||||||
|
<a name="l00065"></a>00065 <a class="code" href="class_c_chart_scroll_bar.html" title="Class which manages the interaction with the axis scroll bar.">CChartScrollBar</a>(<a class="code" href="class_c_chart_axis.html" title="Base class that takes care of the management of a chart axis.">CChartAxis</a>* pParentAxis);
|
||||||
|
<a name="l00067"></a>00067 ~<a class="code" href="class_c_chart_scroll_bar.html" title="Class which manages the interaction with the axis scroll bar.">CChartScrollBar</a>();
|
||||||
|
<a name="l00068"></a>00068
|
||||||
|
<a name="l00069"></a>00069 <span class="keywordtype">bool</span> IsScrollInverted() <span class="keyword">const</span>;
|
||||||
|
<a name="l00070"></a>00070 <span class="keywordtype">void</span> MoveAxisToPos(<span class="keywordtype">int</span> PreviousPos, <span class="keywordtype">int</span> CurPos);
|
||||||
|
<a name="l00071"></a>00071
|
||||||
|
<a name="l00072"></a>00072 <a class="code" href="class_c_chart_axis.html" title="Base class that takes care of the management of a chart axis.">CChartAxis</a>* m_pParentAxis;
|
||||||
|
<a name="l00073"></a>00073 <span class="keywordtype">bool</span> m_bEnabled;
|
||||||
|
<a name="l00074"></a>00074 <span class="keywordtype">bool</span> m_bAutoHide;
|
||||||
|
<a name="l00075"></a>00075 };
|
||||||
|
</pre></div></div>
|
||||||
|
<hr size="1"><address style="text-align: right;"><small>Generated on Sun Jan 17 13:33:10 2010 for ChartDemo by
|
||||||
|
<a href="http://www.doxygen.org/index.html">
|
||||||
|
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.8 </small></address>
|
||||||
|
</body>
|
||||||
|
</html>
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue