Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Chart Control
  New Posts New Posts RSS Feed - UpdateDiagram() buggy!
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

UpdateDiagram() buggy!

 Post Reply Post Reply
Author
Message
znakeeye View Drop Down
Senior Member
Senior Member
Avatar

Joined: 26 July 2006
Status: Offline
Points: 1672
Post Options Post Options   Thanks (0) Thanks(0)   Quote znakeeye Quote  Post ReplyReply Direct Link To This Post Topic: UpdateDiagram() buggy!
    Posted: 04 September 2011 at 7:02pm
Consider this type of diagram:
 
Clearly, the coloring is wrong. I've tried playing with SetColorEach() and SetLegendVisible() but with no success. Digging into the source code reveals the issue. UpdateDiagram() does not check for the above! Palette index should be reset for each series!
 
void CXTPChartContent::UpdateDiagram()
{
    int i;
    int nIndex = 0;
    for (i = 0; i < GetSeries()->GetCount(); i++)
    {
        CXTPChartSeries* pSeries = GetSeries()->GetAt(i);
        if (!pSeries->IsVisible())
            continue;
        if (!pSeries->GetStyle())
            continue;
        if (pSeries->GetStyle()->IsColorEach())
        {
            for (int j = 0; j < pSeries->GetPoints()->GetCount(); j++)
            {
                pSeries->GetPoints()->GetAt(j)->m_nPaletteIndex = nIndex++;
            }
        }
        else
        {
            pSeries->m_nPaletteIndex = nIndex++;
        }
    }
}
PokerMemento - http://www.pokermemento.com/
Back to Top
znakeeye View Drop Down
Senior Member
Senior Member
Avatar

Joined: 26 July 2006
Status: Offline
Points: 1672
Post Options Post Options   Thanks (0) Thanks(0)   Quote znakeeye Quote  Post ReplyReply Direct Link To This Post Posted: 04 September 2011 at 7:11pm
And... just as usual the most critical functions are not virtual. Unbelievable! :(
 
XTPChartContent.h:
void UpdateDiagram();
CXTPChartDeviceContext* CreateDeviceContext(CXTPChartContainer* pContainer, HDC hDC, CRect rcBounds, BOOL bWindowDC);
PokerMemento - http://www.pokermemento.com/
Back to Top
znakeeye View Drop Down
Senior Member
Senior Member
Avatar

Joined: 26 July 2006
Status: Offline
Points: 1672
Post Options Post Options   Thanks (0) Thanks(0)   Quote znakeeye Quote  Post ReplyReply Direct Link To This Post Posted: 07 September 2011 at 10:46am
While I'm at it, how do you set a title text above/under each pie?
PokerMemento - http://www.pokermemento.com/
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.137 seconds.