fullcalendar - how to format the small date in a customized view? - json

Is it possible to format the small date for example Wed 8/8(red arrow in the picture) to a longer format (green arrow in the picture) such as Tue 14 Aug 2018?
See the image attached.
I can't find anything in the documentation.
Here is my json for the view:
timelineSevenDays: {
type: 'timeline',
duration: { days: 7 },
dateIncrement:{ days: 3 },
titleFormat: 'ddd DD MMM YYYY'
}
Thanks
enter image description here

Related

Highchart/stockChart: Zoom with buttons into monthly-data and show affected columns

I have a simple time-series in highchart:
series: [{
"data": [[Date.UTC(2021,0,1), 22312], // January
[Date.UTC(2021,1,1), 12312], // Feburary
[Date.UTC(2021,2,1), 23322], // ... etc.
],
Now I want to zoom into one month, and show just one column with the given code:
rangeSelector: {
buttons: [{
text: '1m',
type: 'month',
count: 1, // This should show only 1 month, but it shows 2.
// If this is changed to "0", one month will be show, but
// The css "highcharts-button-pressed" is disabled, and you cannot
// see that "1m" was clicked.
},
According to documentation "rangeSelector.buttons.count" should span over an area of one month if type is "month" and count is "1". But what I´m getting here is a span over two months.
Here is an example:
https://jsfiddle.net/ds90vf5r/1/
Question 1: Why is higchart showing two columns instead of one when choosing/clicking on just 1-month (1m)?
Question 2: How can I zoom into the current date and show just one moth (or one column)?

Week view show multiple days instead of hours

Is it possible to create a custom resourceTimline view where multiple days of the week are shown - similar to the default month view (resourceTimelineMonth) - instead of just a few slots of a day?
So basically instead of this:
I would like to have something like this:
... but only 5 days shown.
A custom view definition as follows should do what you need:
resourceTimelineFive: {
type: 'resourceTimeline',
buttonText: '5 Days',
slotDuration: { days: 1 },
duration: { days: 5 }
},
Demo: https://codepen.io/ADyson82/pen/abdwOXO
See the following documenation links:
https://fullcalendar.io/docs/custom-view-with-settings
https://fullcalendar.io/docs/slotDuration
https://fullcalendar.io/docs/duration
and the demo at https://fullcalendar.io/docs/timeline-custom-view-demo for more information.

FullCalendar Time Line View

I am using Full Calendar with Time Grid plugin, all is working good. I want to change color for past date & time. By dayRender event I could change color of previous date but not time, as for example view for week starting from Sunday 8 Spetember 2019 till 14 Saturday 2019. and open page on 10 Sep 2019 at 9.00 AM, I should change color until 10 Sep 2019 at 9.00 AM but I could do it until 9 Sep 2019.
How can I include time. My code pen
https://codepen.io/milindsaraswala/pen/VwZXpRM
var calendar = new FullCalendar.Calendar(calendarEl, {
plugins: [ 'resourceTimeGrid' ],
timeZone: 'UTC',
defaultView: 'resourceTimeGridFourDay',
soltDuration: '00:30:00',
slotLabelInterval: '00:30:00',
minTime:'07:00:00',
maxTime:'24:00:00',
slotLabelFormat:{
hour: 'numeric',
minute: '2-digit',
omitZeroMinute: false,
meridiem: 'short'
},
header: {
left: 'prev,next',
center: 'title',
right: 'resourceTimeGridDay,resourceTimeGridFourDay'
},
views: {
resourceTimeGridFourDay: {
type: 'resourceTimeGrid',
duration: { weeks:1},
buttonText: '7 days'
}
},
resources: [
{ id: 'a', title: 'Room A' },
],
//events: 'https://fullcalendar.io/demo-events.json?with-resources=2',
events:events,
dayRender:function(day){
if (moment(day.date).isBefore(moment())) {
day.el.classList.add('disabledDates');
}
}
});
calendar.render();
});
You can restrict the previous days must more robustly by using a validRange without an end date:
validRange: function(nowDate) {
return {
start: nowDate
};
},
As well as just visually greying out the dates this will also stop events being added or dragged onto them.
Greying out the times of the current day is much more problematic. That's because there is no single HTML element representing a "time slot" on a particular day which you can target in order to do an hour-by-hour or even minute-by-minute restriction. I think the best thing you can do here is to create a background event which covers the period of the day up until the current time:
dayRender: function(day) {
var d = moment(day.date).startOf("day");
var today = moment().startOf("day");
if (d.isSame(today)) {
var now = moment();
var evt = {
start: today.format("YYYY-MM-DD HH:mm"),
end: now.format("YYYY-MM-DD HH:mm"),
rendering: "background",
className: "disabledDates"
}
calendar.addEvent(evt);
}
}
If you then wanted to restrict the creation / dragging of other events over the background event you can do via some of the date selection settings.
Demo: https://codepen.io/ADyson82/pen/pozLWjo

Highcharts x axis formatting options

I am a beginner for highcharts. I was trying something and got stuck. My x axis has values repeated multiple times. Tooltip values should contain date and time as shown. but the thing i want to change is the x axis values. same value must be shown only once and not repeated everywhere where there is data.
X axis format must be DD-MMM and tooltip should be DD-MM-YY HH am/pm .
is this possible?
Here is my trial code
http://jsfiddle.net/j6oqcgp2/
Highcharts.chart('container', {
chart: {
type: 'spline'
},
title: {
text: 'Snow depth at Vikjafjellet, Norway'
},
subtitle: {
text: 'Irregular time data in Highcharts JS'
},
xAxis: {
categories:['01-Feb-17 12 AM','01-Feb-17 01 AM','01-Feb-17 02 AM','02-Feb-17 04 AM','02-Feb-17 05 AM','02-Feb-17 06 AM','02-Feb-17 07 AM'],
labels: {
formatter: function () {
y=(this.value).substring(1,6);
return y;
}
}
},
yAxis: {
title: {
text: 'Snow depth (m)'
},
min: 0
},
tooltip: {
formatter: function () {
y=(this.x).substring(0,15);
return y;
},
shared:false
},
plotOptions: {
spline: {
marker: {
enabled: true
}
}
},
series: [{
name: 'Winter 2012-2013',
// Define the data points. All series have a dummy year
// of 1970/71 in order to be compared on the same x axis. Note
// that in JavaScript, months start at 0 for January, 1 for February etc.
data: [5,10,19,10,4,6,8]
}]
});
and this is how i want it to be
If your x-axis categories are going to be a predictable set of values (for example, four readings on each day), then you simply can add the tickInterval attribute to show a new axis label on when the day changes (see http://api.highcharts.com/highcharts/xAxis.tickInterval).
So, if you had four readings per day, you would add tickInterval: 4 to your x-axis options. This would show an axis label at every fourth reading, or, in this example, once per day.
If, however, your x-axis categories are not predictable (for example, any number of readings per day), you may want to look at this Highcharts demo, which shows a chart with irregular time periods: http://www.highcharts.com/demo/spline-irregular-time. In this demo, you'll see regular, non-repeating axis labels for whatever unit you're measuring (hours, days, etc.) and the data being plotted as frequently as it's recorded in the data.
I hope these examples and resources are helpful for you.

Refreshing Data Group in flex immidiately

I am using custom item-renderer to render items of my DataGroup.
The problems is whenever the value of data-provider(Arraylist in my case) is changed,
it takes 6-9 seconds to render, which is unacceptable.
When I tried to back-track the problem, I found that whenever there's less amount of data, DataGroup is refreshed immediately and all the items are rendered within a second.
But whenever there is relatively more amount of data, DataGroup takes 5-7 seconds to get refreshed.
This is my data group :
<s:DataGroup id="selectedInstancesView" dataProvider="{relatedInstances}" width="100%" height="100%"
itemRenderer="com.ui.renderers.CustomInstanceRenderer"
clipAndEnableScrolling="true" >
This is the function which re-assigns the value to data-provider of above data group :
private function relatedInstanceRetrieved(event:ResultEvent):void{
trace("related instances retrieved at :: " + new Date());
relatedInstances = new ArrayList(event.result as Array);
trace("related instances populated at :: " + new Date());
}
And This is within my custom-item-renderer class, where I am printing the time on creation-complete of item-renderer :
protected function itemrenderer1_creationCompleteHandler(event:FlexEvent):void
{
trace("getting rendered at :: " + new Date()); }
And this is the result I am getting :
related instances retrieved at :: Wed Apr 20 **20:58:10** GMT+0530 2016
related instances populated at :: Wed Apr 20 **20:58:10** GMT+0530 2016
getting rendered at :: Wed Apr 20 **20:58:15** GMT+0530 2016
getting rendered at :: Wed Apr 20 20:58:15 GMT+0530 2016
getting rendered at :: Wed Apr 20 20:58:15 GMT+0530 2016
...(1000 similar traces with exact same time)
All the item-renderers (around 1000) are created within a second.
But if you see, the time at which
Data-Provider (relatedInstances) is re-populated or re-assigned
and
the time at which the item-renderers start getting created is 5 seconds, which means it is taking 5 seconds to refresh the data, which is not acceptable.
I tried using invalidateDisplayList(); reassigning the item renderer, and invalidateProperties() methods, But none worked.
I am using flex sdk 4.6
Please enlighten me.