|
Setting Time to X axis |
Posted by Steven on Oct-31-2017 09:33 |
|
Hello
I have a series of arrays, the X axis is the time, and the Y axis is the value. Use the program you provided as follows
c.addScatterLayer (Chart.CTime (dataX), dataY)
c.yAxis (). setLinearScale (100, 500)
c.xAxis (). setLabelFormat ("{value | yyyy / mm / dd hh: nn}")
c.xAxis (). setRounding (True, True)
c.yAxis().setLinearScale(0, 1200, 100)
Found a problem
Suppose the time is 02: 00 ~ 03: 00
The graph will only show the time of the data
Can I set this time point from 02: 00 to 03: 00?
ps.
I can use the Y-axis program control range, but the X-axis does not know how to control the time
ex.c.yAxis().setLinearScale(0, 1200, 100) |
Re: Setting Time to X axis |
Posted by Peter Kwan on Oct-31-2017 17:36 |
|
Hi Steven,
You can use Axis.setDateScale for the x-axis. For example:
'Set the x-axis scale from startDateTime to endDateTime, with a label every 600 seconds
c.xAxis().setDateScale(startDateTime, endDateTime, 600)
You can configure the startDateTime to be 02:00 and endDateTime to be 03:00, like:
Dim startDataTime As DateTime = New DateTime(2017, 10, 31, 2, 0, 0)
Dim endDateTime As DateTime = New DateTime(2017, 10, 31, 3, 0. 0)
(** NOTE: The above assumes you are using VB .NET.)
Hope this can help.
Regards
PeteR Kwan |
Re: Setting Time to X axis |
Posted by Steven on Nov-01-2017 10:06 |
|
Thank you
However
I would like to ask a question
The current X-axis time format is
c.xAxis (). setLabelFormat ("{value | yyyy / mm / dd hh: nn}")
How to break between dd and hh
ex.
2017/11/01 10:00 → 2017/11/01
10:00 |
Re: Setting Time to X axis |
Posted by Peter Kwan on Nov-01-2017 16:49 |
|
Hi Steve,
You can just insert a line feed character. In VB, it is vbLF, like:
c.xAxis ().setLabelFormat ("{value|yyyy/mm/dd}" & vbLF & "{value|hh:nn}")
You can also use the CDML tag <*br*> to represent a line break. It is like:
c.xAxis ().setLabelFormat ("{value|yyyy/mm/dd}<*br*>{value|hh:nn}")
Hope this can help.
Regards
Peter Kwan |
Re: Setting Time to X axis |
Posted by Steven on Nov-03-2017 09:44 |
|
Thank you~~ |
|