Advisor.advise

4 min read
Advisor.advise(params: AdviseParams): ChartList[];

Parameters

  • params * Advisor configurations

    • required
    • type: AdviseParams
type AdviseParams = ChartAdviseParams | GraphAdviseParams;

ChartAdviseParams and GraphAdviseParams represent the types of parameters required for chart recommendations and graph recommendations, respectively.

Chart recommendation parameters

  • ChartAdviseParams Parameter configuration.
PropertiesTypeDescriptionDefault
dataany[]The source data.None
fieldsstring[]The data field information.None Optional
smartColorbooleanWhether to enable smart color matching.false Optional
optionsAdvisorOptionsThe recommended configuration items for the statistics chart.None Optional
colorOptionsSmartColorOptionsThe smartColor option.None Optional
  • AdvisorOptions Parameter configuration.
propertytypedescriptiondefault
purposePurposeThe purpose of the analysis.None Optional
preferencesPreferencesChart preferences.None Optional
refinebooleanWhether to enable rule-based optimization.None Optional
fieldsstring[]Data field information.None Optional
showLogbooleanWhether to show Log.None Optional
themeThemeSpecify color in hexadecimal.None Optional
  • Purpose Parameter configuration.
type PURPOSE_OPTIONS = ["Comparison", "Trend", "Distribution", "Rank", "Proportion", 
  "Composition", "Relation", "Hierarchy", "Flow", "Spatial", "Anomaly", "Value"];
  • Preferences Parameter configuration.
interface Preferences {
  canvasLayout: 'landscape' | 'portrait';
}
  • Theme Parameter configuration.
type Theme = {
  primaryColor?: string;
};
  • SmartColorOptions Parameter configuration.
type SmartColorOptions = {
  themeColor?: string;
  colorSchemeType?: ColorSchemeType;
  simulationType?: SimulationType;
}
PropertiesTypeDescriptionDefault
themeColorstringThe hexadecimal theme color.#006f94 Optional
colorSchemeTypeColorSchemeTypeThe color swatch generation mode.monochromatic Optional
simulationTypeSimulationTypeThe color simulation mode.normal Optional

Graph recommendation parameters

  • GraphAdviseParams Parameter configuration.
PropertiesTypeDescriptionDefault
dataany[]The source data.None Optional
fields{ nodes, links }Data point edge information.None Optional
optionsGraphAdvisorOptionsGraph recommendation configuration items.None Optional
  • GraphAdvisorOptions Parameter configuration.
type GraphAdvisorOptions = {
  nodeColors?: string[];
  nodeSizeRange?: number[];
  edgeWidthRange?: number[];
  extra?: {
    nodeKey?: string;
    edgeKey?: string;
    sourceKey?: string;
    targetKey?: string;
    childrenKey?: string;
  };
  ...AdvisorOptions;
};
PropertiesTypeDescriptionDefault
nodeColorsstring[]The color of the node.None Optional
nodeSizeRangenumber[]The node size range.None Optional
edgeWidthRangenumber[]The width range of the edge.None Optional
extra{ *Key, ...}Specifies the graph-related attributes.See below.
AdvisorOptionsAdvisorOptionsSame as the recommended configuration items for statistical graphs.None Optional
  • extra Parameter configuration.
PropertiesTypeDescriptionDefault
nodeKeystringSpecifies the property name of nodes in the given graph data.nodes
edgeKeystringSpecifies the property name of edges in the given graph data.edges | links
sourceKeystringSpecifies the property name of source node in edges.source
targetKeystringSpecifies the property name of target node in edges.target
childrenKeystringSpecifies the property name of children in the given hirerachy data.children | to

Return value

ChartList[]

  • ChartList Parameter configuration.
PropertiesTypeDescriptionExamples
typeChartTypeThe type of the chart.line-chart
specAntVSpecThe chart attribute information.See below.
scorenumberThe chart score.1.0
  • AntVSpec Parameter configuration.

AntVSpec is the declarative grammar that supports various technology stacks of AntV. See AntVSpec API for detail configurations.

PropertiesDescriptionExamples
basisThe basic information.basis: { type: 'chart' }
dataThe data information.data: { type: 'json-array', values: [...] }
layerThe drawing information.{ [ encoding: { x: {...} , y:{...} }, mark: { type: 'line' } ] }