|
Finance chart resizing and updating |
Posted by vas on Feb-12-2014 18:47 |
|
hi
i am working with finance chart, i have a problem while i am updating my finance chart
(i will be updating my chart for every min).i am posting my code below..the method will
when i am drawing initially and when i am updating ,resizing. FYI chart is drawn using a
picture control in dialogbar (MFC)
OLD METHOD
drawchart()
{
if(pFinancechart) // pfinancechart is a member variable
{
delete pFinanceChart;
pFinanceChart = NULL;
}
else
{
pFinanceChart = new FinanceChart(initialwidth);
}
pFinanceChart->setData(timeStamps, highData, lowData, openData, closeData,
volData);
pFinanceChart->addMainChart(Height); //height and width i will be calculating
dynamically
}
NEW METHOD
drawchart()
{
if(pFinancechart) // pfinancechart is a member variable
{
pFinanceChart->SetTotalWidth(newWidth);
/*settotalwidth is method i added in financechart.h there i am setting
m_totalWidth(private variable of financechart) to new value)*/
}
else
{
pFinanceChart = new FinanceChart(initialwidth);
}
pFinanceChart->setData(timeStamps, highData, lowData, openData, closeData,
volData);
pFinanceChart->addMainChart(Height); //height and width i will be calculating
dynamically
}
Here In my old method i am deleting finance chart object each and every time and
creating new object so my chart is flickering, but resizing the chart will work fine..
To avoid that i wrote a new method , in which i am not deleting the object simple i am
trying set new width(this is in case of resizing)... but while update are coming my chart
becomes white nothing is drawn(but resizing the chart works fine here too) |
Re: Finance chart resizing and updating |
Posted by Peter Kwan on Feb-13-2014 01:19 |
|
Hi vas,
ChartDirector charts cannot be modified after display (except using the "dynamic layer"). So
the old method should be the correct method. The new method probably will not work.
Recreating the chart by itself will not cause flickering. For example, the realtime chart
sample program and the zoomable and scrollable chart sample programs update the chart
(by recreating the chart object) many times per second, and they do not consume
excessive CPU and do not flicker.
Recently, we have discovered the key issue is related to usage of Windows Common
Controls 6.0 in the project (the ChartDirector sample code does not use Windows Common
Controls 6.0 and so do not have these problems). Including the Windows Common Controls
6.0 manifest in the project causes Windows to modify the behaviour of even the standard
controls (such as the static controls), causing flickering. Many Microsoft programs flicker as
well because of the same reason.
We have also come up with an updated CChartViewer to avoid the flickering. See:
http://www.chartdir.com/forum/download_thread.php?
bn=chartdir_support&thread=1137671302#N1389817632
May be you can try to use the updated CChartViewer in the above thread to see if it can
solve the problem.
Regards
Peter Kwan |
|