-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(ava): 修改计算insight mark的方法&补充示例 (#13)
* fix(ava): 修改获取insight mark的方法&补充示例 (#9) * fix(ava): 修改获取insight mark的方法 * fix(ava): 补充insight mark示例 * fix(ava): 删除demo中的styles配置 --------- Co-authored-by: laixingui.lxg <[email protected]> * chore(ava): 更新ava版本 (#12) * fix(ava): 解决格式问题 (#14) --------- Co-authored-by: laixingui.lxg <[email protected]>
- Loading branch information
Showing
20 changed files
with
259 additions
and
113 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
year,value | ||
1991,6 | ||
1992,1.6 | ||
1993,5 | ||
1994,5 | ||
1995,6 | ||
1996,4 | ||
1997,0.5 | ||
1998,5 | ||
1999,5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
year,value | ||
1991,0.3 | ||
1992,-0.5 | ||
1993,0.05 | ||
1994,-0.2 | ||
1995,0.4 | ||
1996,6 | ||
1997,5 | ||
1998,8 | ||
1999,5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { register } from "@antv/g2"; | ||
import { CategoryOutlier } from "../../src/insights"; | ||
|
||
/** @ts-ignore */ | ||
register("mark.categoryOutlier", CategoryOutlier); | ||
|
||
export function CategoryOutlierBasic() { | ||
return { | ||
type: "view", | ||
children: [ | ||
// 原始图表 | ||
{ | ||
data: { type: "fetch", value: "data/category-outlier.csv" }, | ||
encode: { | ||
x: "year", | ||
y: "value", | ||
}, | ||
type: "interval", | ||
}, | ||
// 异常点 mark | ||
{ | ||
type: "categoryOutlier", | ||
data: { type: "fetch", value: "data/category-outlier.csv" }, | ||
encode: { | ||
x: "year", | ||
y: "value", | ||
}, | ||
}, | ||
], | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { register } from "@antv/g2"; | ||
import { ChangePoint } from "../../src/insights"; | ||
|
||
/** @ts-ignore */ | ||
register("mark.changePoint", ChangePoint); | ||
|
||
export function ChangePointBasic() { | ||
return { | ||
type: "view", | ||
children: [ | ||
// 原始图表 | ||
{ | ||
data: { type: "fetch", value: "data/change-point.csv" }, | ||
encode: { | ||
x: "year", | ||
y: "value", | ||
}, | ||
type: "line", | ||
}, | ||
// 突变点 mark | ||
{ | ||
type: "changePoint", | ||
data: { type: "fetch", value: "data/change-point.csv" }, | ||
encode: { | ||
x: "year", | ||
y: "value", | ||
}, | ||
}, | ||
], | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
export { AlphabetAutoBasic } from "./alphabet-auto-basic"; | ||
export { InsightBasic } from './insight-basic'; | ||
export { TimeSeriesOutlierBasic } from './time-series-outlier-basic' | ||
export { InsightBasic } from "./insight-basic"; | ||
export { TimeSeriesOutlierBasic } from "./time-series-outlier-basic"; | ||
export { TrendBasic } from "./trend-basic"; | ||
export { ChangePointBasic } from "./change-point-basic"; | ||
export { CategoryOutlierBasic } from "./category-outlier-basic"; | ||
export { LowVarianceBasic } from "./low-variance-basic"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { register } from "@antv/g2"; | ||
import { LowVariance } from "../../src/insights"; | ||
|
||
/** @ts-ignore */ | ||
register("mark.lowVariance", LowVariance); | ||
|
||
export function LowVarianceBasic() { | ||
return { | ||
type: "view", | ||
children: [ | ||
// 原始图表 | ||
{ | ||
data: { type: "fetch", value: "data/basic-time-series.csv" }, | ||
encode: { | ||
x: "year", | ||
y: "life_expect", | ||
}, | ||
type: "interval", | ||
}, | ||
// 低方差 mark | ||
{ | ||
type: "lowVariance", | ||
data: { type: "fetch", value: "data/basic-time-series.csv" }, | ||
encode: { | ||
x: "year", | ||
y: "life_expect", | ||
}, | ||
}, | ||
], | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,31 @@ | ||
import { register } from "@antv/g2"; | ||
import { Trend } from "../../src/insights"; | ||
|
||
/** @ts-ignore */ | ||
register("mark.trend", Trend); | ||
|
||
export function TrendBasic() { | ||
return { | ||
type: "view", | ||
children: [ | ||
// 原始图表 | ||
{ | ||
data: { type: "fetch", value: "data/change-point.csv" }, | ||
encode: { | ||
x: "year", | ||
y: "value", | ||
}, | ||
type: "line", | ||
}, | ||
// 趋势线 mark | ||
{ | ||
type: "trend", | ||
data: { type: "fetch", value: "data/change-point.csv" }, | ||
encode: { | ||
x: "year", | ||
y: "value", | ||
}, | ||
}, | ||
], | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,20 @@ | ||
import { InsightExtractorProps } from "@antv/ava"; | ||
import { Insight, type InsightMarkOptions } from "./insight"; | ||
|
||
export type CategoryOutlierMarkOptions = Omit<InsightMarkOptions, 'insightType' | 'options'> & { | ||
algorithmParameter?: Pick<InsightExtractorProps['options']['algorithmParameter'], 'outlier'> | ||
};; | ||
export type CategoryOutlierMarkOptions = Omit<InsightMarkOptions, "insightType" | "options"> & { | ||
algorithmParameter?: Pick<InsightExtractorProps["options"]["algorithmParameter"], "outlier">; | ||
}; | ||
|
||
/** 类别型数据异常检测高阶 Mark | ||
/** 类别型数据异常检测高阶 Mark | ||
* category outlier detection augmented mark | ||
*/ | ||
*/ | ||
export const CategoryOutlier = (options: CategoryOutlierMarkOptions) => { | ||
const {algorithmParameter, ...restOptions} = options | ||
const { algorithmParameter, ...restOptions } = options; | ||
return Insight({ | ||
...restOptions, | ||
options: { | ||
algorithmParameter | ||
algorithmParameter, | ||
}, | ||
insightType: 'category_outlier' | ||
}) | ||
} | ||
insightType: "category_outlier", | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,20 @@ | ||
import type { InsightExtractorProps } from "@antv/ava"; | ||
import { Insight, type InsightMarkOptions } from "./insight"; | ||
|
||
export type ChangePointMarkOptions = Omit<InsightMarkOptions, 'insightType' | 'options'> & { | ||
algorithmParameter?: Pick<InsightExtractorProps['options']['algorithmParameter'], 'changePoint'> | ||
export type ChangePointMarkOptions = Omit<InsightMarkOptions, "insightType" | "options"> & { | ||
algorithmParameter?: Pick<InsightExtractorProps["options"]["algorithmParameter"], "changePoint">; | ||
}; | ||
|
||
/** 突变点检测高阶 Mark | ||
/** 突变点检测高阶 Mark | ||
* change point detection augmented mark | ||
*/ | ||
*/ | ||
export const ChangePoint = (options: ChangePointMarkOptions) => { | ||
const {algorithmParameter, ...restOptions} = options | ||
const { algorithmParameter, ...restOptions } = options; | ||
return Insight({ | ||
...restOptions, | ||
options: { | ||
algorithmParameter | ||
algorithmParameter, | ||
}, | ||
insightType: 'change_point' | ||
}) | ||
} | ||
insightType: "change_point", | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,20 @@ | ||
import type { InsightExtractorProps } from "@antv/ava"; | ||
import { Insight, type InsightMarkOptions } from "./insight"; | ||
|
||
export type CorrelationMarkOptions = Omit<InsightMarkOptions, 'insightType' | 'options'> & { | ||
algorithmParameter?: Pick<InsightExtractorProps['options']['algorithmParameter'], 'correlation'> | ||
export type CorrelationMarkOptions = Omit<InsightMarkOptions, "insightType" | "options"> & { | ||
algorithmParameter?: Pick<InsightExtractorProps["options"]["algorithmParameter"], "correlation">; | ||
}; | ||
|
||
/** 相关性拟合线高阶 Mark | ||
/** 相关性拟合线高阶 Mark | ||
* correlation regression line | ||
*/ | ||
*/ | ||
export const Correlation = (options: CorrelationMarkOptions) => { | ||
const {algorithmParameter, ...restOptions} = options | ||
const { algorithmParameter, ...restOptions } = options; | ||
return Insight({ | ||
...restOptions, | ||
options: { | ||
algorithmParameter | ||
algorithmParameter, | ||
}, | ||
insightType: 'correlation' | ||
}) | ||
} | ||
insightType: "correlation", | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
export * from './insight' | ||
export * from './lowVariance' | ||
export * from './categoryOutlier' | ||
export * from './changePoint' | ||
export * from './correlation' | ||
export * from './trend' | ||
export * from './timeSeriesOutlier' | ||
export * from "./insight"; | ||
export * from "./lowVariance"; | ||
export * from "./categoryOutlier"; | ||
export * from "./changePoint"; | ||
export * from "./correlation"; | ||
export * from "./trend"; | ||
export * from "./timeSeriesOutlier"; |
Oops, something went wrong.