зеркало из https://github.com/microsoft/SandDance.git
color hex codes parsed as dates (#663)
This commit is contained in:
Родитель
7cf1f5aff7
Коммит
392b42fbb5
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"name": "@msrvida/data-inference",
|
||||
"version": "1.0.0",
|
||||
"version": "1.0.1",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@msrvida/data-inference",
|
||||
"version": "1.0.0",
|
||||
"version": "1.0.1",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"d3-color": "^3.1.0",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@msrvida/data-inference",
|
||||
"version": "1.0.0",
|
||||
"version": "1.0.1",
|
||||
"description": "Infer column types in tabular data.",
|
||||
"main": "dist/es6/index.js",
|
||||
"repository": {
|
||||
|
|
|
@ -42,7 +42,8 @@ export function inferAll(columns: Column[], data: object[]) {
|
|||
if (!column.stats) {
|
||||
column.stats = getStats(data, column);
|
||||
}
|
||||
if (column.type === 'string' && typeof column.isColorData !== 'boolean') {
|
||||
// hex codes, ex. #003300, are parsed as dates
|
||||
if ((column.type === 'date' || column.type === 'string') && typeof column.isColorData !== 'boolean') {
|
||||
checkIsColorData(data, column);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -49,7 +49,8 @@ export function getStats(data: object[] | Float64Array, ...args: any[]) {
|
|||
}
|
||||
sum += num;
|
||||
}
|
||||
if (columnType === 'string' && !stats.hasColorData && isColor(value)) {
|
||||
// hex codes, ex. #003300, are parsed as dates
|
||||
if ((columnType === 'date' || columnType === 'string') && !stats.hasColorData && isColor(value)) {
|
||||
stats.hasColorData = true;
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче