ChartAdvisor.advise

4 min read
ChartAdvisor.advise(params: AdviseParams): ChartAdvisorList[];

Parameters

  • params * ChartAdvisor 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.None Optional
*KeystringSpecifies the location of the point-edge relationship (point, edge, origin, pointing).None Optional
AdvisorOptionsAdvisorOptionsSame as the recommended configuration items for statistical graphs.None Optional

Return value

ChartAdvisorList[]

  • ChartAdvisorList Parameter configuration.
PropertiesTypeDescriptionExamples
typeChartTypeThe type of the chart.line-chart
specAntVSpecThe chart attribute information.See below.
lintLintThe chart optimization suggestions.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' } ] }
  • Lint Parameter configuration.
PropertiesTypeDescriptionExamples
typestringRule type.hard / soft / design
idstringRule id.10
scorenumberThe score of the rule.1
fixanyThe solution based on this rule.
docsanyThe documentation for the rule.