Merge branch 'master' into exclude_aggr_func
This commit is contained in:
Коммит
d8c861ab51
|
@ -380,7 +380,9 @@ export class MenuBar extends ContextedComponent<
|
|||
const inputElement = document.createElement("input");
|
||||
inputElement.type = "file";
|
||||
let file = null;
|
||||
inputElement.accept = ["tmplt"].map((x) => "." + x).join(",");
|
||||
inputElement.accept = ["tmplt", "json"]
|
||||
.map((x) => "." + x)
|
||||
.join(",");
|
||||
// eslint-disable-next-line
|
||||
inputElement.onchange = () => {
|
||||
if (inputElement.files.length == 1) {
|
||||
|
|
|
@ -1443,7 +1443,7 @@ export class FluentUIWidgetManager
|
|||
<ButtonRaised
|
||||
text="Import Template..."
|
||||
onClick={async () => {
|
||||
const file = await showOpenFileDialog(["tmplt"]);
|
||||
const file = await showOpenFileDialog(["tmplt", "json"]);
|
||||
const str = await readFileAsString(file);
|
||||
const data = JSON.parse(str);
|
||||
const template = new ChartTemplate(data);
|
||||
|
|
|
@ -1120,7 +1120,7 @@ export class WidgetManager
|
|||
<ButtonRaised
|
||||
text="Import Template..."
|
||||
onClick={async () => {
|
||||
const file = await showOpenFileDialog(["tmplt"]);
|
||||
const file = await showOpenFileDialog(["tmplt", "json"]);
|
||||
const str = await readFileAsString(file);
|
||||
const data = JSON.parse(str);
|
||||
const template = new ChartTemplate(data);
|
||||
|
|
|
@ -24,6 +24,7 @@ export namespace Scale {
|
|||
public domainMax: number;
|
||||
|
||||
public inferParameters(values: number[]) {
|
||||
values = values.filter(v => !isNaN(v))
|
||||
const scale = scaleLinear()
|
||||
.domain([Math.min(...values), Math.max(...values)])
|
||||
.nice();
|
||||
|
|
|
@ -90,8 +90,8 @@ export class CategoricalScaleNumber extends ScaleClass<
|
|||
public mapDataToAttribute(data: DataValue): AttributeValue {
|
||||
const attrs = this.state.attributes;
|
||||
const props = this.object.properties;
|
||||
const number = props.mapping[data.toString()];
|
||||
return number * attrs.rangeScale;
|
||||
const number = props.mapping[data ? data?.toString() : null];
|
||||
return (number ?? 0) * attrs.rangeScale;
|
||||
}
|
||||
|
||||
public buildConstraint(
|
||||
|
@ -101,7 +101,7 @@ export class CategoricalScaleNumber extends ScaleClass<
|
|||
) {
|
||||
const attrs = this.state.attributes;
|
||||
const props = this.object.properties;
|
||||
const k = props.mapping[data.toString()];
|
||||
const k = props.mapping[data?.toString()];
|
||||
solver.addLinear(
|
||||
ConstraintStrength.HARD,
|
||||
0,
|
||||
|
@ -207,7 +207,7 @@ export class CategoricalScaleColor extends ScaleClass<
|
|||
|
||||
public mapDataToAttribute(data: DataValue): AttributeValue {
|
||||
const props = this.object.properties;
|
||||
return props.mapping[data.toString()];
|
||||
return props.mapping[data?.toString()];
|
||||
}
|
||||
|
||||
// eslint-disable-next-line
|
||||
|
@ -383,7 +383,7 @@ export class CategoricalScaleEnum extends ScaleClass<
|
|||
|
||||
public mapDataToAttribute(data: DataValue): AttributeValue {
|
||||
const props = this.object.properties;
|
||||
return props.mapping[data.toString()];
|
||||
return props.mapping[data?.toString()];
|
||||
}
|
||||
|
||||
// eslint-disable-next-line
|
||||
|
@ -472,7 +472,7 @@ export class CategoricalScaleBoolean extends ScaleClass<
|
|||
|
||||
public mapDataToAttribute(data: DataValue): AttributeValue {
|
||||
const props = this.object.properties;
|
||||
return props.mapping[data.toString()];
|
||||
return props.mapping[data?.toString()];
|
||||
}
|
||||
|
||||
// eslint-disable-next-line
|
||||
|
@ -555,7 +555,7 @@ export class CategoricalScaleImage extends ScaleClass<
|
|||
|
||||
public mapDataToAttribute(data: DataValue): AttributeValue {
|
||||
const props = this.object.properties;
|
||||
return props.mapping[data.toString()];
|
||||
return props.mapping[data?.toString()];
|
||||
}
|
||||
|
||||
// eslint-disable-next-line
|
||||
|
|
Загрузка…
Ссылка в новой задаче