Skip to content

An open source alternative to Tableau. Embeddable visual analytic

fix: remove useless code

ObservedObserver29cf95bf1017
diff --git a/packages/graphic-walker/src/utils/autoMark.ts b/packages/graphic-walker/src/utils/autoMark.ts
index 1b518a35..255b6b6e 100644
--- a/packages/graphic-walker/src/utils/autoMark.ts
+++ b/packages/graphic-walker/src/utils/autoMark.ts
@@ -15,9 +15,6 @@ export function autoMark(semanticTypeList: ISemanticType[]): string {
couter.set(s, 0)
})
for (let st of semanticTypeList) {
- // if (!couter.has(st)) {
- // couter.set(st, 0);
- // }
couter.set(st, couter.get(st)! + 1);
}
if (couter.get('nominal') === 1 || couter.get('ordinal') === 1) {
@@ -30,5 +27,4 @@ export function autoMark(semanticTypeList: ISemanticType[]): string {
return 'point'
}
return 'point'
- // if (cou)
}
\ No newline at end of file
diff --git a/packages/graphic-walker/src/utils/index.ts b/packages/graphic-walker/src/utils/index.ts
index 017b9bdc..192d8a61 100644
--- a/packages/graphic-walker/src/utils/index.ts
+++ b/packages/graphic-walker/src/utils/index.ts
@@ -26,7 +26,6 @@ function normalizeRecords(dataSource: IRow[], measures: string[]): NRReturns {
dataSource.forEach(record => {
const norRecord: IRow = { ... record };
measures.forEach(mea => {
- // norRecord[mea] = norRecord[mea] - minMeasures[mea]
totalMeasures[mea] += Math.abs(norRecord[mea]);
})
newData.push(norRecord)
@@ -71,9 +70,7 @@ function normalize2PositiveRecords(dataSource: IRow[], measures: string[]): NRRe
newData.forEach((record) => {
measures.forEach((mea) => {
record[mea] /= totalMeasures[mea];
- // if (isNaN(record[mea])) {
- // record[mea] = 1
- // }
+
});
});
return {
diff --git a/packages/graphic-walker/src/utils/normalization.ts b/packages/graphic-walker/src/utils/normalization.ts
index b0feee84..4b2c9f8f 100644
--- a/packages/graphic-walker/src/utils/normalization.ts
+++ b/packages/graphic-walker/src/utils/normalization.ts
@@ -63,9 +63,6 @@ export function compareDistribution (distribution1: IRow[], distribution2: IRow[
tagsForD2[targetRecordIndex] = true;
const targetRecord = distribution2[targetRecordIndex];
for (let mea of measures) {
- // score += Math.abs(targetRecord[mea] - record[mea]);
- // if (targetRecord[mea] === 0 || record[mea] === 0) continue;
- // score += Math.max(targetRecord[mea], record[mea]) / Math.min(targetRecord[mea], record[mea]);
score = Math.max(
score,
@@ -77,7 +74,6 @@ export function compareDistribution (distribution1: IRow[], distribution2: IRow[
} else {
for (let mea of measures) {
score = Math.max(score, record[mea])
- // score += Math.abs(record[mea])
count++;
}
}
@@ -86,7 +82,6 @@ export function compareDistribution (distribution1: IRow[], distribution2: IRow[
if (!tagsForD2[i]) {
tagsForD2[i] = true;
for (let mea of measures) {
- // score += Math.abs(distribution2[i][mea])
score = Math.max(score, distribution2[i][mea]);
count++;
}
@@ -122,7 +117,6 @@ export function normalizeByMeasures (dataSource: IRow[], measures: string[]) {
export function getDistributionDifference(dataSource: IRow[], dimensions: string[], measure1: string, measure2: string): number {
let score = 0;
for (let record of dataSource) {
- // score += Math.abs(record[measure1] - record[measure2])
if (record[measure1] === 0 || record[measure2] === 0) continue;
score += Math.max(record[measure1], record[measure2]) / Math.min(record[measure1], record[measure2]);
}
diff --git a/packages/graphic-walker/src/utils/save.ts b/packages/graphic-walker/src/utils/save.ts
index 57d20d2a..6a0f42f5 100644
--- a/packages/graphic-walker/src/utils/save.ts
+++ b/packages/graphic-walker/src/utils/save.ts
@@ -26,7 +26,6 @@ export function stringifyGWContent (info: IStoInfo) {
export function parseGWContent (raw: string): IStoInfo {
return JSON.parse(raw)
}
-// JSON.stringify
export function download(data: string, filename: string, type: string) {
var file = new Blob([data], {type: type});