Originally posted by: Christian Schmidt
i discovered the graph-class just when i needed it and found it very useful! thanks to Massimo Colurcio!
but i encountered a small problem: while the demo-projekt works just fine, the graphs in my own prog are sometimes drawn below the x-axis where the label is located.
questions: how come? how to prevent this?
thanks in advance, christian.
ReplyOriginally posted by: Manny
Can I use this class with a dialog based app ... ? .... thanks ...
Manny
Reply
Originally posted by: Rohit Gupta
the demo project was made using MDI..i copied the classes and .h files in my SDI project..
i encountered a problem when a click for a new document..
please tell me how to change the code from MDI to SDI
thanx..
rohit
ReplyOriginally posted by: Patricia
I've found your code and I'm using it to show the results of a program I've made.
Patricia
Good evening, Mr.Colurcio:
It is really useful, it has helped me a lot because I didn't know how to show different kinds of graphs in the same image.
But as we see several graphs, I wonder how I could add the legends to know which graph is which.
Thank you very much in advance.
Originally posted by: Eric Jennings
I added a few things, so I thought that I would let you
void CMyViewClass::OnInitialUpdate()
CRect rect;
GetClientRect(&rect);
if( m_Chart.Create( NULL, _T("Hello World!"), style, rect,
...
void CHMXChart::OnPaint()
// Resize the chart to the size of the parent window.
I added some predefined colours so that I had more control
// pre-defined COLORREF values
Then I added m_sFmtYLabel member variable so that the
(Line marked with ##)
bool CHMXChart::DrawYScale(CDC & dc)
// draw text
if( !m_strYText.IsEmpty() ) {
Thanks again, Eric
Good job on this control, its very fast and light.
know. Your chart was added as one of my views to my
project. I just created a window using your class.
{
CView::OnInitialUpdate();
DWORD style;
style=WS_CHILD|WS_VISIBLE;
this, NULL, NULL ) == 0 )
AfxMessageBox( "Create Chart control failed", MB_OK );
}
Then I changed the OnPaint in the chart control to auto size.
{
CPaintDC dc(this); // device context for painting
CWnd *pWndOwner = this->GetOwner();
CRect rect;
pWndOwner->GetWindowRect( &rect );
this->MoveWindow(0,0, RECTWIDTH( &rect ), RECTHEIGHT( &rect ), TRUE);
...
}
over the title, label ect...
#define CR_BLACK RGB(0x00,0x00,0x00)
#define CR_BLUE RGB(0x00,0x00,0xFF)
#define CR_GREEN RGB(0x00,0xFF,0x00)
#define CR_CYAN RGB(0x00,0xFF,0xFF)
#define CR_RED RGB(0xFF,0x00,0x00)
#define CR_MAGENTA RGB(0xFF,0x00,0xFF)
#define CR_YELLOW RGB(0xFF,0xFF,0x00)
#define CR_WHITE RGB(0xFF,0xFF,0xFF)
#define CR_BLUE_BLACK RGB(0x00,0x00,0x3F)
#define CR_SOFT_BLUE RGB(0x5F,0x5F,0xFF)
#define CR_SOFT_GREEN RGB(0x5F,0xFF,0x5F)
#define CR_SOFT_CYAN RGB(0x5F,0xFF,0xFF)
#define CR_SOFT_RED RGB(0xFF,0x5F,0x5F)
#define CR_SOFT_MAGENTA RGB(0xFF,0x5F,0xFF)
#define CR_SOFT_YELLOW RGB(0xFF,0xFF,0x5F)
#define CR_SOFT_WHITE RGB(0xFF,0xFF,0xFF)
#define CR_BROWN RGB(0xBF,0x8F,0x00)
formatting of the Y axis label could be a little more flexable. (ie. set it to "$%.2f" to indicate dollars).
{
if( !m_bShowYScale )
return false;
...
for( f=0; f<=nTicks; f++ ) {
nTemp1 = m_rectYAxis.bottom + nFontSize/2 - ( nY*(f) ) * m_rectData.Height()/(m_nYMax-m_nYMin);
nTemp2 = m_rectYAxis.bottom + nFontSize/2 - ( nY*(f+1) ) * m_rectData.Height()/(m_nYMax-m_nYMin);
## sBuffer.Format( m_sFmtYLabel, m_nYMin + nY*f );
dc.DrawText( sBuffer, CRect( m_rectYAxis.left,(int)nTemp2, m_rectYAxis.right, (int)nTemp1 ),
DT_RIGHT | DT_BOTTOM | DT_SINGLELINE );
}
...
}
Originally posted by: hosang
Hi!
How can I scale the range from 0 in Y axie?
Originally posted by: Anonymous
Sound very good about this article, but where is the attached demo project to prove it?
Reply