Home › forums › Using CanvasJS › stripLines in a xValueType: "dateTime" line chart
Tagged: striplines
Hello everybody.
I want to put some “stripLines” on a line Chart. The problem is that the x-axe is in “dateTime” mode (xValueType: “dateTime”), wath implies that time is in milliseconds, instead of a “regular” date format.
How should I enter the “starValue” and “endValue” parameters to get the “StripLine” that I want on the chart?
At this time, I have tried the next ways:
startValue:2019-08-12 //for YYYY-MM-DD
startValue:1568307600000 //2019-08-12 expresed in millisecons
and some variants of the first one startValue:”2019-08-12″: startValue:(2019-08-12), startValue:’2019-08-12′ and some others, but the “stripLines” just doesn’t appear in the chart.
In the next link, there is simplified code of what I am try to explain above.
https://jsfiddle.net/jvmorin/6xkbgwa0/18/
I will appreciate any comment.
Regards
@jvmorin,
You can either use JavaScript Date objects or timestamp to set the startValue and endValue for stripLine if xValueType is set to dateTime. Please take a look at this updated JSFiddle.
—- Manoj Mohan Team CanvasJS
Dear Manoj.
Thanks a lot for your for your rapid response, that solves completely my problem. I only have completed the the DATE with the specif time when the “stripLines” must start and end.
The final code is:
stripLines:[{ startValue: new Date(2019,08,13,15,0),// for 2019-08-13 at 15:00 h endValue: new Date(2019,08,18,21,45), // for 2019-08-18 at 21:45 h label: “In the 40s” }]
it works perfec.
Thank you again.
jvmorín
Hello.
Is there any way to rotate the label inside a “stripLines”? I mean, the default orientation inside the “stripLines” is vertical, but in some cases, I would like to show it horizontaly.
I have tried (unsuccessfully) to do it using “labelAngle: 0” and “labelAutoFit: true”.
This is part of my script:
`stripLines:[{ startValue: new Date(2019,08,12,15,0), endValue: new Date(2019,08,13,21,45), color:”#d8d8d8″, opacity: 0.3, label: “Flowing to B.P.”, labelAngle: 50, labelAutoFit: true, },`
Thanks in advance for your help.
Regards.
Sorry, this feature is not available as of now.
Ok.
Thank you anyway.
You must be logged in to reply to this topic.