Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(ava/advisor): add some meta info, includes 5 chart ckb, 2 purpos… #786

Open
wants to merge 1 commit into
base: dev-refactor-pipeline2
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
99 changes: 82 additions & 17 deletions packages/ava/src/ckb/base.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,25 @@
import type { PureChartKnowledgeBase } from './types';

export const base: PureChartKnowledgeBase = {
indicator_chart: {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

以前给指标卡预留过一个命名 kpi_panel ,可以用这个名字

id: 'indicator_chart',
name: 'Value Chart',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

name 就叫 KPI Panel ?

alias: ['Indicator'],
family: ['Indicators'],
def: 'A chart show indicator number, can',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这句话好像不完整?

purpose: ['Value'],
coord: ['Other'],
category: ['Statistic'],
shape: ['Other'],
encodePres: {},
dataPres: [
{ minQty: 0, maxQty: 2, fieldConditions: ['Time', 'Ordinal', 'Nominal'] },
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

不考虑在图表内进行数据聚合逻辑的话,指标卡好像不应该有维度?
ava 这里应该不考虑维度,有的话好像也不好限制 maxQty

{ minQty: 1, maxQty: '*', fieldConditions: ['Interval'] },
],
channel: [],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

channel 感觉可以加一个 'Text' ,用文本编码的数据

recRate: 'Recommended',
},

line_chart: {
id: 'line_chart',
name: 'Line Chart',
Expand Down Expand Up @@ -1333,23 +1352,69 @@ export const base: PureChartKnowledgeBase = {
// recRate: 'Recommended',
// },

/*
* WIP: unavailable until completed
*/
// liquid_chart: {
// id: 'liquid_chart',
// name: 'Liquid Chart',
// alias: ['Liquid Ball', 'Progress Ball'],
// family: ['Others'],
// def: 'Liquid chart is a diagram to represent progress.',
// purpose: ['Composition'],
// coord: ['Other'],
// category: ['Diagram'],
// shape: ['Round'],
// dataPres: [{ minQty: 2, maxQty: 2, fieldConditions: ['Interval'] }],
// channel: ['Position'],
// recRate: 'Not Recommended',
// },
liquid_chart: {
id: 'liquid_chart',
name: 'Liquid Chart',
alias: ['Liquid Ball', 'Progress Ball'],
family: ['ProgressCharts'],
def: 'Liquid chart is a diagram to represent progress.',
purpose: ['Progress', 'Value'],
coord: ['Other'],
category: ['Diagram'],
shape: ['Round'],
dataPres: [{ minQty: 1, maxQty: 2, fieldConditions: ['Interval'] }],
channel: ['Position'],
recRate: 'Not Recommended',
},

gauge_chart: {
id: 'gauge_chart',
name: 'Gauge Chart',
alias: [],
family: ['ProgressCharts'],
def: 'Gauge chart is a diagram to represent progress, different color with different progress.',
purpose: ['Progress', 'Value'],
coord: ['Other'],
category: ['Diagram'],
shape: ['Round'],
dataPres: [{ minQty: 1, maxQty: 2, fieldConditions: ['Interval'] }],
channel: ['Color', 'Position'],
recRate: 'Not Recommended',
},

progress_chart: {
id: 'progress_chart',
name: 'Progress Chart',
alias: [],
family: ['ProgressCharts'],
def: 'Progress Chart is a diagram to represent progress, display as bar.',
purpose: ['Progress'],
coord: ['Other'],
category: ['Diagram'],
shape: ['Bars'],
dataPres: [{ minQty: 1, maxQty: 2, fieldConditions: ['Interval'] }],
channel: ['Length'],
recRate: 'Not Recommended',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

为啥这几个都是 'Not Recommended' 呀

},

geo_area_map: {
id: 'geo_area_map',
name: 'Geo Area Map',
alias: [],
family: ['Others'],
def: 'Geo Area Map display data on a area map.',
purpose: ['Geo', 'Distribution'],
coord: ['Geo'],
category: ['Diagram'],
shape: ['Bars'],
dataPres: [
{ minQty: 1, maxQty: 2, fieldConditions: ['Interval'] },
{ minQty: 1, maxQty: 1, fieldConditions: ['Geo'] },
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

地图类先不加好了,因为 fieldConditions 这里内置的还没有识别 Geo 类型的,所以这里加上了实际也推不出来,会有点问题

{ minQty: 0, maxQty: 1, fieldConditions: ['Geo', 'Nominal', 'Time'] },
],
channel: ['Size', 'Color', 'Position'],
recRate: 'Not Recommended',
},

/**
* WIP: unavailable until completed
Expand Down
19 changes: 18 additions & 1 deletion packages/ava/src/ckb/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@
* @public
*/
export const CHART_IDS = [
'indicator_chart',
'liquid_chart',
'gauge_chart',
'progress_chart',
'geo_area_map',
'line_chart',
'step_line_chart',
'area_chart',
Expand Down Expand Up @@ -68,6 +73,7 @@ export const CHART_IDS = [
* @public
*/
export const FAMILIES = [
'Indicators',
'LineCharts',
'ColumnCharts',
'BarCharts',
Expand All @@ -84,6 +90,7 @@ export const FAMILIES = [
'PointLayer',
'HeatmapLayer',
'Table',
'ProgressCharts',
'Others',
] as const;

Expand All @@ -107,6 +114,8 @@ export const PURPOSES = [
'Spatial',
'Anomaly',
'Value',
'Progress',
'Geo',
] as const;

/**
Expand Down Expand Up @@ -164,7 +173,15 @@ export const SHAPES = [
*
* @public
*/
export const LEVEL_OF_MEASUREMENTS = ['Nominal', 'Ordinal', 'Interval', 'Discrete', 'Continuous', 'Time'] as const;
export const LEVEL_OF_MEASUREMENTS = [
'Nominal',
'Ordinal',
'Interval',
'Discrete',
'Continuous',
'Time',
'Geo',
] as const;

/**
* Array of channels.
Expand Down
14 changes: 14 additions & 0 deletions packages/ava/src/ckb/encode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,24 @@ export const heatmapEncodeRequirement: EncodeRequirements = {
},
};

export const indicatorEncodeRequirement: EncodeRequirements = {
x: {
minQty: 0,
maxQty: 1,
fieldConditions: ['Time', 'Nominal'],
},
y: {
minQty: 0,
maxQty: '*',
fieldConditions: ['Interval'],
},
};

export const areaEncodeRequirement = lineEncodeRequirement;
export const columnEncodeRequirement = barEncodeRequirement;

export const chartType2EncodeRequirement: Partial<Record<ChartId, EncodeRequirements>> = {
indicator_chart: indicatorEncodeRequirement,
line_chart: lineEncodeRequirement,
pie_chart: pieEncodeRequirement,
donut_chart: pieEncodeRequirement,
Expand Down