ASE Home Page Products Download Purchase Support About ASE
ChartDirector Support
Forum HomeForum Home   SearchSearch

Message ListMessage List     Post MessagePost Message

  data modification in existing chart object
Posted by vas on Feb-17-2014 18:01
hi
   i created finance chart object and i displayed the chart with some data.. is it possible for
me to modify or set new data to the existing finance chart object...


Regards,
vas

  Re: data modification in existing chart object
Posted by Peter Kwan on Feb-18-2014 01:23
Hi vas,

To update the chart, just draw it again using the latest data. In other words, the code to
draw the chart and to update the chart is the same. In other words, no additional code is
needed to update the chart. You just need to call the same subroutine the draws the chart
in the first place (and that subroutine should draw the chart using the "latest data").

Hope this can help.

Regards
Peter Kwan

  Re: data modification in existing chart object
Posted by vas on Feb-18-2014 14:35
hi,
    i am posting code below..

drawchart()
{

    if(pFinancechart) // pfinancechart is a member variable
    {
     delete pFinanceChart;
     pFinanceChart = NULL;
    }
    else
    {
     pFinanceChart = new FinanceChart(width);
    }

    pFinanceChart->setData(timeStamps, highData, lowData, openData, closeData,
volData);
    pFinanceChart->addMainChart(Height);
dynamically

}


Drawchart is the method, i am using for drawing the chart.. is it possible for me to update
the data displayed by pFinanceChart without calling drawchart(),by some other way (in
simple i want to change the data displayed by pFinancechart object without deleting and
creating it again)
Can i use one more method like
Updatechart()
{
  pFinanceChart->setData(timeStamps, highData, lowData, openData, closeData,
volData);
}
for updating the data displayed by pFinanceChart

  Re: data modification in existing chart object
Posted by Peter Kwan on Feb-18-2014 19:42
Hi vas,

To update a chart, you would need to do something like:

Updatechart()
{
    drawChart();
}

The above code is shorter than your existing code, and it has the same performance.

Creating and deleting the FinanceChart object takes negligible CPU time and does not need
extra memory. In computer graphics, the CPU resource is mainly used for "rendering" and
chart and updating the display. If you change the data, the chart has to be rendered again
in any case (even if you do not recreate the chart object), and the screen needs to be
updated for the updated chart. So it takes essentially the same CPU time even if you can
update the chart object.

Hope this can help.

Regards
Peter Kwan

  Re: data modification in existing chart object
Posted by vas on Feb-18-2014 22:10
hi,
   thanks for the reply.. i understood what u have explained but i just want to know
whether it it possible for me to change the data shown by chart without calling that
drawchart() function


Regards,
Vas