code stringlengths 24 2.07M | docstring stringlengths 25 85.3k | func_name stringlengths 1 92 | language stringclasses 1
value | repo stringlengths 5 64 | path stringlengths 4 172 | url stringlengths 44 218 | license stringclasses 7
values |
|---|---|---|---|---|---|---|---|
function monthDiff (a, b) {
// difference in months
var wholeMonthDiff = ((b.year() - a.year()) * 12) + (b.month() - a.month()),
// b is in (anchor - 1 month, anchor + 1 month)
anchor = a.clone().add(wholeMonthDiff, 'months'),
anchor2, adjust;
if (b - anchor ... | Ported from sass implementation in C
https://github.com/sass/libsass/blob/0e6b4a2850092356aa3ece07c6b249f0221caced/functions.cpp#L209 | monthDiff | javascript | syzoj/syzoj | static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | MIT |
function toString () {
return this.clone().locale('en').format('ddd MMM DD YYYY HH:mm:ss [GMT]ZZ');
} | Ported from sass implementation in C
https://github.com/sass/libsass/blob/0e6b4a2850092356aa3ece07c6b249f0221caced/functions.cpp#L209 | toString | javascript | syzoj/syzoj | static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | MIT |
function toISOString(keepOffset) {
if (!this.isValid()) {
return null;
}
var utc = keepOffset !== true;
var m = utc ? this.clone().utc() : this;
if (m.year() < 0 || m.year() > 9999) {
return formatMoment(m, utc ? 'YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]' : 'YYYYYY-... | Ported from sass implementation in C
https://github.com/sass/libsass/blob/0e6b4a2850092356aa3ece07c6b249f0221caced/functions.cpp#L209 | toISOString | javascript | syzoj/syzoj | static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | MIT |
function inspect () {
if (!this.isValid()) {
return 'moment.invalid(/* ' + this._i + ' */)';
}
var func = 'moment';
var zone = '';
if (!this.isLocal()) {
func = this.utcOffset() === 0 ? 'moment.utc' : 'moment.parseZone';
zone = 'Z';
}
... | Return a human readable representation of a moment that can
also be evaluated to get a new moment which is the same
@link https://nodejs.org/dist/latest/docs/api/util.html#util_custom_inspect_function_on_objects | inspect | javascript | syzoj/syzoj | static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | MIT |
function format (inputString) {
if (!inputString) {
inputString = this.isUtc() ? hooks.defaultFormatUtc : hooks.defaultFormat;
}
var output = formatMoment(this, inputString);
return this.localeData().postformat(output);
} | Return a human readable representation of a moment that can
also be evaluated to get a new moment which is the same
@link https://nodejs.org/dist/latest/docs/api/util.html#util_custom_inspect_function_on_objects | format | javascript | syzoj/syzoj | static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | MIT |
function from (time, withoutSuffix) {
if (this.isValid() &&
((isMoment(time) && time.isValid()) ||
createLocal(time).isValid())) {
return createDuration({to: this, from: time}).locale(this.locale()).humanize(!withoutSuffix);
} else {
return this.l... | Return a human readable representation of a moment that can
also be evaluated to get a new moment which is the same
@link https://nodejs.org/dist/latest/docs/api/util.html#util_custom_inspect_function_on_objects | from | javascript | syzoj/syzoj | static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | MIT |
function fromNow (withoutSuffix) {
return this.from(createLocal(), withoutSuffix);
} | Return a human readable representation of a moment that can
also be evaluated to get a new moment which is the same
@link https://nodejs.org/dist/latest/docs/api/util.html#util_custom_inspect_function_on_objects | fromNow | javascript | syzoj/syzoj | static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | MIT |
function to (time, withoutSuffix) {
if (this.isValid() &&
((isMoment(time) && time.isValid()) ||
createLocal(time).isValid())) {
return createDuration({from: this, to: time}).locale(this.locale()).humanize(!withoutSuffix);
} else {
return this.loc... | Return a human readable representation of a moment that can
also be evaluated to get a new moment which is the same
@link https://nodejs.org/dist/latest/docs/api/util.html#util_custom_inspect_function_on_objects | to | javascript | syzoj/syzoj | static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | MIT |
function toNow (withoutSuffix) {
return this.to(createLocal(), withoutSuffix);
} | Return a human readable representation of a moment that can
also be evaluated to get a new moment which is the same
@link https://nodejs.org/dist/latest/docs/api/util.html#util_custom_inspect_function_on_objects | toNow | javascript | syzoj/syzoj | static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | MIT |
function locale (key) {
var newLocaleData;
if (key === undefined) {
return this._locale._abbr;
} else {
newLocaleData = getLocale(key);
if (newLocaleData != null) {
this._locale = newLocaleData;
}
return this;
}... | Return a human readable representation of a moment that can
also be evaluated to get a new moment which is the same
@link https://nodejs.org/dist/latest/docs/api/util.html#util_custom_inspect_function_on_objects | locale | javascript | syzoj/syzoj | static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | MIT |
function localeData () {
return this._locale;
} | Return a human readable representation of a moment that can
also be evaluated to get a new moment which is the same
@link https://nodejs.org/dist/latest/docs/api/util.html#util_custom_inspect_function_on_objects | localeData | javascript | syzoj/syzoj | static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | MIT |
function startOf (units) {
units = normalizeUnits(units);
// the following switch intentionally omits break keywords
// to utilize falling through the cases.
switch (units) {
case 'year':
this.month(0);
/* falls through */
case 'qua... | Return a human readable representation of a moment that can
also be evaluated to get a new moment which is the same
@link https://nodejs.org/dist/latest/docs/api/util.html#util_custom_inspect_function_on_objects | startOf | javascript | syzoj/syzoj | static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | MIT |
function endOf (units) {
units = normalizeUnits(units);
if (units === undefined || units === 'millisecond') {
return this;
}
// 'date' is an alias for 'day', so it should be considered as such.
if (units === 'date') {
units = 'day';
}
ret... | Return a human readable representation of a moment that can
also be evaluated to get a new moment which is the same
@link https://nodejs.org/dist/latest/docs/api/util.html#util_custom_inspect_function_on_objects | endOf | javascript | syzoj/syzoj | static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | MIT |
function valueOf () {
return this._d.valueOf() - ((this._offset || 0) * 60000);
} | Return a human readable representation of a moment that can
also be evaluated to get a new moment which is the same
@link https://nodejs.org/dist/latest/docs/api/util.html#util_custom_inspect_function_on_objects | valueOf | javascript | syzoj/syzoj | static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | MIT |
function unix () {
return Math.floor(this.valueOf() / 1000);
} | Return a human readable representation of a moment that can
also be evaluated to get a new moment which is the same
@link https://nodejs.org/dist/latest/docs/api/util.html#util_custom_inspect_function_on_objects | unix | javascript | syzoj/syzoj | static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | MIT |
function toDate () {
return new Date(this.valueOf());
} | Return a human readable representation of a moment that can
also be evaluated to get a new moment which is the same
@link https://nodejs.org/dist/latest/docs/api/util.html#util_custom_inspect_function_on_objects | toDate | javascript | syzoj/syzoj | static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | MIT |
function toArray () {
var m = this;
return [m.year(), m.month(), m.date(), m.hour(), m.minute(), m.second(), m.millisecond()];
} | Return a human readable representation of a moment that can
also be evaluated to get a new moment which is the same
@link https://nodejs.org/dist/latest/docs/api/util.html#util_custom_inspect_function_on_objects | toArray | javascript | syzoj/syzoj | static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | MIT |
function toObject () {
var m = this;
return {
years: m.year(),
months: m.month(),
date: m.date(),
hours: m.hours(),
minutes: m.minutes(),
seconds: m.seconds(),
milliseconds: m.milliseconds()
};
} | Return a human readable representation of a moment that can
also be evaluated to get a new moment which is the same
@link https://nodejs.org/dist/latest/docs/api/util.html#util_custom_inspect_function_on_objects | toObject | javascript | syzoj/syzoj | static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | MIT |
function toJSON () {
// new Date(NaN).toJSON() === null
return this.isValid() ? this.toISOString() : null;
} | Return a human readable representation of a moment that can
also be evaluated to get a new moment which is the same
@link https://nodejs.org/dist/latest/docs/api/util.html#util_custom_inspect_function_on_objects | toJSON | javascript | syzoj/syzoj | static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | MIT |
function isValid$2 () {
return isValid(this);
} | Return a human readable representation of a moment that can
also be evaluated to get a new moment which is the same
@link https://nodejs.org/dist/latest/docs/api/util.html#util_custom_inspect_function_on_objects | isValid$2 | javascript | syzoj/syzoj | static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | MIT |
function parsingFlags () {
return extend({}, getParsingFlags(this));
} | Return a human readable representation of a moment that can
also be evaluated to get a new moment which is the same
@link https://nodejs.org/dist/latest/docs/api/util.html#util_custom_inspect_function_on_objects | parsingFlags | javascript | syzoj/syzoj | static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | MIT |
function invalidAt () {
return getParsingFlags(this).overflow;
} | Return a human readable representation of a moment that can
also be evaluated to get a new moment which is the same
@link https://nodejs.org/dist/latest/docs/api/util.html#util_custom_inspect_function_on_objects | invalidAt | javascript | syzoj/syzoj | static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | MIT |
function creationData() {
return {
input: this._i,
format: this._f,
locale: this._locale,
isUTC: this._isUTC,
strict: this._strict
};
} | Return a human readable representation of a moment that can
also be evaluated to get a new moment which is the same
@link https://nodejs.org/dist/latest/docs/api/util.html#util_custom_inspect_function_on_objects | creationData | javascript | syzoj/syzoj | static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | MIT |
function addWeekYearFormatToken (token, getter) {
addFormatToken(0, [token, token.length], 0, getter);
} | Return a human readable representation of a moment that can
also be evaluated to get a new moment which is the same
@link https://nodejs.org/dist/latest/docs/api/util.html#util_custom_inspect_function_on_objects | addWeekYearFormatToken | javascript | syzoj/syzoj | static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | MIT |
function getSetWeekYear (input) {
return getSetWeekYearHelper.call(this,
input,
this.week(),
this.weekday(),
this.localeData()._week.dow,
this.localeData()._week.doy);
} | Return a human readable representation of a moment that can
also be evaluated to get a new moment which is the same
@link https://nodejs.org/dist/latest/docs/api/util.html#util_custom_inspect_function_on_objects | getSetWeekYear | javascript | syzoj/syzoj | static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | MIT |
function getSetISOWeekYear (input) {
return getSetWeekYearHelper.call(this,
input, this.isoWeek(), this.isoWeekday(), 1, 4);
} | Return a human readable representation of a moment that can
also be evaluated to get a new moment which is the same
@link https://nodejs.org/dist/latest/docs/api/util.html#util_custom_inspect_function_on_objects | getSetISOWeekYear | javascript | syzoj/syzoj | static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | MIT |
function getISOWeeksInYear () {
return weeksInYear(this.year(), 1, 4);
} | Return a human readable representation of a moment that can
also be evaluated to get a new moment which is the same
@link https://nodejs.org/dist/latest/docs/api/util.html#util_custom_inspect_function_on_objects | getISOWeeksInYear | javascript | syzoj/syzoj | static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | MIT |
function getWeeksInYear () {
var weekInfo = this.localeData()._week;
return weeksInYear(this.year(), weekInfo.dow, weekInfo.doy);
} | Return a human readable representation of a moment that can
also be evaluated to get a new moment which is the same
@link https://nodejs.org/dist/latest/docs/api/util.html#util_custom_inspect_function_on_objects | getWeeksInYear | javascript | syzoj/syzoj | static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | MIT |
function getSetWeekYearHelper(input, week, weekday, dow, doy) {
var weeksTarget;
if (input == null) {
return weekOfYear(this, dow, doy).year;
} else {
weeksTarget = weeksInYear(input, dow, doy);
if (week > weeksTarget) {
week = weeksTarget;
... | Return a human readable representation of a moment that can
also be evaluated to get a new moment which is the same
@link https://nodejs.org/dist/latest/docs/api/util.html#util_custom_inspect_function_on_objects | getSetWeekYearHelper | javascript | syzoj/syzoj | static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | MIT |
function setWeekAll(weekYear, week, weekday, dow, doy) {
var dayOfYearData = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy),
date = createUTCDate(dayOfYearData.year, 0, dayOfYearData.dayOfYear);
this.year(date.getUTCFullYear());
this.month(date.getUTCMonth());
this.da... | Return a human readable representation of a moment that can
also be evaluated to get a new moment which is the same
@link https://nodejs.org/dist/latest/docs/api/util.html#util_custom_inspect_function_on_objects | setWeekAll | javascript | syzoj/syzoj | static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | MIT |
function getSetQuarter (input) {
return input == null ? Math.ceil((this.month() + 1) / 3) : this.month((input - 1) * 3 + this.month() % 3);
} | Return a human readable representation of a moment that can
also be evaluated to get a new moment which is the same
@link https://nodejs.org/dist/latest/docs/api/util.html#util_custom_inspect_function_on_objects | getSetQuarter | javascript | syzoj/syzoj | static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | MIT |
function getSetDayOfYear (input) {
var dayOfYear = Math.round((this.clone().startOf('day') - this.clone().startOf('year')) / 864e5) + 1;
return input == null ? dayOfYear : this.add((input - dayOfYear), 'd');
} | Return a human readable representation of a moment that can
also be evaluated to get a new moment which is the same
@link https://nodejs.org/dist/latest/docs/api/util.html#util_custom_inspect_function_on_objects | getSetDayOfYear | javascript | syzoj/syzoj | static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | MIT |
function parseMs(input, array) {
array[MILLISECOND] = toInt(('0.' + input) * 1000);
} | Return a human readable representation of a moment that can
also be evaluated to get a new moment which is the same
@link https://nodejs.org/dist/latest/docs/api/util.html#util_custom_inspect_function_on_objects | parseMs | javascript | syzoj/syzoj | static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | MIT |
function getZoneAbbr () {
return this._isUTC ? 'UTC' : '';
} | Return a human readable representation of a moment that can
also be evaluated to get a new moment which is the same
@link https://nodejs.org/dist/latest/docs/api/util.html#util_custom_inspect_function_on_objects | getZoneAbbr | javascript | syzoj/syzoj | static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | MIT |
function getZoneName () {
return this._isUTC ? 'Coordinated Universal Time' : '';
} | Return a human readable representation of a moment that can
also be evaluated to get a new moment which is the same
@link https://nodejs.org/dist/latest/docs/api/util.html#util_custom_inspect_function_on_objects | getZoneName | javascript | syzoj/syzoj | static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | MIT |
function createUnix (input) {
return createLocal(input * 1000);
} | Return a human readable representation of a moment that can
also be evaluated to get a new moment which is the same
@link https://nodejs.org/dist/latest/docs/api/util.html#util_custom_inspect_function_on_objects | createUnix | javascript | syzoj/syzoj | static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | MIT |
function createInZone () {
return createLocal.apply(null, arguments).parseZone();
} | Return a human readable representation of a moment that can
also be evaluated to get a new moment which is the same
@link https://nodejs.org/dist/latest/docs/api/util.html#util_custom_inspect_function_on_objects | createInZone | javascript | syzoj/syzoj | static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | MIT |
function preParsePostFormat (string) {
return string;
} | Return a human readable representation of a moment that can
also be evaluated to get a new moment which is the same
@link https://nodejs.org/dist/latest/docs/api/util.html#util_custom_inspect_function_on_objects | preParsePostFormat | javascript | syzoj/syzoj | static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | MIT |
function get$1 (format, index, field, setter) {
var locale = getLocale();
var utc = createUTC().set(setter, index);
return locale[field](utc, format);
} | Return a human readable representation of a moment that can
also be evaluated to get a new moment which is the same
@link https://nodejs.org/dist/latest/docs/api/util.html#util_custom_inspect_function_on_objects | get$1 | javascript | syzoj/syzoj | static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | MIT |
function listMonthsImpl (format, index, field) {
if (isNumber(format)) {
index = format;
format = undefined;
}
format = format || '';
if (index != null) {
return get$1(format, index, field, 'month');
}
var i;
var out = [];
... | Return a human readable representation of a moment that can
also be evaluated to get a new moment which is the same
@link https://nodejs.org/dist/latest/docs/api/util.html#util_custom_inspect_function_on_objects | listMonthsImpl | javascript | syzoj/syzoj | static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | MIT |
function listWeekdaysImpl (localeSorted, format, index, field) {
if (typeof localeSorted === 'boolean') {
if (isNumber(format)) {
index = format;
format = undefined;
}
format = format || '';
} else {
format = localeSorted;
... | Return a human readable representation of a moment that can
also be evaluated to get a new moment which is the same
@link https://nodejs.org/dist/latest/docs/api/util.html#util_custom_inspect_function_on_objects | listWeekdaysImpl | javascript | syzoj/syzoj | static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | MIT |
function listMonths (format, index) {
return listMonthsImpl(format, index, 'months');
} | Return a human readable representation of a moment that can
also be evaluated to get a new moment which is the same
@link https://nodejs.org/dist/latest/docs/api/util.html#util_custom_inspect_function_on_objects | listMonths | javascript | syzoj/syzoj | static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | MIT |
function listMonthsShort (format, index) {
return listMonthsImpl(format, index, 'monthsShort');
} | Return a human readable representation of a moment that can
also be evaluated to get a new moment which is the same
@link https://nodejs.org/dist/latest/docs/api/util.html#util_custom_inspect_function_on_objects | listMonthsShort | javascript | syzoj/syzoj | static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | MIT |
function listWeekdays (localeSorted, format, index) {
return listWeekdaysImpl(localeSorted, format, index, 'weekdays');
} | Return a human readable representation of a moment that can
also be evaluated to get a new moment which is the same
@link https://nodejs.org/dist/latest/docs/api/util.html#util_custom_inspect_function_on_objects | listWeekdays | javascript | syzoj/syzoj | static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | MIT |
function listWeekdaysShort (localeSorted, format, index) {
return listWeekdaysImpl(localeSorted, format, index, 'weekdaysShort');
} | Return a human readable representation of a moment that can
also be evaluated to get a new moment which is the same
@link https://nodejs.org/dist/latest/docs/api/util.html#util_custom_inspect_function_on_objects | listWeekdaysShort | javascript | syzoj/syzoj | static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | MIT |
function listWeekdaysMin (localeSorted, format, index) {
return listWeekdaysImpl(localeSorted, format, index, 'weekdaysMin');
} | Return a human readable representation of a moment that can
also be evaluated to get a new moment which is the same
@link https://nodejs.org/dist/latest/docs/api/util.html#util_custom_inspect_function_on_objects | listWeekdaysMin | javascript | syzoj/syzoj | static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | MIT |
function abs () {
var data = this._data;
this._milliseconds = mathAbs(this._milliseconds);
this._days = mathAbs(this._days);
this._months = mathAbs(this._months);
data.milliseconds = mathAbs(data.milliseconds);
data.seconds = mathAbs(data.... | Return a human readable representation of a moment that can
also be evaluated to get a new moment which is the same
@link https://nodejs.org/dist/latest/docs/api/util.html#util_custom_inspect_function_on_objects | abs | javascript | syzoj/syzoj | static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | MIT |
function addSubtract$1 (duration, input, value, direction) {
var other = createDuration(input, value);
duration._milliseconds += direction * other._milliseconds;
duration._days += direction * other._days;
duration._months += direction * other._months;
return durat... | Return a human readable representation of a moment that can
also be evaluated to get a new moment which is the same
@link https://nodejs.org/dist/latest/docs/api/util.html#util_custom_inspect_function_on_objects | addSubtract$1 | javascript | syzoj/syzoj | static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | MIT |
function add$1 (input, value) {
return addSubtract$1(this, input, value, 1);
} | Return a human readable representation of a moment that can
also be evaluated to get a new moment which is the same
@link https://nodejs.org/dist/latest/docs/api/util.html#util_custom_inspect_function_on_objects | add$1 | javascript | syzoj/syzoj | static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | MIT |
function subtract$1 (input, value) {
return addSubtract$1(this, input, value, -1);
} | Return a human readable representation of a moment that can
also be evaluated to get a new moment which is the same
@link https://nodejs.org/dist/latest/docs/api/util.html#util_custom_inspect_function_on_objects | subtract$1 | javascript | syzoj/syzoj | static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | MIT |
function absCeil (number) {
if (number < 0) {
return Math.floor(number);
} else {
return Math.ceil(number);
}
} | Return a human readable representation of a moment that can
also be evaluated to get a new moment which is the same
@link https://nodejs.org/dist/latest/docs/api/util.html#util_custom_inspect_function_on_objects | absCeil | javascript | syzoj/syzoj | static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | MIT |
function bubble () {
var milliseconds = this._milliseconds;
var days = this._days;
var months = this._months;
var data = this._data;
var seconds, minutes, hours, years, monthsFromDays;
// if we have a mix of positive and negative values, bubble down... | Return a human readable representation of a moment that can
also be evaluated to get a new moment which is the same
@link https://nodejs.org/dist/latest/docs/api/util.html#util_custom_inspect_function_on_objects | bubble | javascript | syzoj/syzoj | static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | MIT |
function daysToMonths (days) {
// 400 years have 146097 days (taking into account leap year rules)
// 400 years have 12 months === 4800
return days * 4800 / 146097;
} | Return a human readable representation of a moment that can
also be evaluated to get a new moment which is the same
@link https://nodejs.org/dist/latest/docs/api/util.html#util_custom_inspect_function_on_objects | daysToMonths | javascript | syzoj/syzoj | static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | MIT |
function monthsToDays (months) {
// the reverse of daysToMonths
return months * 146097 / 4800;
} | Return a human readable representation of a moment that can
also be evaluated to get a new moment which is the same
@link https://nodejs.org/dist/latest/docs/api/util.html#util_custom_inspect_function_on_objects | monthsToDays | javascript | syzoj/syzoj | static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | MIT |
function as (units) {
if (!this.isValid()) {
return NaN;
}
var days;
var months;
var milliseconds = this._milliseconds;
units = normalizeUnits(units);
if (units === 'month' || units === 'year') {
days = this._days + milliseconds / 864... | Return a human readable representation of a moment that can
also be evaluated to get a new moment which is the same
@link https://nodejs.org/dist/latest/docs/api/util.html#util_custom_inspect_function_on_objects | as | javascript | syzoj/syzoj | static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | MIT |
function valueOf$1 () {
if (!this.isValid()) {
return NaN;
}
return (
this._milliseconds +
this._days * 864e5 +
(this._months % 12) * 2592e6 +
toInt(this._months / 12) * 31536e6
);
} | Return a human readable representation of a moment that can
also be evaluated to get a new moment which is the same
@link https://nodejs.org/dist/latest/docs/api/util.html#util_custom_inspect_function_on_objects | valueOf$1 | javascript | syzoj/syzoj | static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | MIT |
function makeAs (alias) {
return function () {
return this.as(alias);
};
} | Return a human readable representation of a moment that can
also be evaluated to get a new moment which is the same
@link https://nodejs.org/dist/latest/docs/api/util.html#util_custom_inspect_function_on_objects | makeAs | javascript | syzoj/syzoj | static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | MIT |
function clone$1 () {
return createDuration(this);
} | Return a human readable representation of a moment that can
also be evaluated to get a new moment which is the same
@link https://nodejs.org/dist/latest/docs/api/util.html#util_custom_inspect_function_on_objects | clone$1 | javascript | syzoj/syzoj | static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | MIT |
function get$2 (units) {
units = normalizeUnits(units);
return this.isValid() ? this[units + 's']() : NaN;
} | Return a human readable representation of a moment that can
also be evaluated to get a new moment which is the same
@link https://nodejs.org/dist/latest/docs/api/util.html#util_custom_inspect_function_on_objects | get$2 | javascript | syzoj/syzoj | static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | MIT |
function makeGetter(name) {
return function () {
return this.isValid() ? this._data[name] : NaN;
};
} | Return a human readable representation of a moment that can
also be evaluated to get a new moment which is the same
@link https://nodejs.org/dist/latest/docs/api/util.html#util_custom_inspect_function_on_objects | makeGetter | javascript | syzoj/syzoj | static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | MIT |
function weeks () {
return absFloor(this.days() / 7);
} | Return a human readable representation of a moment that can
also be evaluated to get a new moment which is the same
@link https://nodejs.org/dist/latest/docs/api/util.html#util_custom_inspect_function_on_objects | weeks | javascript | syzoj/syzoj | static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | MIT |
function substituteTimeAgo(string, number, withoutSuffix, isFuture, locale) {
return locale.relativeTime(number || 1, !!withoutSuffix, string, isFuture);
} | Return a human readable representation of a moment that can
also be evaluated to get a new moment which is the same
@link https://nodejs.org/dist/latest/docs/api/util.html#util_custom_inspect_function_on_objects | substituteTimeAgo | javascript | syzoj/syzoj | static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | MIT |
function relativeTime$1 (posNegDuration, withoutSuffix, locale) {
var duration = createDuration(posNegDuration).abs();
var seconds = round(duration.as('s'));
var minutes = round(duration.as('m'));
var hours = round(duration.as('h'));
var days = round(duration.as('d'));
... | Return a human readable representation of a moment that can
also be evaluated to get a new moment which is the same
@link https://nodejs.org/dist/latest/docs/api/util.html#util_custom_inspect_function_on_objects | relativeTime$1 | javascript | syzoj/syzoj | static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | MIT |
function getSetRelativeTimeRounding (roundingFunction) {
if (roundingFunction === undefined) {
return round;
}
if (typeof(roundingFunction) === 'function') {
round = roundingFunction;
return true;
}
return false;
} | Return a human readable representation of a moment that can
also be evaluated to get a new moment which is the same
@link https://nodejs.org/dist/latest/docs/api/util.html#util_custom_inspect_function_on_objects | getSetRelativeTimeRounding | javascript | syzoj/syzoj | static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | MIT |
function getSetRelativeTimeThreshold (threshold, limit) {
if (thresholds[threshold] === undefined) {
return false;
}
if (limit === undefined) {
return thresholds[threshold];
}
thresholds[threshold] = limit;
if (threshold === 's') {
thre... | Return a human readable representation of a moment that can
also be evaluated to get a new moment which is the same
@link https://nodejs.org/dist/latest/docs/api/util.html#util_custom_inspect_function_on_objects | getSetRelativeTimeThreshold | javascript | syzoj/syzoj | static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | MIT |
function humanize (withSuffix) {
if (!this.isValid()) {
return this.localeData().invalidDate();
}
var locale = this.localeData();
var output = relativeTime$1(this, !withSuffix, locale);
if (withSuffix) {
output = locale.pastFuture(+this, output);
... | Return a human readable representation of a moment that can
also be evaluated to get a new moment which is the same
@link https://nodejs.org/dist/latest/docs/api/util.html#util_custom_inspect_function_on_objects | humanize | javascript | syzoj/syzoj | static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | MIT |
function sign(x) {
return ((x > 0) - (x < 0)) || +x;
} | Return a human readable representation of a moment that can
also be evaluated to get a new moment which is the same
@link https://nodejs.org/dist/latest/docs/api/util.html#util_custom_inspect_function_on_objects | sign | javascript | syzoj/syzoj | static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | MIT |
function toISOString$1() {
// for ISO strings we do not use the normal bubbling rules:
// * milliseconds bubble up until they become hours
// * days do not bubble at all
// * months bubble up until they become years
// This is because there is no context-free conversion betwee... | Return a human readable representation of a moment that can
also be evaluated to get a new moment which is the same
@link https://nodejs.org/dist/latest/docs/api/util.html#util_custom_inspect_function_on_objects | toISOString$1 | javascript | syzoj/syzoj | static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | MIT |
function computeMinSampleSize(scale, pixels) {
var min = scale.isHorizontal() ? scale.width : scale.height;
var ticks = scale.getTicks();
var prev, curr, i, ilen;
for (i = 1, ilen = pixels.length; i < ilen; ++i) {
min = Math.min(min, pixels[i] - pixels[i - 1]);
}
for (i = 0, ilen = ticks.length; i < ilen; ++i... | Computes the "optimal" sample size to maintain bars equally sized while preventing overlap.
@private | computeMinSampleSize | javascript | syzoj/syzoj | static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | MIT |
function computeFitCategoryTraits(index, ruler, options) {
var thickness = options.barThickness;
var count = ruler.stackCount;
var curr = ruler.pixels[index];
var size, ratio;
if (helpers.isNullOrUndef(thickness)) {
size = ruler.min * options.categoryPercentage;
ratio = options.barPercentage;
} else {
// W... | Computes an "ideal" category based on the absolute bar thickness or, if undefined or null,
uses the smallest interval (see computeMinSampleSize) that prevents bar overlapping. This
mode currently always generates bars equally sized (until we introduce scriptable options?).
@private | computeFitCategoryTraits | javascript | syzoj/syzoj | static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | MIT |
function computeFlexCategoryTraits(index, ruler, options) {
var pixels = ruler.pixels;
var curr = pixels[index];
var prev = index > 0 ? pixels[index - 1] : null;
var next = index < pixels.length - 1 ? pixels[index + 1] : null;
var percent = options.categoryPercentage;
var start, size;
if (prev === null) {
// ... | Computes an "optimal" category that globally arranges bars side by side (no gap when
percentage options are 1), based on the previous and following categories. This mode
generates bars with different widths when data are not evenly spaced.
@private | computeFlexCategoryTraits | javascript | syzoj/syzoj | static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | MIT |
function initConfig(config) {
config = config || {};
// Do NOT use configMerge() for the data object because this method merges arrays
// and so would change references to labels and datasets, preventing data updates.
var data = config.data = config.data || {};
data.datasets = data.datasets || [];
data.lab... | Initializes the given config with global and chart default values. | initConfig | javascript | syzoj/syzoj | static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | MIT |
function updateConfig(chart) {
var newOptions = chart.options;
helpers.each(chart.scales, function(scale) {
layouts.removeBox(chart, scale);
});
newOptions = helpers.configMerge(
Chart.defaults.global,
Chart.defaults[chart.config.type],
newOptions);
chart.options = chart.config.options = newOpt... | Updates the config of the chart
@param chart {Chart} chart to update the options for | updateConfig | javascript | syzoj/syzoj | static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | MIT |
function positionIsHorizontal(position) {
return position === 'top' || position === 'bottom';
} | Updates the config of the chart
@param chart {Chart} chart to update the options for | positionIsHorizontal | javascript | syzoj/syzoj | static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | MIT |
onComplete = function(animation) {
plugins.notify(me, 'afterRender');
helpers.callback(animationOptions && animationOptions.onComplete, [animation], me);
} | Updates dataset at index unless a plugin returns `false` to the `beforeDatasetUpdate`
hook, in which case, plugins will not be called on `afterDatasetUpdate`.
@private | onComplete | javascript | syzoj/syzoj | static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | MIT |
function listenArrayEvents(array, listener) {
if (array._chartjs) {
array._chartjs.listeners.push(listener);
return;
}
Object.defineProperty(array, '_chartjs', {
configurable: true,
enumerable: false,
value: {
listeners: [listener]
}
});
arrayEvents.forEach(function(key) {
var metho... | Hooks the array methods that add or remove values ('push', pop', 'shift', 'splice',
'unshift') and notify the listener AFTER the array has been altered. Listeners are
called on the 'onData*' callbacks (e.g. onDataPush, etc.) with same arguments. | listenArrayEvents | javascript | syzoj/syzoj | static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | MIT |
function unlistenArrayEvents(array, listener) {
var stub = array._chartjs;
if (!stub) {
return;
}
var listeners = stub.listeners;
var index = listeners.indexOf(listener);
if (index !== -1) {
listeners.splice(index, 1);
}
if (listeners.length > 0) {
return;
}
arrayEvents.forEach(function(... | Removes the given array event listener and cleanup extra attached properties (such as
the _chartjs stub and overridden methods) if array doesn't have any more listeners. | unlistenArrayEvents | javascript | syzoj/syzoj | static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | MIT |
function isConstrainedValue(value) {
return value !== undefined && value !== null && value !== 'none';
} | Returns if the given value contains an effective constraint.
@private | isConstrainedValue | javascript | syzoj/syzoj | static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | MIT |
function getConstraintDimension(domNode, maxStyle, percentageProperty) {
var view = document.defaultView;
var parentNode = helpers._getParentNode(domNode);
var constrainedNode = view.getComputedStyle(domNode)[maxStyle];
var constrainedContainer = view.getComputedStyle(parentNode)[maxStyle];
var hasCNode = isC... | Returns if the given value contains an effective constraint.
@private | getConstraintDimension | javascript | syzoj/syzoj | static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | MIT |
function getRelativePosition(e, chart) {
if (e.native) {
return {
x: e.x,
y: e.y
};
}
return helpers.getRelativePosition(e, chart);
} | Helper function to get relative position for an event
@param {Event|IEvent} event - The event to get the position for
@param {Chart} chart - The chart
@returns {Point} the event position | getRelativePosition | javascript | syzoj/syzoj | static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | MIT |
function parseVisibleItems(chart, handler) {
var datasets = chart.data.datasets;
var meta, i, j, ilen, jlen;
for (i = 0, ilen = datasets.length; i < ilen; ++i) {
if (!chart.isDatasetVisible(i)) {
continue;
}
meta = chart.getDatasetMeta(i);
for (j = 0, jlen = meta.data.length; j < jlen; ++j) {
var ele... | Helper function to traverse all of the visible elements in the chart
@param chart {chart} the chart
@param handler {Function} the callback to execute for each visible item | parseVisibleItems | javascript | syzoj/syzoj | static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | MIT |
function getIntersectItems(chart, position) {
var elements = [];
parseVisibleItems(chart, function(element) {
if (element.inRange(position.x, position.y)) {
elements.push(element);
}
});
return elements;
} | Helper function to get the items that intersect the event position
@param items {ChartElement[]} elements to filter
@param position {Point} the point to be nearest to
@return {ChartElement[]} the nearest items | getIntersectItems | javascript | syzoj/syzoj | static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | MIT |
function getNearestItems(chart, position, intersect, distanceMetric) {
var minDistance = Number.POSITIVE_INFINITY;
var nearestItems = [];
parseVisibleItems(chart, function(element) {
if (intersect && !element.inRange(position.x, position.y)) {
return;
}
var center = element.getCenterPoint();
var distanc... | Helper function to get the items nearest to the event position considering all visible items in teh chart
@param chart {Chart} the chart to look at elements from
@param position {Point} the point to be nearest to
@param intersect {Boolean} if true, only consider items that intersect the position
@param distanceMetric {... | getNearestItems | javascript | syzoj/syzoj | static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | MIT |
function getDistanceMetricForAxis(axis) {
var useX = axis.indexOf('x') !== -1;
var useY = axis.indexOf('y') !== -1;
return function(pt1, pt2) {
var deltaX = useX ? Math.abs(pt1.x - pt2.x) : 0;
var deltaY = useY ? Math.abs(pt1.y - pt2.y) : 0;
return Math.sqrt(Math.pow(deltaX, 2) + Math.pow(deltaY, 2));
};
} | Get a distance metric function for two points based on the
axis mode setting
@param {String} axis the axis mode. x|y|xy | getDistanceMetricForAxis | javascript | syzoj/syzoj | static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | MIT |
function indexMode(chart, e, options) {
var position = getRelativePosition(e, chart);
// Default axis for index mode is 'x' to match old behaviour
options.axis = options.axis || 'x';
var distanceMetric = getDistanceMetricForAxis(options.axis);
var items = options.intersect ? getIntersectItems(chart, position) : ge... | Get a distance metric function for two points based on the
axis mode setting
@param {String} axis the axis mode. x|y|xy | indexMode | javascript | syzoj/syzoj | static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | MIT |
Chart = function(item, config) {
this.construct(item, config);
return this;
} | y mode returns the elements that hit-test at the current y coordinate
@function Chart.Interaction.modes.y
@param chart {chart} the chart we are returning items from
@param e {Event} the event we are find things at
@param options {IInteractionOptions} options to use
@return {Chart.Element[]} Array of elements that are u... | Chart | javascript | syzoj/syzoj | static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | MIT |
function filterByPosition(array, position) {
return helpers.where(array, function(v) {
return v.position === position;
});
} | y mode returns the elements that hit-test at the current y coordinate
@function Chart.Interaction.modes.y
@param chart {chart} the chart we are returning items from
@param e {Event} the event we are find things at
@param options {IInteractionOptions} options to use
@return {Chart.Element[]} Array of elements that are u... | filterByPosition | javascript | syzoj/syzoj | static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | MIT |
function sortByWeight(array, reverse) {
array.forEach(function(v, i) {
v._tmpIndex_ = i;
return v;
});
array.sort(function(a, b) {
var v0 = reverse ? b : a;
var v1 = reverse ? a : b;
return v0.weight === v1.weight ?
v0._tmpIndex_ - v1._tmpIndex_ :
v0.weight - v1.weight;
});
array.forEach(function(v... | y mode returns the elements that hit-test at the current y coordinate
@function Chart.Interaction.modes.y
@param chart {chart} the chart we are returning items from
@param e {Event} the event we are find things at
@param options {IInteractionOptions} options to use
@return {Chart.Element[]} Array of elements that are u... | sortByWeight | javascript | syzoj/syzoj | static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | MIT |
function getMinimumBoxSize(box) {
var minSize;
var isHorizontal = box.isHorizontal();
if (isHorizontal) {
minSize = box.update(box.fullWidth ? chartWidth : maxChartAreaWidth, horizontalBoxHeight);
maxChartAreaHeight -= minSize.height;
} else {
minSize = box.update(verticalBoxWidth, maxChartArea... | Fits boxes of the given chart into the given size by having each box measure itself
then running a fitting algorithm
@param {Chart} chart - the chart
@param {Number} width - the width to fit into
@param {Number} height - the height to fit into | getMinimumBoxSize | javascript | syzoj/syzoj | static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | MIT |
function fitBox(box) {
var minBoxSize = helpers.findNextWhere(minBoxSizes, function(minBox) {
return minBox.box === box;
});
if (minBoxSize) {
if (box.isHorizontal()) {
var scaleMargin = {
left: Math.max(totalLeftBoxesWidth, maxHorizontalLeftPadding),
right: Math.max(totalRightBoxesWi... | Fits boxes of the given chart into the given size by having each box measure itself
then running a fitting algorithm
@param {Chart} chart - the chart
@param {Number} width - the width to fit into
@param {Number} height - the height to fit into | fitBox | javascript | syzoj/syzoj | static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | MIT |
function finalFitVerticalBox(box) {
var minBoxSize = helpers.findNextWhere(minBoxSizes, function(minSize) {
return minSize.box === box;
});
var scaleMargin = {
left: 0,
right: 0,
top: totalTopBoxesHeight,
bottom: totalBottomBoxesHeight
};
if (minBoxSize) {
box.update(minBoxSize.... | Fits boxes of the given chart into the given size by having each box measure itself
then running a fitting algorithm
@param {Chart} chart - the chart
@param {Number} width - the width to fit into
@param {Number} height - the height to fit into | finalFitVerticalBox | javascript | syzoj/syzoj | static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | MIT |
function placeBox(box) {
if (box.isHorizontal()) {
box.left = box.fullWidth ? leftPadding : totalLeftBoxesWidth;
box.right = box.fullWidth ? width - rightPadding : totalLeftBoxesWidth + maxChartAreaWidth;
box.top = top;
box.bottom = top + box.height;
// Move to next point
top = box.bottom;
... | Fits boxes of the given chart into the given size by having each box measure itself
then running a fitting algorithm
@param {Chart} chart - the chart
@param {Number} width - the width to fit into
@param {Number} height - the height to fit into | placeBox | javascript | syzoj/syzoj | static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | MIT |
function labelsFromTicks(ticks) {
var labels = [];
var i, ilen;
for (i = 0, ilen = ticks.length; i < ilen; ++i) {
labels.push(ticks[i].label);
}
return labels;
} | @method IPlugin#destroy
@desc Called after the chart as been destroyed.
@param {Chart.Controller} chart - The chart instance.
@param {Object} options - The plugin options. | labelsFromTicks | javascript | syzoj/syzoj | static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | MIT |
function getLineValue(scale, index, offsetGridLines) {
var lineValue = scale.getPixelForTick(index);
if (offsetGridLines) {
if (index === 0) {
lineValue -= (scale.getPixelForTick(1) - lineValue) / 2;
} else {
lineValue -= (lineValue - scale.getPixelForTick(index - 1)) / 2;
}
}
return lineValue;
} | @method IPlugin#destroy
@desc Called after the chart as been destroyed.
@param {Chart.Controller} chart - The chart instance.
@param {Object} options - The plugin options. | getLineValue | javascript | syzoj/syzoj | static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | MIT |
function computeTextSize(context, tick, font) {
return helpers.isArray(tick) ?
helpers.longestText(context, font, tick) :
context.measureText(tick).width;
} | @method IPlugin#destroy
@desc Called after the chart as been destroyed.
@param {Chart.Controller} chart - The chart instance.
@param {Object} options - The plugin options. | computeTextSize | javascript | syzoj/syzoj | static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | MIT |
function parseFontOptions(options) {
var valueOrDefault = helpers.valueOrDefault;
var globalDefaults = defaults.global;
var size = valueOrDefault(options.fontSize, globalDefaults.defaultFontSize);
var style = valueOrDefault(options.fontStyle, globalDefaults.defaultFontStyle);
var family = valueOrDefault(options.fo... | @method IPlugin#destroy
@desc Called after the chart as been destroyed.
@param {Chart.Controller} chart - The chart instance.
@param {Object} options - The plugin options. | parseFontOptions | javascript | syzoj/syzoj | static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | MIT |
function parseLineHeight(options) {
return helpers.options.toLineHeight(
helpers.valueOrDefault(options.lineHeight, 1.2),
helpers.valueOrDefault(options.fontSize, defaults.global.defaultFontSize));
} | @method IPlugin#destroy
@desc Called after the chart as been destroyed.
@param {Chart.Controller} chart - The chart instance.
@param {Object} options - The plugin options. | parseLineHeight | javascript | syzoj/syzoj | static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | MIT |
function mergeOpacity(colorString, opacity) {
var color = helpers.color(colorString);
return color.alpha(opacity * color.alpha()).rgbaString();
} | Helper method to merge the opacity into a color | mergeOpacity | javascript | syzoj/syzoj | static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | MIT |
function pushOrConcat(base, toPush) {
if (toPush) {
if (helpers.isArray(toPush)) {
// base = base.concat(toPush);
Array.prototype.push.apply(base, toPush);
} else {
base.push(toPush);
}
}
return base;
} | Helper method to merge the opacity into a color | pushOrConcat | javascript | syzoj/syzoj | static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | MIT |
function splitNewlines(str) {
if ((typeof str === 'string' || str instanceof String) && str.indexOf('\n') > -1) {
return str.split('\n');
}
return str;
} | Returns array of strings split by newline
@param {String} value - The value to split by newline.
@returns {Array} value if newline present - Returned from String split() method
@function | splitNewlines | javascript | syzoj/syzoj | static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | https://github.com/syzoj/syzoj/blob/master/static/cdnjs/Chart.js/2.7.3/Chart.bundle.js | MIT |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.