Skip to content

An open source alternative to Tableau. Embeddable visual analytic

fix: default mark for single quan

observedobserver31acf5a2c696
diff --git a/packages/graphic-walker/src/lib/insights/explainDiffs.ts b/packages/graphic-walker/src/lib/insights/explainDiffs.ts
new file mode 100644
index 00000000..e69de29b
diff --git a/packages/graphic-walker/src/utils/autoMark.ts b/packages/graphic-walker/src/utils/autoMark.ts
deleted file mode 100644
index 040a0eb6..00000000
--- a/packages/graphic-walker/src/utils/autoMark.ts
+++ /dev/null
@@ -1,30 +0,0 @@
-import { ISemanticType } from "../interfaces";
-
-/**
- *
- * @param semanticTypeList semanticTypeList.length <= 2,调用时,手动将columns 和 rows的最后一个元素组合传进来
- * @returns geom(mark) type
- */
-export function autoMark(semanticTypeList: ISemanticType[]): string {
- if (semanticTypeList.length < 2) {
- if (semanticTypeList[0] === "temporal") return "tick";
- return "bar";
- }
- const couter: Map<ISemanticType, number> = new Map();
- (["nominal", "ordinal", "quantitative", "temporal"] as ISemanticType[]).forEach((s) => {
- couter.set(s, 0);
- });
- for (let st of semanticTypeList) {
- couter.set(st, couter.get(st)! + 1);
- }
- if (couter.get("nominal") === 1 || couter.get("ordinal") === 1) {
- return "bar";
- }
- if (couter.get("temporal") === 1 && couter.get("quantitative") === 1) {
- return "line";
- }
- if (couter.get("quantitative") === 2) {
- return "point";
- }
- return "point";
-}
diff --git a/packages/graphic-walker/src/vis/spec/mark.ts b/packages/graphic-walker/src/vis/spec/mark.ts
index 77b7fdd0..f62b6d90 100644
--- a/packages/graphic-walker/src/vis/spec/mark.ts
+++ b/packages/graphic-walker/src/vis/spec/mark.ts
@@ -7,7 +7,7 @@ import { ISemanticType } from "../../interfaces";
*/
export function autoMark(semanticTypeList: ISemanticType[]): string {
if (semanticTypeList.length < 2) {
- if (semanticTypeList[0] === "temporal") return "tick";
+ if (semanticTypeList[0] === "temporal" || semanticTypeList[0] === 'quantitative') return "tick";
return "bar";
}
const couter: Map<ISemanticType, number> = new Map();