index.ts 993 B

1234567891011121314151617181920212223242526272829303132333435
  1. import { ChartId } from '@antv/ava';
  2. import { CustomChartsType } from '../charts';
  3. export type BackEndChartType =
  4. | 'response_line_chart'
  5. | 'response_bar_chart'
  6. | 'response_pie_chart'
  7. | 'response_scatter_chart'
  8. | 'response_area_chart'
  9. | 'response_heatmap_chart'
  10. | 'response_table';
  11. type ChartType = ChartId | CustomChartsType;
  12. export const getChartType = (backendChartType: BackEndChartType): ChartType[] => {
  13. if (backendChartType === 'response_line_chart') {
  14. return ['multi_line_chart', 'multi_measure_line_chart'];
  15. }
  16. if (backendChartType === 'response_bar_chart') {
  17. return ['multi_measure_column_chart'];
  18. }
  19. if (backendChartType === 'response_pie_chart') {
  20. return ['pie_chart'];
  21. }
  22. if (backendChartType === 'response_scatter_chart') {
  23. return ['scatter_plot'];
  24. }
  25. if (backendChartType === 'response_area_chart') {
  26. return ['area_chart'];
  27. }
  28. if (backendChartType === 'response_heatmap_chart') {
  29. return ['heatmap'];
  30. }
  31. return [];
  32. };