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

Message ListMessage List     Post MessagePost Message

  xAxis timeelapsed
Posted by Victor on Nov-15-2017 17:42
Hi

I'm doing a continuous monitoring application on Qt. I want start the xAxis on 0 and it starts counting the milliseconds elapsed since the application started run, rather the time.

I tried get the time when the application starts run and i substracted it to each xAxis value, but the result wasn't the dessired.

Anyone knows how to do it? Any possible idea to try?

Regards

  Re: xAxis timeelapsed
Posted by Peter Kwan on Nov-15-2017 23:05
Hi Victor,

As many of our customers are using ChartDirector for Realtime charts, we are quite familiar with the method to do what you need.

You do not need to get the time when the application starts to run.

When you code obtains the data, for the first timestamps, store it into a variable. For all timestamps, just subtract them from the first timestamp. It is like:

double xData[100000];
int point_count = 0;
double firstPoint;

void addXData(double xValue)
{
    if (point_count = 0)
      firstPoint = xValue;

    xData[pointCount++] = xValue - firstPoint;
}

With the method, the first element in xData is always 0, and all other points are the time elapsed relative to the first point.

For the x-axis, please use a numeric axis (not date/time axis), as you are basically measuring "duration" and not interested in the date or time of day.

Hope this can help.

Regards
Peter Kwan

  Re: xAxis timeelapsed
Posted by Victor on Nov-15-2017 23:21
Attachments:
It worked! Thank you so much.

The numeric axis was the solution, i didnt remember it.

there is any form i could, rather than displace all the graphs when samples are higher than array lenght, remove the first data and replace with the new one? And just start painting in axis 0? Something like this:


PD: sorry for my paint ^^
test_graph.jpg

  Re: xAxis timeelapsed
Posted by Peter Kwan on Nov-15-2017 23:39
Hi Victor,

Yes. You can find a sample project in the following page (see the last example "Real-Time Sweep Chart":

http://www.advsofteng.com/tutorials/extra.html

Regards
Peter Kwan