canvas-heatmap
Advanced tools
Comparing version 1.2.20 to 1.2.21
{ | ||
"name": "canvas-heatmap", | ||
"version": "1.2.20", | ||
"version": "1.2.21", | ||
"description": "Interactive heatmap, capable of displaying 1,000,000+ data points using canvas and d3. ", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -89,3 +89,3 @@ # Canvas Heatmap | ||
| colors | Color range for the plot (see below for example) | Red -> Blue | Array | | ||
| language | Select language for time axis. EN, DE, FR, ES | EN | String | | ||
| language | Select language for time axis. en, de, fr, es | en | String | | ||
@@ -92,0 +92,0 @@ #### Colors |
@@ -33,2 +33,3 @@ import { | ||
isNumeric, | ||
languageOptions, | ||
} from "./functions"; | ||
@@ -60,3 +61,3 @@ import { canvasGrid, canvasContour } from "./fillcanvas"; | ||
if ("language" in options) setLanguage(options.language); | ||
timeFormatDefaultLocale(languageOptions(options.language)); | ||
@@ -169,204 +170,2 @@ var xAxis = addXAxis(svg, xDomain, options); | ||
const setLanguage = (name) => { | ||
var lang = { | ||
DE: { | ||
decimal: ",", | ||
thousands: ".", | ||
grouping: [3], | ||
currency: ["€", ""], | ||
dateTime: "%a %b %e %X %Y", | ||
date: "%d.%m.%Y", | ||
time: "%H:%M:%S", | ||
periods: ["AM", "PM"], | ||
days: [ | ||
"Sonntag", | ||
"Montag", | ||
"Dienstag", | ||
"Mittwoch", | ||
"Donnerstag", | ||
"Freitag", | ||
"Samstag", | ||
], | ||
shortDays: ["So", "Mo", "Di", "Mi", "Do", "Fr", "Sa"], | ||
months: [ | ||
"Januar", | ||
"Februar", | ||
"März", | ||
"April", | ||
"Mai", | ||
"Juni", | ||
"Juli", | ||
"August", | ||
"September", | ||
"Oktober", | ||
"November", | ||
"Dezember", | ||
], | ||
shortMonths: [ | ||
"Jan", | ||
"Feb", | ||
"Mär", | ||
"Apr", | ||
"Mai", | ||
"Jun", | ||
"Jul", | ||
"Aug", | ||
"Sep", | ||
"Okt", | ||
"Nov", | ||
"Dez", | ||
], | ||
}, | ||
EN: { | ||
decimal: ",", | ||
thousands: ".", | ||
grouping: [3], | ||
currency: ["€", ""], | ||
dateTime: "%a %b %e %X %Y", | ||
date: "%d.%m.%Y", | ||
time: "%H:%M:%S", | ||
periods: ["AM", "PM"], | ||
days: [ | ||
"Sunday", | ||
"Monday", | ||
"Tuesday", | ||
"Wednesday", | ||
"Thursday", | ||
"Friday", | ||
"Saturday", | ||
], | ||
shortDays: ["Sun", "Mon", "Tues", "Weds", "Thurs", "Fri", "Sat"], | ||
months: [ | ||
"January", | ||
"February", | ||
"March", | ||
"April", | ||
"May", | ||
"June", | ||
"July", | ||
"August", | ||
"September", | ||
"October", | ||
"November", | ||
"December", | ||
], | ||
shortMonths: [ | ||
"Jan", | ||
"Feb", | ||
"Mar", | ||
"Apr", | ||
"May", | ||
"Jun", | ||
"Jul", | ||
"Aug", | ||
"Sep", | ||
"Oct", | ||
"Nov", | ||
"Dec", | ||
], | ||
}, | ||
FR: { | ||
decimal: ",", | ||
thousands: ".", | ||
grouping: [3], | ||
currency: ["€", ""], | ||
dateTime: "%a %b %e %X %Y", | ||
date: "%d.%m.%Y", | ||
time: "%H:%M:%S", | ||
periods: ["AM", "PM"], | ||
days: [ | ||
"Dimanche", | ||
"Lundi", | ||
"Mardi", | ||
"Mercredi", | ||
"Jeudi", | ||
"Vendredi", | ||
"Samedi", | ||
], | ||
shortDays: ["Di", "Lu", "Ma", "Me", "Je", "Ve", "Sa"], | ||
months: [ | ||
"Janvier", | ||
"Février", | ||
"Mars", | ||
"Avril", | ||
"Mai", | ||
"Juin", | ||
"Juillet", | ||
"Août", | ||
"Septembre", | ||
"Octobre", | ||
"Novembre", | ||
"Décembre", | ||
], | ||
shortMonths: [ | ||
"Janv", | ||
"Févr", | ||
"Mars", | ||
"Avr", | ||
"Mai", | ||
"Juin", | ||
"Juil", | ||
"Août", | ||
"Sept", | ||
"Oct", | ||
"Nov", | ||
"Déc", | ||
], | ||
}, | ||
ES: { | ||
decimal: ",", | ||
thousands: ".", | ||
grouping: [3], | ||
currency: ["€", ""], | ||
dateTime: "%a %b %e %X %Y", | ||
date: "%d.%m.%Y", | ||
time: "%H:%M:%S", | ||
periods: ["AM", "PM"], | ||
days: [ | ||
"Domingo", | ||
"Lunes", | ||
"Martes", | ||
"Miércoles", | ||
"Jueves", | ||
"Viernes", | ||
"Sábado", | ||
], | ||
shortDays: ["Do", "Lu", "Ma", "Mi", "Ju", "Vi", "Sa"], | ||
months: [ | ||
"Enero", | ||
"Febrero", | ||
"Marzo", | ||
"Abril", | ||
"Mayo", | ||
"Junio", | ||
"Julio", | ||
"Agosto", | ||
"Septiembre", | ||
"Octubre", | ||
"Noviembre", | ||
"Diciembre", | ||
], | ||
shortMonths: [ | ||
"Enero", | ||
"Feb", | ||
"Mar", | ||
"Abr", | ||
"Mayo", | ||
"Jun", | ||
"Jul", | ||
"Agosto", | ||
"Sept", | ||
"Oct", | ||
"Nov", | ||
"Dic", | ||
], | ||
}, | ||
}; | ||
if (name in lang) { | ||
timeFormatDefaultLocale(lang[name]); | ||
} else { | ||
console.error("Language: " + name + " not recognised."); | ||
} | ||
}; | ||
const replaceNull = (data, zMax) => { | ||
@@ -397,3 +196,3 @@ var nullData = JSON.parse(JSON.stringify(data)); | ||
var defaultOptions = [ | ||
{ name: "language", default: false, verify: verifyString }, | ||
{ name: "language", default: "EN", verify: verifyString }, | ||
{ name: "xLabel", default: false, verify: verifyString }, | ||
@@ -825,2 +624,4 @@ { name: "yLabel", default: false, verify: verifyString }, | ||
var lang = languageOptions(options.language) | ||
zoombox.on("mousemove", (event) => { | ||
@@ -851,3 +652,3 @@ try { | ||
if (options.xTime) { | ||
xval = formatDate(process.x[xi], "HH:mm dd MMM yy"); | ||
xval = formatDate(process.x[xi], lang); | ||
} else { | ||
@@ -859,3 +660,3 @@ xval = formatNumber(process.x[xi]); | ||
if (options.yTime) { | ||
yval = formatDate(process.y[yi], "HH:mm dd MMM yy"); | ||
yval = formatDate(process.y[yi], lang); | ||
} else { | ||
@@ -862,0 +663,0 @@ yval = formatNumber(process.y[yi]); |
@@ -94,17 +94,4 @@ export const convertToRGB = (hex) => { | ||
export const formatDate = (a) => { | ||
var months = [ | ||
"Jan", | ||
"Feb", | ||
"Mar", | ||
"Apr", | ||
"May", | ||
"Jun", | ||
"Jul", | ||
"Aug", | ||
"Sep", | ||
"Oct", | ||
"Nov", | ||
"Dec", | ||
]; | ||
export const formatDate = (a, lang) => { | ||
var months = lang.shortMonths | ||
var year = a.getFullYear(); | ||
@@ -129,1 +116,204 @@ var month = months[a.getMonth()]; | ||
}; | ||
export const languageOptions = (name) => { | ||
var lang = { | ||
de: { | ||
decimal: ",", | ||
thousands: ".", | ||
grouping: [3], | ||
currency: ["€", ""], | ||
dateTime: "%a %b %e %X %Y", | ||
date: "%d.%m.%Y", | ||
time: "%H:%M:%S", | ||
periods: ["AM", "PM"], | ||
days: [ | ||
"Sonntag", | ||
"Montag", | ||
"Dienstag", | ||
"Mittwoch", | ||
"Donnerstag", | ||
"Freitag", | ||
"Samstag", | ||
], | ||
shortDays: ["So", "Mo", "Di", "Mi", "Do", "Fr", "Sa"], | ||
months: [ | ||
"Januar", | ||
"Februar", | ||
"März", | ||
"April", | ||
"Mai", | ||
"Juni", | ||
"Juli", | ||
"August", | ||
"September", | ||
"Oktober", | ||
"November", | ||
"Dezember", | ||
], | ||
shortMonths: [ | ||
"Jan", | ||
"Feb", | ||
"Mär", | ||
"Apr", | ||
"Mai", | ||
"Jun", | ||
"Jul", | ||
"Aug", | ||
"Sep", | ||
"Okt", | ||
"Nov", | ||
"Dez", | ||
], | ||
}, | ||
en: { | ||
decimal: ",", | ||
thousands: ".", | ||
grouping: [3], | ||
currency: ["€", ""], | ||
dateTime: "%a %b %e %X %Y", | ||
date: "%d.%m.%Y", | ||
time: "%H:%M:%S", | ||
periods: ["AM", "PM"], | ||
days: [ | ||
"Sunday", | ||
"Monday", | ||
"Tuesday", | ||
"Wednesday", | ||
"Thursday", | ||
"Friday", | ||
"Saturday", | ||
], | ||
shortDays: ["Sun", "Mon", "Tues", "Weds", "Thurs", "Fri", "Sat"], | ||
months: [ | ||
"January", | ||
"February", | ||
"March", | ||
"April", | ||
"May", | ||
"June", | ||
"July", | ||
"August", | ||
"September", | ||
"October", | ||
"November", | ||
"December", | ||
], | ||
shortMonths: [ | ||
"Jan", | ||
"Feb", | ||
"Mar", | ||
"Apr", | ||
"May", | ||
"Jun", | ||
"Jul", | ||
"Aug", | ||
"Sep", | ||
"Oct", | ||
"Nov", | ||
"Dec", | ||
], | ||
}, | ||
fr: { | ||
decimal: ",", | ||
thousands: ".", | ||
grouping: [3], | ||
currency: ["€", ""], | ||
dateTime: "%a %b %e %X %Y", | ||
date: "%d.%m.%Y", | ||
time: "%H:%M:%S", | ||
periods: ["AM", "PM"], | ||
days: [ | ||
"Dimanche", | ||
"Lundi", | ||
"Mardi", | ||
"Mercredi", | ||
"Jeudi", | ||
"Vendredi", | ||
"Samedi", | ||
], | ||
shortDays: ["Di", "Lu", "Ma", "Me", "Je", "Ve", "Sa"], | ||
months: [ | ||
"Janvier", | ||
"Février", | ||
"Mars", | ||
"Avril", | ||
"Mai", | ||
"Juin", | ||
"Juillet", | ||
"Août", | ||
"Septembre", | ||
"Octobre", | ||
"Novembre", | ||
"Décembre", | ||
], | ||
shortMonths: [ | ||
"Janv", | ||
"Févr", | ||
"Mars", | ||
"Avr", | ||
"Mai", | ||
"Juin", | ||
"Juil", | ||
"Août", | ||
"Sept", | ||
"Oct", | ||
"Nov", | ||
"Déc", | ||
], | ||
}, | ||
es: { | ||
decimal: ",", | ||
thousands: ".", | ||
grouping: [3], | ||
currency: ["€", ""], | ||
dateTime: "%a %b %e %X %Y", | ||
date: "%d.%m.%Y", | ||
time: "%H:%M:%S", | ||
periods: ["AM", "PM"], | ||
days: [ | ||
"Domingo", | ||
"Lunes", | ||
"Martes", | ||
"Miércoles", | ||
"Jueves", | ||
"Viernes", | ||
"Sábado", | ||
], | ||
shortDays: ["Do", "Lu", "Ma", "Mi", "Ju", "Vi", "Sa"], | ||
months: [ | ||
"Enero", | ||
"Febrero", | ||
"Marzo", | ||
"Abril", | ||
"Mayo", | ||
"Junio", | ||
"Julio", | ||
"Agosto", | ||
"Septiembre", | ||
"Octubre", | ||
"Noviembre", | ||
"Diciembre", | ||
], | ||
shortMonths: [ | ||
"Enero", | ||
"Feb", | ||
"Mar", | ||
"Abr", | ||
"Mayo", | ||
"Jun", | ||
"Jul", | ||
"Agosto", | ||
"Sept", | ||
"Oct", | ||
"Nov", | ||
"Dic", | ||
], | ||
}, | ||
}; | ||
if (name in lang) { | ||
return lang[name]; | ||
} else { | ||
console.error("Language: " + name + " not recognised."); | ||
return lang["en"]; | ||
} | ||
}; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
925086
7878