chart.js与Angular 8兼容吗?

时间:2019-06-12 07:32:04

标签: typescript chart.js angular8

从那时起,我就将我的angular 7应用程序迁移到了angular 8,因为chartjs无法正常工作,而且会引发很多错误。所以我担心的是“ chartjs是否与新的Angular版本8兼容?”

ERROR in src/app/components/analytics/job-analytics/job-analytics.component.ts(544,13): error TS2322: Type '{ labels: any; datasets: { data: any; label: string; backgroundColor: string; borderColor: string; pointBorderColor: string; pointBackgroundColor: string; pointHoverBackgroundColor: string; ... 5 more ...; datalabels: { ...; }; }[]; }' is not assignable to type 'ChartData'.
  Types of property 'datasets' are incompatible.
    Type '{ data: any; label: string; backgroundColor: string; borderColor: string; pointBorderColor: string; pointBackgroundColor: string; pointHoverBackgroundColor: string; pointHoverBorderColor: string; ... 4 more ...; datalabels: { ...; }; }[]' is not assignable to type 'ChartDataSets[]'.
      Type '{ data: any; label: string; backgroundColor: string; borderColor: string; pointBorderColor: string; pointBackgroundColor: string; pointHoverBackgroundColor: string; pointHoverBorderColor: string; ... 4 more ...; datalabels: { ...; }; }' is not assignable to type 'ChartDataSets'.
        Types of property 'datalabels' are incompatible.
          Type '{ align: string; anchor: string; }' is not assignable to type 'Options'.
            Types of property 'align' are incompatible.
              Type 'string' is not assignable to type 'number | "left" | "right" | "start" | "center" | "end" | "top" | "bottom" | Align[] | ((context: Context) => Align)'.
src/app/components/analytics/job-analytics/job-analytics.component.ts(551,13): error TS2322: Type '{ labels: any; datasets: { data: any; label: string; borderColor: string; backgroundColor: string; pointBorderColor: string; pointBackgroundColor: string; pointHoverBackgroundColor: string; ... 5 more ...; datalabels: { ...; }; }[]; }' is not assignable to type 'ChartData'.
  Types of property 'align' are incompatible.
              Type 'string' is not assignable to type 'number | "left" | "right" | "start" | "center" | "end" | "top" | "bottom" | Align[] | ((context: Context) => Align)'.

src/app/components/analytics/run-history/run-history.component.ts(44,3): error TS2322: Type 'undefined[]' is not assignable to type 'import("E:/ng72ng8/Fxt/Web/src/main/ui/material/node_modules/@types/chart.js/index.d.ts")'.
src/app/components/coverage/api-coverage/api-coverage.component.ts(152,15): error TS2322: Type '(context: Context) => string | string[] | CanvasGradient | CanvasPattern | ChartColor[]' is not assignable to type 'string | CanvasGradient | CanvasPattern | (string | CanvasGradient | CanvasPattern)[] | ((context: Context) => string | CanvasGradient | CanvasPattern)'.
  Type '(context: Context) => string | string[] | CanvasGradient | CanvasPattern | ChartColor[]' is not assignable to type '(context: Context) => string | CanvasGradient | CanvasPattern'.
    Type 'string | string[] | CanvasGradient | CanvasPattern | ChartColor[]' is not assignable to type 'string | CanvasGradient | CanvasPattern'.
      Type 'string[]' is not assignable to type 'string | CanvasGradient | CanvasPattern'.
        Type 'string[]' is not assignable to type 'string'.

src/app/components/projects/project-recommendations/project-recommendations.component.ts(77,12): error TS2322: Type '{ responsive: true; }' is not assignable to type 'ChartOptions & { annotation: any; }'.
  Property 'annotation' is missing in type '{ responsive: true; }' but required in type '{ annotation: any; }'.
src/app/components/projects/project-recommendations/project-recommendations.component.ts(81,12): error TS2322: Type '{ scales: { yAxes: { ticks: { beginAtZero: true; }; }[]; }; }' is not assignable to type 'ChartOptions & { annotation: any; }'.
  Property 'annotation' is missing in type '{ scales: { yAxes: { ticks: { beginAtZero: true; }; }[]; }; }' but required in type '{ annotation: any; }'.
src/app/components/projects/projects-config/projects-config.component.ts(41,50): error TS2305: Module '"E:/ng72ng8/Fxt/Web/src/main/ui/material/node_modules/@types/chart.js"' has no exported member 'Label'.
src/app/components/projects/projects-config/projects-config.component.ts(41,57): error TS2305: Module '"E:/ng72ng8/Fxt/Web/src/main/ui/material/node_modules/@types/chart.js"' has no exported member 'Color'.
src/app/components/projects/projects-config/projects-config.component.ts(41,63): error TS2305: Module '"E:/ng72ng8/Fxt/Web/src/main/ui/material/node_modules/@types/chart.js"' has no exported member 'borderColor'.
src/app/components/projects/projects-config/projects-config.component.ts(167,14): error TS2322: Type '{ responsive: true; }' is not assignable to type 'ChartOptions & { annotation: any; }'.
  Property 'annotation' is missing in type '{ responsive: true; }' but required in type '{ annotation: any; }'.

请对此提供帮助。

谢谢。

0 个答案:

没有答案