types.ts 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. import { Advice, AdvisorConfig, ChartId, Datum, FieldInfo, PureChartKnowledge } from '@antv/ava';
  2. export type ChartType = ChartId | string;
  3. export type Specification = Advice['spec'] | any;
  4. export type RuleConfig = AdvisorConfig['ruleCfg'];
  5. export type AutoChartProps = {
  6. data: Datum[];
  7. /** Chart type which are suggestted. */
  8. chartType: ChartType[];
  9. /** Charts exclude or include. */
  10. scopeOfCharts?: {
  11. exclude?: string[];
  12. include?: string[];
  13. };
  14. /** Customize rules. */
  15. ruleConfig?: RuleConfig;
  16. };
  17. export type ChartKnowledge = PureChartKnowledge & { toSpec?: any };
  18. export type CustomChart = {
  19. /** Chart type ID, unique. */
  20. chartType: ChartType;
  21. /** Chart knowledge. */
  22. chartKnowledge: ChartKnowledge;
  23. /** Chart name. */
  24. chineseName?: string;
  25. };
  26. export type GetChartConfigProps = {
  27. data: Datum[];
  28. spec: Specification;
  29. dataProps: FieldInfo[];
  30. chartType?: ChartType;
  31. };
  32. export type CustomAdvisorConfig = {
  33. charts?: CustomChart[];
  34. scopeOfCharts?: {
  35. exclude?: string[];
  36. include?: string[];
  37. };
  38. ruleConfig?: RuleConfig;
  39. };