7
7
// Copyright: (C) 2006, Paolo Gava
8
// RCS-ID: $Id: chart.cpp 4016 2007-05-30 23:08:39Z byo $
8
// RCS-ID: $Id: chart.cpp 5961 2009-12-08 06:24:32Z mortenmacfly $
9
9
// Licence: wxWindows licence
10
10
/////////////////////////////////////////////////////////////////////////////
14
14
//----------------------------------------------------------------------------
16
#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
17
#pragma implementation "chart.h"
17
20
// For compilers that support precompilation, includes "wx.h".
18
21
#include <wx/wxprec.h>
42
46
//+++-S-cf-------------------------------------------------------------------
45
49
// PARAMETERS: None
47
51
//----------------------------------------------------------------------E-+++
50
54
wxChartPoints* cptmp;
52
56
size_t num = m_LCP.GetCount();
54
for ( size_t loop = 0;
58
for ( size_t loop = 0;
58
62
cptmp = m_LCP.Item(loop);
65
69
//+++-S-cf-------------------------------------------------------------------
68
72
// PARAMETERS: CChartPoints* cp
70
74
//----------------------------------------------------------------------E-+++
78
82
//+++-S-cf-------------------------------------------------------------------
81
85
// PARAMETERS: None
83
87
//----------------------------------------------------------------------E-+++
110
114
//-----------------------------------------------------------------------
111
// if MaxX is 0 could be a Pie chart that doesn't have points like
112
// Bar chart so force this to be something != from 0, otherwise
115
// if MaxX is 0 could be a Pie chart that doesn't have points like
116
// Bar chart so force this to be something != from 0, otherwise
114
118
//-----------------------------------------------------------------------
115
119
if ( valRes == 0 )
118
122
return ( valRes );
156
160
ChartValue valTmp, valRes = 0;
158
162
size_t num = m_LCP.GetCount();
160
for ( size_t loop = 0;
164
for ( size_t loop = 0;
164
168
valTmp = (m_LCP.Item(loop))->GetMaxY();
165
169
if ( valTmp > valRes )
169
173
//-----------------------------------------------------------------------
170
// if MaxY is 0 could be a Pie chart that doesn't have points like
171
// Bar chart so force this to be something != from 0, otherwise
174
// if MaxY is 0 could be a Pie chart that doesn't have points like
175
// Bar chart so force this to be something != from 0, otherwise
173
177
//-----------------------------------------------------------------------
174
178
if ( valRes == 0 )
177
181
return ( valRes );
318
322
// PARAMETERS: None
319
323
// RETURN: ChartSizes sizes
320
324
//----------------------------------------------------------------------E-+++
321
ChartSizes wxChart::GetSizes() const
325
wxChartSizes* wxChart::GetSizes() const
323
327
size_t num = m_LCP.GetCount();
325
for ( size_t loop = 0;
329
for ( size_t loop = 0;
329
return (m_LCP.Item(loop))->GetSizes();
333
return (m_LCP.Item(loop))->GetSizes( );
335
339
//+++-S-cf-------------------------------------------------------------------
338
// PARAMETERS: CHART_HPAINT hp,
342
// PARAMETERS: CHART_HPAINT hp,
339
343
// CHART_HRECT hr
341
345
//----------------------------------------------------------------------E-+++
342
346
void wxChart::Draw(
347
351
int iBarCounter = 0;
348
352
int iBar3DCounter = 0;
349
353
int xTmp = hr->x;
351
355
size_t num = m_LCP.GetCount();
352
for ( size_t loop = 0;
356
for ( size_t loop = 0;
356
360
//-------------------------------------------------------------------
357
361
// Count the number of Bar-Bar3d charts so when more than one bar is
358
// present the first one is draw at position x, the second one at
362
// present the first one is draw at position x, the second one at
359
363
// position x+1*bar_width so just next to the previous one
360
364
//-------------------------------------------------------------------
362
ChartSizes sizes = m_LCP.Item(loop)->GetSizes();
365
static_cast<int>(sizes.wbar * m_LCP.Item(loop)->GetZoom()) +
367
static_cast<int>(sizes.wbar3d * m_LCP.Item(loop)->GetZoom())
366
wxChartSizes *sizes = m_LCP.Item(loop)->GetSizes();
369
static_cast<int>(sizes->GetWidthBar() *
370
m_LCP.Item(loop)->GetZoom()) +
372
static_cast<int>(sizes->GetWidthBar3d() *
373
m_LCP.Item(loop)->GetZoom())
370
376
if ( *(m_LCP.Item(loop)) == wxChartPointsTypes::Bar() )
372
378
iBarCounter += 1;
374
380
else if ( *m_LCP.Item(loop) == wxChartPointsTypes::Bar3D() )