Highcharts breaks on axis - highcharts

I have a few years of sample data that I'd like to break at year end (12/31) of every year. Trying to implement this code from example from API
breaks: [{ // break on last day of year
from: Date.UTC(2008, 12, 31, 58),
to: Date.UTC(2008, 12, 31, 59),
repeat: 24 * 36e5 // not sure how to use this
}],
is there a way to ignore the year in Date.UTC()? Also I'd like to repeat this every year. Tied numerous combos to no avail. Heres my jsfiddle

Adding null value point will create a gap in a series plot if connectNulls is set to false (by default it is false).
Example: http://jsfiddle.net/c9e9ao2L/1/

Related

Start chart from threshold

Current implementation:
Desired implementation:
If you look carefully there is a vertical line connecting threshold with the first point of my displayed chart. Any ideas how to implement it ? What I thought was to get the threshold price (got it)and find a way to insert it a starting point, but I struggle a bit (since i use unix timestamp).Thanks in advance !
I parse the data from Monday to Friday, but I only display Intraday's data (let's say I am o Friday now). So the threshold will be the closing price from Thursday.
You are right. Inserting a starting point seems to be the best solution for that. You can do it as below:
const threshold = 10;
const data = [
[20, 11],
...
];
data.unshift([data[0][0], threshold]);
Highcharts.chart('container', {
series: [{
type: 'area',
threshold,
data
}]
});
Live demo: http://jsfiddle.net/BlackLabel/7ynzhmuv/
API Reference: https://api.highcharts.com/highcharts/series.area.threshold

Understanding 'wrappingComponents' in date(byAdding:to:wrappingComponents:) method

According to Apple Doc, the 'wrappingComponents' parameter serve this purpose:
If true, the component should be incremented and wrap around to
zero/one on overflow, and should not cause higher components to be
incremented. The default value is false.
What I'm having trouble understanding is the 'overflow' part. What is this overflow and when does this overflow happen? Apple Doc currently does not explain this part in its documentation.
Thanks for your answer in advance.
"Overflow" means that the result of the adding of date components goes over the allowed range of that component. For example, adding 5 days to June 30 is an "overflow" because June 35 does not exist. Other examples include adding 7 hours to 18:00, 4 months to December, etc. This also applies to subtracting too.
What happens by default (wrapping components = false) is that the larger component gets incremented: if you add 5 days to June 30, you get July 5:
However, if you set it to true, it wraps around, meaning that the larger component doesn't change - you get June 5.
Today is June 8 for me. Adding 29 days with wrapping components gives June 7:
let newDate = Calendar.current.date(byAdding: DateComponents(day: 29), to: Date(), wrappingComponents: true)
print(newDate)

calculate days count, day and month name from the timeStamp swift 3?

In my current project i need to show most three months events details from the given response (eventTimestamp) array.
this is response:
[
{
"patientEventsId": 11,
"userId": 72,
"patientId": "CDMRI-U-2017030341",
"doctorId": "CDMRIDR2017030012",
"doctorEventsId": 18,
"doctorEventName": "Hypoglycemia",
"eventTimestamp": "2017-03-31 11:54:15",
"recordTimestamp": "2017-03-31 11:54:30",
"reviewed": false
}
]
I need to calculate:
most recent three months names
get dates of that particular month which are in response
List no of events on that particular date (count) in
that particular month
Find difference between two NSDates timeStamp using Swift to check the following Links,
Link-1
Link-2
Link-3
Link-4
Link-5
Link-6

highstock Plotbands to mark certain Daytimes on X Axis

Im trying to mark certain Day Times on my Chart - iE: 15:00 - 21:00
The Date information comes in form of a timestamp - "1365362890000" for example.
Is there any convenient way to say start from time X and go until time Y?
Else I would probs need to loop through all the times to find start/end points.
The timeframe can be anything from a day to a month.
(The plotBands themselves are working for me - just looking if there might be a better way then looping through all the data)
Edit: I meant something like you see in my picture here - its working like this and all is fine. Im just wondering if there was a simple way to say - "mark time x to time y with color z" instead of doing "by hand".
Yes, plotBands have a #from and #to property. Just use the #from and #to of the converted datetime (i.e. the unix time * 1000)
$('#container').highcharts('StockChart', {
xAxis: {
plotBands: [
{
from: 1374658200000,
to: 1374681600000,
color: "rgba(68, 170, 213, .2)"
}
]
}
});
In the xAxis you can set min value and tickInterval.
http://api.highcharts.com/highcharts#xAxis.tickInterval
http://api.highcharts.com/highcharts#xAxis.min (should be timestamp too)
Also you can define pointStart for serie: http://api.highcharts.com/highcharts#plotOptions.series.pointStart and pointInterval http://api.highcharts.com/highcharts#plotOptions.series.pointInterval

Don't display not present date values

I'm trying to get Highcharts to display the daily usage statistics for e.g. a company's ressource. The opening days of the company are from monday to friday.
My dataseries look like this:
[Date.UTC(2012, 8, 6),17.5], (Thu)
[Date.UTC(2012, 8, 7),42.5], (Fri)
-- weekend
[Date.UTC(2012, 8, 10),20], (Mon)
[Date.UTC(2012, 8, 11),20], (Tue)
[Date.UTC(2012, 8, 12),40], (Wed)
[Date.UTC(2012, 8, 13),30], (Thu)
...
In the time series chart there are inserted two labels for the missing two weekend-dates (2012, 8, 8 and 2012, 8, 9), but I don't want those labels to be displayed because there are no values for these labels and so the adjacent dates will be connected via a line but this is wrong.
Is it possible to turn off this 'date interpolation' and show only the values I've inserted?
Thanks with regards, Phil
It may be possible using a scatter series and customizing the tickPositioner callback for the x-axis and filtering of x series data (dates) thats not a weekday.
I've created a fiddle at http://jsfiddle.net/hkskoglund/6jNGg/
To allow for missing weekends days null should be pushed for the y-value in the series data (as mentioned in comment above)
Another option without using a datetime axis is to use a category axis where you push the dates in the series you have data for. This will allow to have a continous plot. Take a look at the new fiddle: Areaspline with categories as dates
xAxis: {
labels: {
formatter: function() {
// http://api.highcharts.com/highcharts#Highcharts.dateFormat()
return Highcharts.dateFormat('%d %b', this.value);
}
},
categories : [
Date.UTC(2012, 8, 6),Date.UTC(2012, 8, 7),
Date.UTC(2012, 8, 10),Date.UTC(2012, 8, 11),
Date.UTC(2012, 8, 11)]
},
series: [{
name : 'resources',
data: [17.5,42.5,20,25,20]
}]
As far as I can understand using datetime on the x-axis using your requested plot-configuration is not possible without changing the source/rendering of Highcharts series. It seems like discontinuties with null values is separated into socalled segments.
Have you tried to set oridinal as false?
http://api.highcharts.com/highstock#xAxis.ordinal
I know this is an old question, but did you try formatting your dates as Strings before inserting them? If so, you can then use a category axis. This should work as long as you don't have any entry for date vs having a null.
I use Highcharts embedded in JasperReports, but this allows us to get your desired behavior.

Resources