Print Page | Close Window

UpdateDiagram() buggy!

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Chart Control
Forum Description: Topics Related to Codejock Chart Control
URL: http://forum.codejock.com/forum_posts.asp?TID=18901
Printed Date: 04 December 2024 at 2:24pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: UpdateDiagram() buggy!
Posted By: znakeeye
Subject: UpdateDiagram() buggy!
Date 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/



Replies:
Posted By: znakeeye
Date 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/


Posted By: znakeeye
Date 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/



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net