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

Message ListMessage List     Post MessagePost Message

  Sub-second unixtimes
Posted by Max on Nov-18-2011 07:22
Hi Peter,

I've got a scatter plot with some unixtime data on the x axis. I'm currently using
chartTime2, and it seems to work great except it floors everything to integers. The decimal
places are really important for the chart I'm making.

Is there a way to keep the milliseconds or simply set the labels on the x axis to be a time
range instead?

Thanks,

Max

  Re: Sub-second unixtimes
Posted by Max on Nov-18-2011 07:50
Hey Peter,

I figured out how to set the x axis labels with

chart.xAxis().setLinearScale3("{value|hh:nn:ss}")

Now, I have another question... Instead of an HH:MM:SS display, I'd like to have the
seconds after midnight.

I've tried to set the x axis linear scale like this:

chart.xAxis().setLinearScale3("{={value|h}*3600+{value|n}*60+{value|s}}")

But, it seems to round to the previous minute. Am I doing something wrong?

Thanks,

Max

  Re: Sub-second unixtimes
Posted by Peter Kwan on Nov-19-2011 00:46
Hi Max,

Are you using the Python edition of ChartDirector?

To preserve the fractional seconds in chartTime2, you just need to add the fractional seconds to the result of chartTime2. For example:

x = chartTime2(math.floor(aaa)) + (aaa % 1)

In the above, math.floor(aaa) gets the integer part of aaa, and (aaa % 1) gets the fractional part of aaa.

The seconds after midnight is:

#The seconds after midnight is a number from 0 - 86399.
chart.xAxis().setLinearScale3("{={value}%86400}")

Hope this can help.

Regards
Peter Kwan

  Re: Sub-second unixtimes
Posted by Max on Nov-19-2011 03:20
Worked like a charm. :)

Thanks again, Peter.