|
Angular meter update data |
Posted by al072 on Aug-15-2020 03:07 |
|
Hello, i am using the last c++ version of chart director, and i am able to run MFC example of angular meter.
The question is how to update the pointer in real time when the value is changed?
I need to update this value in real time and make the chart to update:
// Add a red (0xff0000) pointer at the specified value
m->addPointer2(_value, 0xff0000);
I am trying to do it like this in button click event, but instead of update it simply adds another pointer:
void CHelloworldDlg::OnBnClickedButton1()
{
// Add a red (0xff0000) pointer at the specified value
m->addPointer2(_value, 0xff0000);
m_ChartViewer.setChart(m);
_value += 5.0;
}
Is there any correct way to update the pointer value in real time ? thank you
|
Re: Angular meter update data |
Posted by Peter Kwan on Aug-16-2020 22:45 |
|
Hi al072,
In ChartDirector, there are a number of realtime chart examples (although none of them is using a meter). In all cases, the chart is updated by redrawing.
So for your case, it is like:
void CHelloworldDlg::OnBnClickedButton1()
{
_value += 5.0;
drawChart();
}
The drawChart function is assumed to be the function that you use to draw the meter in the first place. The _value is assumed to be the member variable that is used to draw the meter.
In other words, you do not need to writing any charting code to update chart. You just need to update the parameters (the _value), and the call the same function that draws the chart in the first place.
Regards
Peter Kwan |
Re: Angular meter update data |
Posted by al072 on Aug-22-2020 05:09 |
|
Thank you very much for the explanation!!! It helped me a lot to undestand the basics |
|