A lightweight calendar component for FusionCharts.
Steps to use fc-calendar
- Clone the repository.
git clone https://github.com/fusioncharts/fc-calendar.git cd fc-calendar
- Checkout to
master
branchgit checkout master
- Install dependencies
npm install
- Create a build
npm run build
- Use the build files from
dist
folder.
fc-calendar can be imported directly from the build files and then can be instantiated.
import Calendar from 'dist/fc-calendar';
var calendar = new Calendar({
// configurations. see next section
});
fc-calendar takes different configurations to allow users to modify/customize the calendar to their needs.
- selectedDate: An object containing year, month and day depicting the current date. Months are 1-indexed.
selectedDate: { day: 18, month: 1, year: 2019 }
- rangeStart: Denotes a starting date. All the dates before this date will be disabled.
rangeStart: { day: 1, month: 1, year: 2017 }
- rangeEnd: Denotes a ending date. All the dates after this date will be disabled.
rangeEnd: { day: 31, month: 12, year: 2020 }
- weekLabel: An array containing 7 strings which are shown as days of week.
// show only initial character weekLabel: ['S', 'M', 'T', 'W', 'T', 'F', 'S',] // show first three characters weekLabel: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat']
- events: Users have the option to listen to date change, month change and year change. The events property takes an object containing some or all of the following property.
- onDateChange
- onMonthChange
- onYearChange
events: { onDateChange: function (date) { // do something. date in parameter is the new date }, onMonthChange: function (date) { // do something. }, onYearChange: function (date) { // do something. }, }
- container: The parent container in which the calendar will be appended in DOM. It takes HTML
div
element only.container: <div></div>
- posX: The x-coordinate of the top-left corner of calendar inside the container div.
- posY: The y-coordinate of the top-left corner of calendar inside the container div.
MIT
Copyright (c) 2016 FusionCharts, Inc. <support@fusioncharts.com>.